Suggested Idle Improvements

It's all about the code!
Post Reply
stefanst
contributor
contributor
Posts: 703
Joined: Wed Feb 17, 2016 12:24 am
Location: USA 08530

Suggested Idle Improvements

Post by stefanst »

Quick summary:

We currently have two idle modes- manual and automatic. Manual is "pick a value and leave it". Automatic employs an adjustable PID strategy.

For most modern-ish street-driven cars, automatic will be needed. The implementation has improved considerably over the last few months. But there are still some quirks that need help.

Mission statement: Idle, even on a small engine with multiple different variable load factors, should be OEM quality or better.
And we're much better now than we were a few months back, but we're not quite there yet.
My biggest problem currently is the I-wind-down that happens every time we enter idle from a higher rpm. This happens, because we're entering idle-PID when the engine state is nowhere near stable. So the rpm is much higher than it ought to be and the PID is trying to fight this initial condition, which it really can't.

My proposal is that we only enter PID, when the dRPM/dt value is fairly small, but negative. .

This will require another parameter, maybe two for min/max dRPM/dt. Until this condition is satisfied, the IAC should be at offset. Offset should be chosen, so rpm is slightly above idle target under all operating conditions. In a perfect world, this would also entail a table for offset/CLT, since we have the same thing for target RPM/CLT.
With this we achieve that we only enter PID control when engine operation has stabilized to some degree. It would *appear* that my stock ECU follows a similar strategy. RPMs drop after letting go of throttle, or pushing clutch. They briefly stabilize at a level above target-rpm. Then RPMs slowly drift towards target.

In addition, it would be nice to only enter PID idle when the engine is separated from the drivetrain (at least for a manual transmission car). For this we usually have a clutch/neutral switch.

So conditions for entering idle PID:
- TPS below threshold value
- Engine separated from drivetrain
- dRPM/dt smaller than threshold value. Actually it should be greater, since RPM is dropping, so we have a negative dRPM/dt ( 0 (or max threshold) > dRPM/dt > min threshold)
Attachments
2020-07-06_21.01.02.zip
Log showing reaction to throttle blips
(45.49 KiB) Downloaded 267 times
JPh
Posts: 163
Joined: Wed Jan 01, 2020 10:51 am

Re: Suggested Idle Improvements

Post by JPh »

Don't you think that the I related step down is due to the rpm limit of idle control bugged?

If you start idle control with all parameters in initial state at a rpm just above the idle limit, it should behave much better.
User avatar
AndreyB
Site Admin
Posts: 14323
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: Suggested Idle Improvements

Post by AndreyB »

@andreika reminds about "alternator_antiwindupFreq/alternator_derivativeFilterLoss"
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
User avatar
AndreyB
Site Admin
Posts: 14323
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: Suggested Idle Improvements

Post by AndreyB »

https://github.com/rusefi/rusefi/blob/master/firmware/util/math/pid.cpp

Just added same for idle PID
image.png
image.png (71.04 KiB) Viewed 6037 times
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
stefanst
contributor
contributor
Posts: 703
Joined: Wed Feb 17, 2016 12:24 am
Location: USA 08530

Re: Suggested Idle Improvements

Post by stefanst »

Re-stating the I-wind-down issue:

Pre conditions:
- Automatic idle mode is selected. P, I and D are tuned so that idle can handle all possible external loads with reasonable recovery time, but without oscillation

What happens
Car is in neutral, I am holding the throttle pedal, rpm is 2000rpm. Auto-idle is disengaged
-> Let go of the throttle pedal
-> TPS reads "0" and the ECU enters Automatic Idle Mode and tries to control idle
-> Since current_rpm >> target_rpm P-term goes into far negative territory, which is OK. But I-term also goes into negative saturation, because the error is very large
-> rpm drops precipitously since the IAC is at minimum value and throttle is closed
-> rpm drops far below target rpm and sometimes stalls because I-term is still far negative because when near target, it recovers slowly

The log attached to the first post shows what happens. Look at rpm, idle_air_valve, I-term and TPS. Minimum for I-term is -6, offset is 45 I believe and absolute mnimum is 38. Without the minimums for I-term or absolute value, the engine will stall every time.

Failed approaches:
- Tune P-I-D differently. I probably spent 10 hours total idling my car playing with response time, P, I, D, I can't say for certain that the problem is impossible to solve with JUST the right combination of these factors, but I am unable to do it and will not try again. Enough time wasted
- Tune minimums for total value, offset value and minimum for I-term. While this approach helps, there is no combination of these values that allows the engine to reach target rpm under all possible conditions, but will not allow severe idle droop or stall under a different set of conditions
- I am quite certain, I also tried a few dozen other things as suggested by others either in the forum or on slack, alas without success

In my opinion, the best way to deal with this is to only enter auto-idle when rpms have already stabilized to some degree. Trying to control idle while rpms are falling precipitously after releasing the throttle, is always going to fail.
mck1117
running engine in first post
running engine in first post
Posts: 1494
Joined: Mon Jan 30, 2017 2:05 am
Location: Seattle-ish

Re: Suggested Idle Improvements

Post by mck1117 »

stefanst wrote:
Fri Jul 10, 2020 7:05 pm

-> TPS reads "0" and the ECU enters Automatic Idle Mode and tries to control idle
-> Since current_rpm >> target_rpm P-term goes into far negative territory, which is OK. But I-term also goes into negative saturation, because the error is very large
Why does automatic idle not gate on RPM being near the target? IMO that would completely solve this problem. Only enable automatic when we're already closeish.
porelmundo
contributor
contributor
Posts: 87
Joined: Tue Apr 26, 2016 1:15 am

Re: Suggested Idle Improvements

Post by porelmundo »

Same situation that i have today, spend time making it work but all conditions mentioned in this post are my same results.
mk e
Posts: 486
Joined: Tue Dec 06, 2016 7:32 pm

Re: Suggested Idle Improvements

Post by mk e »

mck1117 wrote:
Fri Jul 10, 2020 7:22 pm
stefanst wrote:
Fri Jul 10, 2020 7:05 pm

-> TPS reads "0" and the ECU enters Automatic Idle Mode and tries to control idle
-> Since current_rpm >> target_rpm P-term goes into far negative territory, which is OK. But I-term also goes into negative saturation, because the error is very large
Why does automatic idle not gate on RPM being near the target? IMO that would completely solve this problem. Only enable automatic when we're already closeish.
Yes if you can stop the PID from running or set an integral value hold or reset the values.

What is often the simplest for this is a minimum position for throttle or IAC. You let the engine warm up, and set the throttle or IAC minimum position to about 25-50 rpm below tartget.....it will probably never stall again (my model also includes a stall saver position that triggers about 10% below target). So release the throttle, idle control tries to over-drive but hits min/clamp position then a second or 2 later recovers its senses and takes over. AC and automatic trans can goof up the min position, but multiple min positions fixes that, you need those inputs anyway so might as well take full advantage, new min position will bump the throttle or IAC the moment you drop it into drive or the AC kicks on so again it never stalls or ever even appears to struggle.....without these input this will be the next problem that needs to be solved, unless like me your car doesn't have such frills as an automatic trans or AC.

...and then comes the day you realize it doesn't idle right when the weather changes and you need IAC and CLT corrections too....and baro while you're at it :o
Post Reply