向大家请教一个问题:
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是怎么产生的,谁能推荐一些质料哈,感激不尽
Johnson Chen1:
相关原理可以参考一下:
C:\ti\controlSUITE\libs\app_libs\motor_control\math_blocks
也可以百度一下。
向大家请教一个问题:
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是怎么产生的,谁能推荐一些质料哈,感激不尽
li li14:
有答案了吗,我也没有找到这方面的介绍
向大家请教一个问题:
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是怎么产生的,谁能推荐一些质料哈,感激不尽
YunFei Cao:
回复 Eric Ma:
首先向您表示衷心的感谢,这段代码从其他TI的程序中也有看到,在SVGEN_COMM.H中有这么一段代码:
#define SVGENCOMM_MACRO(v) v.tmp1=_IQdiv2(v.Ualpha); v.tmp2=_IQmpy(_IQ(0.8660254),v.Ubeta); v.Va = v.Ualpha; v.Vb = -v.tmp1 + v.tmp2; v.Vc = -v.tmp1 – v.tmp2; if (v.Va>v.Vb) {v.Vmax=v.Va; v.Vmin=v.Vb;} else {v.Vmax=v.Vb; v.Vmin=v.Va;} if (v.Vc>v.Vmax) v.Vmax=v.Vc; if (v.Vc<v.Vmin) v.Vmin=v.Vc; v.Vcomm = _IQdiv2(v.Vmax+v.Vmin); v.Ta = v.Va-v.Vcomm; v.Tb = v.Vb-v.Vcomm; v.Tc = v.Vc-v.Vcomm;
#endif // __SVGEN_COMM_H__
也是用了最大值和最小值的平均值算公共点电压,好像和相位补偿有关。
向大家请教一个问题:
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是怎么产生的,谁能推荐一些质料哈,感激不尽
YunFei Cao:
回复 Eric Ma:
这本书上的确有这个公式,如果有需要可以去看看。在书的124页
向大家请教一个问题:
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是怎么产生的,谁能推荐一些质料哈,感激不尽
haibo tan1:
回复 YunFei Cao:
你买了这本书吗?好贵啊。
向大家请教一个问题:
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是怎么产生的,谁能推荐一些质料哈,感激不尽
YunFei Cao:
回复 haibo tan1:
http://caoyunfei2012.blog.163.com/blog/static/26640605220169831929763/, 这本书就不用买了,上面只有一个干巴巴的公式,需要你自己证明。可以去看看上面那个连接
向大家请教一个问题:
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是怎么产生的,谁能推荐一些质料哈,感激不尽
haibo tan1:
回复 YunFei Cao:
额,好的,非常感谢分享。
向大家请教一个问题:
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是怎么产生的,谁能推荐一些质料哈,感激不尽
zy zhang:
回复 YunFei Cao:
您好,我也不是很理解svpwm这一段代码,刚才看了您给出的回答,网易博客这边您设置了权限,您看您方不方便把您博客中的这部分相关资料发我一下!
谢谢!
向大家请教一个问题:
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是怎么产生的,谁能推荐一些质料哈,感激不尽
XIAOYU HE:
回复 YunFei Cao:
请问是哪本书?能提供下书名和作者名字吗?