SVGENCURRENT module reconstructs phase currents in a simple way, depending on the state of an enumeration called: IgnoreShunt. The following logic is implemented as part of the SVGENCURRENT module in order to reconstruct the currents:
// select valid shunts and ignore one when needed
if (svgencurrent->IgnoreShunt==ignore_a)
{ // repair a based on b and c
Ia = -Ib - Ic; //Ia = -Ib - Ic;
}
else if (svgencurrent->IgnoreShunt==ignore_b)
{ // repair b based on a and c
Ib = -Ia - Ic; //Ib = -Ia - Ic;
}
else if (svgencurrent->IgnoreShunt==ignore_c)
{ // repair c based on a and b
Ic = -Ia - Ib; //Ic = -Ia - Ib;
}
else if (svgencurrent->IgnoreShunt==ignore_ab)
{ // repair a and b based on c
Ia = (-Ic)>>1; //Ia = (-Ic)/2;
Ib = Ia; //Ib = Ia;
}
else if (svgencurrent->IgnoreShunt==ignore_ac)
{ // repair a and c based on b
Ia = (-Ib)>>1; //Ia = (-Ib)/2;
Ic = Ia; //Ic = Ia;
}
else if (svgencurrent->IgnoreShunt==ignore_bc)
{ // repair b and c based on a
Ib = (-Ia)>>1; //Ib = (-Ia)/2;
Ic = Ib; //Ic = Ib;
}
A second stage of current reconstruction is added to this lab, where we take care of corner case conditions when two out of the three currents are not valid. This approach makes use of a running average, where the principle is simple, if a current is not valid, use a software approximation with a filter and its past values. The following code listing shows how this is done in lab 10:
gIavg.value[0] += (gAdcData.I.value[0] - gIavg.value[0])>>gIavg_shift;
gIavg.value[1] += (gAdcData.I.value[1] - gIavg.value[1])>>gIavg_shift;
gIavg.value[2] += (gAdcData.I.value[2] - gIavg.value[2])>>gIavg_shift;
if(ignoreShuntThisCycle == ignore_ab)
{
gAdcData.I.value[0] = gIavg.value[0];
gAdcData.I.value[1] = gIavg.value[1];
}
else if(ignoreShuntThisCycle == ignore_ac)
{
gAdcData.I.value[0] = gIavg.value[0];
gAdcData.I.value[2] = gIavg.value[2];
}
else if(ignoreShuntThisCycle == ignore_bc)
{
gAdcData.I.value[1] = gIavg.value[1];
gAdcData.I.value[2] = gIavg.value[2];
}
After this second stage of current reconstruction, the measured currents and estimated currents are as close as we can have in order to have an FOC system running during extreme overmodulation conditions.
What is the work principle of this algorithm?