我用F28M35做三相PFC整流电路,在矢量控制模块SVGEN.H与波形输出模块F28M35xPWM.H配合输出的结果总是不正常,表现在PFC部分,最小升压为1.8倍,逆变状态输出波形峰值比应该输出峰值低1.8倍。
如果您使用过SVGEN.H这个程序做过电机控制或者整流控制,请指出我引用的两段程序在哪里出了问题?
参考SVGENDQ.H的使用说明,有一个系数是Udc/√3 ,但是不知道怎么使用√3这个系数,求解答!
TI提供的SVGEN.H的程序如下
//—————————————————————
//File name: SVGEN.H
#ifndef __SVGEN_H__
#define __SVGEN_H__
typedefstruct {
_iq Ualpha; // Input: reference alpha-axis phase voltage
_iq Ubeta; // Input: reference beta-axis phase voltage
_iq Ta; // Output: reference phase-a switching function
_iq Tb; // Output: reference phase-b switching function
_iq Tc; // Output: reference phase-c switching function
_iq tmp1; // Variable: temp variable
_iq tmp2; // Variable: temp variable
_iq tmp3; // Variable: temp variable
Uint16 VecSector; // Space vector sector
} SVGEN;
#define SVGEN_DEFAULTS { 0,0,0,0,0 }
/*——————————————————————-
Space Vector Generator (SVGEN) Macro Definition
v.tmp1 = Ubeta;
v.tmp2 = Ubeta/2 + sqrt(3)/2*Ualpha
v.tmp3 =-Ubeta/2 + sqrt(3)/2*Ualpha
———*/
#define SVGENDQ_MACRO(v) v.tmp1= v.Ubeta;
v.tmp2= _IQdiv2(v.Ubeta) + (_IQmpy(_IQ(0.866),v.Ualpha));
v.tmp3= v.tmp2 – v.tmp1;
v.VecSector=3;
v.VecSector=(v.tmp2> 0)?( v.VecSector-1):v.VecSector;
v.VecSector=(v.tmp3> 0)?( v.VecSector-1):v.VecSector;
v.VecSector=(v.tmp1< 0)?(7-v.VecSector) :v.VecSector;
if(v.VecSector==1 || v.VecSector==4)
{ v.Ta= v.tmp2;
v.Tb= v.tmp1-v.tmp3;
v.Tc=-v.tmp2;
} \
elseif(v.VecSector==2 || v.VecSector==5)
{ v.Ta= v.tmp3+v.tmp2;
v.Tb= v.tmp1;
v.Tc=-v.tmp1;
}
else \
{ v.Ta= v.tmp3;
v.Tb=-v.tmp3;
v.Tc=-(v.tmp1+v.tmp2);
}
#endif // __SVGEN_H__
//——————————————————————————–
pwm脉冲输出程序参考F28335改写而成,
//File name : F28M35xPWM.H
#ifndef __F28M35X_PWM_H__
#define __F28M35X_PWM_H__
#include "f28M35xbmsk.h"
#include "f28M35xdrvlib.h"
#define PWM_INIT_STATE ( FREE_RUN_FLAG + \
PRDLD_IMMEDIATE + \
TIMER_CNT_UPDN + \
HSPCLKDIV_PRESCALE_X_1 + \
CLKDIV_PRESCALE_X_1 + \
PHSDIR_CNT_UP + \
CNTLD_DISABLE )
/*———–Initialization constant for the F2833X Compare Control Register. LOADAMODE_ZRO——-*/
#define CMPCTL_INIT_STATE ( LOADAMODE_PRD + \
LOADBMODE_PRD + \
SHDWAMODE_SHADOW + \
SHDWBMODE_SHADOW )
/*——————————————————————-Initialization constant for the F2833X Action Qualifier Output A Register.
——-*/
#define AQCTLA_INIT_STATE ( CAU_CLEAR + CAD_SET )
/*—————————————————————————-
Initialization constant for the F2833X Dead-Band Generator registers for PWM Generation.
Sets up the dead band for PWM and sets up dead band values.
—————————————————————————-*/
#define DBCTL_INIT_STATE (BP_ENABLE + POLSEL_ACTIVE_HI_CMP)
#define DBCNT_INIT_STATE 200 // 200 counts = 2.5 usec (delay) (for TBCLK = SYSCLK/1)
/*——————————————————————-
Initialization constant for the F2833X PWM Chopper Control register for PWM Generation.
——-*/
#define PCCTL_INIT_STATE CHPEN_DISABLE
/*——————————————————————-
Initialization constant for the F2833X Trip Zone Select Register
——-*/
#define TZSEL_INIT_STATE ENABLE_TZ1_OST //DISABLE_TZSEL
/*——————————————————————-
Initialization constant for the F2833X Trip Zone Control Register
———————————————————————
#define TZCTL_INIT_STATE ( TZA_HI_Z + TZB_HI_Z + \
DCAEVT1_HI_Z + DCAEVT2_HI_Z + \
DCBEVT1_HI_Z + DCBEVT2_HI_Z )
/*——————————————————————-
Define the structure of the PWM Driver Object
——–*/
typedefstruct {
Uint16 PeriodMax; // Parameter: PWM Half-Period in CPU clock cycles (Q0)
Uint16 HalfPerMax; // Parameter: Half of PeriodMax (Q0)
Uint16 Deadband; // Parameter: PWM deadband in CPU clock cycles (Q0)
_iq MfuncC1; // Input: EPWM1 A&B Duty cycle ratio (Q24)
_iq MfuncC2; // Input: EPWM2 A&B Duty cycle ratio (Q24)
_iq MfuncC3; // Input: EPWM3 A&B Duty cycle ratio (Q24)
} PWMGEN ;
#define F28M35X_FC_PWM_GEN { 3750,
1875,
100,
0x4000,
0x4000,
0x4000,
}
#define PWMGEN_DEFAULTS F28M35X_FC_PWM_GEN
#define PWM_MACRO(ch1,ch2,ch3,v)
(*ePWM[ch1]).CMPA.half.CMPA = _IQmpy(v.HalfPerMax,v.MfuncC1)+ v.HalfPerMax;
(*ePWM[ch2]).CMPA.half.CMPA = _IQmpy(v.HalfPerMax,v.MfuncC2)+ v.HalfPerMax;
(*ePWM[ch3]).CMPA.half.CMPA = _IQmpy(v.HalfPerMax,v.MfuncC3)+ v.HalfPerMax;
#endif
逆变输出波形如下:
iparkI.Ds = _IQ(1);
iparkI.Qs = _IQ(0);
直流端输入50.1VDC,交流侧空载引出
从结果可以看出,50.1VDC输入,17.9V线电压输出,相电压峰值为14.61VDC,远低于应该输出的比例28.76VDC.(28.76VDC的计算依据 50.1×310/540=28.76VDC)
逆变输出波形为
jianqing wang:
#define PWM_MACRO(ch1,ch2,ch3,v)
(*ePWM[ch1]).CMPA.half.CMPA = _IQmpy(v.HalfPerMax,v.MfuncC1)+ v.HalfPerMax;
(*ePWM[ch2]).CMPA.half.CMPA = _IQmpy(v.HalfPerMax,v.MfuncC2)+ v.HalfPerMax;
(*ePWM[ch3]).CMPA.half.CMPA = _IQmpy(v.HalfPerMax,v.MfuncC3)+ v.HalfPerMax;
楼主能否解释一下解释一下这个PWM_MACRO(),谢谢!