Page 1 of 1

Speed dependent throttle curve

Posted: Mon Jul 11, 2022 6:28 pm
by catphish
After driving a car with openinverter, one thing I didn't love was the throttle deadzone reserved for regen. I wondered if it would be good at have a throttle map that behaved more like an ICE, with the full throttle travel being usable at all times, and regen being relative to speed.

I therefore propose this patch (not as a complete replacement as I've written it, but as a selectable option).
https://github.com/catphish/stm32-sine/ ... 67e2984c1a

What this does is fairly simple:
* At 0 RPM, there is no regen. The throttle is mapped as 0-100% forward. For example 1% throttle means 1% acceleration.
* At the speed defined by "brkrampstr / regenrampstr", the throttle is remapped so that zero throttle is full regen (brkmax / offthrotregen) and 100% throttle is still 100% acceleration.
* Between those two points, there is a linear ramp, so at 50% of brkrampstr speed, you get 50% of brkmax regen.

The benefit is no throttle deadzone when stationary, and hopefully a more natural feel. The disadvantage is that there will be a lot less regen / braking at low speed.

I've only tested this on the bench so far, but wondered if people were interested in the concept. The other possibility here would be the ability to load a full table, but openinverter doesn't really have a place to put maps for now. The CalcThrottle function takes a throttle and a rpm input, and gives a torque output, so there are plenty of possibilities here.

Re: Speed dependent throttle curve

Posted: Mon Jul 11, 2022 8:14 pm
by tom91
I do a very similar thing in my control of the outlander motor it works perfect and mimics an OEM feel.

I have actually taken it a little further, the first couple of 100 rpm there is no regen at all, but this should be tuned.

This is also very nice as a decent control, so you rolling down a hill and it decelerates to a constant speed and keeps the car there.

Re: Speed dependent throttle curve

Posted: Mon Jul 11, 2022 8:26 pm
by remy_martian
Isn't the pedal position a torque/motor_current command to where excess torque automatically produces regen as the natural order of the universe as prescribed by Michael Faraday? Throttle closed is a zero torque command which should be max regen (braking torque decays) all the way to zero vehicle speed.

I guess I don't understand what "throttle deadband" means. You should simply command 0-100% torque from the traction drive motor...the rest is up to the vehicle, motor, inertia, and gravity as far as whether any regen occurs. The amount of regen is modulated by the throttle position in one pedal driving. Zero throttle is max regen.

I'm missing something conceptually if there's a deadband or hysteresis in commanded torque by the throttle pedal to the inverter.

Re: Speed dependent throttle curve

Posted: Mon Jul 11, 2022 8:31 pm
by catphish
remy_martian wrote: Mon Jul 11, 2022 8:26 pm Isn't the pedal position a torque/motor_current command to where excess torque automatically produces regen as the natural order of the universe as prescribed by Michael Faraday? Throttle closed is a zero torque command which should be max regen (braking torque decays) all the way to zero vehicle speed.

I guess I don't understand what "throttle deadband" means. You should simply command 0-100% torque from the traction drive motor...the rest is up to the vehicle, motor, inertia, and gravity as far as whether any regen occurs. The amount of regen is modulated by the throttle position in one pedal driving. Zero throttle is max regen.
Zero torque means no acceleration, and no regen. If you want regen, you have to send a request for *negative* torque. For this reason, Openinverter maps the throttle to a range like -30 to +100. If you're stationary, the part between -30 and 0 doesn't do anything.

If you just commanded 0% to 100%, you'd never have any regen.

Re: Speed dependent throttle curve

Posted: Mon Jul 11, 2022 8:41 pm
by catphish
remy_martian wrote: Mon Jul 11, 2022 8:26 pm You should simply command 0-100% torque from the traction drive motor...the rest is up to the vehicle, motor, inertia, and gravity as far as whether any regen occurs. The amount of regen is modulated by the throttle position in one pedal driving. Zero throttle is max regen.
The reason this isn't true is that regen it's the result of natural forces, it's a deliberate negative acceleration by the inverter. The goal of my code is actually to create something more like what you're describing, to mimic the feel of "engine braking" so the braking force increases as speed increases.

Re: Speed dependent throttle curve

Posted: Tue Jul 12, 2022 4:22 am
by remy_martian
catphish wrote: Mon Jul 11, 2022 8:31 pm
remy_martian wrote: Mon Jul 11, 2022 8:26 pm Isn't the pedal position a torque/motor_current command to where excess torque automatically produces regen as the natural order of the universe as prescribed by Michael Faraday? Throttle closed is a zero torque command which should be max regen (braking torque decays) all the way to zero vehicle speed.

I guess I don't understand what "throttle deadband" means. You should simply command 0-100% torque from the traction drive motor...the rest is up to the vehicle, motor, inertia, and gravity as far as whether any regen occurs. The amount of regen is modulated by the throttle position in one pedal driving. Zero throttle is max regen.
Zero torque means no acceleration, and no regen. If you want regen, you have to send a request for *negative* torque. For this reason, Openinverter maps the throttle to a range like -30 to +100. If you're stationary, the part between -30 and 0 doesn't do anything.

If you just commanded 0% to 100%, you'd never have any regen.
ick

I now see what you're talking about - it's a virtual brake pedal, not one pedal driving like on my production car.

Re: Speed dependent throttle curve

Posted: Tue Jul 12, 2022 4:35 am
by remy_martian
catphish wrote: Mon Jul 11, 2022 8:41 pm
remy_martian wrote: Mon Jul 11, 2022 8:26 pm You should simply command 0-100% torque from the traction drive motor...the rest is up to the vehicle, motor, inertia, and gravity as far as whether any regen occurs. The amount of regen is modulated by the throttle position in one pedal driving. Zero throttle is max regen.
The reason this isn't true is that regen it's the result of natural forces, it's a deliberate negative acceleration by the inverter. The goal of my code is actually to create something more like what you're describing, to mimic the feel of "engine braking" so the braking force increases as speed increases.
I submit you don't need to set a constant at which speed you turn on regen, but rather can map "brkrampstr / regenrampstr" to being a variable that is a function of either vehicle/motor speed or is pulled from a lookup table with speed as the address. From there you linear interpolate to closed throttle being max regen, continuously until you're stopped. Blip the throttle and you're merely adding in some torque to the regen braking to reduce regen. Balancing regen and added torque holds speed. Go down a hill, it starts to regen on its own, minimally initially unless the speed increases significantly beyond the mapped speed or the throttle starts being closed.

I'm up to my eyeballs trying to build my inverter output driver stage right now, and plan to use the OI controller (Johannes is likely at the casino spending the money from my second board order 😂), so am interested in going beyond this "it's a brake pedal below 30% WOT" stuff.

Re: Speed dependent throttle curve

Posted: Tue Jul 12, 2022 4:53 am
by remy_martian
Some good material in this dissertation (I am starting at zero knowledge in this area):

https://publikationen.bibliothek.kit.ed ... 41/6717029

Re: Speed dependent throttle curve

Posted: Tue Jul 12, 2022 4:58 am
by remy_martian

Re: Speed dependent throttle curve

Posted: Tue Jul 12, 2022 8:13 am
by tom91
remy_martian wrote: Tue Jul 12, 2022 4:58 am Take a look at Table 1 here:

https://link.springer.com/content/pdf/1 ... 0546-x.pdf

🤓
Look at Fig 5, the figure that actually includes vehicle speed/motor speed. You notice how they taper the deceleration for all pedal positions to 0 m/s2 for speeds aproaching 0 km/h?

Re: Speed dependent throttle curve

Posted: Tue Jul 12, 2022 8:34 am
by Bigpie
tom91 wrote: Mon Jul 11, 2022 8:14 pm I do a very similar thing in my control of the outlander motor it works perfect and mimics an OEM feel.
What vehicle do you have the outlander motor in?

Re: Speed dependent throttle curve

Posted: Tue Jul 12, 2022 8:39 am
by tom91
Bigpie wrote: Tue Jul 12, 2022 8:34 am
tom91 wrote: Mon Jul 11, 2022 8:14 pm I do a very similar thing in my control of the outlander motor it works perfect and mimics an OEM feel.
What vehicle do you have the outlander motor in?
At the moment a classic mini, soon will have one in a Gen 2 new mini. The vehicle used does not really have any impact on this topic.

Re: Speed dependent throttle curve

Posted: Tue Jul 12, 2022 9:45 am
by johu
Alright, so besides ramping down "offthrotregen" starting at "regenrampstr" we'd also ramp down "regentravel"

Re: Speed dependent throttle curve

Posted: Tue Jul 12, 2022 10:09 am
by catphish
johu wrote: Tue Jul 12, 2022 9:45 am Alright, so besides ramping down "offthrotregen" starting at "regenrampstr" we'd also ramp down "regentravel"
Yes, that's good description of what this does. Another way to implement it might be to actually dynamically modify regentravel. I'm not sure whether this would result in the same curve or not.