The SVGEN.H as below,
//---------------------------------------------------------------
//File name: SVGEN.H
#ifndef __SVGEN_H__
#define __SVGEN_H__
typedef struct {
_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;
} \
else if(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__
//--------------------------------------------------------------------------------
//NOTE: The following file refrence from 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
--------*/
typedef struct {
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
//no more
//////////////////////////////////////////////////////////////////////////////////
using open loop ,set as below:
iparkI.Ds = _IQ(1);
iparkI.Qs = _IQ(0);
I provide 50.1VDC source, and the device works under invert state,the voltage of line-line RMS equal 17.9V,
and we can calculate the peak voltage of L to N is 14.61Vdc, It's lower than 28.76VDC
When the device works as 3-phase PFC,the ratio of DC voltage is bigger 1.8 times than it should be.
read the document fo SVGENDQ.h,there is a constant :Udc/(sqrt(3)),but I don't know how to use this constant.
if (sqrt(3)) can be used in program,maybe the result is correct.
please tell me how can I resolve the program,thans!