PWM idle valve voltage compensation

Tuning concepts, methods, tips etc.

Moderators: jsmcortina, muythaibxr

142 guy
Helpful MS/Extra'er
Posts: 58
Joined: Thu Oct 22, 2015 9:05 am

PWM idle valve voltage compensation

Post by 142 guy »

I have a 1971 Volvo B20E running MS2Extra using a Bosch 2 wire idle air valve in place of the original Djet thermal auxiliary air valve. The Bosch 2 wire valve position is sensitive to supply voltage and I have a correction factor of about 3% per volt. Generally, everything works just fine except during fairly cold weather starts. When the engine temperature at start up is below about -10C, the engine requires a fair amount of air during cranking and after ignition is achieved in order to sustain operation. I use a crank to run taper setting of 0.5 for the idle air valve which allows for a successful transition to the setting established by the PWM warm-up curve.

My problem is that it appears that during cranking no voltage correction is applied to the idle air valve. My voltage during cranking is fairly low because I am utilizing a fairly small battery (lighter weight). Because the voltage is low during cranking I have to use a fairly high cranking PW value to get the required air to provide a quick start. As the engine catches and RPM increases the voltage recovers very quickly to around 14 volts causing the valve to go fairly wide open because of the crank to run taper setting. Voltage correction appears to kick in at the crank to run transition RPM; but, the total amount of correction applied at 14 volts is only -6% which leaves me with too much air. This results in the engine RPM going up to 2000 + RPM until the taper drops to the warm up idle setting which would be around 1200 - 1300 RPM. I tried to reduce the RPM overshoot by reducing / eliminating the taper. However too quick of a taper usually results in the engine dying. Reducing the cranking setting on the valve reduced the RPM overshoot; but, makes the start harder.

Is there a setting that I am missing that would allow me to apply voltage correction to the valve during the cranking phase or could there be some other factor which is preventing the application of voltage correction during cranking? Is there some other potential solution? I know I could solve the problem by using a Bosch 3 wire valve which does not suffer from the same voltage sensitivity.
Eskie
MS/Extra Newbie
Posts: 27
Joined: Fri Sep 15, 2017 5:58 am

Re: PWM idle valve voltage compensation

Post by Eskie »

There is PWM idle voltage compensation under the startup/idle menu in Tuner Studio. Is that what your looking for?
elaw
Super MS/Extra'er
Posts: 2926
Joined: Fri Oct 16, 2009 6:20 am
Location: Wilmington, MA

Re: PWM idle valve voltage compensation

Post by elaw »

:msq:

Without knowing anything about what Megasquirt and firmware version you're using, it's hard to offer advice. Also a log showing the problem would be very helpful.
Eric Law
1990 Audi 80 quattro with AAN turbo engine: happily running on MS3+MS3X
2012 Audi A4 quattro, desperately in need of tweaking

Be alert! America needs more lerts.
142 guy
Helpful MS/Extra'er
Posts: 58
Joined: Thu Oct 22, 2015 9:05 am

Re: PWM idle valve voltage compensation

Post by 142 guy »

Eskie wrote:There is PWM idle voltage compensation under the startup/idle menu in Tuner Studio. Is that what your looking for?
Not what I am looking for. I am currently using that voltage compensation curve and it works just fine for control of the idle air valve when the engine is running. My point was that there does not appear to be any PWM voltage compensation applied during cranking. I was questioning whether that is just the way it is or was there some entry I could make that would activate voltage compensation during cranking.
142 guy
Helpful MS/Extra'er
Posts: 58
Joined: Thu Oct 22, 2015 9:05 am

Re: PWM idle valve voltage compensation

Post by 142 guy »

elaw wrote::msq:

Without knowing anything about what Megasquirt and firmware version you're using, it's hard to offer advice. Also a log showing the problem would be very helpful.
MS2Extra release 3.4.1.

I am not looking for any particular tuning advice so I didn't bother with a log. I am specifically looking for whether there is some feature that allows you to turn on PWM voltage compensation during cranking and yes I agree that I should have provided the release number to facilitate that.

I have largely mitigated the problem by shifting the PWM voltage correction curve down so that all the voltage compensation values are negative values (in some cases very negative) and shifted the PWM warm up curve up by the same amount so that the actual PWM values are unchanged during warm up. The large negative values on the voltage correction curve reduce the overshoot on the PWM valve when the voltage recovers as the valve tapers from the cranking to the warm up setting. This solution works; however, if I ever replace my tiny battery with a battery with a higher cranking capacity the higher voltages during cranking are going to screw up my cranking PW settings. Having voltage correction during cranking would eliminate the variability in valve position caused by different voltages during cranking.
elaw
Super MS/Extra'er
Posts: 2926
Joined: Fri Oct 16, 2009 6:20 am
Location: Wilmington, MA

Re: PWM idle valve voltage compensation

Post by elaw »

The reason I mentioned the firmware version in particular is that while I'm not sure I've ever actually seen it written, I've always thought voltage compensation would be on all the time, and especially during cranking! I thought if you were running a very old version of firmware that might not be the case but you're not.

I will say that while it's been a few years since I used MS2, I'm not aware of any setting that would enable/disable compensation during cranking.

The other possibility that comes to mind is the MS for some reason is not correctly "seeing" the battery voltage during cranking. A log would show if that's the case, and if it's the case, a copy of the tune file could provide a clue as to why (most likely an incorrect lag factor).
Eric Law
1990 Audi 80 quattro with AAN turbo engine: happily running on MS3+MS3X
2012 Audi A4 quattro, desperately in need of tweaking

Be alert! America needs more lerts.
142 guy
Helpful MS/Extra'er
Posts: 58
Joined: Thu Oct 22, 2015 9:05 am

Re: PWM idle valve voltage compensation

Post by 142 guy »

I do have a log (actually lots of them). The logs show that as the engine speed transitions from crank to run at 600 RPM the PWM value in the log takes a jump from the value in the PWM valve cranking table to that value + or - what the voltage correction is on the PWM valve voltage correction table.

Because my MS2 has been significantly customized (full sequential with one-off cam and tach inputs and other stuff) I built a second one as a back up. I bench tested the back-up MS2 connected to a lab power supply and my now dead jimstim. With the lab supply running around 10 volts you could watch the PWM valve output as I dialed up the engine speed on the jimstim and the PWM output would change as soon as the jimstim RPM output transitioned from crank to run and it transitioned by exactly the amount on the voltage correction table.

I tried attaching a log from about a month ago that clearly shows the change in the PWM output as the engine transitions from the crank to run. Unfortunately, that log (and all my existing log) exceeds the allowed attachment size. I could run a new log of just a start; however, my tune is now significantly different and no longer demonstrates that transition in PWM. I think I can save the log as a jpeg showing the transition section and attach that. Let me try that.
elaw
Super MS/Extra'er
Posts: 2926
Joined: Fri Oct 16, 2009 6:20 am
Location: Wilmington, MA

Re: PWM idle valve voltage compensation

Post by elaw »

If you're familiar with how to use a text editor you can also use one to shorten a log file. Make sure you keep the first 4 lines as they contain info on the file and the fields it contains. Otherwise just delete lines before and after the area that shows the problem.

You also might consider starting a thread about this in the MS2 support forum since in my opinion it's more a question about how the firmware functions than about tuning technique.
Eric Law
1990 Audi 80 quattro with AAN turbo engine: happily running on MS3+MS3X
2012 Audi A4 quattro, desperately in need of tweaking

Be alert! America needs more lerts.
142 guy
Helpful MS/Extra'er
Posts: 58
Joined: Thu Oct 22, 2015 9:05 am

Re: PWM idle valve voltage compensation

Post by 142 guy »

2017-11-20 edited.msl.txt
(47.58 KiB) Downloaded 54 times
Good point about the text editor. Dug out my copy of Notepad and have attached the abbreviated log.

The transition from crank to run is easiest to spot by the transition in fuel PW from the high cranking values to the run value. The configured transition is actually at 600 RPM. You can see the idle valve PW transition from 64.7% which is the value in the cranking table to around 67.8%. The PWM correction at a voltage of 9.7 V would have been just a touch over +3%. The PWM valve position tapers to the PWM warm up setting in 10 steps with each step being equal to the taper setting in Tuner Studio. I have never sat down to figure out whether it is a linear taper and how the voltage correction is applied. Analysing the taper from the log is complicated by the fact that the voltage is increasing as the alternator starts doing its thing.

The coolant temperatures look a little wild in this log due to scaling. The Bosch coolant sensor that I am using has a very high resistance coefficient at low temperatures with the result that any noise combined with the scaling results in some scary looking stuff.

At this point I am not inclined to start something in the support forum. I was primarily interested in determining whether I had missed something in setting up the configuration in Tuner Studio. If I haven't missed something and that is just the way it is, then I will continue with my current work around and if the work around becomes to cludgy, then I will eliminate the issue by going to a 3 wire PWM valve.
elaw
Super MS/Extra'er
Posts: 2926
Joined: Fri Oct 16, 2009 6:20 am
Location: Wilmington, MA

Re: PWM idle valve voltage compensation

Post by elaw »

It's a little hard to interpret that log without seeing your tune.

If you look at the area where the RPM is rising from about 1100-1600, you can see the battery voltage rising and the PWM idle duty dropping. However it's hard to tell whether that is the crank-run taper, voltage compensation, or both.

One thing you could try is increasing the voltage compensation a lot (like triple it) and see what happens. I of course don't know the particular hardware you're using but 3% compensation between normal running voltage and cranking voltage to me seems like way too little.

The current through the idle valve (and thus how far it opens) is proportional to voltage. Your system voltage when running is about 13.8, but toward the end of cranking when the engine catches it's only 9.5. In theory to have the same amount of current flowing in the idle valve at 9.5 volts as at 13.8, you'd need to add 45% to the PWM value.
Eric Law
1990 Audi 80 quattro with AAN turbo engine: happily running on MS3+MS3X
2012 Audi A4 quattro, desperately in need of tweaking

Be alert! America needs more lerts.
142 guy
Helpful MS/Extra'er
Posts: 58
Joined: Thu Oct 22, 2015 9:05 am

Re: PWM idle valve voltage compensation

Post by 142 guy »

The +3% I was referring to was the actual compensation applied at 9.7 volts. The valve position sensitivity is about 3%/volt and I use a straight line voltage compensation curve with a slope of -3% per volt. The total compensation changes from +3% dropping to -12% at 14 volts. Just to complicate things, the Bosch PWM valve is a trifle odd. 0% PWM is not closed. At 12 volts the operating range is about 35% PWM for closed to around 80% PWM for full open. If you are not directly familiar with the operation of the Bosch 2 wire, the % PW settings in the configuration look really bizarre.

Following the transition from crank to run, the valve position is a combination of taper and voltage compensation. I have set the taper to zero and you can see the valve position drop almost instantly to the warm up setting. That warm up PWM setting is not large enough to sustain operation in the first 5 seconds after start up. That is why I use the crank to run taper. However, the voltage correction that gets applied to my overly large crank PWM values (because there is no voltage compensation during crank) cause the valve to open a lot after transitioning to run leading to high RPMs after start.
DocWalt
Helpful MS/Extra'er
Posts: 35
Joined: Sun Dec 15, 2013 5:43 pm
Location: Royersford, PA

Re: PWM idle valve voltage compensation

Post by DocWalt »

I'm seeing the same whacky behavior on startup due to this exact issue: http://www.msextra.com/forums/viewtopic ... 16#p517016

The timing of this is almost comical :)
'92 GTI 16V running MS2 v3.57 & MS2/Extra v3.4.0
142 guy
Helpful MS/Extra'er
Posts: 58
Joined: Thu Oct 22, 2015 9:05 am

Re: PWM idle valve voltage compensation

Post by 142 guy »

DocWalt wrote:I'm seeing the same whacky behavior on startup due to this exact issue: http://www.msextra.com/forums/viewtopic ... 16#p517016

The timing of this is almost comical :)
I read through your thread. Your description of the problem is almost exactly the same as mine. This includes the fact that I can reduce the RPM overshoot by reducing the cranking PWM; but, the first start then usually fails. Second starts are always successful. The overshoot is present when warm; but, much less significant because the valve position during cranking is much smaller.

You talked about modifying the firmware to enable voltage compensation during cranking. Where did you get the source code for the MS2Extra? I had searched; but, never found it. I did find a really old version of MS3Extra. How far in to the code (what line #s) is the section dealing with the PWM idle valve? I had pretty much come to the conclusion that fixing it was going to require a switch to a Bosch 3 wire valve which does not display the valve position versus voltage sensitivity that the 2 wire valve does.
DocWalt
Helpful MS/Extra'er
Posts: 35
Joined: Sun Dec 15, 2013 5:43 pm
Location: Royersford, PA

Re: PWM idle valve voltage compensation

Post by DocWalt »

The source code is included with the release, check the ms2extra folder. See here for details about how to do the development: http://www.msextra.com/forums/viewtopic ... 91&t=43601

Are you using the PWM warmup or closed loop? I made my changes to the closed loop code, I haven't looked at the PWM warmup bit of code.

I believe that building a current controller for the 2 wire valve will work as well, BTW. There's schematics floating around somewhere, I don't have them handy.
'92 GTI 16V running MS2 v3.57 & MS2/Extra v3.4.0
142 guy
Helpful MS/Extra'er
Posts: 58
Joined: Thu Oct 22, 2015 9:05 am

Re: PWM idle valve voltage compensation

Post by 142 guy »

DocWalt wrote:The source code is included with the release, check the ms2extra folder. See here for details about how to do the development: http://www.msextra.com/forums/viewtopic ... 91&t=43601

Are you using the PWM warmup or closed loop? I made my changes to the closed loop code, I haven't looked at the PWM warmup bit of code.

I believe that building a current controller for the 2 wire valve will work as well, BTW. There's schematics floating around somewhere, I don't have them handy.
Well look and Yee shall receive! I never got past grabbing the .s19 file.

I am just using the PWM in warm-up mode. I don't have air conditioning so have not been particularly motivated to experiment with closed loop idle control.

A controlled current source (using current feed-back?) for the 2-wire valve would be an option. I had thought about the possibility of using a small buck-boost regulator to provide a constant voltage source. Depending on how much the valve inductance smooths or doesn't smooth the PWM valve current the regulator might have a tough time controlling the voltage. The other option I briefly thought of was filter the PWM output from the MS2 to create a voltage output signal which could be used as a set point for an adjustable buck-boost regulator which would then supply the PWM valve. However, the down side to all of these is that they add complexity and failure points. If the firmware does not fix the problem, I am really inclined to go to the 3 wire valve which should not require any voltage compensation.

As a matter of curiosity, what voltage sensitivity are you using for your valve (assuming it is the Bosch 2 wire)? I had done some bench tests on voltage versus the start of open and full open positions (the only valve positions that you can quantify) and got a voltage sensitivity between 3%PWM / volt and 6% PWM/volt (discerning valve movement by looking into the opening of the valve requires a certain amount of 'art'). In operation, testing by triggering drops in alternator voltage while watching the MAP suggests that the voltage sensitivity is more like 3% or maybe less. A 6% correction slope causes the valve to open too much when the voltage drops and the MAP takes a dip.
DocWalt
Helpful MS/Extra'er
Posts: 35
Joined: Sun Dec 15, 2013 5:43 pm
Location: Royersford, PA

Re: PWM idle valve voltage compensation

Post by DocWalt »

142 guy wrote:
DocWalt wrote:The source code is included with the release, check the ms2extra folder. See here for details about how to do the development: http://www.msextra.com/forums/viewtopic ... 91&t=43601

Are you using the PWM warmup or closed loop? I made my changes to the closed loop code, I haven't looked at the PWM warmup bit of code.

I believe that building a current controller for the 2 wire valve will work as well, BTW. There's schematics floating around somewhere, I don't have them handy.
Well look and Yee shall receive! I never got past grabbing the .s19 file.

I am just using the PWM in warm-up mode. I don't have air conditioning so have not been particularly motivated to experiment with closed loop idle control.

A controlled current source (using current feed-back?) for the 2-wire valve would be an option. I had thought about the possibility of using a small buck-boost regulator to provide a constant voltage source. Depending on how much the valve inductance smooths or doesn't smooth the PWM valve current the regulator might have a tough time controlling the voltage. The other option I briefly thought of was filter the PWM output from the MS2 to create a voltage output signal which could be used as a set point for an adjustable buck-boost regulator which would then supply the PWM valve. However, the down side to all of these is that they add complexity and failure points. If the firmware does not fix the problem, I am really inclined to go to the 3 wire valve which should not require any voltage compensation.

As a matter of curiosity, what voltage sensitivity are you using for your valve (assuming it is the Bosch 2 wire)? I had done some bench tests on voltage versus the start of open and full open positions (the only valve positions that you can quantify) and got a voltage sensitivity between 3%PWM / volt and 6% PWM/volt (discerning valve movement by looking into the opening of the valve requires a certain amount of 'art'). In operation, testing by triggering drops in alternator voltage while watching the MAP suggests that the voltage sensitivity is more like 3% or maybe less. A 6% correction slope causes the valve to open too much when the voltage drops and the MAP takes a dip.
Closed loop doesn't seem very important unless you have varying load on the engine. When I turn the steering wheel the P/S pump loads up and drags the engine down so I needed closed loop.

I also didn't want to add failure points which is why I didn't make the current controller. It would solve the problem though as it's what Bosch intended to be used for controlling the 2-wire valve.

I'm seeing about 3 to 3.5% PWM/volt compensation as well. It idles smoothly in normal conditions with 0 compensation but the idle dips quite a bit when I turn on all of the lights and HVAC fan, for example. Closed-loop corrects and stabilizes the idle back to target but it's slower than the voltage compensation.
'92 GTI 16V running MS2 v3.57 & MS2/Extra v3.4.0
142 guy
Helpful MS/Extra'er
Posts: 58
Joined: Thu Oct 22, 2015 9:05 am

Re: PWM idle valve voltage compensation

Post by 142 guy »

Any thoughts on why the developers did not implement PWM voltage correction while cranking or at least make it a settable option? I am assuming that it was intentional rather than oversight. If there is some hook into another piece of code (either in the valve control or the voltage correction) that complicates matters, it would be nice to know before I end up in the Land of Unintended Consequences.
DocWalt
Helpful MS/Extra'er
Posts: 35
Joined: Sun Dec 15, 2013 5:43 pm
Location: Royersford, PA

Re: PWM idle valve voltage compensation

Post by DocWalt »

I'm certainly no expert on MegaSquirt and why decisions were made, but I don't see any particularly major reason why you wouldn't want voltage compensation applied during cranking. I could see it complicating things if you weren't expecting to see it during the cranking process in the log, otherwise I'm not sure what it would cause an issue with. If anyone knows, I'd like to know too!
'92 GTI 16V running MS2 v3.57 & MS2/Extra v3.4.0
prof315
Super MS/Extra'er
Posts: 3760
Joined: Sun Jan 18, 2009 3:13 am
Location: Melbourne, FL

Re: PWM idle valve voltage compensation

Post by prof315 »

142 guy wrote:Any thoughts on why the developers did not implement PWM voltage correction while cranking or at least make it a settable option? I am assuming that it was intentional rather than oversight. If there is some hook into another piece of code (either in the valve control or the voltage correction) that complicates matters, it would be nice to know before I end up in the Land of Unintended Consequences.
It's actually quite simple why we don't have PWM voltage correction during cranking. We have a separate PWM table for cranking. Dial that in correctly along with crank to run taper and there is no need for voltage correction. If your cranking voltage fluctuates you need to take a hard look at powers, grounds and your battery's condition and CA/CCA.
Linfert Performance/321 Motorsports
SCCA 2019 SM National Champion Crew Chief
SCCA 2023 FP National Champion Tuner/electrical engineer
100s of MS systems built installed and tuned
Support the developers!
DocWalt
Helpful MS/Extra'er
Posts: 35
Joined: Sun Dec 15, 2013 5:43 pm
Location: Royersford, PA

Re: PWM idle valve voltage compensation

Post by DocWalt »

Except when it gets cold the demand on the battery increases and the voltage drops a lot more than it does when it's summer...
'92 GTI 16V running MS2 v3.57 & MS2/Extra v3.4.0
Post Reply