IPM Motor Simulation and FOC Software

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 »

Following some problems identified by Zieg a bug in the simulator has come to light (well not quite the simulator, more the configuration of the simulator).

Essentially if the motor current goes above around 435A using the standard param_prj.h the simulator correctly models ADC saturation :(

This causes all sorts of apparent stability issues as the software tries to cope with the bad readings.

Essentially this is simulating the behaviour of the inverter correctly but the default file is for a Prius inverter which has a lower range on the CTs, not normally a problem on the Prius but if the same file is used on a Leaf setup without revisions you get adc saturation and stability problems.

To fix change the lines in the param_prj.h file (the one in the same directory as the IPMMotorSim.pro file) from

Code: Select all

    PARAM_ENTRY(CAT_INVERTER,il1gain,     "dig/A",   -100,   100,    4.7,    27  ) \
    PARAM_ENTRY(CAT_INVERTER,il2gain,     "dig/A",   -100,   100,    4.7,    28  ) \
to

Code: Select all

    PARAM_ENTRY(CAT_INVERTER,il1gain,     "dig/A",   -100,   100,    1,    27  ) \
    PARAM_ENTRY(CAT_INVERTER,il2gain,     "dig/A",   -100,   100,    1,    28  ) \
and rebuild the project. This should fix it in the simulator.

I'll update the default file on github to fix this. Edit - done

Sorry about this, virtually all my testing has been at around 300A motor currents :oops:

As an aside, anyone who is using a Prius inverter in real life and pushing the currents up (@Bigpie) may be seeing this effect in real life too unless they have modified the logic board to change the current input scaling factor!

Edit - It would be better to set these values to match those in your actual install, that way the simulator will accurately reproduce adc saturation at the same point that will happen in real life in the car.
johnspark
Posts: 264
Joined: Fri Apr 12, 2019 10:42 pm
Location: Adelaide, South Australia
Has thanked: 59 times
Been thanked: 48 times

Re: IPM Motor Simulation and FOC Software

Post by johnspark »

Hi all, I am trying to build the software, so far I have these screens:
image.png
image.png
just wondering what I am doing wrong,

Kind regards,

johnspark
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 »

You should just need to open the project (.pro) file. It looks like you may be trying to import the project which is normally only used for non qt projects.

Edit - sorry, misinterpreted the above, it looks like it is kit that is missing. Qt should have set up a default kit that suited your computer when it was installed and it should just pick that up and use it when you first open the project. When you look at the available kits (manage kits button) what are the options shown?
johnspark
Posts: 264
Joined: Fri Apr 12, 2019 10:42 pm
Location: Adelaide, South Australia
Has thanked: 59 times
Been thanked: 48 times

Re: IPM Motor Simulation and FOC Software

Post by johnspark »

Thank you Pete9008,

so I managed to find a kits page and got this:
image.png
wondering what to do next,

Kind regards,

johnspark
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 »

Yep, no valid kits. Looks like you might be missing the toolchain, see if this helps? https://forum.qt.io/topic/109793/no-s ... ve-this

Not sure what's happened there, the qt install always used to include it all by default. If going into the management tool it is also worth checking that qtcharts are included (there is another post about that somewhere above).

I need to do a clean install sometime to check the install instructions are right but don't have a suitable machine at the moment.
Zieg
Posts: 140
Joined: Mon Apr 25, 2022 3:31 am
Has thanked: 59 times
Been thanked: 52 times

Re: IPM Motor Simulation and FOC Software

Post by Zieg »

Pete9008 wrote: Tue Feb 14, 2023 11:13 am

I need to do a clean install sometime to check the install instructions are right but don't have a suitable machine at the moment.
Having just gone through it the other day, I can say I believe the instructions are generally right, but the module selection (including charts) might need a bit of a tweak. Perhaps I could try to make myself useful and propose a revision to the instructions? I can do a clean install with another computer so as not to impact what I've already done on my primary machine. Will take a shot at it later today.
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 »

Thanks, that would be great :)

If you could capture a screen shot or two they could be added to the wiki instructions too (your forum login should work there, or if you're not happy doing that post them here and I can copy them over) ?

Btw - I would suggest disabling Android support (unless you need it for anything else), it really bloats the install!
johnspark
Posts: 264
Joined: Fri Apr 12, 2019 10:42 pm
Location: Adelaide, South Australia
Has thanked: 59 times
Been thanked: 48 times

Re: IPM Motor Simulation and FOC Software

Post by johnspark »

So here is the next screen, (I guess the screens I find can be added to the how to instructions later on):


kind regards,

johnspark
image.png
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 think you need to expand the Qt section at the bottom first.

Edit - I tend to go for the Long Term Support (LTS) rather than the latest version too but it's not critical, just personal preference.
Zieg
Posts: 140
Joined: Mon Apr 25, 2022 3:31 am
Has thanked: 59 times
Been thanked: 52 times

Re: IPM Motor Simulation and FOC Software

Post by Zieg »

I've got a bunch of screenshots taken over the last couple hours, just need to figure out how to format them right. I've done trial and error on several install methods and so far the best approach is actually to add charts after the fact.
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 »

Fantastic! Just been doing a little digging and found this https://forum.qt.io/topic/127564/qt ... enance/16 , seems there are two places charts are listed in the maintenance tool and the one within the Qt tree is the one to go with. Does that agree with what you found?
Zieg
Posts: 140
Joined: Mon Apr 25, 2022 3:31 am
Has thanked: 59 times
Been thanked: 52 times

Re: IPM Motor Simulation and FOC Software

Post by Zieg »

Yeah, it does. I made some edits to the wiki but when I tried to add the pictures I couldn't get them placed properly before having to get up to take care of baby. I'll post them here once I'm back at my PC so they can be evaluated, and possibly copied over by someone who knows what they're doing :)
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 »

That rules me out then ;) That wiki post is the only one I've ever done (and it still bugs me that I couldn't get the formatting to look right in the table of contents!)

Seen your changes, all looks good. If you want to stick any captures here I'll have a go at copying them over tomorrow (although I doubt I'll be able to do any better).

Thanks!

Edit - I seem to remember the trick with images was to turn off float over text or wrap round text (can't remember exact phrase) which defaults back to on each time an image is added. With it turned off the images stay where you put them.
Zieg
Posts: 140
Joined: Mon Apr 25, 2022 3:31 am
Has thanked: 59 times
Been thanked: 52 times

Re: IPM Motor Simulation and FOC Software

Post by Zieg »

Aha, thank you! That did the trick. I've uploaded four of what I think are the most helpful screengrabs (one of which just shows the git commandline in case people aren't familiar with how that looks).

Adding charts after the fact via the maintenance tool doesn't feel like the most streamlined approach , but of all the installation methods I tried , it did result in the smallest footprint.
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 »

That's much better, thank you.

What size did you get the install down to, how much difference did it make?

Edit - will need to go in and tweak it myself tomorrow too, while looking at your changes I spotted half a dozen typos in my bit :oops:
Zieg
Posts: 140
Joined: Mon Apr 25, 2022 3:31 am
Has thanked: 59 times
Been thanked: 52 times

Re: IPM Motor Simulation and FOC Software

Post by Zieg »

Still >3Gb unfortunately. Some attempts were >4Gb. If there's a more compact way to achieve this I'd definitely like to know!
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 »

3GB doesn't sound too bad, see https://openinverter.org/forum/view ... 1#p49245 , 215G for a full install!

I'm sure you could get it down a bit more by going down the custom install route but there is too much chance of breaking something. Your method gives 95% of the benefits while keeping a nice simple install, so thanks for taking the time to work out the best combination :)

Edit - think you've done well to keep it down to 3G, just checked and both my installs and they're nearer 8GB. I quite like Qt but it does seem to take up a lot of space!
johnspark
Posts: 264
Joined: Fri Apr 12, 2019 10:42 pm
Location: Adelaide, South Australia
Has thanked: 59 times
Been thanked: 48 times

Re: IPM Motor Simulation and FOC Software

Post by johnspark »

So I have now added QT charts:
image.png
Thank you Pete (and also for LTS)

I have this for kits:
image.png
and this for build:
image.png
image.png (5.24 KiB) Viewed 5108 times
sorry guys, I looked at wiki but could not find instructions for QT.


Kind regards,

Johnspark
Zieg
Posts: 140
Joined: Mon Apr 25, 2022 3:31 am
Has thanked: 59 times
Been thanked: 52 times

Re: IPM Motor Simulation and FOC Software

Post by Zieg »

Hm, it says 5.15 there.. does that match the version of Qt you have installed?
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 »

Sorry, I probably confused things by mentioning LTS.

Zieg is correct in that the version of charts installed needs to match the version of the rest of the install. Given the missing kits it's probably worth uninstalling and doing a clean install from scratch. The instructions (complete with Zieg's install guide and screenshots) are here https://openinverter.org/wiki/IPM_Motor_Simulator
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: Sat Oct 29, 2022 7:05 pm Ok I dug out some spare motor parts, only tested with stationary rotor in one position but these are Lexus rx400h transaxle

Mg2
image.png
image.png (234.66 KiB) Viewed 4645 times
@Ev8 - any idea what the size and weight of MG2 is?
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 »

Will weigh that spare rotor and stator tomorrow
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 »

Okay rotor diameter 160mm 80mm deep 10.1kg
Stator approx 270 od to outside of lamination’s x 71mm 20.9kg
Attachments
8D2BC1CF-7009-4E6C-89E3-0FBD4A761FAD.jpeg
AD49005A-C2B0-4C68-86A4-48D4734C76EE.jpeg
303B8483-D8FE-486D-9862-EEAC3F1486B7.jpeg
9F305E0E-5937-452D-B91E-9D15C2EE07C2.jpeg
86E7C378-9E23-4178-82D9-79F18320EB73.jpeg
2EA9CEA4-6CC1-49FF-8D1B-D4F47A26881A.jpeg
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 Feb 23, 2023 11:31 am Okay rotor diameter 160mm 80mm deep 10.1kg
Stator approx 270 od to outside of lamination’s x 71mm 20.9kg
Fantastic information, thank you!

That actually looks like a possibility for what I'm thinking about (viewtopic.php?p=53431#p53431) :)

What torque do you think you make from it and do you believe the simulator results you get for it match the real world?
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 »

Not sure on how the torque compares to real life as wasn’t sure how the gear parameter in the sim actually works, but yes it’s plenty torquey, can spin the wheels in 3rd gear on an approx 14-1500kg car, obviously mg1 is in their helping also but the sim doesn’t credit it with much torque and i say that matches reality
Post Reply