void svpwm(float alpha, float beta, float theta, float Vdc, float T, float *Tu, float *Tv, float *Tw)
{
float Vref, modulationIndex;
float Ta, Tb, T0, sinTheta;
uint32_t sector;
Vref = sqrtf((alpha * alpha) + (beta * beta));
modulationIndex = (Vref * PIOVER2) / Vdc;
/*
* Put theta in the range 0 - pi/3 (0-60 degrees) and determine which
* of the six sectors of the SV hexagon the angle lies.
*/
sector = 1;
while(theta > PIOVER3) {
theta -= PIOVER3;
sector++;
}
/*
* Ta and Tb are the on times the two sector endpoints used to synthesize the desired voltage.
* T0 is the time the (+++) and (---) states are active
* Tu, Tv, Tw are the times (in timer compare counts) the U, V, and W high-side MOSFETs are on.
*/
sinTheta = sinf(theta);
Ta = modulationIndex * (cosf(theta) - (ONEOVERSQRT3 * sinTheta));
Tb = modulationIndex * TWOOVERSQRT3 * sinTheta;
T0 = (T - (T * Ta) - (T * Tb)) / T;
switch(sector) {
case 1:
*Tu = T * (0.5f * T0);
*Tv = T * ((0.5f * T0) + Ta);
*Tw = T - (T * (0.5f * T0));
break;
case 2:
*Tu = T * ((0.5f * T0) + Tb);
*Tv = T * 0.5f * T0;
*Tw = T - (T * (0.5f * T0));
break;
case 3:
*Tu = T - (T * (0.5f * T0));
*Tv = T * (0.5f * T0);
*Tw = T * ((0.5f * T0) + Ta);
break;
case 4:
*Tu = T - (T * (0.5f * T0));
*Tv = T * ((0.5f * T0) + Tb);
*Tw = T * (0.5f * T0);
break;
case 5:
*Tu = T * ((0.5f * T0) + Ta);
*Tv = T - (T * (0.5f * T0));
*Tw = T * (0.5f * T0);
break;
case 6:
*Tu = T * (0.5f * T0);
*Tv = T - (T * (0.5f * T0));
*Tw = T * ((0.5f * T0) + Tb);
break;
}
}
I presume you have half bridge drivers with DC-=0 and DC+=12V. Respectively the DC bias should be 6 V. You have apparently 8 V DC bias, thus an unwanted DC offset of 2 V. Things would be clearer if you show phase voltage U, V or W relative to DC- (GND).
You also don't show the motor wiring. We expect that it has three phase lines and no external star point connection.
Do you apply a frequency/voltage ramp when starting the motor? Otherwise it will probably not run.
Hi,
again: the DC offset won´t harm motor function. If the motor does not spin, then this is a different error.
again: I still miss informations that simply can be shown with a sketch.
For example: are we talking about 8V on a 12V rail or 8V on a 600V rail ...
Klaus
I presume the latter. Bias voltage should have no effect on power consumption. For maximal undistorted output voltage, it would be however DC/2, 6V rather than 8V.I'm assuming this is due to either the 8V DC offset the SVPWM implementation generates or perhaps the rotor Iq axis isn't exactly 90 degrees ahead or behind the Id axis.
I presume the latter.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?