Svgen‘s code is as following:
Va_tmp = -(pVab->value[0]>>1);
Vb_tmp = _IQmpy(SVGEN_SQRT3_OVER_2,pVab->value[1]);
Va = pVab->value[0]; //alpha
Vb = Va_tmp + Vb_tmp; //-0.5*alpha + sqrt(3)/2 * beta;
Vc = Va_tmp - Vb_tmp; //-0.5*alpha - sqrt(3)/2 * beta;
if (Va > Vb)
{
Vmax = Va;
Vmin = Vb;
}
else
{
Vmax = Vb;
Vmin = Va;
}
if (Vc > Vmax)
{
Vmax = Vc;
}
else if (Vc < Vmin)
{
Vmin = Vc;
}
Vcom = _IQmpy(Vmax+Vmin, _IQ(0.5));
// Subtract common-mode term to achieve SV modulation
pT->value[0] = (Va - Vcom);
pT->value[1] = (Vb - Vcom);
pT->value[2] = (Vc - Vcom);
I do not understand it. Now I want to change it into the usual code as svgen_mf.h. When i change the above sv into svgen_mf.h in FOC's ways. But the motor can not run.
I calculate the two code's Tabc in theta=0 situation. Then the two results are not same. So how can I change it?
In the above code, Ta=3/4*Valpha, Tb=Tc=-Ta;
but in the svgen_mf.h code, Ta=-sqrt(3)/2*Valpha, Tb=Tc=-Ta;
How can I change it ?