regen tuning process!  [SOLVED]

Nissan Leaf/e-NV200 drive stack topics
Post Reply
User avatar
janosch
Posts: 306
Joined: Tue Jun 30, 2020 9:23 am
Location: London, UK
Has thanked: 67 times
Been thanked: 54 times
Contact:

regen tuning process!

Post by janosch »

Hello,

this should be easy to answer for someone who has done it. We have a Leaf drivetrain on a RWD vehicle with 5.06.R-foc software. I just went to a car park to try various settings.
  • My idea: Set it super aggressive -> then work backwards from there till it is pleasant
  • Primary goal: range
  • Secondary goal: smoothness
1) How can I create visibility of what is actually happening in a plot?
I tried plotting il1, il2, idc and expected negative values for idc at least but couldn't really spot it when braking from low speeds, is there a variable that will help? scaledBrkMax from throttle.cpp would be interesting I think, but it isn't a param. I could expose it as a param and plot I suppose.

2) Do I need to save to flash & fully turn inverter off between every param change for them to take effect? (I saw it can't be done in run-mode, makes sense).

3) BrkRampStr in Hz <-- What is 1 Hz here? Is it one motor revolution, or one magnetic field revolution (so 4x per physical rotation). I didn't go faster than 20mph/32kmh, gearbox reduction is pretty close to 8:1, wheel diameter 66cm so in 1s @ 20mph I drive 8.9m, 8.9 / 2.07 are 4.3 wheel revolutions. 4.3 * 8 = 34.4 Hz if it is the motor revolution or 137Hz for the field. brkrampstr felt the same at 10Hz and 30Hz.

Below the two sets of params that I tried, but I struggled to feel a difference really.

Thanks for any hints!

calm settings
calm_settings.png
more aggressive settings
more_aggr_settings.png
P.S: I had a look at the tuning guide here before I went out: https://openinverter.org/wiki/Parameters#Tuning_Guide
But it appears the parameters there are more throttle related and for SIN rather than FOC.
User avatar
janosch
Posts: 306
Joined: Tue Jun 30, 2020 9:23 am
Location: London, UK
Has thanked: 67 times
Been thanked: 54 times
Contact:

Re: regen tuning process?

Post by janosch »

I am controlling via CAN, just saw this post:
viewtopic.php?p=33532#p33532
Are you sending anything to pot2? If so, pot2 will scale your regen as well. Check pot2min and pot2max
Is this relevant for CAN control? pot2min, pot2max sit at 4095
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: regen tuning process?

Post by johu »

1. Plotting potnom will show the regen command, in percent of 100*throtcur. Idc should indeed be negative, at least at higher speed.
2. Changes take effect instantly. You only need to stop the inverter to save to flash (which stalls the processor and is therefore not allowed in run mode)
3. Refers to electrical turns

CAN only differs in data sourcing, not processing
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
janosch
Posts: 306
Joined: Tue Jun 30, 2020 9:23 am
Location: London, UK
Has thanked: 67 times
Been thanked: 54 times
Contact:

Re: regen tuning process?

Post by janosch »

It only brakes at ~1kW.
I would have expected it to be more like 10kW with aggressive settings, right?

pot2 sits at 0. I set pot2min = pot2max = 0 for the trials just then, I could try -1 I suppose, haven't looked at the code yet if that would force it to 100%.

Noteworthy: I averaged the brake signal over 100ms in code to make sure there is no oscillation between 1 and 0, thats why din_brake comes up a bit later. Still I would have expected idc to dip a lot further afterwards. It just coasts till the friction brakes catch.

acceleration & brake test
regen_when_braking.png
most aggressive settings I tested
most_aggressive_settings.png
List of all options below. Sorry it is in a screenshot.
Attachments
Screenshot 2021-12-21 at 13-07-13 Huebner Inverter Management Console.png
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: regen tuning process?  [SOLVED]

Post by johu »

In some version there was indeed an issue with pot2. Try setting both to 0. Indeed potnom never seems to go below 0, so no regen
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
janosch
Posts: 306
Joined: Tue Jun 30, 2020 9:23 am
Location: London, UK
Has thanked: 67 times
Been thanked: 54 times
Contact:

Re: regen tuning process?

Post by janosch »

johu wrote: ↑Tue Dec 21, 2021 4:17 pm In some version there was indeed an issue with pot2. Try setting both to 0. Indeed potnom never seems to go below 0, so no regen
I had both at 0 earlier. Let me update firmware and see if that alleviates the issue.


Edit:
Software update to 5.14-FOC makes potnom go negative!

Going to a car park now to try it.
Screenshot from 2021-12-21 16-55-14.png
Edit Edit:
There she is! 5.06r-FOC had the pot issue.
Screenshot from 2021-12-21 17-10-42.png
To summarise regen braking setup:

prerequisites for regen when coasting & brake pedal:
  • check din_brake shows up correctly when pedal depressed
  • observe params here: https://openinverter.org/wiki/Parameters and in the param database
  • potnom and idc go negative when regen is active
  • pot2min, pot2max need to be set correctly
  • 5.06R-FOC seems to not let potnom go negative, update if on that version
  • a plot of potnom, idc and din_brake will help you debugging (erroneous and correct plots in my posts above)
Further reading: https://openinverter.org/forum/viewtopic.php?f=7&t=2172

Thanks Johannes!
User avatar
Renegate2020
Posts: 50
Joined: Tue Dec 01, 2020 6:20 am
Location: Odessa UA
Has thanked: 1 time
Contact:

Re: regen tuning process!

Post by Renegate2020 »

If you do not mind, I will try to find out here - is it possible to regulate the regeneration on the fly? For example, by installing a push-button or rotary knob.
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: regen tuning process!

Post by johu »

Yes, by connecting it to the pot2 input.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
Renegate2020
Posts: 50
Joined: Tue Dec 01, 2020 6:20 am
Location: Odessa UA
Has thanked: 1 time
Contact:

Re: regen tuning process!

Post by Renegate2020 »

Super!!!
glink
Posts: 18
Joined: Mon Mar 15, 2021 7:02 pm
Been thanked: 3 times

Re: regen tuning process!

Post by glink »

Hi, tried to wrap my head around the regen setup when testing out on the bench with a "dyno" setup with two em57's against eachother. I want to control the regen with CAN, but I see very different behaviour when regen is controlled by CAN vs when I "set" potnom using offthrotregen. Potnom should behave the same in both scenarios, right?

Using v5.24R-FOC and 48v battery.

If I have these settings on the "generator" side...
pot2min=pot2max=4095
regentravel=30
offthrotregen=-25
throtcur=10
pot=0
pot2=0
potnom is then set to around -25
...and things runs smooth and I'm able to easily pump 120 amps from the "driving" side and IDC on "generator" side is around -65 amps (Sounds little imo, so power have to dissipate somewhere more than it should...)

However, if I have these settings for adjusting regen from CAN...
pot2min=0
pot2max=4095
regentravel=30
offthrotregen=-25
throtcur=10
pot=0
pot2=Adjusted by CAN from 0 to 4095 resulting in relative movement of potnom as expected
potnom is not even close to -25 before the "driving" side is put to a halt (with the same pot on "driving" side as previous)
and IDC never over -20. Also, I don't understand why offthrotregen and regentravel has to be set to allow to adjust regen on pot2 via CAN. If they are not set, potnom is always 0. I'm using CAN for potmode, think that is the correct one.

Ideas anyone?
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: regen tuning process!

Post by johu »

Settings seem correct but I didn't quite understand the problem. With pot2 configured you get more braking force but less current?
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
glink
Posts: 18
Joined: Mon Mar 15, 2021 7:02 pm
Been thanked: 3 times

Re: regen tuning process!

Post by glink »

Thanks, had a look at the code to understand the algorithm, and undrestand now the relationships :-)
My problem was that having -25 potnom on the generator side worked fine from 0 RPM and up at given motor side Pot, but not going from 0 potnom to -25 potnom on the generator side wit same Pot on motor side. But this can be due to some wrong settings in my rig.
Post Reply