suggestions for the next release 5.17 -> 5.18

LeonB
Posts: 55
Joined: Fri Mar 26, 2021 12:19 am
Location: Germany

Re: suggestions for the next release 5.17 -> 5.18

Post by LeonB »

johu wrote: Fri May 27, 2022 7:50 am What had you set syncadv to?
Syncadv was set to 10.

As the FW controller only adds additional Id while keeping the total current constant, one should be able to simulate it by increasing idiqsplit at higher speeds? I have tried that several times with various values, but never came close to the power of the “real” FW.
User avatar
johu
Site Admin
Posts: 5682
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 960 times
Contact:

Re: suggestions for the next release 5.17 -> 5.18

Post by johu »

FW is just always there regardless of throttle position. That what makes it so dangerous when having offset between real and measured rotor position. Then part of the FW current becomes torque producing.

EDIT: oh that is not even true. This part is bound to go wrong

Code: Select all

sqrt(is * is - id * id)
"is" is commanded total current. If that is smaller than FW current the sum inside the square root will be negative! Uh, how do we fix that?

EDIT2: just thought about this further. It cannot becomes negative in the actual sense but it will become a very large positive number. So it dumped out the maximum possible iq command. That's why it must have been so exciting!
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
johu
Site Admin
Posts: 5682
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 960 times
Contact:

Re: suggestions for the next release 5.17 -> 5.18

Post by johu »

So that should be out of the way

Code: Select all

   float id = idiqSplit * is / 100.0f;
   id = -ABS(id) + fwRequest;
   id = MAX(id, -100 * throtcur); //Limit id to 100% throttle. MAX function because negative
   is += -fwRequest; //fwRequest is always negative
   is = MIN(is, 100 * throtcur);
   s32fp iq = SIGN(torquePercent) * fp_sqrt(FP_FROMFLT(is * is) - FP_FROMFLT(id * id));
So fwRequest is added to the original throttle request and then id vector-subtracted from that to arrive at iq. Still total current is limited to throtcur@100%.

I also added SW ocurlim. So when software measures il1 or il2 > ocurlim it will shut down
Attachments
stm32_foc.bin
(47.57 KiB) Downloaded 52 times
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
Romale
Posts: 441
Joined: Fri May 20, 2022 4:16 pm
Location: Romania
Has thanked: 204 times
Been thanked: 45 times

Re: suggestions for the next release 5.17 -> 5.18

Post by Romale »


here is the behavior of switching on the neutral with firmware 5.17.R foc

Hi. Does it make sense for me to test FW at a low voltage (120 volts)? or is it reasonable to do this only with a full voltage of 360 volts?
evil neodymium :twisted:
LeonB
Posts: 55
Joined: Fri Mar 26, 2021 12:19 am
Location: Germany

Re: suggestions for the next release 5.17 -> 5.18

Post by LeonB »

Thanks for the quick update.
johu wrote: Fri May 27, 2022 2:41 pm So it dumped out the maximum possible iq command. That's why it must have been so exciting!
Below is the plot recorded during self-acceleration due to FW. ud is maxed out but uq is not. It rather looks like it has a new minimum value that it can’t fall below.
newFW.png
johu wrote: Fri May 27, 2022 3:17 pm I also added SW ocurlim. So when software measures il1 or il2 > ocurlim it will shut down
This change is not on github yet, is it? Sometimes during those strong regenerative braking incidents, id shoots up to some crazy value (>10000) for a split second. I am afraid that this is due to a faulty readout from the current sensors and thus, maybe il1 or il2 are also at some high value. If the inverter shuts down at such a moment, this would put me in full regenerative breaking at high rpm, wouldn't it? That’s something I do not want to test ;).
User avatar
johu
Site Admin
Posts: 5682
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 960 times
Contact:

Re: suggestions for the next release 5.17 -> 5.18

Post by johu »

Romale wrote: Fri May 27, 2022 3:25 pm here is the behavior of switching on the neutral with firmware 5.17.R foc

Hi. Does it make sense for me to test FW at a low voltage (120 volts)? or is it reasonable to do this only with a full voltage of 360 volts?
Oh wow, that is brutal. Yes any test voltage is fine.
LeonB wrote: Fri May 27, 2022 4:10 pm Below is the plot recorded during self-acceleration due to FW. ud is maxed out but uq is not. It rather looks like it has a new minimum value that it can’t fall below.
Thanks for the plot. I'm assuming it's with the last firmware 5.23.B?
Is self-acceleration less pronounced now?
Yes if FW collapses you get a short burst of strong regen until motor speed drops to generate less than battery voltage.

Pushed it to github now
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
EV_Builder
Posts: 1199
Joined: Tue Apr 28, 2020 3:50 pm
Location: The Netherlands
Has thanked: 16 times
Been thanked: 33 times
Contact:

Re: suggestions for the next release 5.17 -> 5.18

Post by EV_Builder »

May I suggest we first test our models in a stm32 environment with simulated values and we plot the outcome? In that way we can check the behavior of the math. Also I would think that the outcome of what ever PID loop we have is capped by some parameters maximums?
During tuning/ testing I would love to see graphs from the values/parameters.
Converting an Porsche Panamera
see http://www.wdrautomatisering.nl for bespoke BMS modules.
User avatar
johu
Site Admin
Posts: 5682
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 960 times
Contact:

Re: suggestions for the next release 5.17 -> 5.18

Post by johu »

I did test some parts of the code independently from the rest.
Now I'm just struggling to think of a practical method to do a pure SIL test. We'd basically need to model the power stage (probably easy) and the motor (probably hard). Not yet committed to that route but of course anyone is invited to go ahead on that one.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
EV_Builder
Posts: 1199
Joined: Tue Apr 28, 2020 3:50 pm
Location: The Netherlands
Has thanked: 16 times
Been thanked: 33 times
Contact:

Re: suggestions for the next release 5.17 -> 5.18

Post by EV_Builder »

No I think you need to define with parameters what the boundaries are for each control loop. Further i think that the current measurement needs tobe checked/logged because imagine that one jumping around.

One of the ways I used to check RealTime systems is by logging a second on command and grabbing that data and check it afterwards.
So making a "freeze frame" or logger is quite elementary (Dump it on the CANBus?!?)

If loops are stacked on each other normally the motor is ran with only the first loop. And then we add the second etc.
For example first only IQ loop and then speed loop and then position loop.
The IQ loop should be possible to check and tune with the wheels up in the air.

This somewhat the approach I would do it.
Converting an Porsche Panamera
see http://www.wdrautomatisering.nl for bespoke BMS modules.
LeonB
Posts: 55
Joined: Fri Mar 26, 2021 12:19 am
Location: Germany

Re: suggestions for the next release 5.17 -> 5.18

Post by LeonB »

johu wrote: Fri May 27, 2022 4:51 pm Thanks for the plot. I'm assuming it's with the last firmware 5.23.B?
I don’t know the version number, but it was the firmware before the sqrt fix.

I just tried the newest firmware with the fix. First I wanted to optimize syncofs and syncadv: I started with syncadv = 0. I accelerated normally to various rpms and then switched to idiqsplit = 100. Then I tuned syncofs so that I could push down the gas pedal without creating any torque. This gave me some values from which I calculated syncofs at 0rpm and a suitable syncadv. I ended up with syncadv=3. It’s a bit tricky to maintain constant rpm but in the end it worked quite well, at least for throtcur=1. Going above that led to a very quick acceleration at some critical id value >100A, resulting in a software overcurrent error (that also works ;)). So I remained at throtcur=1 for the rest of the test.

While doing this I noted that at 100% throttle, the uq amplitude seems to be capped just above 10000. When letting go off the throttle it is able to reach higher values. This was with fkwp=fwki=0 and qmargin = 3000:
FW2.png
I then tested with fwkp=10. There was no uncontrollable acceleration but also no other effect. Ifw reached a maximum value of 1 and oscillated. Below are the plots for fwkp=40. This created some rattle and noise (as can be expected from the id and iq currents oscillating with >100A amplitude). After letting go off the gas pedal, the oscillations stopped but there was some weak self-acceleration. What only came to my mind after the test drive is that ud was nearly maxed out before FW kicked in. Thus, it had a hard time to add even more id. I will try again with lower idiqsplit.
FW1.png
User avatar
johu
Site Admin
Posts: 5682
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 960 times
Contact:

Re: suggestions for the next release 5.17 -> 5.18

Post by johu »

Actually that looks pretty promising. Good work finding the matching syncadv. Actually 3 is quite close to my earlier uttered theory comparing the age of id/iq and angle. Now the FW controller needs more gain because it hardly seems to do anything.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
LeonB
Posts: 55
Joined: Fri Mar 26, 2021 12:19 am
Location: Germany

Re: suggestions for the next release 5.17 -> 5.18

Post by LeonB »

I tried again with idiqsplit down to 20% and fwkp up to 400. There is no change in the behavior, ifw still maxes out at 4 and everything is oscillating heavily. fwki=0 for all tests, as even in standstill any value above 0 causes some rattling in the motor. Below are examples with fwkp=100 and fwkp=400. Notice that I have a quite high curkp, so even without FW there is some oscillation of the PI output values, id and iq. I have spent quite some time trying to get curkp lower, but there are always unwanted effects (self-acceleration, torque oscillations, ..) associated with that.
FW3.png
Again, throtcur=1 was used. I then tried to tune syncadv for bigger currents, but it seems impossible. I went along a small decline with the handbrake at just the right position to keep at constant rpm. Then I changed syncofs in a range of 2000 with 100- and 50-digit steps around the suspected value-> I could not find a value where the motor would not start accelerating in the region of id~150A.
User avatar
johu
Site Admin
Posts: 5682
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 960 times
Contact:

Re: suggestions for the next release 5.17 -> 5.18

Post by johu »

Oh, ifw display has a bug but the actual value should be correct. Tripped over my own fixed point math wire... So when you see 4 it is actually 4*32
Now see what happens at lower kp values, hopefully oscillation goes away

Fixed.
Attachments
stm32_foc.bin
(47.57 KiB) Downloaded 77 times
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
johu
Site Admin
Posts: 5682
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 960 times
Contact:

Re: suggestions for the next release 5.17 -> 5.18

Post by johu »

Now tested myself and I have to say it's quite useless. I turned off FW by setting both gains to 0 and I still got self acceleration.
Also went back to legacy FW with just the amplitude limit only to find that it doesn't actually make a whole lot of difference. Shortly before reaching max amplitude there is still a wiggle. If curkp is too low (32) this wiggle becomes so strong that it trips on overcurrent. Once I've "punched through" it the wiggle is gone and everything is smooth again.
Attachments
canvas.png
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
LeonB
Posts: 55
Joined: Fri Mar 26, 2021 12:19 am
Location: Germany

Re: suggestions for the next release 5.17 -> 5.18

Post by LeonB »

Yes, I can confirm that there is basically no effect. Whenever FW kicks into action, ud gets or is already maxed out. So even when switching fwkp around, between values of 0, 10 and 20, there is no difference noticeable. Only when getting to fkwp=30 (where ifw~120A), the rattle and oscillations start again.

As a side note: If I got this right, the new FW algorithm tries to change the angle of the id-iq vector towards the id-axis to create more id current while keeping the total current constant. Isn’t that rotation equivalent to a rotation of the measured rotor position? I tried to tune syncadv with FW disabled and it makes a strong difference, the motor accepts 3 times the power at syncadv=35 compared to syncadv=3. Of course, syncadv is coupled to frequency and not uq and this is probably what makes it unstable at higher rpms. But maybe one could botch a FW algorithm which changes syncofs depending on uq amplitude?
Dusty4
Posts: 83
Joined: Tue Dec 25, 2018 12:41 pm
Location: Western Australia
Has thanked: 11 times
Been thanked: 7 times

Re: suggestions for the next release 5.17 -> 5.18

Post by Dusty4 »

Went to do some testing today, turn on ignition and no wifi... I removed plastic sealing plate around the LV plug and spotted the wifi module in the bottom 😔. Looks like I'm splitting the inverter next weekend and making sure I glue it in place 😂. No new firmware testing for me 😔 sorry guys.
Attachments
PXL_20220529_060308959.jpg
LeonB
Posts: 55
Joined: Fri Mar 26, 2021 12:19 am
Location: Germany

Re: suggestions for the next release 5.17 -> 5.18

Post by LeonB »

Thinking about my previous tests, I guess that it would have been best to use idiqsplit=0 to test the FW. Because id is only used for field weaking, it makes sense to leave it completely to the FW-controller and just define iq with the gas pedal. However, when I use idiqsplit=0, ud already maxes out trying to keep id=0. uq maxes out as well. Thus, FW again has no effect. As I am not 100% confident that there may not be a problem with my setup, maybe someone other could try this as well?
User avatar
johu
Site Admin
Posts: 5682
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 960 times
Contact:

Re: suggestions for the next release 5.17 -> 5.18

Post by johu »

Id also produces torque (called reluctance torque) on IPM motors and it is quite significant

Also I figured because of the vector subtraction 50% doesn't result in 50% id
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
Romale
Posts: 441
Joined: Fri May 20, 2022 4:16 pm
Location: Romania
Has thanked: 204 times
Been thanked: 45 times

Re: suggestions for the next release 5.17 -> 5.18

Post by Romale »

in general, I tried a lot of different settings yesterday and today. always regen is furious only if I release the gas pedal even a little. the feeling that the controller is trying to dramatically slow down the speed so that it corresponds to the new position of the throttle. I removed almost all the regen settings, and made the permissible regen current no more than 50 amps. but with a slight release of the gas pedal, I still get a sharp blow to the drives to lower the current speed and bring it in line with the new position of the accelerator pedal
evil neodymium :twisted:
User avatar
Romale
Posts: 441
Joined: Fri May 20, 2022 4:16 pm
Location: Romania
Has thanked: 204 times
Been thanked: 45 times

Re: suggestions for the next release 5.17 -> 5.18

Post by Romale »

I think it remains just to understand which field of settings affects this action. if you make sure that lowering the throttle position does not lead to an instant attempt to lower the speed of movement, but allows you to roll or regenerate according to the incoming requirements of the brake and gas pedal, then the terrible unpredictable regen will disappear forever. by the way, at any syncadv below 10, I got terrible behavior with blows during acceleration, and only when I reached the value of 13 I was able to keep exactly any speed, except in cases of braking.
evil neodymium :twisted:
Post Reply