Page 8 of 14
Re: Renault Clio Electrique -97
Posted: Thu Jan 05, 2023 12:20 pm
by bexander
Hm, Johu recommends running curkp around 500 and I have 32 so this is a good starting point for adjustment, will give it a go.
Re: Renault Clio Electrique -97
Posted: Thu Jan 05, 2023 1:30 pm
by bexander
Set curkp to 500 (32) and also changed vlimmargin to 2000 (2500).
That made big difference. Now the oscillation starts closer to 60km/h or fstat 260 and are much smaller in amplitude however at 70km/h or fstat 300 it starts to self accelerate, I guess due to it is running out of Ud?
Worth mentioning, I made an acceleration from standstill up to self acceleration while pulling around 60A from battery, gets up to 65A when self accelerating..., anyway thats around 22kW (or 24kW while self accelerating). I don't think the MGR have delivered this power at that speed before, and no unwanted regen either, just the self accelerating part that needs to be tuned away.
And also, that was not flooring the pedal so more to come...
Should I incease curkp further or should I tweak some other parameter?
The weather forcast states snow for tomorrow so probably will have to wait until saturday for more tests.
Re: Renault Clio Electrique -97
Posted: Thu Jan 05, 2023 5:15 pm
by johu
You can do the coasting test next (
viewtopic.php?p=48358&hilit=coasting#p48358). I thought syncadv was independent of the motor, maybe it's not?
So you just let the car coast with no regen, field weakening or acceleration. I prefer doing it downhill because then you get acceleration and see various frequencies. You want to adjust syncadv so that ud does not vary with frequency.
Re: Renault Clio Electrique -97
Posted: Thu Jan 05, 2023 8:19 pm
by bexander
Great, will test this. I do have a good downhill close by.
I suspect my Ld and Lq measurement could be off as well, hence LqminusLd is off. I'm reading through the entire "IPM Motor Simulation and FOC Software" thread in an attempt to better understand what to tune and what effects to expect.
A lot of work put into this from Johu and Pete9008 and others as well. I think it has really payed of!!
Re: Renault Clio Electrique -97
Posted: Thu Jan 05, 2023 8:42 pm
by Ev8
Have you tried using the simulator Pete made? It’s really helped me with tuning
Re: Renault Clio Electrique -97
Posted: Thu Jan 05, 2023 8:53 pm
by bexander
Ev8 wrote: ↑Thu Jan 05, 2023 8:42 pm
Have you tried using the simulator Pete made? It’s really helped me with tuning
No, because I have not yet understod where do download it from?
Re: Renault Clio Electrique -97
Posted: Thu Jan 05, 2023 9:02 pm
by Ev8
Copied from the foc and sim thread
Pete9008 wrote: ↑Mon Nov 28, 2022 11:55 am
Again sorry should have done this sooner!
First install Qt,
https://www.qt.io/download-qt-installer. I'm still using an old version but it should work fine with the latest too. The open source version is fine for this. Qt should be happy on Linux, Windows, Mac, etc.
Once it has downloaded create a directory and then clone the simulator code into it
Code: Select all
git clone https://github.com/Pete9008/IPMMotorSim
if using Johannes repository which has the submodule already there you can include --recurse-submodules to also get the openinverter firmware. Otherwise if using mine move to the IPMMotorSim subdirectoty (the one that contains the IPMMotorSim.pro file) within the project and get the firmware
Code: Select all
git clone --recurse-submodules https://github.com/jsphuebner/stm32-sine
Open up Qt and then open the IPMMotorSim.pro file. It should then ask about configuring the project, selecting the default kit (that should already be selected) will be fine. Then just to be safe do a rebuild (under build menu) and run (either the play icon or F5) and it should run. You will probably need to adjust the settings in the param_prj.h file (same directory as the .pro file) to match your install but make sure that both the resolver and motor poles are set to 4 (other values should also work but I haven't tested it, the resolver and motor poles values do have to match though).
Re: Renault Clio Electrique -97
Posted: Fri Jan 06, 2023 5:34 am
by bexander
Ev8 wrote: ↑Thu Jan 05, 2023 9:02 pm
Copied from the foc and sim thread
I'm only at page 12 reading through that thread so that explains why I have not found the sim SW yet. Thanks!
Re: Renault Clio Electrique -97
Posted: Fri Jan 06, 2023 7:01 am
by bexander
So, played with the sim a bit and it suggests that I need to reduce "fwcurmax" from -100A to more like -30A. That should make it stable up to much higher speeds.
I will test this, when possible due to weather, in the car.
I can't get the sim to produce my exact results in numbers but it shure provides a very good understanding for which parameter that has a certain effect, hence it really helps with my understanding on how to tweak parameters. Very educational and fun to play with. Very nice work creating this!!!
Re: Renault Clio Electrique -97
Posted: Fri Jan 06, 2023 4:10 pm
by Ev8
Yes I don’t think I would have got to my current tune without playing with the sim
Re: Renault Clio Electrique -97
Posted: Fri Jan 06, 2023 6:53 pm
by Pete9008
bexander wrote: ↑Fri Jan 06, 2023 7:01 am
I can't get the sim to produce my exact results in numbers but it shure provides a very good understanding for which parameter that has a certain effect, hence it really helps with my understanding on how to tweak parameters. Very educational and fun to play with. Very nice work creating this!!!
Thanks, good to hear it is proving useful

Also thanks for some of the post you made previously (that are mentioned in the early pages of the simulator thread) that helped me get started with the maths.
Sorry about having to wade through 35 pages of my disjointed musings to figure out how to use it. I've been intending for a while to do some kind of documentation for it, either on the wiki or an improved readme, but haven't got to it yet
I noticed you liked a post on PI tuning - it's worth mentioning that later on in the thread it was found that high inductance motors (like the MGR) need more Integral gain than the post suggests (I'll go and add an edit to reflect this now).
Regarding the closeness of the results to real life - I would like to make the simulator more realistic if possible but need more data to do so. If you could let me know in what ways it disagrees it would be useful?
Looking forward to hearing how you get on with the tuning!
Edit - Re documentation, what I'll do for now is edit the first post of the thread to include links to some of the more relevant later posts, there are probably only half a dozen that are really relevant.
Re: Renault Clio Electrique -97
Posted: Fri Jan 06, 2023 7:03 pm
by bexander
Pete9008 wrote: ↑Fri Jan 06, 2023 6:53 pm
I noticed you liked a post on PI tuning - it's worth mentioning that later on in the thread it was found that high inductance motors (like the MGR) need more Integral gain than the post suggests (I'll go and add an edit to reflect this now).
I plan to do the stationary PI tuning procedure but I want to test the car a bit first. I will try to do the coast test as Johu suggested and also try to reduce fwcurrent before I adjust PI values.
Pete9008 wrote: ↑Fri Jan 06, 2023 6:53 pm
Regarding the closeness of the results to real life - I would like to make the simulator more realistic if possible but need more data to do so. If you could let me know in what ways it disagrees it would be useful?
Well, might have been user error... When I started the sim later it seem to give much more correct values so I think it was up to me putting in wrong values. I will let you know if I see this again.
Pete9008 wrote: ↑Fri Jan 06, 2023 6:53 pm
Edit - Re documentation, what I'll do for now is edit the first post of the thread to include links to some of the more relevant later posts, there are probably only half a dozen that are really relevant.
Great idea! Some post really contains a lot of good information.
Re: Renault Clio Electrique -97
Posted: Fri Jan 06, 2023 8:54 pm
by Pete9008
bexander wrote: ↑Fri Jan 06, 2023 7:03 pm
Well, might have been user error... When I started the sim later it seem to give much more correct values so I think it was up to me putting in wrong values. I will let you know if I see this again.
Just a thought on this - any changes to the param_prj.h file are only picked up when the software is recompiled, just re-running the executable isn't enough. Only the parameters in the GUI can be updated live. Could that have been the cause of the discrepancy?
Re: Renault Clio Electrique -97
Posted: Sat Jan 07, 2023 5:24 am
by bexander
Pete9008 wrote: ↑Fri Jan 06, 2023 8:54 pm
Just a thought on this - any changes to the param_prj.h file are only picked up when the software is recompiled, just re-running the executable isn't enough. Only the parameters in the GUI can be updated live. Could that have been the cause of the discrepancy?
I have not done any changes to the param_pfj.h file and maybe thats the problem? I only changed the parameters in the GUI.
My guess is that I had set one or more parameters wrong in the GUI.
Re: Renault Clio Electrique -97
Posted: Sat Jan 07, 2023 8:41 am
by Pete9008
Not sure there is anything in the param file that has to be changed, most of the critical stuff is available in the gui. All the parameters that are in the param file (essentially the ones in the middle pane of the gui) are initialised from the param file on each program start up though so I normally go into the param file and set it up with default values for the motor, gains, lqminusld, fwmax, throttle current, etc that suit the simulation (so that I don't have to change them every time the program is restarted).
The values in the left hand and right hand panes are not in the param file (it's part of the inverter firmware and so just contains values used by it) but are stored when the program is closed and reset to the previous value when the program restarts. That means that if the values in the param file are right then there should be nothing that needs changing when restarting the simulator.
Will try and get some proper instructions done (and stop cluttering you thread up with simulator details

)
Re: Renault Clio Electrique -97
Posted: Sat Jan 07, 2023 11:17 am
by bexander
Still damp roads but couln't hold back my quriosity any longer so some tests done.
First a coast up (well, its downhill) test with just trying to hold the pedal at neutral torque request.
Looks like Ud is decently straight. Maybe slight tendency upwards, hence might need small decrease in syncadv?
Changed "lqminusld" to 2 (4) and set "fwcurmax" to -50.
No auto acceleration nor oscillation but a bit sluggish, only pulling 40A from battery at 370V in FW.
Set "fwcurmax" to -75.
Felt like I got some small oscillations starting at 80km/h, pulled 52A from battery at 370V in FW.
Set "fwcurmax" to -70.
Felt good with no oscillations at 89km/h (ran out of road, top speed limited to 91km/h), pulled 50A from battery at 365V in FW.
Before FW I got 75A at 360V so 27kW and then 18kW in FW.
A bit concerned about the dip in Id and Iq after FW has started to kick in. Don't really understand why it is doing this?
Overall, very smooth to drive with no unexpected behaviors.
Next will be to test and tune "curkp" and "curki".
Also will test different "lqminusld" settings. I feel 4mH is a bit high and that is why I changed it to 2.
Lastly, my latest parameters.
Re: Renault Clio Electrique -97
Posted: Sat Jan 07, 2023 11:19 am
by bexander
Pete9008 wrote: ↑Sat Jan 07, 2023 8:41 am
Will try and get some proper instructions done (and stop cluttering you thread up with simulator details

)
I don't mind at all. Anything that can help me tune the inverter for the MGR is a good thing!
Re: Renault Clio Electrique -97
Posted: Sat Jan 07, 2023 11:26 am
by Pete9008
Looking good
Ud on the first plot looks fine.
I think the oscillation is when the controller goes past the critical current and the motor voltages start increasing rather than decreasing. On that basis -70A looks about right.
I'd should stay pretty stable during field weakening, it needs to stay close to the critical current, but to allow that Id has to drop as that is the only way left to control motor volts, so that looks fine. Also interesting to see the way Uq rises when you come off the throttle, exacltly what the maths predicts but nice to see it in real life too
Edit - it should be possible to maintain the power level going into FW though, agree it is worth adjusting lqminusld to see if it improves.
Edit2 - adjusting fluxlinkage may help here too.
Edit3 - whats also interesting is that it is Ud not Uq that is driving the field weakening. I need to have a play on the simulator to be sure but that could suggest that Lq is quite a bit bigger than Ld. If so then a good amount of the torque will be reluctance torque which you will lose if lqminusld is set too small. 4 might not be too big after all?
Re: Renault Clio Electrique -97
Posted: Sat Jan 07, 2023 2:14 pm
by johu
Agreed that constant power should be sort of close to the 27 kW you're getting before field weakening.
For some extra power you can also try the overmodulation version:
viewtopic.php?p=48964#p48964
Re: Renault Clio Electrique -97
Posted: Sat Jan 07, 2023 5:00 pm
by Pete9008
Just been doing instructions for the simulator so while it was all set up I decided to have a quick look at this, essentially I get exactly the powers you mention, 27kW dropping to 18kW and no matter how I tune the motor parameters the power drop is still there.
Having looked a bit more I think the problem is that FW is coming in when it's not required. FW helps when Uq is hitting the stops due to high motor speed, the simulations on your motor (and your plots) don't show that, instead it's Ud that is hitting the stops. Unfortunately the existing algorithm doesn't differentiate between the two so it tries to add FW when it needs to back off the throttle which actually makes things worse and causes the power drop.
I have had a play with an algorithm that differentiated between the two before but didn't get too far with it and at the time hadn't seen any evidence that it was a real problem. If you can't tune the power drop out let me know and I'll have another look.
BTW - I think flux linkage should probably be a bit higher, Icrit x Ld should ideally equal the flux linkage (70 x 2mH = 140mWb, or 70 x 3mH = 210mWb).
Re: Renault Clio Electrique -97
Posted: Sat Jan 07, 2023 6:32 pm
by bexander
I agree that the constant power should be close to the peak power.
It is very likely that my measurements of Ld, Lq and flux linkage are not trustworthy as it is very hard to lock the rotor of the MGR. I only locked the wheels and then all the gear reduction backlash is still there. When I just now read through the measurement guide again I relized that I probably made a mistake with the flux linkage measurement as well...
Will try to figure out a better way to do these measurements.
Re: Renault Clio Electrique -97
Posted: Sat Jan 07, 2023 6:41 pm
by Pete9008
Ld is pretty easy to measure as the motor will naturally rest aligned with one pole so just measure all three combinations of leads (one side of meter to one motor connection and the other side of the meter to the other two motor connections shorted together). The smallest measurement will be Ld and the other two should be larger and similar to each other and will be a bit smaller than Lq (see
https://openinverter.org/forum/viewtop ... p47050 . Flux linkage can be worked out from the plots, there is a link on how to do it at the start of the simulator thread now.
Re: Renault Clio Electrique -97
Posted: Sun Jan 08, 2023 8:16 am
by bexander
I don't have access to a LCR-meter as my other measurements where done using a voltage pulse and a home made current probe for the oscilloscope.
Might be time to buy one though. Any recommendations?
Re: Renault Clio Electrique -97
Posted: Sun Jan 08, 2023 8:40 am
by bexander
Pete9008 wrote: ↑Sat Jan 07, 2023 5:00 pm
BTW - I think flux linkage should probably be a bit higher, Icrit x Ld should ideally equal the flux linkage (70 x 2mH = 140mWb, or 70 x 3mH = 210mWb).
According to the calculation of the fluxlinkage with data from coast up test I get,
6800 * 32768 * 380 / (2 * pi * 65) = 0,193Weber
Close to your suggested 210mWb.
So a good idea might be to test with fluxlinkage set to 193 and lqminusld set to 4.
EDIT: Wrong, missed the /2 of the DC-voltage. Should be
6800 * 32768 * 380/2 / (2 * pi * 65) = 0,097Weber
Re: Renault Clio Electrique -97
Posted: Sun Jan 08, 2023 10:20 am
by Pete9008
bexander wrote: ↑Sun Jan 08, 2023 8:16 am
I don't have access to a LCR-meter as my other measurements where done using a voltage pulse and a home made current probe for the oscilloscope.
Might be time to buy one though. Any recommendations?
Depends what you would like to use it for, if it is just for measuring the motor then any of the cheap ones should be ok (both Ev8 and Bigpie have detailed the ones that they used in the simulator thread). If you do any electronic work then a slightly better one may be worthwhile.
The current probe technique should be fine if you have the kit for it, in fact due to the higher currents it is probably a bit more representative. I'm guessing it might need the motor shaft locking accurately to get a good value for Lq (as the higher currents might start to move the rotor which would invalidate the result).
bexander wrote: ↑Sun Jan 08, 2023 8:40 am
According to the calculation of the fluxlinkage with data from coast up test I get,
6800 * 32768 * 380 / (2 * pi * 65) = 0,193Weber
Close to your suggested 210mWb.
So a good idea might be to test with fluxlinkage set to 193 and lqminusld set to 4.
EDIT: Wrong, missed the /2 of the DC-voltage. Should be
6800 * 32768 * 380/2 / (2 * pi * 65) = 0,097Weber
I'm wondering whether it is possible to calculate Ld and Lq from your plots too. What's needed is a step change in throttle below FW, from the change in Iq and Id and the corresponding change in Vd and Vq it should be possible to work them out. There is a bit towards the end of one plot that might do so Ill try to have a look later today.