向大家请教一个问题:
SVPWM一般采用7段式或者5段式生成,需要考虑合成磁场所在位置。最近学习
ti 的C2000-launchpad TMS320f28027F 永磁无刷电机控制,发现这么一段SVPWM产生的代码,很不理解,希望大家能给予一些指导。
主程序
void main()
[
...........
SVGEN_run(svgenHandle,&Vab_out_pu,&(gPwmData.Tabc)); //产生PWM占空比
HAL_writePwmData(halHandle,&gPwmData); //输出PWM
.............
]
具体涉及函数
static inline void SVGEN_run(SVGEN_Handle handle,const MATH_vec2 *pVab,MATH_vec3 *pT)
[
_iq Vmax,Vmin,Vcom;
_iq Va,Vb,Vc;
_iq Va_tmp = -(pVab->value[0]>>1);
_iq Vb_tmp = _IQmpy(SVGEN_SQRT3_OVER_2,pVab->value[1]);
Va = pVab->value[0]; //alpha
Vb = Va_tmp + Vb_tmp; //-0.5*alpha + sqrt(3)/2 * beta;
Vc = Va_tmp - Vb_tmp; //-0.5*alpha - sqrt(3)/2 * beta;
Vmax=0;
Vmin=0;
// find order Vmin,Vmid,Vmax
if (Va > Vb)
[
Vmax = Va;
Vmin = Vb;
]
else
[
Vmax = Vb;
Vmin = Va;
]
if (Vc > Vmax)
[
Vmax = Vc;
]
else if (Vc < Vmin)
[
Vmin = Vc;
]
Vcom = _IQmpy(Vmax+Vmin, _IQ(0.5));
// Subtract common-mode term to achieve SV modulation
pT->value[0] = (Va - Vcom);
pT->value[1] = (Vb - Vcom);
pT->value[2] = (Vc - Vcom);
return;
] // end of SVGEN_run() function
static inline void HAL_writePwmData(HAL_Handle handle,HAL_PwmData_t *pPwmData)
[
uint_least8_t cnt;
HAL_Obj *obj = (HAL_Obj *)handle;
PWM_Obj *pwm;
_iq period;
_iq pwmData_neg;
_iq pwmData_sat;
_iq pwmData_sat_dc;
_iq value;
uint16_t value_sat;
for(cnt=0;cnt<3;cnt++)
[
pwm = (PWM_Obj *)obj->pwmHandle[cnt];
period = (_iq)pwm->TBPRD;
pwmData_neg = _IQmpy(pPwmData->Tabc.value[cnt],_IQ(-1.0));
pwmData_sat = _IQsat(pwmData_neg,_IQ(0.5),_IQ(-0.5));
pwmData_sat_dc = pwmData_sat + _IQ(0.5);
value = _IQmpy(pwmData_sat_dc, period);
value_sat = (uint16_t)_IQsat(value, period, _IQ(0.0));
// write the PWM data
PWM_write_CmpA(obj->pwmHandle[cnt],value_sat);
]
return;
] // end of HAL_writePwmData() function
无法理解TI 这个程序SVPWM是怎么产生的,谁能推荐一些质料哈,感激不尽
0