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 with ezdsp f28335 please helppppp

 

hello,

i use ezdsp f28335.
there is on homepage of TI "F280x ACI3_3:Sensored Indirect Flux Vector Control of Three-Phase ACI Motor -SPRC207"  .it is helpful for me.but they use IQ-math. i guess in my case using f28335 floating point DSP i dont need IQ-math.(?) 
for example. In reference  "svgen_dq.pdq"  is explained how to creat Space vector modulation with µC.I would like to say :Ta,Tb and Tc must be between [0,1](!?). So my code looks like this:

void svgendq_calc(SVGENDQ *v)
{
    float32 Va,Vb,Vc,t1,t2;
    Uint16 Sector = 0;
   
//Inverse clarke transformation
    Va = v->Ubeta;
    Vb = (-v->Ubeta + 1.73205081*v->Ualpha)/2;  //1.73205081 = sqrt(3), Ualpha is float32
    Vc = (-v->Ubeta - 1.73205081*v->Ualpha)/2;

//60 Grad Sector determination with Sector = 4*c + 2*b + a
    if (Va > 0)
        Sector = 1;
    if (Vb > 0)
        Sector = Sector + 2;
    if (Vc > 0)
        Sector = Sector + 4;

// X,Y,Z (Va,Vb,Vc) calculations
    Va = v->Ubeta;
    Vb = (v->Ubeta + v->Ualpha*1.73205081)/2;
    Vc = (v->Ubeta - v->Ualpha*1.73205081)/2;

    if (Sector == 0) //(Ualpha,Ubeta) = (0,0)
    {
        v->Ta = 0;
        v->Tb = 0;
        v->Tc = 0;
    } 
    else if
    ......
}

//  So Ta,Tb,Tc for Compare Register:
EPwm1Regs.CMPA.half.CMPA = (Uint16)(v->Ta*PWM_periode);//     i expect: 0<= Ta <= 1 ,so 0<= CMPA =<  PWM_periode
EPwm2Regs.CMPA.half.CMPA = (Uint16)(v->Tb*PWM_periode);
EPwm3Regs.CMPA.half.CMPA = (Uint16)(v->Tc*PWM_periode);

I tried with 20KHz sampling rate, it seems to work, but when I look in the Watch window I'm surprised that Ta,Tb,Tc are not within [0,1]  but such as 14.543  .... and so on. Therefore Compare register value is greater than PWM_periode (maximum of UP_DOWN counter).

so sample-code in IQ-math von TI:
void svgendq_calc(SVGENDQ *v)
{   

    _iq Va,Vb,Vc,t1,t2;
    Uint32 Sector = 0;  // Sector is treated as Q0 - independently with global Q
                                                                   
// Inverse clarke transformation
    Va = v->Ubeta;
    Vb = _IQmpy(_IQ(-0.5),v->Ubeta) + _IQmpy(_IQ(0.8660254),v->Ualpha);  // 0.8660254 = sqrt(3)/2
    Vc = _IQmpy(_IQ(-0.5),v->Ubeta) - _IQmpy(_IQ(0.8660254),v->Ualpha);  // 0.8660254 = sqrt(3)/2

//............
// Convert the unsigned GLOBAL_Q format (ranged (0,1)) -> signed GLOBAL_Q format (ranged (-1,1))
    v->Ta = _IQmpy(_IQ(2.0),(v->Ta-_IQ(0.5)));
    v->Tb = _IQmpy(_IQ(2.0),(v->Tb-_IQ(0.5)));
    v->Tc = _IQmpy(_IQ(2.0),(v->Tc-_IQ(0.5)));

}       

   
second question is: why must we implement the last line, (ie are then Ta, Tb, Tc within [-1.1])?

thanks
Best regards,
tequila
  •  

    Problem I have found,.I forgot, normalized alpha and beta by the maximun
    value (Umax = Udc / sqrt (3)). as expected, Ta, Tb, Tc (float32)
    remain within (0.1).

    As svgendq.pdf reference of TI,  i think because Ta,Tb,Tc are  for Pwm Compare Register , i need only : 

    EPwm1Regs.CMPA.half.CMPA = (Uint16)(Ta*PWM_periode);//     i expect: 0<= Ta <= 1 ,so 0<= CMPA =<  PWM_periode
    EPwm2Regs.CMPA.half.CMPA = (Uint16)(Tb*PWM_periode);
    EPwm3Regs.CMPA.half.CMPA = (Uint16)(Tc*PWM_periode);

    But I think I misunderstood.

    Can someone explain, in my case floating point DSP how i must  do?

    tequila

    (sorry about my english)

  • Hi tequila,

    I dont know about your application but in my opinion, the IQ should only be used with non-floating point DSPs.

    So, if you need to use this TI provided function of the DMC library, since it is not found in the C:\tidcs\DMC\c28\v32x\lib\dmclib\cfloat\src directory, you need to convert it to floating point, which should be very straightforward.

    To do this, use float32 or float64 data types to redefine SVGENDQ struct and replace _IQmpy, _IQdiv by their respective C/C++ representation (i.e. *, /).

    Hope this helps...

     

  • hi hugo,

    thank u very much :-)