Improving MTPA

Post Reply
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Improving MTPA

Post by Bigpie »

Looking at the firmware, the MTPA seems to use some hardcoded values.

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://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.
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
User avatar
johu
Site Admin
Posts: 5683
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 960 times
Contact:

Re: Improving MTPA

Post by johu »

I think bexander worked out Rs, Lq and Ld for his MGR motor:
viewtopic.php?p=28905#p28905

There was also an attempt to make them parameters
viewtopic.php?t=2025
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
bexander
Posts: 834
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 63 times
Been thanked: 89 times

Re: Improving MTPA

Post by bexander »

Here is the document I used as a guide to measure Rs, Lq and Ld.
Measure Ld and Lq.pdf
(2.25 MiB) Downloaded 99 times
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Re: Improving MTPA

Post by Bigpie »

Thanks, I was just reading that and following through your changes. Did you commit to a github fork?
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
User avatar
bexander
Posts: 834
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 63 times
Been thanked: 89 times

Re: Improving MTPA

Post by bexander »

Bigpie wrote: Mon Aug 15, 2022 1:07 pm Thanks, I was just reading that and following through your changes. Did you commit to a github fork?
No sorry, no github fork.
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Re: Improving MTPA

Post by Bigpie »

No problem.

Still reading up at the moment. https://github.com/vedderb/bldc/ is a treasure trove, especially this commit https://github.com/vedderb/bldc/pull/179

"The only configuration parameter needed is the Lq-Ld difference which determines how "tilted" the MTPA trajectory is. Torque increase depends on Ldiff and flux linkage, in a motor with high saliency it can yield a 40+% torque increase (nissan leaf motor) and the % gets bigger with more amps." Some bold claims.
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
User avatar
johu
Site Admin
Posts: 5683
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 960 times
Contact:

Re: Improving MTPA

Post by johu »

Also found this paper that at least acknowledges the issue of phase delay between current and position measurement. Doesn't present a solution though...
Attachments
impact-of-digital-signal-processing-on-foc-current-feedback-in-high-speed-pmsm-drive_38901.pdf
(1.44 MiB) Downloaded 76 times
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
Post Reply