IPM Motor Simulation and FOC Software
- Bigpie
- Posts: 1595
- Joined: Wed Apr 10, 2019 8:11 pm
- Location: South Yorkshire, UK
- Has thanked: 75 times
- Been thanked: 304 times
Re: IPM Motor Simulation and FOC Software
I have fmax set to 800, I've not logged what I manage to get it up to, again, I'll log it.
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
-
- 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
Assuming a 4 pole motor 800Hz would be 12000rpm, the simulation is only running to 3000rpm. If you let it run to a higher speed in the simulator you will see more power. The power should level out, probably by 6000rpm, when you hit base freq and enter the constant power region. At 3k you are still in the constant torque region.
- Bigpie
- Posts: 1595
- Joined: Wed Apr 10, 2019 8:11 pm
- Location: South Yorkshire, UK
- Has thanked: 75 times
- Been thanked: 304 times
Re: IPM Motor Simulation and FOC Software
4 pole motor, 12000 rpm is reasonable, motor rated to 14k so might up some more.
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
- 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
It's a pretty good book, obviously a bit dated in places. It cost me something like £65 back in 1999 or so. There's a used copy on Amazon right now for £12, which is well worth it.
The EV section of the book is based on work done by Motorola for Ford and what ended up going into the 1998-2002 Ford Rangers; https://en.wikipedia.org/wiki/Ford_Ranger_EV
Motorola's own test platform was a bit different and might not have made Ford all that happy; https://www.thedrive.com/news/culture/w ... -the-1990s
-
- 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
Thanks, I'd noticed that already, if its still there will probably order it.SciroccoEV wrote: ↑Wed Nov 16, 2022 1:57 pm It's a pretty good book, obviously a bit dated in places. It cost me something like £65 back in 1999 or so. There's a used copy on Amazon right now for £12, which is well worth it.
Probably not happy at all!SciroccoEV wrote: ↑Wed Nov 16, 2022 1:57 pm Motorola's own test platform was a bit different and might not have made Ford all that happy; https://www.thedrive.com/news/culture/w ... -the-1990s
Edit - does the book go into motor equations at all or is it more the electrical side?
-
- 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
Ahh, ok, see what you mean now. The control loops aren't't looking too happy at higher speeds at all which code is that, guessing mine as it does tend to do that. If so it is worth dropping curkifrqgain or fwki to see if it helps.
Johannes new IIR filter version does seem to help avoid that control loop oscillation at higher speeds.
-
- 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
Just tried to reproduce and I can't get anything to stay stable in FW.
The thing that seems to make the biggest difference is Ld. I'm wondering if your bridge is under reading slightly, with a value of 0.16mH everything behaves much better and the power is back up to 75kW.
What is the resolution of your LCR bridge? If it is only 0.1mH then the actual inductance could have been up to 0.199mH??
- Bigpie
- Posts: 1595
- Joined: Wed Apr 10, 2019 8:11 pm
- Location: South Yorkshire, UK
- Has thanked: 75 times
- Been thanked: 304 times
Re: IPM Motor Simulation and FOC Software
It shows to 2 dp, one reading was 0.25 part way though a rotation, I also had a 0.13mH. Lowest was 0.10mH and highest was 0.30mH it was cheap so not expecting high accuracy.
I'm still running your code on the car and simulator for now.
I'm still running your code on the car and simulator for now.
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
-
- 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
I'd use 0.15mH for the time being, 0.1mH does seem very low. Any idea what frequency the Outlander OEM inverters run at?
It's been a while since I used the master branch on the simulator (I've been running the experimental branch) and It really isn't that good in terms of stability above base freq (not too surprising as it is essentially 5.20 code plus logging).
It would be worth moving either to Johannes latest (safest but no logging yet) or my experimental (untested but has the logging). As there is no rush on data I'd probably go for the former and hope that Johannes gets the logging going before we need it. Both options are better then the old code that you are currently running.
It's been a while since I used the master branch on the simulator (I've been running the experimental branch) and It really isn't that good in terms of stability above base freq (not too surprising as it is essentially 5.20 code plus logging).
It would be worth moving either to Johannes latest (safest but no logging yet) or my experimental (untested but has the logging). As there is no rush on data I'd probably go for the former and hope that Johannes gets the logging going before we need it. Both options are better then the old code that you are currently running.
-
- 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
@johu - just trying to update the simulator for the latest build. Got a build error and it looks like the definition
is missing from the top of pwmgeneration.cpp.
I'm using a fresh git checkout so could you check this against your local repo?
Code: Select all
uint16_t PwmGeneration::slipIncr;
I'm using a fresh git checkout so could you check this against your local repo?
- Bigpie
- Posts: 1595
- Joined: Wed Apr 10, 2019 8:11 pm
- Location: South Yorkshire, UK
- Has thanked: 75 times
- Been thanked: 304 times
Re: IPM Motor Simulation and FOC Software
I've not calculated the icrit yet, but might get chance to try it out at the weekend, plus the current code works great for me.
Just uploading a log to my drive where the car had a cut out event though.
Just uploading a log to my drive where the car had a cut out event though.
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
-
- 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
Fair enough, just don't pull the latest simulator when I update it as it won't build with your code (no new features though so not a big issue).
When did it trip, from stationary or while moving?
Have you fixed the final overflow bug in your code (not sure I ever pushed it to the master github branch)?
-
- 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
@johu - updating the simulator to support you latest code, all the mods are done but I don't seem to be able to reproduce your results. The plot which should reproduce the above comes out looking like this: Have you changed anything else that might affect this?johu wrote: ↑Sun Nov 06, 2022 3:20 pm 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: 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
Edit - BTW - best to run with the extra cycle box checked as otherwise it doesn't accurately simulate the hardware PWM load delay.
Edit2 - Looks to be something to do with the IIR filter which is producing silly results but can't figure out what. Assume that 11 is right for vlimflt?
- Bigpie
- Posts: 1595
- Joined: Wed Apr 10, 2019 8:11 pm
- Location: South Yorkshire, UK
- Has thanked: 75 times
- Been thanked: 304 times
Re: IPM Motor Simulation and FOC Software
Stationary, tried to set off too quick. Can't get the decoder to decode it though unfortunately.
I'm not sure if the final overflow bug is fixed, got the commit id?
I'm not sure if the final overflow bug is fixed, got the commit id?
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
-
- 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
Not sure it got commited as a standalone mode, fairly sure it's in the experimental branch. If your InvParkClarke function looks like this (particularly the ua/=2 and ub/=2 lines):
Code: Select all
void FOC::InvParkClarke(int32_t ud, int32_t uq)
{
//Inverse Park transformation
s32fp ua = FP_MUL(cos, ud) - FP_MUL(sin, uq);
s32fp ub = FP_MUL(cos, uq) + FP_MUL(sin, ud);
//Inverse Clarke transformation
DutyCycles[0] = ua;
ua /= 2;
ub /= 2;
DutyCycles[1] = (-ua + FP_MUL(SQRT3, ub));
DutyCycles[2] = (-ua - FP_MUL(SQRT3, ub));
- Bigpie
- Posts: 1595
- Joined: Wed Apr 10, 2019 8:11 pm
- Location: South Yorkshire, UK
- Has thanked: 75 times
- Been thanked: 304 times
Re: IPM Motor Simulation and FOC Software
I've checked my stm32-pete, looks like I've not.
Code: Select all
void FOC::InvParkClarke(int32_t ud, int32_t uq)
{
//Inverse Park transformation
s32fp ua = FP_MUL(cos, ud) - FP_MUL(sin, uq);
s32fp ub = FP_MUL(cos, uq) + FP_MUL(sin, ud);
//Inverse Clarke transformation
DutyCycles[0] = ua;
DutyCycles[1] = (-ua + FP_MUL(SQRT3, ub)) / 2;
DutyCycles[2] = (-ua - FP_MUL(SQRT3, ub)) / 2;
int32_t offset = SineCore::CalcSVPWMOffset(DutyCycles[0], DutyCycles[1], DutyCycles[2]);
for (int i = 0; i < 3; i++)
{
/* subtract it from all 3 phases -> no difference in phase-to-phase voltage */
DutyCycles[i] -= offset;
/* Shift above 0 */
DutyCycles[i] += zeroOffset;
/* Short pulse suppression */
if (DutyCycles[i] < minPulse)
{
DutyCycles[i] = 0;
}
else if (DutyCycles[i] > maxPulse)
{
DutyCycles[i] = (FP_FROMINT(2)-1);
}
}
}
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
- Bigpie
- Posts: 1595
- Joined: Wed Apr 10, 2019 8:11 pm
- Location: South Yorkshire, UK
- Has thanked: 75 times
- Been thanked: 304 times
Re: IPM Motor Simulation and FOC Software
Sadly not, stamping from standstill still cuts out. Doing so while moving is ok it seems
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
- johu
- Site Admin
- Posts: 5791
- Joined: Thu Nov 08, 2018 10:52 pm
- Location: Kassel/Germany
- Has thanked: 157 times
- Been thanked: 1025 times
- Contact:
Re: IPM Motor Simulation and FOC Software
Yes I had changed something just for the simulator. Let me see:Pete9008 wrote: ↑Wed Nov 16, 2022 4:20 pm @johu - updating the simulator to support you latest code, all the mods are done but I don't seem to be able to reproduce your results. The plot which should reproduce the above comes out looking like this:
johu_5.24.png
Have you changed anything else that might affect this?
Edit - BTW - best to run with the extra cycle box checked as otherwise it doesn't accurately simulate the hardware PWM load delay.
Edit2 - Looks to be something to do with the IIR filter which is producing silly results but can't figure out what. Assume that 11 is right for vlimflt?
Code: Select all
/*if (frqFiltered < FP_FROMINT(30))
qController.SetMinMaxY(dir <= 0 ? -qlimit : 0, dir > 0 ? qlimit : 0);
else*/
qController.SetMinMaxY(-qlimit, qlimit);
vlimflt=11 is good. I had tried with that delay checkbox + syncadv 10 and got some infinite currents. So disabled it and didn't investigate further.
Had that with Leaf motor and had to lower curkp from 150 to 60
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
-
- 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
That's a shame
Still a bit suspicious about the current sampling on low L motors. There were some very odd current waveforms in you early logs but not sure whether it was the card or real.
Edit - still also wonder whether adding transmission play to teh simulator would help with modelling those trips.
Still a bit suspicious about the current sampling on low L motors. There were some very odd current waveforms in you early logs but not sure whether it was the card or real.
Edit - still also wonder whether adding transmission play to teh simulator would help with modelling those trips.
-
- 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
Thanks, that's fixed it. Could do with figuring out what the problem is or add some conditional compilation.johu wrote: ↑Wed Nov 16, 2022 5:18 pm Yes I had changed something just for the simulator. Let me see:simulator didn't like that.Code: Select all
/*if (frqFiltered < FP_FROMINT(30)) qController.SetMinMaxY(dir <= 0 ? -qlimit : 0, dir > 0 ? qlimit : 0); else*/ qController.SetMinMaxY(-qlimit, qlimit);
Running without it does make life a lot easier for the control loops but unfortunately isn't very realistic
Right, going to push the latest simulator code up to github then I can get to the stuff I meant to do this afternoon!
-
- 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
OK, latest version of the simulator that supports Rel 5.24 of the inverter code is now on github. Note the change in the above post that is needed to keep things happy.
Also note that this version will not work with previous versions of Johannes or my code!
Also note that this version will not work with previous versions of Johannes or my code!
- johu
- Site Admin
- Posts: 5791
- Joined: Thu Nov 08, 2018 10:52 pm
- Location: Kassel/Germany
- Has thanked: 157 times
- Been thanked: 1025 times
- Contact:
Re: IPM Motor Simulation and FOC Software
Nice, thanks
would it make sense to tie in the matching version as a submodule?
would it make sense to tie in the matching version as a submodule?
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
-
- 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
Could do, not sure how to tie the sub module to a specific build though?
-
- 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
Was about to order this but just checked and it would be coming from the USA - £33.58 delivery so think I'll leave it!SciroccoEV wrote: ↑Wed Nov 16, 2022 1:57 pm It's a pretty good book, obviously a bit dated in places. It cost me something like £65 back in 1999 or so. There's a used copy on Amazon right now for £12, which is well worth it.