DIYPNP install: inital tuning
#341
![Default](https://www.miataturbo.net/images/icons/icon1.gif)
No idle tuning today, took the car out or a drive ![big grin](https://www.miataturbo.net/images/smilies/biggrin.gif)
This was taken while warming up. Looks like a bit too much P. Hardly noticeable in the car.
P100 I140 D6500
![](https://www.miataturbo.net/attachments/megasquirt-18/24154-diypnp-install-inital-tuning-93p100i140d6500.png?dateline=1315016786)
When the car was nice and hot, I did have 2 strange stalls when the AC engaged. Looking at the logs, the idle valve action was weird, like it started to react then stopped midway. Any ideas?
![big grin](https://www.miataturbo.net/images/smilies/biggrin.gif)
This was taken while warming up. Looks like a bit too much P. Hardly noticeable in the car.
P100 I140 D6500
![](https://www.miataturbo.net/attachments/megasquirt-18/24154-diypnp-install-inital-tuning-93p100i140d6500.png?dateline=1315016786)
When the car was nice and hot, I did have 2 strange stalls when the AC engaged. Looking at the logs, the idle valve action was weird, like it started to react then stopped midway. Any ideas?
![](https://www.miataturbo.net/attachments/megasquirt-18/24155-diypnp-install-inital-tuning-93weirddroop.png?dateline=1315016786)
#345
Elite Member
![](/mt2011/images_td/ranks/supporter1.gif)
iTrader: (10)
Join Date: Jun 2006
Location: Athens, Greece
Posts: 5,987
Total Cats: 359
![Default](https://www.miataturbo.net/images/icons/icon1.gif)
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.
#349
Elite Member
![](/mt2011/images_td/ranks/supporter1.gif)
iTrader: (10)
Join Date: Jun 2006
Location: Athens, Greece
Posts: 5,987
Total Cats: 359
![Default](https://www.miataturbo.net/images/icons/icon1.gif)
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.
#350
![Default](https://www.miataturbo.net/images/icons/icon1.gif)
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
![](https://www.miataturbo.net/attachments/megasquirt-18/24325-diypnp-install-inital-tuning-97p85i85d5500.png?dateline=1315387734)
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.
![](https://www.miataturbo.net/attachments/megasquirt-18/24326-diypnp-install-inital-tuning-97p85i85d5500acoff.png?dateline=1315387734)
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:
![](https://www.miataturbo.net/attachments/megasquirt-18/24327-diypnp-install-inital-tuning-97p85i85d5500mag.png?dateline=1315387734)
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?
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
![](https://www.miataturbo.net/attachments/megasquirt-18/24325-diypnp-install-inital-tuning-97p85i85d5500.png?dateline=1315387734)
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.
![](https://www.miataturbo.net/attachments/megasquirt-18/24326-diypnp-install-inital-tuning-97p85i85d5500acoff.png?dateline=1315387734)
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:
![](https://www.miataturbo.net/attachments/megasquirt-18/24327-diypnp-install-inital-tuning-97p85i85d5500mag.png?dateline=1315387734)
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?
Last edited by Greg G; 09-07-2011 at 06:25 AM.
#351
![Default](https://www.miataturbo.net/images/icons/icon1.gif)
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.
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.
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.
#352
![Default](https://www.miataturbo.net/images/icons/icon1.gif)
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
![](https://www.miataturbo.net/attachments/megasquirt-18/24356-diypnp-install-inital-tuning-98p100i85d5500max1600.png?dateline=1315473072)
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
![](https://www.miataturbo.net/attachments/megasquirt-18/24357-diypnp-install-inital-tuning-98revdroop.png?dateline=1315473072)
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?
Thanks guys!
All I can do I look for a stronger solenoid.
P100 I85 D 5500 min rpm 700 max rpm 1600
![](https://www.miataturbo.net/attachments/megasquirt-18/24356-diypnp-install-inital-tuning-98p100i85d5500max1600.png?dateline=1315473072)
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
![](https://www.miataturbo.net/attachments/megasquirt-18/24357-diypnp-install-inital-tuning-98revdroop.png?dateline=1315473072)
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?
Thanks guys!
#353
Boost Czar
![](/mt2011/images_td/ranks/supporter1.gif)
![](/mt2011/images_td/ranks/admin.png)
iTrader: (62)
Join Date: May 2005
Location: Chantilly, VA
Posts: 79,688
Total Cats: 4,113
![Default](https://www.miataturbo.net/images/icons/icon1.gif)
2. Last know idle PWM% - or if that hasn't been established yet, your warmup table.
3. Any RPM in which you lift and the software determines through all the parameters (like MAPdot) that you're coming to idle. The idle valve should always open right away + dashpot.
#355
![Default](https://www.miataturbo.net/images/icons/icon1.gif)
The answer is yes!
I played with minimum/maximum rpm to exaggerate the idle duty. Went from min 700 max1600 to min 850 max 1250.
P100 I100 D5500
![](https://www.miataturbo.net/attachments/megasquirt-18/24538-diypnp-install-inital-tuning-910p100i100d5500m850m1250.png?dateline=1315650705)
~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!![](https://www.miataturbo.net/images/smilies/smile.gif)
![](https://www.miataturbo.net/attachments/megasquirt-18/24539-diypnp-install-inital-tuning-910acmap28cutoffrev.png?dateline=1315650705)
See the revs catch smoothly with no load, then the AC re engages a second after hitting steady state![](https://www.miataturbo.net/images/smilies/smile.gif)
Of course the day wouldn't be complete without a mystery. I have this occasional droop which looks like this:
![](https://www.miataturbo.net/attachments/megasquirt-18/24540-diypnp-install-inital-tuning-910missingp.png?dateline=1315650705)
It looks like P is missing! I see the D response and the I response, but P went on vacation! WTF...
I played with minimum/maximum rpm to exaggerate the idle duty. Went from min 700 max1600 to min 850 max 1250.
P100 I100 D5500
![](https://www.miataturbo.net/attachments/megasquirt-18/24538-diypnp-install-inital-tuning-910p100i100d5500m850m1250.png?dateline=1315650705)
~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!
![](https://www.miataturbo.net/images/smilies/smile.gif)
![](https://www.miataturbo.net/attachments/megasquirt-18/24539-diypnp-install-inital-tuning-910acmap28cutoffrev.png?dateline=1315650705)
See the revs catch smoothly with no load, then the AC re engages a second after hitting steady state
![](https://www.miataturbo.net/images/smilies/smile.gif)
Of course the day wouldn't be complete without a mystery. I have this occasional droop which looks like this:
![](https://www.miataturbo.net/attachments/megasquirt-18/24540-diypnp-install-inital-tuning-910missingp.png?dateline=1315650705)
It looks like P is missing! I see the D response and the I response, but P went on vacation! WTF...
#356
![Default](https://www.miataturbo.net/images/icons/icon1.gif)
Long drive today- first impressions:
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.
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.
#358
![Default](https://www.miataturbo.net/images/icons/icon1.gif)
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:
![](https://www.miataturbo.net/attachments/megasquirt-18/24605-diypnp-install-inital-tuning-912iscdutyrangetest.png?dateline=1315818441)
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
![](https://www.miataturbo.net/attachments/megasquirt-18/24606-diypnp-install-inital-tuning-912rpmmax2200.png?dateline=1315818441)
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
![](https://www.miataturbo.net/attachments/megasquirt-18/24607-diypnp-install-inital-tuning-912rpmmax1800.png?dateline=1315818441)
Nice and smooth, but still 100 rpm dip.
RPM max 1400
![](https://www.miataturbo.net/attachments/megasquirt-18/24608-diypnp-install-inital-tuning-912rpmmax1400.png?dateline=1315818441)
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
![](https://www.miataturbo.net/attachments/megasquirt-18/24609-diypnp-install-inital-tuning-912rpmmax1200.png?dateline=1315818441)
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...
Are we there yet?
Did the idle valve test again to determine the correct values for minimum and maximum effective duty, and the corresponding RPMs. Results:
![](https://www.miataturbo.net/attachments/megasquirt-18/24605-diypnp-install-inital-tuning-912iscdutyrangetest.png?dateline=1315818441)
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
![](https://www.miataturbo.net/attachments/megasquirt-18/24606-diypnp-install-inital-tuning-912rpmmax2200.png?dateline=1315818441)
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
![](https://www.miataturbo.net/attachments/megasquirt-18/24607-diypnp-install-inital-tuning-912rpmmax1800.png?dateline=1315818441)
Nice and smooth, but still 100 rpm dip.
RPM max 1400
![](https://www.miataturbo.net/attachments/megasquirt-18/24608-diypnp-install-inital-tuning-912rpmmax1400.png?dateline=1315818441)
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
![](https://www.miataturbo.net/attachments/megasquirt-18/24609-diypnp-install-inital-tuning-912rpmmax1200.png?dateline=1315818441)
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
![Laugh](https://www.miataturbo.net/images/smilies/laugh.gif)
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...
Are we there yet?
![big grin](https://www.miataturbo.net/images/smilies/biggrin.gif)
Last edited by Greg G; 09-12-2011 at 05:22 AM.