Thread: Calculating MPG from VSS and MAF from OBD2

1. Calculating MPG using speed and air flow from OBDII readout

Hi, I'd like to add instantaneous fuel efficiency (MPG - miles per gallon) to OBD Gauge for Palm. I've only been able to find a single mention of how to calculate this from an article at Circuit Cellar http://www.circuitcellar.com/adverti...ghtner-183.pdf .

There, Bruce Lightner gives the formula:

MPG = (14.7 * 6.17 * 4.54 * VSS * 0.621371) / (3600 * MAF / 100)
= 710.7 * VSS / MAF

MPG - miles per gallon
14.7 grams of air to 1 gram of gasoline - ideal air/fuel ratio
6.17 pounds per gallon - density of gasoline
4.54 grams per pound - conversion
VSS - vehicle speed in kilometers per hour
0.621371 miles per hour/kilometers per hour - conversion
3600 seconds per hour - conversion
MAF - mass air flow rate in 100 grams per second
100 - to correct MAF to give grams per second

Is this what other software uses to calculate MPG? Are there other methods?

I just got my OBD2 All-In-One yesterday, and have just started playing around with it and OBD Gauge. I'm going to try and add the above formula to OBD Gauge and see what it gives. I'd really appreciate any info. Thanks

2. The software that came with the OBD reader I have, has some formulas for computing various things from the codes. One of which is instantaneous MPG, as follows:

instantaneous Distance D = VSS * t/3600
instantaneous Fuel F = 1 / (14.75 * 6.26) * MAF * t/60
instantaneous MPG = D / F

t is delta time.

So other than the conversion constants being slightly different, I would say your formula looks good.

3. so you can get accurate readings out of this?

When I replace my current Dell Axim, I'm consdiering using it as a GPS/OBD tool.

4. I haven't the slightest clue about how reliable this method is, that's what I hope to find out.

Unfortunately, my 98 Civic does not have a MAF sensor! However, hopefuly there can be another way. Right now I'm looking at PID \$04, Calculated Load Value (CLV), defined as:

CLV = [current airflow] / [(peak airflow at WOT@STP as a function of rpm) * (BARO/29.92) * SQRT(298/(AAT+273))]

There's airflow! As for the other variables:
peak airflow: dunno what this value is
WOT = wide open throttle
STP = standard temperature and pressure (25C, 29.92inHg)
BARO = barometric pressure (maybe same as manifold air pressure MAP ?)
AAT = ambient air temperature

As you can see, the last two terms correct for temperature and pressure. If BARO happens to be from the MAP sensor, then we've got that. If AAT happens to be intake air temperature (IAT), then we've got that. Even if we don't have these values, the result won't be changed by a great deal.

Peak airflow is trickier. The easy and completely inaccurate route to get peak airflow would be to just multiply the engine displacement by RPM (divided by 2, since it takes two revolutions in a 4-stroke engine). However this assumes 100% volumetric efficiency (VE), which is generally not the case. We'd need the map of VE to RPMs, which of course the ECU happily holds within its silicon.

So we're missing a few crucial things. Perhaps we could at least get some value that's proportional to MPG. I'll try some things out.

Anyone else here have any ideas?

5. Just saw this on Digg the other day...

Fueling a Lifestyle

In particular:

Understanding the Engine

Internal combustion engines are often called aspirated engines because they are "air-breathing" machines. These engines burn a combination of air and fuel mixed at the stoichiometric ratio 14.7 to 1.17 In the past, fuel and air were mixed in the carburetor, relying on the venturi effect of the pipework to render the fuel into an aerosol.18 Modern systems rely on fuel injection, a process governed by the car's engine computer unit (ECU).19 A variety of sensors feed into the ECU providing real-time information so the computer can manipulate engine performance for optimal emissions. The ECU can regulate fuel flow precisely to match air intake or even adjust the spark timing for various RPM and engine loads.

A rough approximation of fuel use can be made through calculations on engine sensor data. Estimates on fuel consumption will be approximately equal to dividing the amount of airflow through the engine by 14.7, the stoichiometric ratio.20 Engine mass airflow may be determined either with an MAF (Mass Air Flow) sensor or through calculations on the MAP (Manifold Absolute Pressure) sensor.

(in case the server goes down, the equations in the image are:

Engine Mass Airflow = RPM * (Manifold Air Pressure / Absolute Temperature)

Fuel Mass = Engine Mass Airflow / Stoichiometric Ratio
)

Varying Speed

Using these equations, I can compare the fuel requirements for different driving speeds. To collect the necessary data, I configured the DigiMoto software to log data on the engine's RPM, intake temperature and manifold pressure. For the tests, I drove the Jeep at 45, 55, 65 and 75mph along the same stretch of Riverwatch Parkway. To ensure consistency, logging only took place after the appropriate speed was reached and locked into with cruise control.21 During the drive, the windows were left up for consistent aerodynamics and the air conditioning was left off to eliminate extra engine variables. The engine intake added approximately 13° of heat to the ambient air temperature resulting in 103° Fahrenheit (312.5° Kelvin).
So there you have it. I also have a Honda Civic and was wondering how you would calculate instant MPG when you don't have an MAF sensor. From the equation above it looks like you use the RPM, MAP, and intake air temperatures instead. I haven't taken my laptop, OBD-II reader, and car out for a spin yet to test it out but it should give everyone a start...

I'd recommend reading the entire article - it was very interesting. This guy did his research.

6. This formula
Fuel Mass = Engine Mass Airflow / Stoichiometric Ratio
and also Bruce Lightner's formula, assumes a perfect stoichiometric combustion of typical gasoline.
It will give reasonable values most of the time.
The results may differ from the correct ones due to:
1. Some (defective) engines may not have a perfectly Stoichiometric tuning.
2. Some gasoline may have different octane grade and modern cars will automatically tune the mixture ratio.
3. In the warm-up and during throttle change, the combustion is not stoichiometric.

Problems 1. and 3. can be corrected if we have access to the Lambda factor, measured from the exhaust gas:

Fuel Mass = Engine Mass Airflow / (Stoichiometric Ratio*Lambda)

I still dont know how to correct problem 2. Any ideas?

A note on Diesel engines:
A Diesel engine does not use stoichiometric combustion.
So, a reasonable approach of the fuel mass can only be achieved with the Lambda correction and the value of 14.5 for the Stoichiometric Ratio.
The density of Diesel fuel is 7.03 lbs/gal.

JML

7. There are 454 grams per pound, not 4.54.

8. Originally Posted by JML
2. Some gasoline may have different octane grade and modern cars will automatically tune the mixture ratio.

Fuel Mass = Engine Mass Airflow / (Stoichiometric Ratio*Lambda)

JML
The lambda sensors are used to compensate for the varying grades of gasoline (well, they compensate for everything and only look at the composition of the exhaust gases). I suspect your correction calculation would be close enough.

9. Let's Get the MPG Formula Right!

Originally Posted by maeliosa
Hi, I'd like to add instantaneous fuel efficiency (MPG - miles per gallon) to OBD Gauge for Palm. I've only been able to find a single mention of how to calculate this from an article at Circuit Cellar http://www.circuitcellar.com/adverti...ghtner-183.pdf .

There, Bruce Lightner gives the formula:

MPG = (14.7 * 6.17 * 4.54 * VSS * 0.621371) / (3600 * MAF / 100)
= 710.7 * VSS / MAF

MPG - miles per gallon
14.7 grams of air to 1 gram of gasoline - ideal air/fuel ratio
6.17 pounds per gallon - density of gasoline
4.54 grams per pound - conversion
VSS - vehicle speed in kilometers per hour
0.621371 miles per hour/kilometers per hour - conversion
3600 seconds per hour - conversion
MAF - mass air flow rate in 100 grams per second
100 - to correct MAF to give grams per second

Is this what other software uses to calculate MPG? Are there other methods?

I just got my OBD2 All-In-One yesterday, and have just started playing around with it and OBD Gauge. I'm going to try and add the above formula to OBD Gauge and see what it gives. I'd really appreciate any info. Thanks
For the record, the first "one-line" MPG formula above, taken from my Circuit Cellar article, is off by 100! The "4.54" should in fact be "454". The correct formula is:

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

Note that OBD-II VSS reading is in kilometers/hour and MAF reading is grams/sec times 100.

This formula works very well in a modern automobile because the engine computer spends almost 100% of its time managing the fuel-air-ratio to 14.7, which it can do very well because of the "closed loop" feedback from the O2 sensor(s).

In fact, the accuracy of this method has been proven in literally tens of thousands of gasoline-powered vehicles. Accuracy within a few percent is typical, often limited by the accuracy of the vehicle speed reading (i.e., VSS).

As for other ways of doing this, especially if you don't have a MAF sensor, by knowing the displacement of the engine, and after a simple "calibration" using fuel tank "fill-up" data to find the only unknown, namely the "volumetric efficiency" (VE) of the engine, MAF can be calculated from RPM, MAP and IAT. With VE, one can use the following formulas to calculate a synthetic "mass air-flow" (MAF) in grams per second, all without a MAF sensor, using the "Ideal Gas Law", as follows:

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

where manifold absolute pressure (MAP) is in kPa, intake air temp (IAT) is in degrees Kelvin, R is 8.314 J/°K/mole and the average molecular mass of air (MM) is 28.97 g/mole. Note that, in the above formula, the volumetric efficiency of the (4-cycle!) engine is measured in percent and the engine displacement (ED) is in liters.

The VE of my 1999 7.4L Chevy Suburban is about 65%. Smaller, higher performance engines can have VE's of 85% or higher.

Best regards,

Bruce D. Lightner
[email protected]
http://www.lightner.net/lightner/bruce/

10. I would suggest trying to use injector pulse width instead if it is available. Not all engines run at stoich all the time. For instance, some of the lean-burn Civics run closer to 17:1 when cruising. Also, when you floor it and your car goes into open loop, you may be running closer 12:1 to keep from popping your motor. Or before your car is warmed up in the winter, it is probably running open-loop. Wiring in a wide-band O2 sensor to accurately read the A/F ratio in realtime in conjunction with your MAF readings would be more accurate than just assuming you are running at stoich.

Page 1 of 13 1234567891011 ... Last

Posting Permissions

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