This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Question about SVGEN used in ControlSuite.

Other Parts Discussed in Thread: CONTROLSUITE

Hi

I'm using TMDSHVMTRPFCKIT & HVMotorCtrol+pfcKit_v2.1/HVPM_Sensored_Servo project.

'HVPM_Sensored_Servo' project basically included math_blocks/v4.1

The SVGEN code used in version3 and version4 is different.

Version 4 SVGEN code is very simple.

But, unlike version 3,  there is no detailed description about below code.

I have 3 question.

1. Is there theoretical document for SVGENDQ_MACRO of version 4?

if not, can you explain the code?

2. The code is different, but the output Ta, Tb, and Tc of version 3&4 values ​​are the same?

3. In version 3, variable is normalized by the maximum phase voltage, Vdc/sqrt(3)

Therefore, real Ubeta value is Ubeta * Vdc/sqrt(3), right?

  • 1. It is a different type of PWM generation and is not classical sector based method, it adds a common mode voltage to all 3 phases. The output of SVPWM is similar to carrier based PWM with a common mode signal added to all three modulation signals of a three-phase PWM inverter. The common mode signal is made up of third harmonics of the supply frequency. The line-line output will not contain the common mode signal since the same common mode signal is added to all three phases.
    2. The Ta/Tb/Tc is similar for pwm duty of 3 phase.
    3. Right.
  • Thanks, Yanming.
    But, i don't know exactly.

    1. what you saying is the svgen_comm.h ?
    In mathblock v4, svgen.h and sgven_comm.h are exist.
    I would likte to know in detail how to determine the sector and PWM duty ratio Ta,Tb,Tc using the above code.
    .
    2. you mean that SEVGENDQ_MACRO(version 4) and SVGEN_MACRO(version 3) output Ta,Tb,Tc is similar but different?

    %%%%%%%% ControlSuite math block Version 3 or later %%%%%%%%%%%%%%%

    #define SVGEN_MACRO(v) \
    \
    Sector = 0; \
    temp_sv1=_IQdiv2(v.Ubeta); /*divide by 2*/ \
    temp_sv2=_IQmpy(_IQ(0.8660254),v.Ualpha); /* 0.8660254 = sqrt(3)/2*/ \
    \
    /* Inverse clarke transformation */ \
    Va = v.Ubeta; \
    Vb = -temp_sv1 + temp_sv2; \
    Vc = -temp_sv1 - temp_sv2; \
    /* 60 degree Sector determination */ \
    if (Va>_IQ(0)) Sector = 1; \
    if (Vb>_IQ(0)) Sector = Sector+2; \
    if (Vc>_IQ(0)) Sector = Sector+4; \
    /* X,Y,Z (Va,Vb,Vc) calculations X = Va, Y = Vb, Z = Vc */ \
    Va = v.Ubeta; \
    Vb = temp_sv1 + temp_sv2; \
    Vc = temp_sv1 - temp_sv2; \
    /* Sector 0: this is special case for (Ualpha,Ubeta) = (0,0)*/ \
    \
    switch(Sector) \
    { \
    case 0: \
    v.Ta = _IQ(0.5); \
    v.Tb = _IQ(0.5); \
    v.Tc = _IQ(0.5); \
    break; \
    case 1: /*Sector 1: t1=Z and t2=Y (abc ---> Tb,Ta,Tc)*/ \
    t1 = Vc; \
    t2 = Vb; \
    v.Tb=_IQdiv2((_IQ(1)-t1-t2)); \
    v.Ta = v.Tb+t1; /* taon = tbon+t1 */ \
    v.Tc = v.Ta+t2; /* tcon = taon+t2 */ \
    break; \
    case 2: /* Sector 2: t1=Y and t2=-X (abc ---> Ta,Tc,Tb)*/ \
    t1 = Vb; \
    t2 = -Va; \
    v.Ta=_IQdiv2((_IQ(1)-t1-t2)); \
    v.Tc = v.Ta+t1; /* tcon = taon+t1 */ \
    v.Tb = v.Tc+t2; /* tbon = tcon+t2 */ \
    break; \
    case 3: /* Sector 3: t1=-Z and t2=X (abc ---> Ta,Tb,Tc)*/ \
    t1 = -Vc; \
    t2 = Va; \
    v.Ta=_IQdiv2((_IQ(1)-t1-t2)); \
    v.Tb = v.Ta+t1; /* tbon = taon+t1 */ \
    v.Tc = v.Tb+t2; /* tcon = tbon+t2 */ \
    break; \
    case 4: /* Sector 4: t1=-X and t2=Z (abc ---> Tc,Tb,Ta)*/ \
    t1 = -Va; \
    t2 = Vc; \
    v.Tc=_IQdiv2((_IQ(1)-t1-t2)); \
    v.Tb = v.Tc+t1; /* tbon = tcon+t1 */ \
    v.Ta = v.Tb+t2; /* taon = tbon+t2 */ \
    break; \
    case 5: /* Sector 5: t1=X and t2=-Y (abc ---> Tb,Tc,Ta)*/ \
    t1 = Va; \
    t2 = -Vb; /* tbon = (1-t1-t2)/2 */ \
    v.Tb=_IQdiv2((_IQ(1)-t1-t2)); \
    v.Tc = v.Tb+t1; /* taon = tcon+t2 */ \
    v.Ta = v.Tc+t2; \
    break; \
    case 6: /* Sector 6: t1=-Y and t2=-Z (abc ---> Tc,Ta,Tb)*/ \
    t1 = -Vb; \
    t2 = -Vc; \
    v.Tc=_IQdiv2((_IQ(1)-t1-t2)); \
    v.Ta = v.Tc+t1; /* taon = tcon+t1 */ \
    v.Tb = v.Ta+t2; /* tbon = taon+t2 */ \
    break; \
    } \
    /* Convert the unsigned GLOBAL_Q format (ranged (0,1)) ->.. */ \
    /* ..signed GLOBAL_Q format (ranged (-1,1))*/ \
    v.Ta = _IQmpy2(v.Ta-_IQ(0.5)); \
    v.Tb = _IQmpy2(v.Tb-_IQ(0.5)); \
    v.Tc = _IQmpy2(v.Tc-_IQ(0.5)); \

    #endif // __SVGEN_DQ_H__

    %%%%%%%% ControlSuite math block Version 4 or later %%%%%%%%%%%%%%%

    #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__

  • It means svgen_comm.h which uses common mode. The output is the same in both svgen.h and sgven_comm.h, is the duty for pwm output. svgen_comm.h don't need to calculate the sector.