📄 ifoc_ti.c
字号:
v->pid_spd.pid_out_min = 0x8000; /* Q15 */
} /* End: IFOC_TI_Init() */
#endif /* (BUILDLEVEL==LEVEL5) */
/* ************************************************************************** */
/* ************************************************************************** */
#if (BUILDLEVEL==LEVEL1)
void IFOC_TI_Run(IFOC_TI_handle v)
{
/*-----------------------------------------------------------------------------
Connect freq_testing inputs to the RMPCNTL
-----------------------------------------------------------------------------*/
v->rmpc.target_value = v->freq_testing;
/*-----------------------------------------------------------------------------
Call the compute function for the RMPCNTL
-----------------------------------------------------------------------------*/
v->rmpc.calc((void *)&v->rmpc); /* Call RMPCNTL compute function */
/*-----------------------------------------------------------------------------
Connect RMPCNTL output to the RAMPGEN input
-----------------------------------------------------------------------------*/
v->rg.rmp_freq = v->rmpc.setpt_value;
/*-----------------------------------------------------------------------------
Call the compute function for the RAMPGEN
-----------------------------------------------------------------------------*/
v->rg.calc((void *)&v->rg); /* Call RAMPGEN compute function */
/*-----------------------------------------------------------------------------
Connect voltages in DQT structure
-----------------------------------------------------------------------------*/
v->voltage_DQt.D = v->Vd_testing;
v->voltage_DQt.Q = v->Vq_testing;
v->voltage_DQt.theta = v->rg.rmp_out;
/*-----------------------------------------------------------------------------
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 */
} /* End: IFOC_TI_Run() */
#endif /* (BUILDLEVEL==LEVEL1) */
#if (BUILDLEVEL==LEVEL2)
void IFOC_TI_Run(IFOC_TI_handle v)
{
/*-----------------------------------------------------------------------------
Connect freq_testing inputs to the RMPCNTL
-----------------------------------------------------------------------------*/
v->rmpc.target_value = v->freq_testing;
/*-----------------------------------------------------------------------------
Call the compute function for the RMPCNTL
-----------------------------------------------------------------------------*/
v->rmpc.calc((void *)&v->rmpc); /* Call RMPCNTL compute function */
/*-----------------------------------------------------------------------------
Connect RMPCNTL output to the RAMPGEN input
-----------------------------------------------------------------------------*/
v->rg.rmp_freq = v->rmpc.setpt_value;
/*-----------------------------------------------------------------------------
Call the compute function for the RAMPGEN
-----------------------------------------------------------------------------*/
v->rg.calc((void *)&v->rg); /* Call RAMPGEN compute function */
/*-----------------------------------------------------------------------------
Connect voltages in DQT structure
-----------------------------------------------------------------------------*/
v->voltage_DQt.D = v->Vd_testing;
v->voltage_DQt.Q = v->Vq_testing;
v->voltage_DQt.theta = v->rg.rmp_out;
/*-----------------------------------------------------------------------------
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->rg.rmp_out;
/*-----------------------------------------------------------------------------
Call the compute function for the PARK
-----------------------------------------------------------------------------*/
park((void *)&v->current_dqt,(void *)&v->current_DQ);
} /* End: IFOC_TI_Run() */
#endif /* (BUILDLEVEL==LEVEL2) */
#if (BUILDLEVEL==LEVEL3)
void IFOC_TI_Run(IFOC_TI_handle v)
{
/*-----------------------------------------------------------------------------
Connect freq_testing inputs to the RMPCNTL
-----------------------------------------------------------------------------*/
v->rmpc.target_value = v->freq_testing;
/*-----------------------------------------------------------------------------
Call the compute function for the RMPCNTL
-----------------------------------------------------------------------------*/
v->rmpc.calc((void *)&v->rmpc); /* Call RMPCNTL compute function */
/*-----------------------------------------------------------------------------
Connect RMPCNTL output to the RAMPGEN input
-----------------------------------------------------------------------------*/
v->rg.rmp_freq = v->rmpc.setpt_value;
/*-----------------------------------------------------------------------------
Call the compute function for the RAMPGEN
-----------------------------------------------------------------------------*/
v->rg.calc((void *)&v->rg); /* Call RAMPGEN compute function */
/*-----------------------------------------------------------------------------
Connect PIDREG3 inputs for Id control
-----------------------------------------------------------------------------*/
v->pid_id.pid_ref_reg3 = v->my_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 PIDREG3 inputs for Iq control
-----------------------------------------------------------------------------*/
v->pid_iq.pid_ref_reg3 = v->my_iq_ref;
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 */
/*-----------------------------------------------------------------------------
Checking constant_current
-----------------------------------------------------------------------------*/
if(v->constant_current==TRUE)
{
/* Constant Current Mode if constant_current = 1 */
/*-----------------------------------------------------------------------------
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 = 0x0000;
/*-----------------------------------------------------------------------------
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 = 0x0000;
/*-----------------------------------------------------------------------------
Call the compute function for the PARK
-----------------------------------------------------------------------------*/
park((void *)&v->current_dqt,(void *)&v->current_DQ);
} /* End: constant_current==TRUE */
else if(v->constant_current==FALSE)
{ /* Dynamic Mode if constant_current = 0 */
/*-----------------------------------------------------------------------------
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->rg.rmp_out;
/*-----------------------------------------------------------------------------
Call the compute function for the IPARK
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -