双极性SPWM调制

2023-12-14 14:38:21

UPS电压稳压控制原理框图(以A相为例)如下:

慢环稳压算法采用增量式PI控制器,一周期计算控制量一次,三相独立控制。

误差计算error=(参考-输出有效值);

注:输出有效值一周期更新一次,采样频率为9K。

PI算法:

A_Uk=A_Uk+(P+I)*error(k)-P*error(k-1);0<A_Uk<AUk_Max;

B_Uk=B_Uk+(P+I)*error(k)-P*error(k-1);0<B_Uk<BUk_Max;

C_Uk=C_Uk+(P+I)*error(k)-P*error(k-1);0<C_Uk<CUk_Max;

采用双极性调制:

SPWM波形生成算法:查正弦表法(其它有对称规则采样法、不对称规则采样法、等效面积采样法,计算量相对大些)。

在程序中要保证:

比较值?= 周期/2?+?(_IQ14mpy(Sin60HzTAB[当前点],A_UK<<2)*周期/2)?>>?14;

因为?_IQ14(-1)<?Sin60HzTAB[当前点]?<_IQ14(1);

可求得:0 <?AUk_Max?=?BUk_Max?=?CUk_Max?=?Mk_Max?<?4096。

逆变输出控制量限幅选择公式:Mk_Max*0.9=A_UK稳定值;“A_UK稳定值”是在保证UPS空载输出电压稳定在期望值后对应的A_UK值;当前有六种电压期望值:220V/230V/240V/50Hz和220V/230V/240V/60Hz;“A_UK稳定值”需要在线调试得到,最终计算出六种Mk_Max值。

本项目采用固定点数输出SPWM,逆变开关频率9kHz(实际驱动开关频率3kHz),即50Hz对应180个采样点,60Hz对应150个采样点,Sin60HzTAB[k]= _IQ14(sin(2*π*k/150)),k∈[0,149];Sin50HzTAB[k]=_IQ14(sin(2*π*k/180)),k∈[0,179]。

正弦表:

/****************sin Table IQ14(-0.999~0.999)******************/

int32?const?Sin50HzTAB[] = {

?286, ?857, 1428, 1997, 2563, 3126, 3686, 4240, 4790, 5334,5872, 6402, 6924, 7438, 7943, 8438, 8923, 9397, 9860,10311,10749,11174,11585,11982,12365,12733,13085,13421,13741,14044,14330,14598,14849,15082,15296,15491,15668,15826,15964,16083,16182,16262,16322,16362,16382,16382,16362,16322,16262,16182,16083,15964,15826,15668,15491,15296,15082,14849,14598,14330,14044,13741,13421,13085,12733,12365,11982,11585,11174,10749,10311, 9860, 9397, 8923, 8438, 7943, 7438, 6924, 6402, 5872,5334, 4790, 4240, 3686, 3126, 2563, 1997, 1428, ?857, ?286,-286, ?-857, -1428, -1997, -2563, -3126,-3686,-4240,-4790,-5334,-5871,-6402-6924-7438,-7943,-8438,-8923,-9397,-9860,-10311,-10749,-11174,-11585,-11982,-12365,-12733,-13085,-13421,-13741,-14044,-14330,-14598,-14849,-15082,-15296,-15491,-15668,-15826,-15964,-16083,-16182,-16262,-16322,-16362,-16382,-16382,-16362,-16322,-16262,-16182,-16083,-15964,-15826,-15668,-15491,-15296,-15082,-14849,-14598,-14330,-14044,-13741,-13421,-13085,-12733,-12365,-11983,-11585,-11174,-10749,-10311, -9860, -9397, -8923, -8438, -7943, -7438, -6924, -6402, -5872,-5334, -4790, -4240, -3686, -3126, -2563, -1997, -1428, ?-857, -286};

PI调节:

if?(2 == Sin_Counter )

{

????A_Vout_Ek = (VAref_Period - A_Vout_Aver);

????if?(A_Vout_Ek > 50 ) A_Vout_Ek = 50;

????if?(A_Vout_Ek < -50 ) A_Vout_Ek = -50;

????A_Uk_Temp = (Urms_Kp + Urms_Ki) * A_Vout_Ek ?- Urms_Kp * ?A_Vout_EK_1;

????A_Uk_Temp = A_Uk_Temp >> 16;

????A_UK = A_UK + A_Uk_Temp;

????if?(A_UK < 0 )A_UK = 0;

????if?(A_UK > AUk_Max )

????{

????????A_UK = AUk_Max;

????}

????A_Vout_EK_1 = A_Vout_Ek;

}

计算比较值:

{

????AM = Sin_Counter; ???????????????????????????????// AM=sin_counter

????SPWM_Temp2 = EPwm1Regs.TBPRD?>> 1; ??????????// 逆变输出波形周期计算

????SPWM_Temp1 = Sin50HzTAB[AM]; ????????????????// 查表

????SPWM_Temp3 = (_IQ14mpy( SPWM_Temp1, A_UK<<2) * SPWM_Temp2 ) >> 14;

????AM =(int)( SPWM_Temp2 + SPWM_Temp3 );

????EPwm1Regs.CMPA.half.CMPA?= AM; ???????????????// EPWM1比较值更新

????EPwm2Regs.CMPA.half.CMPA?= BM; ???????????????// EPWM2比较值更新

????EPwm3Regs.CMPA.half.CMPA?= CM; ???????????????// EPWM3比较值更新

}

文章来源:https://blog.csdn.net/jacklood/article/details/134994088
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。