Baro fuel calculation

Testing and development of Megasquirt 3

Moderators: jsmcortina, muythaibxr

jsmcortina
Site Admin
Posts: 39615
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Baro fuel calculation

Post by jsmcortina »

A few months or so ago (I can't find the topic right now) a user posted up questioning the fuel calcs and why baro is factored in twice.
The MS2/Extra and MS3 codes both evolved from an early version of MS2/BG which has this

Code: Select all

  lsum = (lsum * ((outpc.barocor * outpc.aircor) / 100)/100);
  outpc.gammae = (int)lsum;
  if(inpram.FuelAlpha != 2)
    lsum2 = (long)outpc.kpa;
  else
    lsum2 = 1000; // normalizes to ~1 when divide by baro 
  lsum1 = (lsum * ((outpc.egocor1 * lsum2) / outpc.baro)/100);
outpc.barocor is a calculated barometric correction.
outpc.baro is that actual barometer reading.
So the code accounts for changes in baro twice.

Ken and I asked B&G about this and the conclusion is that this came from some GM research which later turned out to be very specific to one engine and therefore does not apply to us.

I plan to remove the division by outpc.baro by default and add a compatability option for existing users.

Comments?

James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
prof315
Super MS/Extra'er
Posts: 3777
Joined: Sun Jan 18, 2009 3:13 am
Location: Melbourne, FL

Re: Baro fuel calculation

Post by prof315 »

Sounds good to me James.
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!
TheSilverBuick
Experienced MS/Extra'er
Posts: 357
Joined: Thu Feb 02, 2012 9:08 am

Re: Baro fuel calculation

Post by TheSilverBuick »

I'm glad for the backwards compatibility, but am also curious what effect the change will have to the correction curve I've currently got...
"Hey, at least the Skylark proves that even a messy hack can patch together a reliable EFI system. I can't think of a time the MegaSquirt has left me stranded since installation ~100,000 miles ago."

Drag Week 2011, 2012 & 2015. - BB N/A - 1977 Skylark w/Buick 455 EFI and TKO-600!
Alfagta
Experienced MS/Extra'er
Posts: 239
Joined: Wed Aug 21, 2013 2:54 am

Re: Baro fuel calculation

Post by Alfagta »

Hello,

i've asked you about this. And it was an PM not a Topic...


Regards
Alfa 156 GTA
Alfa 75 Race Car MS III -- alway latest FW
Alfa 164 V6 Turbo
Alfa 155 2,5TD RIP
Test MS II --always latest FW
Tunerstudio V2.6.11 Registered
MegaLog Viewer V3.4.04 Registered
jsmcortina
Site Admin
Posts: 39615
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: Baro fuel calculation

Post by jsmcortina »

Alfagta wrote:Hello,
i've asked you about this. And it was an PM not a Topic...
Ah, that would explain why I couldn't find the topic.

James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
Nightstalker1993
Helpful MS/Extra'er
Posts: 75
Joined: Tue Jun 03, 2014 11:09 am

Re: Baro fuel calculation

Post by Nightstalker1993 »

You mean baro correction is applied eventhough the barometric correction curve is set to 100 at all points is that correct?

I was actually wondering about that when I installed my independent map sensor as barometer and had my engine ran pig rich as I climbed up in altitude where before that it would lean out slightly. In the barometric correct curve i actually had to REDUCE fueling to compensate for the default over-compensation. So if I'm understanding this correctly, with the new baro correction calculation, it only takes in the barometric correction curve set by us and I would have to edit my barometric compensation curve to INCREASE fueling now is that correct?
jsmcortina
Site Admin
Posts: 39615
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: Baro fuel calculation

Post by jsmcortina »

Nightstalker1993 wrote:You mean baro correction is applied eventhough the barometric correction curve is set to 100 at all points is that correct?
Yes.

Previously (and in compatability mode) the code does the equivalent of:
PW = PW * (100kPa / baro)
So if I'm understanding this correctly, with the new baro correction calculation, it only takes in the barometric correction curve set by us and I would have to edit my barometric compensation curve to INCREASE fueling now is that correct?
Yes.

James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
Nightstalker1993
Helpful MS/Extra'er
Posts: 75
Joined: Tue Jun 03, 2014 11:09 am

Re: Baro fuel calculation

Post by Nightstalker1993 »

jsmcortina wrote:
Nightstalker1993 wrote:You mean baro correction is applied eventhough the barometric correction curve is set to 100 at all points is that correct?
Yes.

Previously (and in compatability mode) the code does the equivalent of:
PW = PW * (100kPa / baro)
So if I'm understanding this correctly, with the new baro correction calculation, it only takes in the barometric correction curve set by us and I would have to edit my barometric compensation curve to INCREASE fueling now is that correct?
Yes.

James
Thanks. Should've asked earlier when I encountered it but i assumed it was normal for the barometric correction to be applied as part of the main fuel calculation and the baro correction curve is just to compensate for the default code. The default baro correction was waaaay overcorrecting it for me, at 80kpa baro my wideband maxed out below 10 when the target is suppoed to be around 11.5 and to get around it I reduced it in the baro correction curve.

Guess it's time to pay a visit to the mountains again to get the baro curve re-tuned based on the new code.
suberimakuri
Master MS/Extra'er
Posts: 632
Joined: Sun May 02, 2004 2:16 pm
Location: Auckland, NZ
Contact:

Re: Baro fuel calculation

Post by suberimakuri »

Would this also be getting factored in twice for the percent baro fuelling method?
jsmcortina
Site Admin
Posts: 39615
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: Baro fuel calculation

Post by jsmcortina »

suberimakuri wrote:Would this also be getting factored in twice for the percent baro fuelling method?
Yes. The only time it was not included was MAF only.

James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
elaw
Super MS/Extra'er
Posts: 2926
Joined: Fri Oct 16, 2009 6:20 am
Location: Wilmington, MA

Re: Baro fuel calculation

Post by elaw »

jsmcortina wrote:
Nightstalker1993 wrote:You mean baro correction is applied eventhough the barometric correction curve is set to 100 at all points is that correct?
Yes.

Previously (and in compatability mode) the code does the equivalent of:
PW = PW * (100kPa / baro)
Hey this is just academic since I don't use baro correction but something about the above doesn't seem right to me.

If "baro" is 100 (I'm assuming "baro" is the value from the correction table), it shouldn't matter if you do "PW = PW * (100kPa / baro)" once or twice or 50 times, PW would remain the same.

Am I missing something?

I do get that if "baro" were *not* 100, the number of times it was factored in would make a difference.
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.
jsmcortina
Site Admin
Posts: 39615
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: Baro fuel calculation

Post by jsmcortina »

No...
the value from the table is outpc.barocor
the value of the actual barometer is outpc.baro

Including barocor makes sense, including the raw baro does not.

James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
elaw
Super MS/Extra'er
Posts: 2926
Joined: Fri Oct 16, 2009 6:20 am
Location: Wilmington, MA

Re: Baro fuel calculation

Post by elaw »

Ah, that makes sense. I should have read the first post more carefully!
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.
jsmcortina
Site Admin
Posts: 39615
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: Baro fuel calculation

Post by jsmcortina »

Following on from the above, but oddly independently, we've had some users (off forum) reporting inconsistent AFRs on each restart.

This appears to apply only to users with baro setting to "Initial MAP Reading" and is more apparent on installs with large injectors and a low idle pulsewidth.

We've not fully got to the bottom of this yet, but it _appears_ that in some cases that initial MAP reading is inaccurate giving a false "Barometer" reading. This then has an effect on fuelling.

That feeds in to the change discussed above where Barometer had an impact on fuel even when the baro correction curve was set to all 100s. (Beta 14 released last week disables that calculation and sets the defaults baro correction to "Off" )

I'm very keen to receive feedback from experienced users on stable installs that have "Initial MAP Reading" enabled.
a. With your existing tune and firmware please look at "Barometer" from start to start and see if it makes sense. Please datalog and post them here.

b. Compare with beta14 and "Old baro calc" set to "On"

c. Compare with beta14plus (below) and "Old baro calc" set to "On". Also observe dash gauge "Sensor 15".
This "plus" firmware has a small tweak so that baro is sampled twice and startup and the highest value used. "Sensor 15" contains the value that _would_ have been used.

The beta14plus firmware can be found here:
http://www.msextra.com/downloads/dev/ms ... ta-14plus/

Inherently the "Initial MAP Reading" concept is imperfect as there's always a risk that it will read engine vaccum instead of atmospheric pressure. However, it has been there since MS1 and we haven't removed it. If you really want baro correction then a second 1bar sensor should be used.

James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
racingmini_mtl
Super MS/Extra'er
Posts: 9130
Joined: Sun May 02, 2004 6:51 am
Location: Quebec, Canada
Contact:

Re: Baro fuel calculation

Post by racingmini_mtl »

Do you know what type of starting process is used by those having inconsistent AFRs? Do they pause after a key on or do they simply go from off to cranking? It would be good to see if that is simply a question of cranking before the MS is ready. So if they could make many starts with a 1 second pause before cranking, that could be helpful to see what the issue is and whether or not they get stable AFRs this way. Or have you already covered that?

Jean
jbperf.com Main site . . . . . . . . . . . . . . . . . . . . . . jbperf.com Forum
Image
jsmcortina
Site Admin
Posts: 39615
Joined: Mon May 03, 2004 1:34 am
Location: Birmingham, UK
Contact:

Re: Baro fuel calculation

Post by jsmcortina »

The MAP reading looks to be taken around 20ms after power-on, so it "ought" to be ok even if you are fairly quick on the key. However, testing both ways would be handy.

James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk

My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
racingmini_mtl
Super MS/Extra'er
Posts: 9130
Joined: Sun May 02, 2004 6:51 am
Location: Quebec, Canada
Contact:

Re: Baro fuel calculation

Post by racingmini_mtl »

I just had a quick look at the MAP sensor datasheet and the warm up time is quoted at 20ms. That might be too close to what you say the code does.

Jean
jbperf.com Main site . . . . . . . . . . . . . . . . . . . . . . jbperf.com Forum
Image
Nightstalker1993
Helpful MS/Extra'er
Posts: 75
Joined: Tue Jun 03, 2014 11:09 am

Re: Baro fuel calculation

Post by Nightstalker1993 »

jsmcortina wrote:Following on from the above, but oddly independently, we've had some users (off forum) reporting inconsistent AFRs on each restart.

This appears to apply only to users with baro setting to "Initial MAP Reading" and is more apparent on installs with large injectors and a low idle pulsewidth.

We've not fully got to the bottom of this yet, but it _appears_ that in some cases that initial MAP reading is inaccurate giving a false "Barometer" reading. This then has an effect on fuelling.

That feeds in to the change discussed above where Barometer had an impact on fuel even when the baro correction curve was set to all 100s. (Beta 14 released last week disables that calculation and sets the defaults baro correction to "Off" )

I'm very keen to receive feedback from experienced users on stable installs that have "Initial MAP Reading" enabled.
a. With your existing tune and firmware please look at "Barometer" from start to start and see if it makes sense. Please datalog and post them here.

b. Compare with beta14 and "Old baro calc" set to "On"

c. Compare with beta14plus (below) and "Old baro calc" set to "On". Also observe dash gauge "Sensor 15".
This "plus" firmware has a small tweak so that baro is sampled twice and startup and the highest value used. "Sensor 15" contains the value that _would_ have been used.

The beta14plus firmware can be found here:
http://www.msextra.com/downloads/dev/ms ... ta-14plus/

Inherently the "Initial MAP Reading" concept is imperfect as there's always a risk that it will read engine vaccum instead of atmospheric pressure. However, it has been there since MS1 and we haven't removed it. If you really want baro correction then a second 1bar sensor should be used.

James
I've actually encountered that quite a number of times where after a restart the car would run pig rich and when checking the datalog it shows baro being at an unrealistic number(71kpa where i'm at sea level, for example). Will dig out my old datalogs see if I can find it. It rarely happens though, probably like 5 times out of my 1 year running ms3x. All the while I would just dismiss it and restart the engine and drive off as usual. One of the reasons why I decided to install a secondary map sensor for barometer.
Nightstalker1993
Helpful MS/Extra'er
Posts: 75
Joined: Tue Jun 03, 2014 11:09 am

Re: Baro fuel calculation

Post by Nightstalker1993 »

heres the datalog, captured by SD card and since SD card takes some time to initialise before it actually records anything, the actual cranking wasn't recorded.

September last year. Don't have anymore datalogs which caught this bug.
elaw
Super MS/Extra'er
Posts: 2926
Joined: Fri Oct 16, 2009 6:20 am
Location: Wilmington, MA

Re: Baro fuel calculation

Post by elaw »

Hey just a random thought... does the "initial MAP reading" code run when there's a sync loss?

I'm just envisioning a scenario where sync is lost during cranking, and when it regains sync it captures the MAP reading as the baro. But since at that time the engine was turning there would be vacuum in the manifold and thus the captured MAP reading would not equal barometric pressure.
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.
Post Reply