Improving MTPA
Posted: Mon Aug 15, 2022 8:49 am
Looking at the firmware, the MTPA seems to use some hardcoded values.
https://hackaday.io/project/164932-axio ... -into-vesc
https://github.com/vedderb/bldc/pull/17 ... 103ae858b2
I can manage to make these values in to parameters, but I've not yet found a way to externally workout the flux linkage and the d q inductance difference for a specific motor.
Code: Select all
static const s32fp fluxLinkage = FP_FROMFLT(0.09);
static const s32fp lqminusldSquaredBs10 = FP_FROMFLT(0.01722); //additional 10-bit left shift because otherwise it can't be represented
static const s32fp lqminusld = FP_FROMFLT(0.0058);
....
void FOC::Mtpa(int32_t is, int32_t& idref, int32_t& iqref)
{
int32_t isSquared = is * is;
int32_t sign = is < 0 ? -1 : 1;
s32fp term1 = fpsqrt(fluxLinkage2 + ((lqminusldSquaredBs10 * isSquared) >> 10));
idref = FP_TOINT(FP_DIV(fluxLinkage - term1, lqminusld));
iqref = sign * (int32_t)sqrt(isSquared - idref * idref);
}
https://github.com/vedderb/bldc/pull/17 ... 103ae858b2
I can manage to make these values in to parameters, but I've not yet found a way to externally workout the flux linkage and the d q inductance difference for a specific motor.