I think I figured out the weird rpm spike when turning ac off. When the AC turns off, the ECU goes out of closed loop idle for a bit then returns! Now to figure out why it goes out of closed loop....
Is it RPMdot?
When you are idling, the PWM duty is say, 30%. With the A/C, it is 45%. When you disengage the A/C, you are left for a split second, without A/C and with a PWM duty at 45%. RPMs will naturally rise, a bit fast too, disabling the CL idle for a split second. Normal, move along.
Used my last free output (wled) to implement an rpm/tps cutoff- signals a relay intercepting the 1q wire to the ECU. What settings are you guys using to cutoff the AC compressor? I have it at 70% tps or 5000rpm. That sound about right?
Depends, I like it as I thought that if you are playing with the throttle and crossing that 85-90% often, you may be switching the compressor on and off rapidly even with the 5% hysterisis, so I thought I should put it in there. The 7sec afterstart helps as well, as the engine is a little bit readier to accept the load at 7 secs.
I shifted my thinking and disabled table switching for AC. The reasons:
1. Jason always said I didn't need it because the 2 situations (AC on and off) occur at completely different map rows.
2. Ken (muaithaibxr) always said spark table tuning would handle oscillations
3. Reverant's findings on idle advance with the stock ecu stim experiment
4. The final push: I was on vacation in Singapore and happened to pick up one of the Greg Banish books and got a better understanding of the whole process.
The key concept for me- spark advance increases the torque, and idle is just torque balancing at zero flywheel load. The extra torque from spark advance will react faster vs idle droop than the idle valve, since spark advance takes effect at the next combustion cycle, nearly instant response. So by table switching into a higher flat advance ahead of the compressor engagement, I used up my torque reserve before I actually needed it.
Went back to a sloped idle advance table with what are subjectively smoother transitions. So when it's deviating from setpoint, the slope of the advance table will make it want to go back. In either direction. Note the stability near setpoint. I don't overshoot it anymore. PID tuning is getting really difficult because the differences are really very subtle now, I can only see the differences in the logs.
P85 i 85 d5500 minRPM700 maxRPM1600
This is how it looks:
Reverant- I changed minimum idle valve duty from 30.9 to 19.9 as per your advice from the other threads. It helped with reacting to the RPM rise from the AC compressor turning off! I don't fall out of closed loop anymore.
I was curious though, why I could not kill the initial dip to less than 100-200 rpm. I magnified the graph, and found some weirdness to the PWM duty:
The duty was jagged, reducing the effect. Particularly at the start of the dip where the D effect is strongest, it actually backed off even as RPMdot was increasing. My first thoughts are (1) is this too much D? And (2) or is it the effect of too small a min/max RPM value, making the code drive the valve with too coarse a resolution?
The software appears to filter RPMDot while the 'D' is not. The D is amplifying jitter in the RPM signal, while RPMDot filters out noise. Note how quickly Duty jumps when RPM begins to dip, while RPMDot appears to react more slowly. If you filtered D as heavily as RPMDot is, so you wouldn't see those jaggies, but D wouldn't react as quickly either.
There's nothing really "wrong" with the way D is acting. The software *could* get more sophisticated and add a "bandwidth limit" or low-pass, to D, in order to reduce the jitter in its output. In *some* cases this can improve performance because it allows even larger amounts of D without causing oscillation. In control system parlance, that's to add a "pole" to the "zero" of 'D'.
If you want to reduce the dip, I think the goal should be to enlarge the solenoid air bleed so that the duty cycle remains the same when you add the load (after the transient dies out). Otherwise you're relying on 'I' to ratchet its way up and increase steady state Duty to stay at the RPM target. Other than that, you can increase P more to reduce the depth of the dip and risk oscillation.
Originally Posted by Greg
The duty was jagged, reducing the effect.
The effect is slight in terms of "timeliness" because you can see how long it takes for RPM to drop down after D has reacted and caused duty to jump up.
Well, looks like this is pretty much it for PID tuning. I have a stable idle with a consistent 200 RPM drop on initial AC engagement (and a mirror 200RPM rise on disengagement), with zero oscillation. Headlight and other loads are hardly felt.
All I can do I look for a stronger solenoid.
P100 I85 D 5500 min rpm 700 max rpm 1600
It seems robust enough that the action is consistent throughout the normal range of CLT and MAT.
Will now turn to another issue--> droop when coming down from revs, BEFORE closed loop idle starts. Here's a pic showing a near-stall after revving from idle. AC and headlights are on. When closed loop starts, it's OK. But BEFORE it starts...meh. Droop and oscillation >.<
vertical lines in row 3 show entry/exit to closed loop. tall lines across all rows- headlights on/off
1. Am I not entering closed loop idle early enough?
2. What determines the PWM idle duty in open loop?
3. Hardware-wise, at what RPM should my throttle dashpot engage?
I played with minimum/maximum rpm to exaggerate the idle duty. Went from min 700 max1600 to min 850 max 1250.
P100 I100 D5500
~50 rpm drop on AC engagement!
But I still had a droop coming down from revs, even occasionally stalling if AC load was on. I wanted it to enter PID sooner, so I edited the ini to allow zero delay for closed loop entry (previous minimum was 2 secs). Results: I entered closed loop at the bottom of the first dip (instead of like 2 seconds later). Will raise the RPM adder to enter closed loop a bit earlier, to see what happens. I wish there was a "force closed loop idle" setting, with settings for RPM and TPS.
But I still got occasional droop coming down from revs with AC, especially with lights. Then it occurred to me: well then why not turn off AC? So I reset my rev/tps AC cutoff- I kept the TPS cutoff, but changed the 2nd setting to cut off the AC trigger when MAP <28. So The AC cuts off during overrun conditions!
See the revs catch smoothly with no load, then the AC re engages a second after hitting steady state
Of course the day wouldn't be complete without a mystery. I have this occasional droop which looks like this:
It looks like P is missing! I see the D response and the I response, but P went on vacation! WTF...
1. Having the relay click everytime you are in overrun is annoying! Plus it switches the AC on & off when I shift. Net effect is- AC ain't cooling as well as it should. It did help a lot with droop though. Just dunno if this is the final solution. Maybe not.
2. The weird "missing P" response is SUPER annoying! I just don't know when it will happen, so I am not confident the car will not stall-- and that's a stressful way to drive. Looks like a strange new software bug, possibly related to the tight RPM window. But when it's working, it really works well! 50 rpm drop.
3. The idle is weird when the engine is cold/warming up. Like too much air being let in. When at operating temp, it's great--except for the missing P bug.
OK after yesterday's frustration, I had to regroup. Decided to recheck all the parameters I'd been working with. Which of course centered on the idle valve.
Did the idle valve test again to determine the correct values for minimum and maximum effective duty, and the corresponding RPMs. Results:
I input those values in so I could start clean from a known correct baseline.
P 105 I100 D5500 RPM min 900 RPM max 2200
You can see the high D, but the idle duty isnt bein driven anywhere near its maximum effective limit.
Then with the same PID values, I lowered the max RPM. This exaggerates the effect of PID on idle duty. Note the changing shape of the idle duty curve as PID is exaggerated. I was looking for a good initial response, driving the duty up near max. Also watch the depth of the droop and the speed with which it is countered by the PID code.
RPM max 1800
Nice and smooth, but still 100 rpm dip.
RPM max 1400
Very nice initial response (50rpm dip caught instantly with the duty being driven up nicely), but has some low amplitude oscillations. Looks like this may be good with P and I turned down a bit. Actually those oscillations- I didn't even feel them on the car. I just saw them here. RPM was smooth.
RPM max 1200
Too much! It put idle duty to the roof, but look at the valve chatter at steady state! Idle could not even reach target because the valve duty was swinging so wide! Idle actually felt like it went up when I turned the AC on
So far no sign of that weird "no P" bug from the other day. Maybe running the idle valve up to 100% duty helped loosen it up...