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])?