📄 sfoc_ti.c
字号:
/*-----------------------------------------------------------------------------
Connect IPARK voltage outputs to the SVGENDQ inputs
-----------------------------------------------------------------------------*/
v->svgen.d = v->voltage_dq.d;
v->svgen.q = v->voltage_dq.q;
/*-----------------------------------------------------------------------------
Call the compute function for the SVGENDQ
-----------------------------------------------------------------------------*/
v->svgen.calc((void *)&v->svgen); /* Call SVGENDQ compute function */
/*-----------------------------------------------------------------------------
Call the compute function for the CLARKE
-----------------------------------------------------------------------------*/
clark((void *)&v->current_abc,(void *)&v->current_dq);
/*-----------------------------------------------------------------------------
Connect currents in DQT structure
-----------------------------------------------------------------------------*/
v->current_dqt.D = v->current_dq.d;
v->current_dqt.Q = v->current_dq.q;
v->current_dqt.theta = v->rg.rmp_out;
/*-----------------------------------------------------------------------------
Call the compute function for the PARK
-----------------------------------------------------------------------------*/
park((void *)&v->current_dqt,(void *)&v->current_DQ);
/*-----------------------------------------------------------------------------
Connect SVGENDQ outputs and Vbus to the PHASEVOLTAGE inputs
-----------------------------------------------------------------------------*/
v->volt.DC_bus = v->Vbus;
v->volt.Mfunc_V1 = v->svgen.va;
v->volt.Mfunc_V2 = v->svgen.vb;
v->volt.Mfunc_V3 = v->svgen.vc;
/*-----------------------------------------------------------------------------
Call the compute function for the PHASEVOLTAGE
-----------------------------------------------------------------------------*/
v->volt.calc((void *)&v->volt); /* Call PHASEVOLTAGE compute function */
/*-----------------------------------------------------------------------------
Connect SMOPOS inputs
-----------------------------------------------------------------------------*/
v->smo.isalfa = v->current_dq.d;
v->smo.isbeta = v->current_dq.q;
v->smo.vsalfa = v->volt.Vdirect;
v->smo.vsbeta = v->volt.Vquadra;
/*-----------------------------------------------------------------------------
Call the compute function for the SMOPOS
-----------------------------------------------------------------------------*/
v->smo.calc((void *)&v->smo); /* Call SMOPOS compute function */
/*------------------------------------------------------------------------------
Connect outputs of the estimated angle from SMOPOS to SPEED
------------------------------------------------------------------------------*/
v->speed.theta_elec = v->smo.thetae;
v->speed.calc((void *)&v->speed);
v->Est_spd = v->speed.speed_frq;
} /* End: SFOC_TI_Run() */
#endif /* (BUILDLEVEL==LEVEL5) */
#if (BUILDLEVEL==LEVEL6)
void SFOC_TI_Run(SFOC_TI_handle v)
{
/*-----------------------------------------------------------------------------
Connect PIDREG3 inputs for speed control
-----------------------------------------------------------------------------*/
v->pid_spd.pid_ref_reg3 = v->speed_ref;
v->pid_spd.pid_fdb_reg3 = v->Mea_spd;
/*-----------------------------------------------------------------------------
Call the compute function for the PIDREG3 inputs for speed control
-----------------------------------------------------------------------------*/
v->pid_spd.calc((void *)&v->pid_spd); /* Call PIDREG3 compute function */
/*-----------------------------------------------------------------------------
Connect PIDREG3 inputs for Iq control
-----------------------------------------------------------------------------*/
v->pid_iq.pid_ref_reg3 = v->pid_spd.pid_out_reg3;
v->pid_iq.pid_fdb_reg3 = v->current_DQ.q;
/*-----------------------------------------------------------------------------
Call the compute function for the PIDREG3 inputs for Iq control
-----------------------------------------------------------------------------*/
v->pid_iq.calc((void *)&v->pid_iq); /* Call PIDREG3 compute function */
/*-----------------------------------------------------------------------------
Connect PIDREG3 inputs for Id control
-----------------------------------------------------------------------------*/
v->pid_id.pid_ref_reg3 = v->Id_ref;
v->pid_id.pid_fdb_reg3 = v->current_DQ.d;
/*-----------------------------------------------------------------------------
Call the compute function for the PIDREG3 inputs for Id control
-----------------------------------------------------------------------------*/
v->pid_id.calc((void *)&v->pid_id); /* Call PIDREG3 compute function */
/*-----------------------------------------------------------------------------
Connect voltages in DQT structure
-----------------------------------------------------------------------------*/
v->voltage_DQt.D = v->pid_id.pid_out_reg3;
v->voltage_DQt.Q = v->pid_iq.pid_out_reg3;
v->voltage_DQt.theta = v->shaft_theta_elec;
/*-----------------------------------------------------------------------------
Call the compute function for the IPARK
-----------------------------------------------------------------------------*/
ipark((void *)&v->voltage_DQt,(void *)&v->voltage_dq);
/*-----------------------------------------------------------------------------
Connect IPARK voltage outputs to the SVGENDQ inputs
-----------------------------------------------------------------------------*/
v->svgen.d = v->voltage_dq.d;
v->svgen.q = v->voltage_dq.q;
/*-----------------------------------------------------------------------------
Call the compute function for the SVGENDQ
-----------------------------------------------------------------------------*/
v->svgen.calc((void *)&v->svgen); /* Call SVGENDQ compute function */
/*-----------------------------------------------------------------------------
Call the compute function for the CLARKE
-----------------------------------------------------------------------------*/
clark((void *)&v->current_abc,(void *)&v->current_dq);
/*-----------------------------------------------------------------------------
Connect currents in DQT structure
-----------------------------------------------------------------------------*/
v->current_dqt.D = v->current_dq.d;
v->current_dqt.Q = v->current_dq.q;
v->current_dqt.theta = v->shaft_theta_elec;
/*-----------------------------------------------------------------------------
Call the compute function for the PARK
-----------------------------------------------------------------------------*/
park((void *)&v->current_dqt,(void *)&v->current_DQ);
/*-----------------------------------------------------------------------------
Connect SVGENDQ outputs and Vbus to the PHASEVOLTAGE inputs
-----------------------------------------------------------------------------*/
v->volt.DC_bus = v->Vbus;
v->volt.Mfunc_V1 = v->svgen.va;
v->volt.Mfunc_V2 = v->svgen.vb;
v->volt.Mfunc_V3 = v->svgen.vc;
/*-----------------------------------------------------------------------------
Call the compute function for the PHASEVOLTAGE
-----------------------------------------------------------------------------*/
v->volt.calc((void *)&v->volt); /* Call PHASEVOLTAGE compute function */
}
#endif /* (BUILDLEVEL==LEVEL6) */
#if (BUILDLEVEL==LEVEL7)
void SFOC_TI_Run(SFOC_TI_handle v)
{
/*-----------------------------------------------------------------------------
Connect PIDREG3 inputs for speed control
-----------------------------------------------------------------------------*/
v->pid_spd.pid_ref_reg3 = v->speed_ref;
v->pid_spd.pid_fdb_reg3 = v->Est_spd;
/*-----------------------------------------------------------------------------
Call the compute function for the PIDREG3 inputs for speed control
-----------------------------------------------------------------------------*/
v->pid_spd.calc((void *)&v->pid_spd); /* Call PIDREG3 compute function */
/*-----------------------------------------------------------------------------
Connect PIDREG3 inputs for Iq control
-----------------------------------------------------------------------------*/
v->pid_iq.pid_ref_reg3 = v->pid_spd.pid_out_reg3;
v->pid_iq.pid_fdb_reg3 = v->current_DQ.q;
/*-----------------------------------------------------------------------------
Call the compute function for the PIDREG3 inputs for Iq control
-----------------------------------------------------------------------------*/
v->pid_iq.calc((void *)&v->pid_iq); /* Call PIDREG3 compute function */
/*-----------------------------------------------------------------------------
Connect PIDREG3 inputs for Id control
-----------------------------------------------------------------------------*/
v->pid_id.pid_ref_reg3 = v->Id_ref;
v->pid_id.pid_fdb_reg3 = v->current_DQ.d;
/*-----------------------------------------------------------------------------
Call the compute function for the PIDREG3 inputs for Id control
-----------------------------------------------------------------------------*/
v->pid_id.calc((void *)&v->pid_id); /* Call PIDREG3 compute function */
/*-----------------------------------------------------------------------------
Connect voltages in DQT structure
-----------------------------------------------------------------------------*/
v->voltage_DQt.D = v->pid_id.pid_out_reg3;
v->voltage_DQt.Q = v->pid_iq.pid_out_reg3;
v->voltage_DQt.theta = v->smo.thetae;
/*-----------------------------------------------------------------------------
Call the compute function for the IPARK
-----------------------------------------------------------------------------*/
ipark((void *)&v->voltage_DQt,(void *)&v->voltage_dq);
/*-----------------------------------------------------------------------------
Connect IPARK voltage outputs to the SVGENDQ inputs
-----------------------------------------------------------------------------*/
v->svgen.d = v->voltage_dq.d;
v->svgen.q = v->voltage_dq.q;
/*-----------------------------------------------------------------------------
Call the compute function for the SVGENDQ
-----------------------------------------------------------------------------*/
v->svgen.calc((void *)&v->svgen); /* Call SVGENDQ compute function */
/*-----------------------------------------------------------------------------
Call the compute function for the CLARKE
-----------------------------------------------------------------------------*/
clark((void *)&v->current_abc,(void *)&v->current_dq);
/*-----------------------------------------------------------------------------
Connect currents in DQT structure
-----------------------------------------------------------------------------*/
v->current_dqt.D = v->current_dq.d;
v->current_dqt.Q = v->current_dq.q;
v->current_dqt.theta = v->smo.thetae;
/*-----------------------------------------------------------------------------
Call the compute function for the PARK
-----------------------------------------------------------------------------*/
park((void *)&v->current_dqt,(void *)&v->current_DQ);
/*-----------------------------------------------------------------------------
Connect SVGENDQ outputs and Vbus to the PHASEVOLTAGE inputs
-----------------------------------------------------------------------------*/
v->volt.DC_bus = v->Vbus;
v->volt.Mfunc_V1 = v->svgen.va;
v->volt.Mfunc_V2 = v->svgen.vb;
v->volt.Mfunc_V3 = v->svgen.vc;
/*-----------------------------------------------------------------------------
Call the compute function for the PHASEVOLTAGE
-----------------------------------------------------------------------------*/
v->volt.calc((void *)&v->volt); /* Call PHASEVOLTAGE compute function */
/*-----------------------------------------------------------------------------
Connect SMOPOS inputs
-----------------------------------------------------------------------------*/
v->smo.isalfa = v->current_dq.d;
v->smo.isbeta = v->current_dq.q;
v->smo.vsalfa = v->volt.Vdirect;
v->smo.vsbeta = v->volt.Vquadra;
/*-----------------------------------------------------------------------------
Call the compute function for the SMOPOS
-----------------------------------------------------------------------------*/
v->smo.calc((void *)&v->smo); /* Call SMOPOS compute function */
/*------------------------------------------------------------------------------
Connect outputs of the estimated angle from SMOPOS to SPEED
------------------------------------------------------------------------------*/
v->speed.theta_elec = v->smo.thetae;
v->speed.calc((void *)&v->speed);
v->Est_spd = v->speed.speed_frq;
} /* End: SFOC_TI_Run() */
#endif /* (BUILDLEVEL==LEVEL7) */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -