关于纯正正弦波的算法,有请钟工,老寿先生进来以及各位大侠高手来讨论
关于正弦波的修正算法,你们都是用什么方法去修正的?还有用SPWM做的话过零点需要注意什么。
全部回复(6)
正序查看
倒序查看
现在还没有回复呢,说说你的想法
@jackcai02
那如果PI算出来的值是负的话,怎么转换成给PWM的DUTY,DUTY是个无符合寄存器呢。
//180~360 degree close loop algorithmn
VoltageError = -SineTable_50Hz[PwmTabIndex] + InverterOutPutVoltageTmp;
VoltageErrorSum = VoltageErrorSum + Voltage_kCoeffs[1]*VoltageError;
Temp1 = Voltage_kCoeffs[0]*VoltageError;
Temp1 = Temp1+VoltageErrorSum;
if(Temp1 > 32767)
Temp1 = 32767;
if(Temp1 < -32767)
Temp1 = -32767;
Temp1 = abs(Temp1);
PWM_Mutiply_Data = ((__builtin_muluu((int)Temp1,(int)INVERTER_PERIOD_VALUE))>>15);
if(PWM_Mutiply_Data > INVERTER_PERIOD_VALUE)
PWM_Mutiply_Data = INVERTER_PERIOD_VALUE;
0
回复
提示
@jackcai02
//180~360degreecloseloopalgorithmnVoltageError=-SineTable_50Hz[PwmTabIndex]+InverterOutPutVoltageTmp; VoltageErrorSum=VoltageErrorSum+Voltage_kCoeffs[1]*VoltageError; Temp1=Voltage_kCoeffs[0]*VoltageError; Temp1=Temp1+VoltageErrorSum; if(Temp1>32767) Temp1=32767; if(Temp1<-32767) Temp1=-32767; Temp1=abs(Temp1); PWM_Mutiply_Data=((__builtin_muluu((int)Temp1,(int)INVERTER_PERIOD_VALUE))>>15); if(PWM_Mutiply_Data>INVERTER_PERIOD_VALUE) PWM_Mutiply_Data=INVERTER_PERIOD_VALUE;
//0~180 degree close loop algorithmn 其中在180°,360°的时候把VoltageErrorSum = 0
VoltageError = SineTable_50Hz[PwmTabIndex] - InverterOutPutVoltageTmp;
VoltageErrorSum = VoltageErrorSum + 5*VoltageError;
Temp1 = 22*VoltageError;
Temp1 = Temp1 +VoltageErrorSum;
if(Temp1 > 32767)
Temp1 = 32767;
if(Temp1 < -32767)
Temp1 = -32767;
Temp1 = abs(Temp1);
PWM_Mutiply_Data = ((__builtin_muluu((int)Temp1,(int)INVERTER_PERIOD_VALUE))>>15);
if(PWM_Mutiply_Data > INVERTER_PERIOD_VALUE)
PWM_Mutiply_Data = INVERTER_PERIOD_VALUE;
0
回复
提示
@jackcai02
//0~180degreecloseloopalgorithmn其中在180°,360°的时候把VoltageErrorSum =0VoltageError=SineTable_50Hz[PwmTabIndex]-InverterOutPutVoltageTmp; VoltageErrorSum=VoltageErrorSum+5*VoltageError; Temp1=22*VoltageError; Temp1=Temp1+VoltageErrorSum; if(Temp1>32767) Temp1=32767; if(Temp1<-32767) Temp1=-32767; Temp1=abs(Temp1); PWM_Mutiply_Data=((__builtin_muluu((int)Temp1,(int)INVERTER_PERIOD_VALUE))>>15); if(PWM_Mutiply_Data>INVERTER_PERIOD_VALUE) PWM_Mutiply_Data=INVERTER_PERIOD_VALUE;
现在回想起来,这个问题很简单,做稳压太简单了。哈哈。。。
0
回复
提示