Page 29 of 40
Re: IPM Motor Simulation and FOC Software
Posted: Fri Nov 04, 2022 6:47 pm
by Ev8
Ok I may give that a go first, thanks
Re: IPM Motor Simulation and FOC Software
Posted: Sat Nov 05, 2022 10:50 am
by Ev8
so the current version on Johannes github wont compile, i get this error:
Re: IPM Motor Simulation and FOC Software
Posted: Sat Nov 05, 2022 10:56 am
by Ev8
looks like the = is just the wrong side of the > right?
Re: IPM Motor Simulation and FOC Software
Posted: Sat Nov 05, 2022 12:04 pm
by johu
oh, yes, seems I only corrected that locally
Re: IPM Motor Simulation and FOC Software
Posted: Sun Nov 06, 2022 3:20 pm
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
Re: IPM Motor Simulation and FOC Software
Posted: Sun Nov 06, 2022 4:08 pm
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?
Re: IPM Motor Simulation and FOC Software
Posted: Sun Nov 06, 2022 4:13 pm
by johu
Re: IPM Motor Simulation and FOC Software
Posted: Sun Nov 06, 2022 4:46 pm
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.
Re: IPM Motor Simulation and FOC Software
Posted: Sun Nov 06, 2022 5:06 pm
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?
Re: IPM Motor Simulation and FOC Software
Posted: Sun Nov 06, 2022 5:11 pm
by johu
Yeah, might well be. At 550V I'm getting 48 kW peak and about 35 kW constant power
Re: IPM Motor Simulation and FOC Software
Posted: Sun Nov 06, 2022 5:15 pm
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.
Re: IPM Motor Simulation and FOC Software
Posted: Sun Nov 06, 2022 5:25 pm
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?
Re: IPM Motor Simulation and FOC Software
Posted: Sun Nov 06, 2022 6:12 pm
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?
Re: IPM Motor Simulation and FOC Software
Posted: Sun Nov 06, 2022 6:36 pm
by Pete9008
Just do it in radians not Hz
Re: IPM Motor Simulation and FOC Software
Posted: Sun Nov 06, 2022 6:37 pm
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.
Re: IPM Motor Simulation and FOC Software
Posted: Sun Nov 06, 2022 8:54 pm
by johu
Yes, well, sortof - 244 mWeber I suppose then. Not bad, huh

Re: IPM Motor Simulation and FOC Software
Posted: Sun Nov 06, 2022 9:55 pm
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.
Re: IPM Motor Simulation and FOC Software
Posted: Mon Nov 07, 2022 11:31 am
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??
Re: IPM Motor Simulation and FOC Software
Posted: Tue Nov 08, 2022 2:42 pm
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.
Re: IPM Motor Simulation and FOC Software
Posted: Tue Nov 08, 2022 5:49 pm
by Pete9008
Is the unwanted regen that spike at 60400?
Do you have any plots of the high requested regen turning into uncontrolled regen?
Re: IPM Motor Simulation and FOC Software
Posted: Tue Nov 08, 2022 6:15 pm
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
Re: IPM Motor Simulation and FOC Software
Posted: Tue Nov 08, 2022 6:41 pm
by Ev8
Is that the highest throtcur you can push?
Re: IPM Motor Simulation and FOC Software
Posted: Tue Nov 08, 2022 6:59 pm
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.
Re: IPM Motor Simulation and FOC Software
Posted: Tue Nov 08, 2022 7:06 pm
by Ev8
Makes sense
Re: IPM Motor Simulation and FOC Software
Posted: Tue Nov 08, 2022 9:00 pm
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.