IPM Motor Simulation and FOC Software

User avatar
Ev8
Posts: 801
Joined: Sat Jan 30, 2021 11:05 am
Has thanked: 41 times
Been thanked: 149 times

Re: IPM Motor Simulation and FOC Software

Post by Ev8 »

Ok I may give that a go first, thanks
User avatar
Ev8
Posts: 801
Joined: Sat Jan 30, 2021 11:05 am
Has thanked: 41 times
Been thanked: 149 times

Re: IPM Motor Simulation and FOC Software

Post by Ev8 »

so the current version on Johannes github wont compile, i get this error:
Attachments
error.jpg
User avatar
Ev8
Posts: 801
Joined: Sat Jan 30, 2021 11:05 am
Has thanked: 41 times
Been thanked: 149 times

Re: IPM Motor Simulation and FOC Software

Post by Ev8 »

looks like the = is just the wrong side of the > right?
User avatar
johu
Site Admin
Posts: 5685
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 154 times
Been thanked: 960 times
Contact:

Re: IPM Motor Simulation and FOC Software

Post by johu »

oh, yes, seems I only corrected that locally
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
johu
Site Admin
Posts: 5685
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 154 times
Been thanked: 960 times
Contact:

Re: IPM Motor Simulation and FOC Software

Post by johu »

More combined simulator and car tuning today (Prius that is). Today it seems simulator and car match up quite well.
I struggle to get more than 20kW constant power both in the car and the simulator:
image.png
Controllers are very smooth now. The code is based on the recent github master commit, slightly modified for the simulator (e.g. export vlim). fwkp means filter constant!

The car starts out very powerful but quickly looses grunt above 40 kph. I saw 120A@360V which is a nice 43 kW. But then when at "speed", say 60 kph, I only see about 70A or 25 kW. So more than in the simulator but similar drop off. Any ideas how to obtain more constant power?

Had one uncontrolled regne event with some delay though, when coming off throttle at 100 kph
run01.png
Attachments
stm32_foc.bin
(48.39 KiB) Downloaded 40 times
audi 2022-11-06.json
(1.48 KiB) Downloaded 52 times
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
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: Sun Nov 06, 2022 3:20 pm Any ideas how to obtain more constant power?
Its all down to what the operating point is doing when it limits, could you post the operating point plot for that run?
User avatar
johu
Site Admin
Posts: 5685
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 154 times
Been thanked: 960 times
Contact:

Re: IPM Motor Simulation and FOC Software

Post by johu »

Yes:
image.png
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
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 »

Couple of assumptions, the vertical bit on the plot is the initial limiting at very low speed and the bit that then goes towards the origin is the limiting as speed increases.

The initial near vertical bit is actually increasing -Id slightly which is going in the wrong direction. The ideal would be to pull some -Id out to move closer to icrit while also allowing Iq to remain higher (this does depend on what ud is doing though) which should help keep torque up.
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 »

Take that back. Just tried it both with the operating point moving to the right initially and then down towards icrit and also with it just moving directly towards icrit and neither is significantly better.

It may be that that is as good as it is going to be without running at a higher voltage?
User avatar
johu
Site Admin
Posts: 5685
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 154 times
Been thanked: 960 times
Contact:

Re: IPM Motor Simulation and FOC Software

Post by johu »

Yeah, might well be. At 550V I'm getting 48 kW peak and about 35 kW constant power
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
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 »

The problem is the wLqIq term in the Ud voltage equation. Essentially the torque producing Iq is generating a large Ud voltage, this isn't affected by field weakening at all and so whatever we do with Id has no effect on it. Without the higher voltage all we can do is reduce Iq as speed increases to keep it in check which reduces torque and power.
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 »

Could do with a better handle on the flux linkage value. Setting it to 200mWeber with my controller gives the same results as in your plot, increasing it to 300 gives this:
johu.png
which seems closer to the numbers you are getting in the car?
User avatar
johu
Site Admin
Posts: 5685
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 154 times
Been thanked: 960 times
Contact:

Re: IPM Motor Simulation and FOC Software

Post by johu »

The latter. Like said, saw 43 kW electrical. Raising icrit to -100A also seems to help

EDIT: just did some quick and dirty math on my plot. At the very end it looks like I'm coasting.
We have: uq=25000, udc=360, fstat=110
uac = uq/37813*udc/sqrt(2)=169V
V/Hz = 169/110=1.5 V/Hz . How can you calculate flux linkage from that?
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
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 »

Just do it in radians not Hz
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 »

Pete9008 wrote: Mon Oct 31, 2022 9:26 pm Now that syncadv is sorted and uq and ud are representative you can measure it fairly easily. This is the equation:
vq.png

If you are coasting below base freq (Iq and Id are zero) the only term remaining in the above is the last one (the bemf). So measure vq, divide by 2xPIx(electrical motor speed) and you should have the flux linkage :)

Edit - but only trust the measurements if vd is zero, as well as iq and id, while coasting. If it isn't there is still a sync offset somewhere.
User avatar
johu
Site Admin
Posts: 5685
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 154 times
Been thanked: 960 times
Contact:

Re: IPM Motor Simulation and FOC Software

Post by johu »

Yes, well, sortof - 244 mWeber I suppose then. Not bad, huh ;)
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
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 »

Just looked back at your plot, the only bit I can see where iq, id and ud are all zero is at time 19965. This has a uq of nearer 20000 which would then give a flux linkage of 200mWb?

Would be worth measuring at a few frequencies and seeing if the results agree but this does suggest that values of 200 or more are realistic on high L motors.
User avatar
Romale
Posts: 441
Joined: Fri May 20, 2022 4:16 pm
Location: Romania
Has thanked: 204 times
Been thanked: 45 times

Re: IPM Motor Simulation and FOC Software

Post by Romale »

johu wrote: Sun Nov 06, 2022 3:20 pm

Controllers are very smooth now. The code is based on the recent github master commit,...
is this assembly also suitable for the Nissan motor, or only for Toyota motors?

On your question about power, and if you add the values of the maximum currents in your settings??
evil neodymium :twisted:
User avatar
johu
Site Admin
Posts: 5685
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 154 times
Been thanked: 960 times
Contact:

Re: IPM Motor Simulation and FOC Software

Post by johu »

Romale wrote: Mon Nov 07, 2022 11:31 am is this assembly also suitable for the Nissan motor, or only for Toyota motors?

On your question about power, and if you add the values of the maximum currents in your settings??
I have only tested on Prius lately but will also test on Leaf soon.

Did another test run with the latest simulator results. Upped fwcurmax (=icrit) too -100A and curkp to 500. More makes it noisy. Also found that sometimes FW current is generated at 0 rpm, not sure why.

Anyway, first the coast run:
canvas.png
Note there is 5A FW current to overcome Toyotas 50/50 "intelligence". I don't think it changes flux linkage much, as on some previous test even -20A did not seem to affect uq at all.
Lets repeat:
uq=12000, udc=370, fstat=70
uac = uq/37813*udc/sqrt(2)=83V
V/Hz = 83/70=1.2 V/Hz = 188 mWeber

Then I just drove around not specifically testing anything. The car is slightly more powerful now, about 80A at 360V, so 28 kW. It does become slightly wiggly above 90 kph and ud is almost saturated. Transition to regen is smooth and light throttle is also not an issue. So very well drivable now.

At some point though while regenning down a hill behind a lorry, far away from any controller saturation I got a short jolt of unwanted regen but it fixed itself fairly quickly:
unwanted regen.png
Any ideas what could be causing that? Also requesting too much regen seems to easily end up in uncontrolled regen in general.
Attachments
audi 2022-11-08.json
(1.48 KiB) Downloaded 78 times
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
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 »

Is the unwanted regen that spike at 60400?
Do you have any plots of the high requested regen turning into uncontrolled regen?
User avatar
johu
Site Admin
Posts: 5685
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 154 times
Been thanked: 960 times
Contact:

Re: IPM Motor Simulation and FOC Software

Post by johu »

Pete9008 wrote: Tue Nov 08, 2022 5:49 pm Is the unwanted regen that spike at 60400?
Do you have any plots of the high requested regen turning into uncontrolled regen?
yes, that one.

No plots besides that one, will do more driving and try to trigger it
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
Ev8
Posts: 801
Joined: Sat Jan 30, 2021 11:05 am
Has thanked: 41 times
Been thanked: 149 times

Re: IPM Motor Simulation and FOC Software

Post by Ev8 »

Is that the highest throtcur you can push?
User avatar
johu
Site Admin
Posts: 5685
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 154 times
Been thanked: 960 times
Contact:

Re: IPM Motor Simulation and FOC Software

Post by johu »

Ev8 wrote: Tue Nov 08, 2022 6:41 pm Is that the highest throtcur you can push?
I can do more, had it set to 3.5A before but it just gives a jolt of torque on startup and the backoff towards higher speed feels even worse. It doesn't help high speed power and doesn't improve the driving experience. So dialed it down to 2.8A.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
Ev8
Posts: 801
Joined: Sat Jan 30, 2021 11:05 am
Has thanked: 41 times
Been thanked: 149 times

Re: IPM Motor Simulation and FOC Software

Post by Ev8 »

Makes sense
User avatar
johu
Site Admin
Posts: 5685
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 154 times
Been thanked: 960 times
Contact:

Re: IPM Motor Simulation and FOC Software

Post by johu »

On another note I found the actual reason why the car tends to hop about when starting from standstill. It's the idle offset calibration and disabling of PWM. The frequency only starts to measure at 7 Hz. When PWM is disabled motor leads are shorted by the Gen2 logic and current sensor offset calibration is wrong. Afterwards the entire algorithm suffers from the wrong offset even though it doesn't show as much at higher speed.

So I'll add a parameter to turn off the idle function. Offset will be measured once at startup and that's it.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
Post Reply