IPM Motor Simulation and FOC Software

User avatar
mjc506
Posts: 343
Joined: Wed Sep 09, 2020 9:36 pm
Location: Wales, United Kingdom
Has thanked: 30 times
Been thanked: 28 times

Re: IPM Motor Simulation and FOC Software

Post by mjc506 »

I 'upgraded' (deleted IPMMotorSim directory, and redownloaded from git) from one of the earlier versions to latest, but the 'noise' and 'gradient' options weren't showing, and it had remembered my misguided settings, so I wanted a fresh start :)

I don't miss the registry... perhaps a 'delete preferences' button somewhere? Not sure how useful it might be. Although most people using the sim should be happy enough with a bit of registry hacking :)
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 »

mjc506 wrote: Tue Jan 10, 2023 10:37 am I don't miss the registry...
I don't miss windows much either ;)
mjc506 wrote: Tue Jan 10, 2023 10:37 am perhaps a 'delete preferences' button somewhere? Not sure how useful it might be. Although most people using the sim should be happy enough with a bit of registry hacking :)
Did wonder about a button but discounted it because the program would have just resaved whatever bad data that was causing the problem on exit. It's only just occurred to me that all is needed is a flag when the button is pressed so that as well as deleting the data it flags not to save anything on exit - then on restart it will use all the defaults. Feeling a bit dim now!

Also just started another thread (viewtopic.php?t=3047). Might have a way of calculating Lq, Ld and flux linkage from web browser csv files (talked about doing it from binary logs before in this thread). Decided not to integrate it into the simulator so it is in a new thread instead.
User avatar
mjc506
Posts: 343
Joined: Wed Sep 09, 2020 9:36 pm
Location: Wales, United Kingdom
Has thanked: 30 times
Been thanked: 28 times

Re: IPM Motor Simulation and FOC Software

Post by mjc506 »

So the button can delete prefs, set a "don't save" flag, restart the program, optimise the inverter settings for performance, efficiency and making a cool noise, implementing world peace... :)

Great news about your new app!
User avatar
bexander
Posts: 834
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 63 times
Been thanked: 89 times

Re: IPM Motor Simulation and FOC Software

Post by bexander »

For information, when setting "throtcur" in param_prj.h to 1.5, the sim reads it as 1, and I have to set it to 1.5 manually every time I start the sim. Probably the sim doesn't expect decimal value?
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 »

Oops, thanks for finding that. I'll fix when I next update but in the meantime change line 292 of mainwindow.cpp to matcn line 146. Both should read:

Code: Select all

 ui->throttleCurrent->setText(QString::number(Param::GetFloat(Param::throtcur), 'f', 1)); 
That should fix it (not tested yet though).
User avatar
bexander
Posts: 834
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden
Has thanked: 63 times
Been thanked: 89 times

Re: IPM Motor Simulation and FOC Software

Post by bexander »

Works!
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 good, will update the code when I'm next working on it.

Looks like I broke it while "improving" the program startup initialisation routine and copied the wrong format specifier a while ago.
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Re: IPM Motor Simulation and FOC Software

Post by Bigpie »

Struggling to get anything that looks stable with with the sim built against latest release.
Screenshot 2023-01-17 at 5.19.24 pm.png
This seems to be closest I can get, any ideas?
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 »

Not this is it viewtopic.php?p=50997#p50997?

Also if you are still on my code fork you may have problems with the latest sim?

Edit - alternatively it could just be accelerating to a speed where the control loops can't keep up and you get unwanted regen (you only have a vehicle weight of 1kg set!)

Edit2 - Yep, just checked, it's accelerating up to high speeds and the control loops give up, unwanted regen slows it down, and repeats over and over. Increasing vehicle weight should fix it.

BTW - It's worth updating to the latest sim, the ability to turn of the phase voltages/currents in the plots does speed up redraws a fair bit.
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 »

Simulator update pushed to github that fixes the above problem with throtcur initialisation.

Also adds an optional efficiency plot. The results look believable but it is nowhere near fully tested. Note - this does NOT include inverter losses or motor iron losses. It just compares the electrical power flowing into the motor to the calculated shaft mechanical output power.
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Re: IPM Motor Simulation and FOC Software

Post by Bigpie »

Ahh, I'd checked out Johannes fork. I've sync'd with your repo now and it's working and got some fairly stable plots from the looks of it. Admittedly, I'm still not 100% sure I know what and ideal plot will look like and which parameters will have what effect on various aspects.

My ignition switch seems to have broken though, I've constantly got 12v on the start line, so as soon as I power up the inverter tried to start in run mode so got to either address that or fudge something so I can update and change params.
I've got Janosch, bobby_come_lately and rstevens81 visiting next week so want to get the car performing as good as it gets this weekend :D
They last drove the car pre pete.
Screenshot 2023-01-19 at 6.31.00 pm.png
Screenshot 2023-01-19 at 6.30.49 pm.png
Screenshot 2023-01-19 at 6.30.42 pm.png
Screenshot 2023-01-19 at 6.30.35 pm.png
I *think* these are best simulation settings I've got but will test them in the car at weekend on 5.24
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 Jan 19, 2023 6:33 pm They last drove the car pre pete.
Now that made me laugh :lol:

Not looking bad at all, think your motor resistance is probably on the high side though, I'd drop it to around 0.1 and see what difference it makes. It should lift the power a bit.

Noticed your plot is saturated on Ud not Uq which made me wonder what the MTPV stuff might do for it so tried your settings (except for the resistance, dropped that to 0.1 which may explain some of the gains) and got this:
Bigpie_MTPV.png
Not sure whether to believe that or not (it's without over-modulation too!).

Still needs a bit of work, you can see it doesn't transition between MTPA and MTPV nicely and it's prone to oscillation but there is definately potential there.

Have you got your tripping from standstill sorted now?
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Re: IPM Motor Simulation and FOC Software

Post by Bigpie »

I've not fixed it yet, just been driving around the issue. It did happen while driving last week too, stepped on it too fast at about 30. Hoping it just gets magically fixed by 5.24

I am looking forward to trying overmodulation.
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 above is without over-modulation, just MTPV. With both it should add a bit more. Was hoping to have something to test by the weekend but it's not looking too likely at the moment :(

Edit - At 30, thought it was only from standstill?
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Re: IPM Motor Simulation and FOC Software

Post by Bigpie »

So did I. I can put my foot to the floor and keep it there but it seems to be the speed at which I do it. I've got fairly slow throttle ramping.set. I guess I need to tune the KI 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
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 »

Your ki and kp both seem very low but I didn't see any real improvement when increasing them and your sim plots look pretty good. Worth trying Johannes latest code first as it should be an improvement.
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Re: IPM Motor Simulation and FOC Software

Post by Bigpie »

Managed to get a cutout on 5.24 too unfortunately, was web logging at the time and attached to my project thread.
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: Mon Jan 23, 2023 6:04 pm Managed to get a cutout on 5.24 too unfortunately, was web logging at the time and attached to my project thread.
Had a look but nothing obvious in the plot. I'm not even sure where the cutout is. Here is what the log looks like:
bigpie_cutout.png
Not sure where the cutout is in that, any ideas?

The voltages all do seem pretty low, not more than half the battery voltage used.

What does look odd is the data after 250sec, not quite sure I believe that section of the log?

Edit - just logged it in open office and the second half looks a lot better, need to figure out why my plotting is not reading the second half of that file correctly

Edit2 - OK found the trip, it's at 250sec. After the trip the logging goes strange, instead of getting a row of data in the file a few times a second we're only getting one line every few seconds (with 20second gaps in places, my plotting is fine, it's open office that doesn't process the time stamps right). This is odd, looks like the trip, or restart, somehow messes up the logging function, not enough to kill it just enough to slow it down by /10-/100 ?!?

Still nothing obvious jumping out as to the cause of the trip. The question is does the trip cause the logging disruption or does whatever causes the logging disruption also cause the trip?

Edit3 - The logging seems to continue for around a second after the trip. This would suggest that the restart somehow breaks the logging so the logging disruption is nothing to do with the cause of the trip.

The big problem here is we have 1 measurement point every 300ms, that about 2600 runs of the control loop. Looks like we might still need the binary fast logging to find this?
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Re: IPM Motor Simulation and FOC Software

Post by Bigpie »

The cut was I think towards the end of the log, it didn't auto restart and I was in the middle of the road so keyd off and on, laptop disconnected from WiFi

Didn't know if this firmware still has the binary logging in.
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 »

OK so the point I was looking at wasn't the trip, just a normal start. The trip must have been in the section where the logging had already gone odd so afraid there is not much in there that is going to help.

Just had a quick look, can't see the fast binary logging in the latest code. There is the binary streaming version of normal logging which will be a bit better but not yet supported by the web page.
User avatar
Bigpie
Posts: 1585
Joined: Wed Apr 10, 2019 8:11 pm
Location: South Yorkshire, UK
Has thanked: 74 times
Been thanked: 299 times

Re: IPM Motor Simulation and FOC Software

Post by Bigpie »

Not sure what's going on with my logging. Not sure what the binary streaming is, I'll have to look in to it.

It certainly seems harder to trip out, so that's a bonus.
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
johu
Site Admin
Posts: 5684
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 960 times
Contact:

Re: IPM Motor Simulation and FOC Software

Post by johu »

Didn't manage to include bin logging into 5.24.R
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
Zieg
Posts: 128
Joined: Mon Apr 25, 2022 3:31 am
Has thanked: 47 times
Been thanked: 45 times

Re: IPM Motor Simulation and FOC Software

Post by Zieg »

Hey quick question, trying to get this working and got stuck at building the software.

The instructions say
To build the software go to 'Build' at the top and select 'Rebuild Project: IPMMotorSim'

but there is no such option. I tried "Build Project 'IPMMotorSim'" but I get the error:
Unknown module(s) in QT: charts
I have no idea what I'm doing here so any help would be appreciated.
qtrerror.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 »

Sounds like you may need to install the qtcharts module, see https://stackoverflow.com/question ... -windows
Zieg
Posts: 128
Joined: Mon Apr 25, 2022 3:31 am
Has thanked: 47 times
Been thanked: 45 times

Re: IPM Motor Simulation and FOC Software

Post by Zieg »

Yeah I think you're right. Sorry, thought it was related to the code not the software.
Post Reply