IPM Motor Simulation and FOC Software

User avatar
Bigpie
Posts: 1594
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 75 times
Been thanked: 303 times

Re: IPM Motor Simulation and FOC Software

Post by Bigpie »

Not sure, not sure it's possible to plot the currents of each phase, with the current software, nor differentiate between controller position and motor position?

According to my shunt, I'm getting about 32kw from the motor, so half what Mitsubishi rate it at. I can setoff is 2nd slowly.
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
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 »

Bigpie wrote: Wed Sep 21, 2022 10:39 am Not sure, not sure it's possible to plot the currents of each phase, with the current software, nor differentiate between controller position and motor position?

According to my shunt, I'm getting about 32kw from the motor, so half what Mitsubishi rate it at. I can setoff is 2nd slowly.
I think you can get il1 and il2 which would be enough and only need the controller angle (the others are just there as standard on my plots and not easy to remove).

If you try to set of quickly in 2nd, or slowly in any higher gears, what happens?

Edit - does it ever stutter a little when starting off?
User avatar
Bigpie
Posts: 1594
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 75 times
Been thanked: 303 times

Re: IPM Motor Simulation and FOC Software

Post by Bigpie »

If I bring throttle in I can move off in 5th, if a little juddery and very slow. Full throttle results in a cutout.
Attached is backwards and forwards on the drive as slow as I could with datapoints reduced to 100 to see if that improves things.
Attachments
log (9).csv
(81.27 KiB) Downloaded 53 times
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
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 time resolution on that has improved to 0.3sec so the 100 points does help. It's still only the first few seconds that have good enough resolution though:
BP_SlowRun.png
That looks pretty good, the angle plot is a nice sawtooth with very little noise. The min, max and ave currents track each other and are a nice sinusoid. No obvious problems there at all which is great - but I'm now at a loss as to why you get the cut-outs and are only running at around half power!

Edit - calculating the 3rd phase and plotting gives this - again all good.
BP_3phase.png
Edit2 - do the cut-outs tend to be low speed, high speed, low load, high load or fairly random?
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 is the current plot for the complete run:
BP_3pFull.png
It's very intermittent, was this you coming on and off the throttle or was this the juddering?

Edit, looking at the time axis guessing the former.
User avatar
Bigpie
Posts: 1594
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 75 times
Been thanked: 303 times

Re: IPM Motor Simulation and FOC Software

Post by Bigpie »

The cutouts can occur in 2 situations from what I can tell, is accelerating from standstill at high throttle, i.e. trying to setoff more quickly than usual. It starts moving very briefly then cuts. The other situation is when for example merging to motorway and trying to gain speed quickly and so at pretty high RPM, very much over 10k.

I can only think it's overshooting causing the problem?

On and off the throttle, going forward a little, putting it in reverse going backwards and repeat.
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
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 »

Another plot showing a section in the middle, nothing wrong with that at all!
BP_midRun.png
From standstill will give some pretty fast motor movement/rates of change as all the slack in the drivetrain is taken up. Does it still do it if you use a little bit of throttle to take up the slack and then accelerate hard?

On the high speed one it might be worth trying the build of code that I did for Ev8 which has a bit of sync compensation which will help at high speeds, let me know if so.
User avatar
Bigpie
Posts: 1594
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 75 times
Been thanked: 303 times

Re: IPM Motor Simulation and FOC Software

Post by Bigpie »

Taking up the slack first still has the issue even rolling at a couple of mph the same. Not a big issue day to day, but would be nice to understand why and irradicate. I've not played with curkifrqgain as the higher speed cutouts are even less of an issue daily as I don't tend to need to accelerate to higher speed quickly often.

I'll try plot with even fewer points see if that highlights anything
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
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 »

Pete9008 wrote: Mon Sep 19, 2022 4:16 pm
The unwanted throttle on fw suggests that either the Mtpa parameters are wrong (it needs more -Id which means a larger value for lqminusld) or syncofs is still out. Might be worth upping lqminusld a bit more (I think Bexander did use 6 at one point), it shouldn't do any harm. Keep increasing it till it stops improving performance (although I'd be getting pretty suspicious above 10mH)

I got a chance to do a few runs with mtpa settings up to 10mH no difference in the unwanted acceleration, will try a few more things
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 »

Did the higher lqminusld make any noticable difference to performance below base freq? How much unwanted acceleration are you getting?

Also do you know what kind of power you are getting from the inverter? I'm hoping to put 100kW through mine but starting to wonder how realistic that is.
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 »

Bigpie wrote: Thu Sep 22, 2022 2:50 pm Edit, with my new PI values I'm able to get to 40kw before cutout
Getting better :)

How does it drive with the new values?

Re. the cutouts I'm pretty much out of ideas. All I can think is it's either a desat event or and IGBT die temperature cutout (if the Prius has them??). I doubt the web plotting is going to be quick enough to catch enough detail to see any more unless you are very lucky. I've been pondering on whether a data logger board, that could be plugged in in place of the ESP module, would be useful (based on something like this https://shop.pimoroni.com/products/adaf ... 1892212935) . If it worked in conjunction with custom inverter code it would be possible to capture pretty much every input and output in the control loop on every pass through. Trouble is it is quite a bit of work, would need the inverter dissembling to fit/remove and would only help if it was a control/firmware problem. On balance I don't think it is worth doing at the moment.

Edit - Have you paralleled up the MG1/MG2 outputs on the inverter or are you just using MG2?
User avatar
Bigpie
Posts: 1594
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 75 times
Been thanked: 303 times

Re: IPM Motor Simulation and FOC Software

Post by Bigpie »

It drives mostly well, except at 40kw it does cut out. Damien says it doesn't cutout for temperature just derates automatically. Cutouts are desat only.
I have my wifi module mounted externally so swapping it out for something else is easy :D
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
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 »

Bigpie wrote: Thu Sep 22, 2022 4:48 pm It drives mostly well, except at 40kw it does cut out. Damien says it doesn't cutout for temperature just derates automatically. Cutouts are desat only.
Need to have a good look at the board. In the pictures there seem to be more connections to the IGBTs than I would expect and I wondered whether one of them might be a temperature sensor. The Toyota engineers do seem to have done a pretty good job of the protection so it wouldn't surprise me if there is something hidden away.

Edit - this is where the logger would work well, it would probably be able to tell the difference. If the current increases prior to the trip it's likely desat if not it isn't
Bigpie wrote: Thu Sep 22, 2022 4:48 pm I have my wifi module mounted externally so swapping it out for something else is easy :D
That might be an option then. Would you be interested in trying it?
User avatar
Bigpie
Posts: 1594
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 75 times
Been thanked: 303 times

Re: IPM Motor Simulation and FOC Software

Post by Bigpie »

of course :D Since the starting to use it I've wanted a log to SD card option, just haven't got round to it yet. An ESP32 with SDCard would be best of both worlds.
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
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 »

Bigpie wrote: Thu Sep 22, 2022 5:11 pm of course :D Since the starting to use it I've wanted a log to SD card option, just haven't got round to it yet. An ESP32 with SDCard would be best of both worlds.
I've only played with the ESP modules a little bit but didn't find them that good at time critical stuff (could be wrong but seem to remember the OS shares the processor between the WiFi stack and the app to there can be latency issues) might be worth a try though.

I've also got lazy with coding and can't manage without good in system debug anymore so tend to stick with the arm cores whenever possible!

Edit - just had a look and there is a debugger for the ESP, i also have a few modules here already. Time for a bit of reading up!
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 »

Isn't the ESP32 a dual core?
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 »

SciroccoEV wrote: Thu Sep 22, 2022 5:26 pm Isn't the ESP32 a dual core?
You're right. I was thinking of the older esp8266. The esp32 would be a much better choice!

I've just had a look at what's involved with the IDE and debugger and its not something I'm going to be looking at,. Too much of a project on top of everything else. It would be a nice solution though.
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 »

Pete9008 wrote: Thu Sep 22, 2022 6:59 am Did the higher lqminusld make any noticable difference to performance below base freq? How much unwanted acceleration are you getting?

Also do you know what kind of power you are getting from the inverter? I'm hoping to put 100kW through mine but starting to wonder how realistic that is.

I can’t remember the change of Lqminusld making much difference in performance, unwanted acceleration is like basically whatever the throttle was last at before lifting off.

As for power, on the way home in 4th gear from 30mph to 70mph the battery monitor showed 295amps Soc was 80ish so 312v so nearly 100kw through a Prius gen2
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 »

Ev8 wrote: Thu Sep 22, 2022 6:09 pm I can’t remember the change of Lqminusld making much difference in performance, unwanted acceleration is like basically whatever the throttle was last at before lifting off.
The unwanted acceleration sounds quite severe, not sure what could be the cause. If your wifi module is inside the ECU case it might be worth considering relocating it to get a better signal and do some plots?
Ev8 wrote: Thu Sep 22, 2022 6:09 pm As for power, on the way home in 4th gear from 30mph to 70mph the battery monitor showed 295amps Soc was 80ish so 312v so nearly 100kw through a Prius gen2
Now that's encouraging :D I was starting to wonder whether the Prius inverter could do that. Is that just the MG2 output?
User avatar
Bigpie
Posts: 1594
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 75 times
Been thanked: 303 times

Re: IPM Motor Simulation and FOC Software

Post by Bigpie »

What was you thinking? Using the existing stream command with a low number of indexes and write.to sdcard or something more involved?
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
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 »

That’s mg1 and mg2 driving the 2 motors independently,

I previously used a gen2 inverter to drive a dc motor with mg1 and mg2 power stages paralleled at was able to push over 160kw through it with 80s battery. So the gen2 Prius is definitely capable of handling much more than the 50kw Toyota rate it at,
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 »

Not looked at the streaming command in detail but I don't think anything ascii based would be fast enough to capture everything.

I was thinking something along the lines of a command that would stop all normal terminal activity and instead start sending binary data out at the end of each run of the control loop. Only did some very rough calcs but it looked to need a couple of Mbps to capture everything. If the esp can handle this kind of data rate (not managed to find any definative data on max rates) then it could stream it over wifi otherwise it could be copied to the SDcard. A separate app would be used to decode the saved files. Possibly over the top but it would capture everything.
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 »

Ev8 wrote: Thu Sep 22, 2022 7:09 pm That’s mg1 and mg2 driving the 2 motors independently,

I previously used a gen2 inverter to drive a dc motor with mg1 and mg2 power stages paralleled at was able to push over 160kw through it with 80s battery. So the gen2 Prius is definitely capable of handling much more than the 50kw Toyota rate it at,
Wow! Ok I take it all back! Wonder why the Toyota engineers built so much spare capacity into it?
User avatar
Bigpie
Posts: 1594
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 75 times
Been thanked: 303 times

Re: IPM Motor Simulation and FOC Software

Post by Bigpie »

https://github.com/Noltari/pico-uart-bridge raspberry pi pico uart to usb bridge should be good to cover the capture side of the task
VW Beetle 2003
Outlander front generator
Prius Gen 3 inverter (EVBMW logic board)
Outlander charger
3x Golf GTE batteries
Chademo Charging
Outlander water heater
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 »

Bigpie wrote: Thu Sep 22, 2022 8:18 pm https://github.com/Noltari/pico-uart-bridge raspberry pi pico uart to usb bridge should be good to cover the capture side of the task
I think your first idea of an ESP32 could be the way to go. There's already a port of the web interface and that would make a good starting point. viewtopic.php?t=1447.

Add a SD card (and possibly a real time clock to allow file time stamping) and you would have a very flexible platform. It could provide the current web page functionality. When there were no connections to the web server it could automatically switch to high speed logging to the SD card. The web page or a ftp server could then provide access to logged files over wifi (would be slow to download but faster than disassembling the inverter!). The wifi would probably also be quick enough to stream live high speed data.
Post Reply