📄 vfmrasti.c
字号:
-----------------------------------------------------------------------------*/
v->rmpc.target_value = v->freq_testing;
/*-----------------------------------------------------------------------------
Call the compute function for the RAMPCNTL
-----------------------------------------------------------------------------*/
v->rmpc.calc((void *)&v->rmpc); /* Call RAMPCNTL compute func */
/*-----------------------------------------------------------------------------
Connect RAMPCNTL output to the VHZPROFILE input
-----------------------------------------------------------------------------*/
v->vhzprof.freq = v->rmpc.setpt_value;
/*-----------------------------------------------------------------------------
Call the compute function for the VHZPROFILE
-----------------------------------------------------------------------------*/
v->vhzprof.calc((void *)&v->vhzprof); /* Call VHZPROFILE compute func */
/*-----------------------------------------------------------------------------
Connect VHZPROFILE/RAMPCNTL outputs to the SVGENMF inputs
-----------------------------------------------------------------------------*/
v->svgen.gain=v->vhzprof.vout; /* Use the computed gain */
v->svgen.freq=v->vhzprof.freq; /* Use the computed frequency */
/*-----------------------------------------------------------------------------
Call the compute function for the SVGEN
-----------------------------------------------------------------------------*/
v->svgen.calc((void *)&v->svgen); /* Call SVGEN compute function */
} /* End: VFMRAS_TI_Run() */
#endif /* (BUILDLEVEL==LEVEL2) */
#if (BUILDLEVEL==LEVEL3)
void VFMRAS_TI_Run(VFMRAS_TI_handle v)
{
/*-----------------------------------------------------------------------------
Connect freq_testing to the RAMPCNTL input
-----------------------------------------------------------------------------*/
v->rmpc.target_value = v->freq_testing;
/*-----------------------------------------------------------------------------
Call the compute function for the RAMPCNTL
-----------------------------------------------------------------------------*/
v->rmpc.calc((void *)&v->rmpc); /* Call RAMPCNTL compute func */
/*-----------------------------------------------------------------------------
Connect RAMPCNTL output to the VHZPROFILE input
-----------------------------------------------------------------------------*/
v->vhzprof.freq = v->rmpc.setpt_value;
/*-----------------------------------------------------------------------------
Call the compute function for the VHZPROFILE
-----------------------------------------------------------------------------*/
v->vhzprof.calc((void *)&v->vhzprof); /* Call VHZPROFILE compute func */
/*-----------------------------------------------------------------------------
Connect VHZPROFILE/RAMPCNTL outputs to the SVGENMF inputs
-----------------------------------------------------------------------------*/
v->svgen.gain=v->vhzprof.vout; /* Use the computed gain */
v->svgen.freq=v->vhzprof.freq; /* Use the computed frequency */
/*-----------------------------------------------------------------------------
Call the compute function for the SVGEN
-----------------------------------------------------------------------------*/
v->svgen.calc((void *)&v->svgen); /* Call SVGEN compute function */
/*-----------------------------------------------------------------------------
Connect SVGENMF 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 */
/*-----------------------------------------------------------------------------
Call the compute function for the CLARKE
-----------------------------------------------------------------------------*/
clark((void *)&v->current_abc,(void *)&v->current_dq);
} /* End: VFMRAS_TI_Run() */
#endif /* (BUILDLEVEL==LEVEL3) */
#if (BUILDLEVEL==LEVEL4)
void VFMRAS_TI_Run(VFMRAS_TI_handle v)
{
/*-----------------------------------------------------------------------------
Connect freq_testing to the RAMPCNTL input
-----------------------------------------------------------------------------*/
v->rmpc.target_value = v->freq_testing;
/*-----------------------------------------------------------------------------
Call the compute function for the RAMPCNTL
-----------------------------------------------------------------------------*/
v->rmpc.calc((void *)&v->rmpc); /* Call RAMPCNTL compute func */
/*-----------------------------------------------------------------------------
Connect RAMPCNTL output to the VHZPROFILE input
-----------------------------------------------------------------------------*/
v->vhzprof.freq = v->rmpc.setpt_value;
/*-----------------------------------------------------------------------------
Call the compute function for the VHZPROFILE
-----------------------------------------------------------------------------*/
v->vhzprof.calc((void *)&v->vhzprof); /* Call VHZPROFILE compute func */
/*-----------------------------------------------------------------------------
Connect VHZPROFILE/RAMPCNTL outputs to the SVGENMF inputs
-----------------------------------------------------------------------------*/
v->svgen.gain=v->vhzprof.vout; /* Use the computed gain */
v->svgen.freq=v->vhzprof.freq; /* Use the computed frequency */
/*-----------------------------------------------------------------------------
Call the compute function for the SVGEN
-----------------------------------------------------------------------------*/
v->svgen.calc((void *)&v->svgen); /* Call SVGEN compute function */
/*-----------------------------------------------------------------------------
Connect SVGENMF 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 */
/*-----------------------------------------------------------------------------
Call the compute function for the CLARKE
-----------------------------------------------------------------------------*/
clark((void *)&v->current_abc,(void *)&v->current_dq);
/*-----------------------------------------------------------------------------
Connect CLARKE/PHASEVOLTAGE outputs to the ACIMRAS inputs
-----------------------------------------------------------------------------*/
v->mras.ualfa_mras=v->volt.Vdirect;
v->mras.ubeta_mras=v->volt.Vquadra;
v->mras.ialfa_mras=v->current_dq.d;
v->mras.ibeta_mras=v->current_dq.q;
/*-----------------------------------------------------------------------------
Call the compute function for the ACIMRAS
-----------------------------------------------------------------------------*/
v->mras.calc((void *)&v->mras); /* Call ACIMRAS compute function */
/*-----------------------------------------------------------------------------
Connect ACIMRAS output to the BOXCAR input
-----------------------------------------------------------------------------*/
v->bc.BC_IN=v->mras.wr_hat_mras;
/*-----------------------------------------------------------------------------
Call the compute function for the BOXCAR
-----------------------------------------------------------------------------*/
v->bc.calc((void *)&v->bc); /* Call BOXCAR compute function */
} /* End: VFMRAS_TI_Run() */
#endif /* (BUILDLEVEL==LEVEL4) */
#if (BUILDLEVEL==LEVEL5)
void VFMRAS_TI_Run(VFMRAS_TI_handle v)
{
/*-----------------------------------------------------------------------------
Check the close-loop flag (FALSE = open-loop, TRUE = close-loop)
-----------------------------------------------------------------------------*/
if(v->cl_flag==FALSE)
{
/* 0x7EB8=0.99, assuming slip is 1 % */
v->speed_ref = mul_q(v->freq_testing,15,0x7EB8,15,15);
/*-----------------------------------------------------------------------------
Connect BOXCAR output to the PIDREG1 input
-----------------------------------------------------------------------------*/
v->pid.pid_fb_reg1=v->bc.BC_OUT;
v->pid.pid_ref_reg1=v->speed_ref;
/*-----------------------------------------------------------------------------
Call the compute function for the PIDREG1
-----------------------------------------------------------------------------*/
v->pid.calc((void *)&v->pid); /* Call PIDREG1 compute function */
v->syn_speed = v->pid.pid_out_reg1 + v->pid.pid_ref_reg1;
v->rmpc.target_value = v->freq_testing;
/*-----------------------------------------------------------------------------
Call the compute function for the RAMPCNTL
-----------------------------------------------------------------------------*/
v->rmpc.calc((void *)&v->rmpc); /* Call RAMPCNTL compute function */
/*-----------------------------------------------------------------------------
Connect RAMPCNTL output to the VHZPROFILE input
-----------------------------------------------------------------------------*/
v->vhzprof.freq = v->rmpc.setpt_value;
}
else if(v->cl_flag==TRUE)
{
v->rmpc.target_value = v->speed_ref;
/*-----------------------------------------------------------------------------
Call the compute function for the RAMPCNTL
-----------------------------------------------------------------------------*/
v->rmpc.calc((void *)&v->rmpc); /* Call RAMPCNTL compute func */
/*-----------------------------------------------------------------------------
Connect BOXCAR/RMPCNTL outputs to the PIDREG1 inputs
-----------------------------------------------------------------------------*/
v->pid.pid_fb_reg1=v->bc.BC_OUT;
v->pid.pid_ref_reg1=v->rmpc.setpt_value;
/*-----------------------------------------------------------------------------
Call the compute function for the PIDREG1
-----------------------------------------------------------------------------*/
v->pid.calc((void *)&v->pid); /* Call PIDREG1 compute function */
v->syn_speed = v->pid.pid_out_reg1 + v->pid.pid_ref_reg1;
v->freq_testing = v->syn_speed;
/*-----------------------------------------------------------------------------
Connect syn_speed variable to the VHZPROFILE input
-----------------------------------------------------------------------------*/
v->vhzprof.freq = v->syn_speed;
}
/*-----------------------------------------------------------------------------
Call the compute function for the VHZPROFILE
-----------------------------------------------------------------------------*/
v->vhzprof.calc((void *)&v->vhzprof); /* Call VHZPROFILE compute func */
/*-----------------------------------------------------------------------------
Connect VHZPROFILE/RAMPCNTL outputs to the SVGENMF inputs
-----------------------------------------------------------------------------*/
v->svgen.gain=v->vhzprof.vout; /* Use the computed gain */
v->svgen.freq=v->vhzprof.freq; /* Use the computed frequency */
/*-----------------------------------------------------------------------------
Call the compute function for the SVGEN
-----------------------------------------------------------------------------*/
v->svgen.calc((void *)&v->svgen); /* Call SVGEN compute function */
/*-----------------------------------------------------------------------------
Connect SVGENMF 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 */
/*-----------------------------------------------------------------------------
Call the compute function for the CLARKE
-----------------------------------------------------------------------------*/
clark((void *)&v->current_abc,(void *)&v->current_dq);
/*-----------------------------------------------------------------------------
Connect CLARKE/PHASEVOLTAGE outputs to the ACIMRAS inputs
-----------------------------------------------------------------------------*/
v->mras.ualfa_mras=v->volt.Vdirect;
v->mras.ubeta_mras=v->volt.Vquadra;
v->mras.ialfa_mras=v->current_dq.d;
v->mras.ibeta_mras=v->current_dq.q;
/*-----------------------------------------------------------------------------
Call the compute function for the ACIMRAS
-----------------------------------------------------------------------------*/
v->mras.calc((void *)&v->mras); /* Call ACIMRAS compute function */
/*-----------------------------------------------------------------------------
Connect ACIMRAS output to the BOXCAR input
-----------------------------------------------------------------------------*/
v->bc.BC_IN=v->mras.wr_hat_mras;
/*-----------------------------------------------------------------------------
Call the compute function for the BOXCAR
-----------------------------------------------------------------------------*/
v->bc.calc((void *)&v->bc); /* Call BOXCAR compute function */
} /* End: VFMRAS_TI_Run() */
#endif /* (BUILDLEVEL==LEVEL5) */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -