IPM Motor Simulation and FOC Software

User avatar
mjc506
Posts: 343
Joined: Wed Sep 09, 2020 9:36 pm
Location: Wales, United Kingdom
Has thanked: 30 times
Been thanked: 28 times

Re: IPM Motor Simulation and FOC Software

Post by mjc506 »

Is it possible to measure Ld and Lq from a motor?

Edit: Should've googled first, of course. I'll see what I can do with a Hyundai HSG (SPM), if that's useful?

Do you account for changing Ld and Lq with current?
image.png
https://www.physicsforums.com/attachmen ... pdf.79167/
User avatar
mjc506
Posts: 343
Joined: Wed Sep 09, 2020 9:36 pm
Location: Wales, United Kingdom
Has thanked: 30 times
Been thanked: 28 times

Re: IPM Motor Simulation and FOC Software

Post by mjc506 »

If I've measured right, I get (very approximately) 4mH for the HSG (both Ld and Lq)
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: IPM Motor Simulation and FOC Software

Post by Pete9008 »

Thank you!

How did you measure it, with a LCR bridge or using the TI app note approach? I have an Outlander rear motor here but dont have the current probe needed for the TI approach, or a bridge for that matter, but might be able to rig up something with a scope and sig gen. I have looked at the cheap LCR meters that are now available but don't know whether they can be trusted?

The same value for Ld and Lq would be right for an SPM.

Those numbers are more like the ones I found when starting to look at this and why I've been using higher values. They are for smaller motors though. My original thought was that larger motors would have larger inductance but I'm wondering if it is the other way round? Using your motor, the PMSM motor and the Leaf data it looks more like inductance may be inversely related to operating current, which makes sense in some ways?

I don't account for changing inductance with current although it would be nice to do. Finding a single value for a motor seems difficult enough! It should be possible to calculate it from logged data though.
User avatar
mjc506
Posts: 343
Joined: Wed Sep 09, 2020 9:36 pm
Location: Wales, United Kingdom
Has thanked: 30 times
Been thanked: 28 times

Re: IPM Motor Simulation and FOC Software

Post by mjc506 »

No problem! Just an LCR meter... like you say, I don't know how much I trust it, but it does come up with good numbers on known inductors.

The HSG is a small motor - about 150mm dia, 100m length stator, rated circa 12kW (depends which OEM you ask!) designed just as a starter/generator for mild and full hybrids. I would assume larger motor = larger inductance (more copper, more iron etc etc) but I don't have much of a handle on it. Haven't got anything bigger at the moment to measure I'm afraid.

'Self learning' inverter? :-) I'd hope the control loop would be robust enough to manage changes like that anyway, especially damped with big lumps or plastic and steel :-)
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: IPM Motor Simulation and FOC Software

Post by Pete9008 »

Which meter do you use? Its something that has been on my list for a while but never made it too the top (mainly because I used to be able to use work ones which were significantly better than anything I'd buy). Just had a quick look and the DE-5000 gets good reviews but is expensive for something that would only get occasional use.

Thing is bigger currents mean larger windings which means less turns (and seem to remember L proportional to N squared). Wonder if intuition is wrong in this case?

Edit - bigger inductance also means higher back emf, not good when trying to run at speed. What rpm is the HSG rated for?

A self learning inverter has been at the back of my mind for a while now, fairly sure it is possible but a fair chunk of work and not sure it is worth it?

Think for now I'm going to use the Leaf 300A values (330uH and 100uH) and experiment a bit more with the simulation. There is something odd going on from stationary (very high currents, just for a few ms) which might explain the trips people have experienced?

EDIT - Ignore the last bit, the brief high currents were due to the encoder test stubs not being re-initialised properly on restarting the simulation. The lower L values just exaggerated the effect, now fixed.
LeonB
Posts: 55
Joined: Fri Mar 26, 2021 12:19 am
Location: Germany

Re: IPM Motor Simulation and FOC Software

Post by LeonB »

Pete9008 wrote: Sun Oct 16, 2022 9:31 am So the question, does anyone have data for the Lq and Ld inductance for other motors?
This paper (https://www.mdpi.com/2032-6653/13/3/51) specifies around 3mH for Ld and 5mH for Lq for the gen3 Prius motor.
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: IPM Motor Simulation and FOC Software

Post by Pete9008 »

LeonB wrote: Sun Oct 16, 2022 12:02 pm This paper (https://www.mdpi.com/2032-6653/13/3/51) specifies around 3mH for Ld and 5mH for Lq for the gen3 Prius motor.
Thank you, that interesting. Higher numbers than I'd like but then the Prius does step up the DC bus voltage and so could possibly stand a bit more inductance. Still lower values than Ive typically been using though. Its also not clear what current those are at, if its at 0A then the inductance should drop as the currents increase.
User avatar
mjc506
Posts: 343
Joined: Wed Sep 09, 2020 9:36 pm
Location: Wales, United Kingdom
Has thanked: 30 times
Been thanked: 28 times

Re: IPM Motor Simulation and FOC Software

Post by mjc506 »

I've got one of these supremely high quality items... Cheapy Amazon LCR meter. Like I say, I don't trust it at all, just because it's so cheap, but I have to admit it reports reasonable numbers for a range of (known) inductors, and is handy to measure very low resistances too (motor phase windings etc etc)

Yeah, good point. My intuition is so often wrong... haha

I think the HSG is rated for something like 10-15k shaft rpm, 4 pole pairs so pretty fast. Mid 30s rpm/volt (OEM pack voltage is around 240V)

Interesting that the MDPI paper gives similar Ld and Lq for the Prius motor. Although I suppose not too dissimilar speeds or battery voltages. About 10x what you've been using? (mH, uH)
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: IPM Motor Simulation and FOC Software

Post by Pete9008 »

mjc506 wrote: Sun Oct 16, 2022 4:50 pm I've got one of these supremely high quality items... Cheapy Amazon LCR meter. Like I say, I don't trust it at all, just because it's so cheap, but I have to admit it reports reasonable numbers for a range of (known) inductors, and is handy to measure very low resistances too (motor phase windings etc etc)
:)
I found a cheap meter on Amazon which is supposed to have the same chipset as the DE-5000 (which gets good reviews) so have ordered that, should be here tomorrow and I'll measure my motor then.
mjc506 wrote: Sun Oct 16, 2022 4:50 pm Yeah, good point. My intuition is so often wrong... haha
Dangerous thing intuition, the trouble is if you start questioning everything you never get anywhere. I tend to go with mine but accept that I'm regularly going to be wrong (and try to think of it as a learning opportunity ;) )
mjc506 wrote: Sun Oct 16, 2022 4:50 pm I think the HSG is rated for something like 10-15k shaft rpm, 4 pole pairs so pretty fast. Mid 30s rpm/volt (OEM pack voltage is around 240V)

Interesting that the MDPI paper gives similar Ld and Lq for the Prius motor. Although I suppose not too dissimilar speeds or battery voltages.
Good point, the speed and pack voltage would probably be the determining values (depending on whether field weakening is used?).
mjc506 wrote: Sun Oct 16, 2022 4:50 pm About 10x what you've been using? (mH, uH)
To summarise:
I've typically been using 8mH and 10mH for Ld and Lq.
You measured 4mH for the HSG.
The MDPI paper gives 3mH and 5mH for the Prius.
The mcmaster paper gives 150uH and 550uH for the Leaf.
I seem to remember that someone measured the Toyota MGR at 4mH and 6mH but can't find it now.

Allowing for a bit of reduction due to current suggests that I'm overestimating by a factor of between 3 and 80 depending on which figures you go with!
User avatar
mjc506
Posts: 343
Joined: Wed Sep 09, 2020 9:36 pm
Location: Wales, United Kingdom
Has thanked: 30 times
Been thanked: 28 times

Re: IPM Motor Simulation and FOC Software

Post by mjc506 »

My head hurts hahah. I'm not sure if I'm surprised how close the Prius, MGR and HSG are, or how much different the leaf is :)

I need to download this and have a proper play...
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: IPM Motor Simulation and FOC Software

Post by Pete9008 »

I'll push the new code onto git once it appears to be working (maybe later this week) so I suggest you wait for that as it makes a significant difference in some areas, the main one being above base freq. At the moment I can't work out whether the wLdId term is responsible for field weakening by itself or whether I also need to model the change in flux linkage with Id. What I really need is the full derivation of the motor equations so that I can understand where each term comes from and what effects are included! Thinking about it good quality logged data should also be enough to determine it.

The numbers do make me wonder about the Leaf data, it does seem to be the odd one out. Will see what the Outlander motor looks like, hopefully later today. Could also do with working out a way to do the inductance measurement at high current levels as that would be more representative. Should be relatively straight forward once it is connected to a battery and inverter but it will be a while before I have that setup here.

When I have time I'm also going to try tuning the simulator for different motor inductances to try and get a feel for how much difference it might make to the inverter settings.
User avatar
johu
Site Admin
Posts: 5791
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 157 times
Been thanked: 1024 times
Contact:

Re: IPM Motor Simulation and FOC Software

Post by johu »

Gotta say 150uH sounds implausible as the Leaf inverter runs at 5 kHz PWM frequency. 150 uH would not be able to smooth that out at all and you'd have enormous ripple currents:
grafik.png
And here's what 1mH looks like
grafik.png
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
SciroccoEV
Posts: 369
Joined: Thu Oct 10, 2019 1:50 pm
Location: Luton UK
Been thanked: 15 times

Re: IPM Motor Simulation and FOC Software

Post by SciroccoEV »

Found a video on simulating motor characteristics. Later part of the video uses Leaf motor as example. Not watched it properly, but Ld and Lq are shown on screen at the linked timeframe.

Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: IPM Motor Simulation and FOC Software

Post by Pete9008 »

johu wrote: Mon Oct 17, 2022 8:44 pm Gotta say 150uH sounds implausible as the Leaf inverter runs at 5 kHz PWM frequency. 150 uH would not be able to smooth that out at all and you'd have enormous ripple currents:

grafik.png

And here's what 1mH looks like

grafik.png
Agree, although trying to keep an open mind on it at the moment. The ripple on the 150u plot is just about on the limit of what I'd consider acceptable, and that is with 400V? It might explain some of the nuisance trips at low speeds though?

Edit - maybe a little bit over acceptable!
SciroccoEV wrote: Mon Oct 17, 2022 9:06 pm Found a video on simulating motor characteristics. Later part of the video uses Leaf motor as example. Not watched it properly, but Ld and Lq are shown on screen at the linked timeframe.

Good find. Now that is a proper simulator :) I want one of those!

The inductances they show are low but not sure I totally trust them as the magnitudes of Ld and Lq seem to be the wrong way round (Ld is bigger, should be the smaller)?

The LCR bridge has arrived, done some quick measurements and it seems to give reasonable results so this mornings job is to measure the approximate motor inductances.
User avatar
SciroccoEV
Posts: 369
Joined: Thu Oct 10, 2019 1:50 pm
Location: Luton UK
Been thanked: 15 times

Re: IPM Motor Simulation and FOC Software

Post by SciroccoEV »

Pete9008 wrote: Tue Oct 18, 2022 8:17 am Good find. Now that is a proper simulator :) I want one of those!
It looks as if non profit 'research' licences are available, but getting an Inventor or Solidworks licence might be more challenging. If it works with Inventor, it might work with Fusion 360.
The inductances they show are low but not sure I totally trust them as the magnitudes of Ld and Lq seem to be the wrong way round (Ld is bigger, should be the smaller)?
If I recall correctly, the inductance is angle dependent, so these values could be at a specific angle?

Perhaps this video is more useful (not wathed it yet);

Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: IPM Motor Simulation and FOC Software

Post by Pete9008 »

Interesting - that shows the inductances calculated from the model and they are the right way round (Lq bigger). Both are also well under a mH though (0.3mH for Ld and 0.6mH for Lq at ~200A).

Not managed to measure my motor yet, couple of reasons:

Found out why the LCR bridge I bought was cheap, think it's a return that checked out as being OK when tested - but wasn't. It had an intermittent connection on one of the kelvin adaptor connectors which turned out to be just due to a badly formed terminal. Still took most of the morning to find and fix though. With that sorted it seems to work well and will accurately measure series and parallel RC combinations of 30pF and a few K which is not far off a lot of the proper bridges I've used in the past.

Someone also managed to put a JCB bucket through the streets water main this morning so no water all day :(

Hopefully get it measured tomorrow.
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: IPM Motor Simulation and FOC Software

Post by Pete9008 »

Motor measurements done :)

Not the best measurement method but I decided that trying to rotate the motor via the driveshafts, diff and gears to try and find the optimum q and d positions wasn't going to work (too much play, too much cogging and the (small) risk of a back emf killing my LCR bridge if it moves too quick). Instead the motor was left stationary and I just measured all three combinations of connections (one side of the bridge to one phase connection and the other side of the bridge connected to the other two phases shorted together). The results were:

Phase 1: L = 305uH, ESR = 95mR
Phase 2: L = 310uH, ESR = 91mR
Phase 3: L = 171uH, ESR = 70mR

These were pretty consistent measured at 100Hz and 1kHz but the inductances dropped by around 15% and the ESR increased to over an ohm at 10kHz. 10kHz is pushing it a bit for the test setup so I'm going to ignore that measurement. The change in ESR for phase 3 shouldn't happen so I'm guessing the bridge isn't doing a perfect job of separating the L and R components. It's close enough for now though.

From this I'm going to guess that phase 3 is aligned for Ld and the other two are therefore 30degrees out for Lq and so a bit low. Without doing any sums at all I'd guess at real values of:

Ld = 171uH
Lq = 350-400uH

Now this is with zero current, with a couple of hundred amps Lq will drop a fair bit, Ld less so (for -Id as it's opposing the magnets so reducing core saturation) so the values I'm going to use for simulation are:

Ld = 160uH
Lq = 300uH

Now this is all starting to make me wonder whether the difference between motors that no-one seems to be able to get to work (like the MGR) and motors that do seem to work (Leaf, Outlander rear) is the inductance. Based on limited simulations to date it looks like low inductance motors generate reasonable torque at both low speeds and high speeds relatively easily. High inductance motors generate torque at low speed and can be made to spin to high speed but not do both at the same time (high inductance means that the wLI terms get too big and limit the current, and so torque, at higher speeds). Need to spend a bit more time on the simulator to confirm this. Could also do with a few more inductance measurements for other motors too.

I'm also going to see if I can find, or get hold of, a 300uH inductor, just to check that the LCR bridge is telling the truth at that kind of inductance value as these results are lower than I was expecting!
User avatar
mjc506
Posts: 343
Joined: Wed Sep 09, 2020 9:36 pm
Location: Wales, United Kingdom
Has thanked: 30 times
Been thanked: 28 times

Re: IPM Motor Simulation and FOC Software

Post by mjc506 »

Yes, lower than I expected, but that would make a lot of sense... Apart from the Prius haha
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: IPM Motor Simulation and FOC Software

Post by Pete9008 »

mjc506 wrote: Wed Oct 19, 2022 4:24 pm Yes, lower than I expected, but that would make a lot of sense... Apart from the Prius haha
I was wondering about that, the Prius does have the boost converter to lift the bus voltage up to 500V or so though, which could help a lot with running a high inductance motor at higher speeds? Will have to try and simulate it :)

Edit - Also found some 100uH inductors, the LCR bridge measured 99uH for one and 201uH for two in series so I think I'm going to have to believe the motor numbers!

Edit2 - Has anyone had success using the Prius motor with OpenInverter?
User avatar
mjc506
Posts: 343
Joined: Wed Sep 09, 2020 9:36 pm
Location: Wales, United Kingdom
Has thanked: 30 times
Been thanked: 28 times

Re: IPM Motor Simulation and FOC Software

Post by mjc506 »

Ah yes, good shout.

Good numbers :)

I think Johannes at least has been running a Prius inverter and transaxle, I'm sure there are a few others but can't think at the moment!
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: IPM Motor Simulation and FOC Software

Post by Pete9008 »

This may all be starting to make some kind of sense now :)

I think the simulator is now a fairly realistic model (it still doesn't do anything about core saturation but can live with that for now) and we have a better handle on motor parameters. Today's plan is to try and put the two together and see if it is possible to reproduce the behaviour seen on different motors.

I'm going to split motors into two groups for the purposes of this. A low inductance group (Outlander rear, Leaf (debatable depending on which numbers you believe?!)) and high inductance motors (MGR, Prius, basically anything with a boost converter that normally runs at higher voltage). My current theory is that the Toyota motors (particularly the smaller ones that need to make maximum torque to be usable) need the higher boost voltage to work well at high rpms - it will be interesting to see if the simulator results back this up or not!

Low inductance motors will use 160uH and 500uH (compromise between Outlander an Leaf values).

High Inductance motors will use 4mH and 6mH (this is from memory - sure someone measured it, can find the post detailing how to do itviewtopic.php?p=28905#p28905 but not the actual measurements :( )

Edit - spoke to soon, still need to figure out how exactly to model the permanent magnet flux linkage. In particular do I need to modify the value used in the equations based on -Id or do the mathworks equations just take care of it. I would have thought the later should be the case, especially as I can't find any equations for modifying the flux linkage in papers :( Going to have to add another plot to give better visibility of what's going on inside the model to try and figure it out. If anyone has come across any good reference material on this subject links would be appreciated.
User avatar
Romale
Posts: 451
Joined: Fri May 20, 2022 4:16 pm
Location: Romania
Has thanked: 214 times
Been thanked: 49 times

Re: IPM Motor Simulation and FOC Software

Post by Romale »

Pete9008 wrote: Sat Oct 22, 2022 9:13 am This may all be starting to make some kind of sense now :)
tell me, is it possible to discuss the increased heating of the controller and large battery currents for the motor without load when the FW or lqminusld is turned on, or is it better to create a separate topic? this problem appeared with the new firmware.
evil neodymium :twisted:
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: IPM Motor Simulation and FOC Software

Post by Pete9008 »

Romale wrote: Sat Oct 22, 2022 10:48 am tell me, is it possible to discuss the increased heating of the controller and large battery currents for the motor without load when the FW or lqminusld is turned on, or is it better to create a separate topic? this problem appeared with the new firmware.
Really need more data (csv log or plot capture) to comment but I'd guess that it might be this viewtopic.php?p=45686#p45686?

If it is then a momentary small throttle opening following deceleration would reset Iq and Id and remove the current.
Pete9008
Posts: 1801
Joined: Sun Apr 03, 2022 1:57 pm
Has thanked: 102 times
Been thanked: 347 times

Re: IPM Motor Simulation and FOC Software

Post by Pete9008 »

Starting to make sense again, just for reference here is a plot showing what the individual contributions to the motor voltages are:
MotorVoltages.png
Vd and Vq are the same as on previous plots and are what are seen on the motor terminals (after the Park, Clarke translation). The rest are the voltages generated by the individual terms of the model equations:

Vq_BEMF is the back EMF generated by the turning motor, if it gets above battery voltage (~175V) the motor is above base freq.
Vq_Ld and Vd_Lq are the voltages generated across Ld and Lq by Id and Iq when the motor is turning (actual term is wLI so are proportional to speed). They are mostly a pain (these are what limit the performance of high inductance motors) but Vq_Ld is useful to produce field weakening. You can see its effect starting to come in as FW increases -Id at around 1.4sec.
Vd_Rd and Vq_Rq are the voltages dropped across the DC resistance of teh windings.
VLd and VLq are the residual voltages left after the above are subtracted from Vd and Vq that appear across the inductance and produce current change in the windings.

At the moment all the control loops are barely stable so they are the next thing to work on.
User avatar
Romale
Posts: 451
Joined: Fri May 20, 2022 4:16 pm
Location: Romania
Has thanked: 214 times
Been thanked: 49 times

Re: IPM Motor Simulation and FOC Software

Post by Romale »

Screenshot_20221018-165156_1.png
Screenshot_20221018-165254_1.png
Screenshot_20221018-164848_1.png
evil neodymium :twisted:
Post Reply