# Thread: Calculating MPG from VSS and MAF from OBD2

1. I'd say probably, as a diesel engine pushes more fuel for more power, rather than more air, and dosent try to obtain a stoimetric air/fuel ratio of 14.7:1.

However, because your fuel usage is directly affected by your throttle position, perhaps there is a way to figure it out that way?

2. I think Scangauge is reading this values

0C - RPM
05 - Engine coolant temp
0B - MAP
0F - Intake air temp

But how to calculate this to get MPG etc. ?

/pwb

as many have posted already, the formulas given here are for stoichiometric fuel ratios. Unfortunately, modern cars don't run at stoichiometric fuel ratios. They run as lean as possible, just on the cusp of lean missing when cruising. They run rich anywhere from half-throttle to WOT. They automatically compensate for sub-standard fuels and fuel additives that affect octane.

My suggestion is, use the formula for calculating stoichiometric fuel consumption, but use the LTFT (Long Term Fuel Trim) to find what the vehicle is actually using. LTFT is given in +/- % (percentage). An example of the formula to use is

MPG = (14.7 * (1 + LTFT/100) * 6.17 * 454 * VSS * 0.621371) / (3600 * MAF / 100)
MPG = 710.7 * VSS / MAF * (1 + LTFT/100)

This formula uses the car's fuel trim value to compensate for the difference in actual AFR and stoichiometric AFR, however I'm not 100% sure that the LTFT value is % difference from stoichiometric. If anybody has any ideas as to how correct my thoughts are, please respond.

I just wanted to chime in and let you know that LTFT can't be used to adjust for the ECU changing it's target AF ratio. The LTFT is not an indication of a different AF ratio, it's an adjustment made because the ECU learned through the STFT that more or less fuel is needed for a given rpm/load point. The LTFT is a percentage of fuel removed from the expected amount required.

For example, I have a 2000 subaru impreza 2.5RS. I've put in a mild set of aftermarket cams. As a result, vacuum at idle is much lower than what the ECU was pre-programmed to expect. The STFT was pulling -25% fuel at idle while the LTFT was still at 0. Over time, the LTFT adjusted from 0%, to -25% and now the STFT hovers betwen +- 5%.

so.. the LTFT helps the ECU achieve it's target AF ratio by remembering and learning wha the STFT has found while driving. But, at no point was the target AF ratio ever known. The idle target AF could have been as lean as 18:1 in my car. No way to know from the LTFT calculation.

P.S. On a side note, your MPG formula has helped me out tremendously! I've implemented it in a program that I'm writing for OBD2 (and other protocols) display.
http://jdash.ludicrous-speed.com/for....php?f=11&t=63

Shane.

4. ## MPG Calculations

What if you do not have MAF sensor to calc from? I have a honda Civic 1999 with no MAF sensor readout but it has Air Pressure. Would I be SOL?

5. Originally Posted by Takiyon
What if you do not have MAF sensor to calc from? I have a honda Civic 1999 with no MAF sensor readout but it has Air Pressure. Would I be SOL?
Perhaps not.. My 2000 Subaru Impreza also does not have a MAF sensor, but the ECU returns an accurate MAF value. I guess it calculates it based on the other parameters, and generates a virtual MAF signal. So, if your car does the same, you'll be good to go.

6. unless you car is carbureted there's a measurement of airflow somewhere. some systems calculate the airflow based on air intake velocity/density/temperature, etc.

http://www.ktarry.com/pub/techhtm/air_metering.htm

7. Originally Posted by Takiyon
What if you do not have MAF sensor to calc from? I have a honda Civic 1999 with no MAF sensor readout but it has Air Pressure. Would I be SOL?
I know many Chryslers use MAP sensors and do not supply a MAF reading for OBD requests. There are corporate PIDs for Chrysler MAF, but here is a method for doing MPG without a MAF sensor. It is not as accurate, but it is OK. You will need to calculate a Pseudo MAF.

MAP:
MPG=((AirFuel*FuelDensityPounds*GramsPerPound*Spee dMPH))/((3600*MAF/100)))
AirFuel=14.7
Fuel Density=6
GramsPerPound=454
SpeedMPH=VSS(KPH)*.621371
3600=seconds to hours conversion

MAF=(MAP/IAT)*(MM/R)*(RPM/60)*(EngDisp/2)*VE
MAP=Manifold Absolute Pressure from vehicle per J1979
IAT(K)=IAT(C) from vehicle per J1979 +273
MM=Molecular mass of air 28.97 g/mol
R=Universal air constant 8.314 J/K/mol
RPM= Revolutions per minute from vehicle per J1979
EngDisp=Engine displacement in liters
VE=Volumetric efficiency

It's up to you to determine your VE as it varies across the powerband, but you can assume it is one value.

8. disregard

9. Originally Posted by split63
With regard to working with a MAP sensor and having no MAF sensor. One post had a rough conversion between MAP and MAF as:
Engine Mass Airflow= RPM * ( MAP/Temp)
Fuel Mass = Engine Mass Airflow / Stoichiometric Ratio

IMAP = RPM * MAP / IAT (Same as above)
MAF = (IMAP/120)*(VE/100)*(ED)*(MM)/(R)
Where,
R is 8.314 J/°K/mole = universal gas constant
MM is molecular mass or 28.97 g/mole
ED = engine displacement in liters
VE = Volumetric displacement

Equating the two approaches, MAF= (IMAP/120)*(VE/100)*(ED)*(MM)/(R) = Engine Mass Airflow / Stoichiometric Ratio
where IMAP = Engine Mass Airflow

Reducing:
1/Stoichiometric Ratio = (1/120)*(VE/100)*(ED)*(MM)/(R)

or Stoichiometric Ratio =(120 * 100* R) / (VE * ED * MM)

I'm at a lost to understand how the terms on the right equate to the Stoichiometric ratio, even roughly.

Assuming the more complex equation is correct/accurate, it can be reduced to MAF = RPM * (MAP/TEMP) * X

Where X is a contant comprised of the constants R, MM, ED, and VE
If this is the case, then X can be approximated and then scaled by actual mileage results. In which case, the value of VE and displacement are not important. However, I believe VE is reduced with RPM, so it would seem that a scaling factor is needed based on RPM and I'm not sure there is an easy way to generate this scale factor.
The two equations should not be equated. You use MAP to generate a pseudo MAF. That pseudo MAF is then used in the "generic" MPG equation.

MAF= (IMAP/120)*(VE/100)*(ED)*(MM)/(R)

MPG= Engine Mass Airflow / Stoichiometric Ratio

Note: I just corrected your approach. I did not check you numbers.

10. does anyone have and code or binaries they want to post that will work with an elm on windows?

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•