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.

motor control lib V4.2 svgen.h

Other Parts Discussed in Thread: CONTROLSUITE

It is a surprise to see the SVGEN macro in file of  svgen.h out put Ta, Tb, Tc with one is negative another.

the file located at: C:\TI\controlSUITE\libs\app_libs\motor_control\math_blocks\v4.2.

For example, when (v.VecSector==2 || v.VecSector==5) ,             

  v.Tb= v.tmp1;     v.Tc=-v.tmp1 = -v.Tb

In the document "DMC MATH_v13.1.pdf"

The Ta, Tb, Tc are "Duty ratio of PWM1 (CMPR1 register value as a fraction of associated period register, TxPR, value)."

below is the copy of svgen.h.

Please help to make this clear,

Thank you,

*------------------------------------------------------------------------------
    Space Vector  Generator (SVGEN) Macro Definition
------------------------------------------------------------------------------*/


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