View Full Version : Trip computer and MPG calculation: how can it possibly know?

09-04-2006, 02:40 PM
I was thinking about this the other day, and I realized that I couldn't quite figure something out.

I know that on both the 3.8SFI (not sure about the turbo) as well as the 3800 and later engines, an option was some sort of computer display that will tell you all sorts of things like date, time, average speed, average and instantaneous fuel economy, remaining fuel, oil life, etc.

Now, on my 89 Olds with the 3800, the average fuel economy every tankful is nearly dead-on accurate, always being within 0.1 MPG of what I calculate by hand.

But how can the engine know exactly how much fuel is being used? I know that it knows what the pulse width is for each injector pulse, how many pulses occur, how fast the car is going, etc., but how does it know how much fuel is being used?

The wildcard I don't get how the computer knows about is the fuel pressure from the pressure regulator. Isn't that strictly vacuum operated? Doesn't the fuel pressure vary rather significantly, and thus the amount of fuel delivered given a pulsewidth of X?

Just wondering what I'm missing here...

09-07-2006, 04:24 AM
I have this in my '89 Reattas. Very cool, and very ahead of the times. Now this is found on just about everything.

I don't believe that anything is measuring the fuel volume. Or pressure. Pressure only swings greatly under full throttle, so there may be some extra factors calculated in. It could be estimating fuel volume based on solid known values, however. The size of the injectors is a constant. The injector on-time commanded at any given milisecond is a known, calculated value. So take those, multiply by six, and you can pretty much chart fuel flow with great accuracy. Since tank capacity is a constant, it can make good assumptions about volume used and left. And since it counts very accurate wheel revolutions from the VSS, it can tell speed accurately - provided you haven't mucked with tire height.

If you think about it, 0.1 MPG isn't that accurate. A tenth of a mile per gallon, for a car with an 18 gallon tank and a 300+ mile capacity...that's a bit of fudge factor. Still, its definitely in the ballpark.

What seems most informative are the instant MPG readings. (may not be on all the models of that era) Watch that for a bit, and you can learn to drive so you increase your mileage.

Not that anyone buys a TR looking for its wonderful gas mileage. Although it does fine on the highway compared to the V8 cars. :) Of course, the TRs don't offer this...

09-07-2006, 09:32 AM
Hmm, yeah, I guess maybe it could be doing something like looking at the TPS value versus engine RPM, and making an estimate of how much extra fuel use that might result in due to higher fuel pressure. I was just wondering if it was known for sure how the computer was doing the calculation, though I guess those who've gone through the ECM's code probably could tell about this. (while it looks very similar to the MOS 6502 assembly language I'm familiar with, I just don't have time to go through it these days!)

And while 0.1MPG inaccuracy does seem like a bit of a fudge factor, it may be that I'm the one who is inaccurate, because the tank isn't topped off to the exact same level every time. In any case, it's a clear sight better than the 89 Cougar I had, which would be off by as much as 1.5 MPG, relative to my hand calculations.

I figure also that while the TRs don't have it, there's that article about using the 86-88 3.8 ECM and MAF from the front drive cars, and I know I've seen an 86 or 87 Delta 88 in the junkyard that had the onboard computer display.

Yep, I love that instant-MPG thing, that's usually what I leave the display showing by default.

09-07-2006, 09:37 AM
Usually, it's a distance vs. fuel MASS that's being calculated.

With a simple speed density equation, you can get a precise measure of how much fuel is being used by the engine ...

So you keep a running total, convert the mass to gallons and then divide the distance by the gallons.

09-07-2006, 08:11 PM
Usually, it's a distance vs. fuel MASS that's being calculated.

With a simple speed density equation, you can get a precise measure of how much fuel is being used by the engine ...

Interesting... so is this what the ECM from the 3-code 3.8 SFI motors is actually doing? Can you elaborate a bit more on this equation, or was I thinking in the right direction?

09-08-2006, 09:58 AM
Basic operation of a speed density system:
- Using the Ideal Gas law equations and various sensors, you end up with a calculated air mass
- A MAP sensor measures the air pressure and provides he density term in "speed density". This is the "P" in the calculation.
- The RPM is used to figure out the VOLUME of air (RPM is the "speed" term in "speed density). This used in conjunction with known factors (engine displacement, cylinder filling efficiency, etc.). This provides the "V" term.
-The Intake Air Temperature Sensor measures the temperature of air entering the engine, providing the T term in the Ideal Gas Law calculation.
- R is a constant

Knowing P, V, R and T, the ECU can then calculate an estimate of n (moles of air entering motor) from sensor data and n = PV / RT.

This is roughly how it works. In practice, you use all the other various sensors (coolant temp, throttle position, etc.) to trim these calculations to real world values and to provide transitional enrichment, power enrichment, etc.

If you have a MAF, then you can directly measure the air mass.

In the end, the ECU knows exactly how much fuel it has commanded the injectors to deliver and usually has some sort of input from the speedometer that tells it distance traveled.

09-18-2006, 08:00 PM
There was a recent thread on one of the Vette boards about this. They have the controls to go with lean cruise on the Vettes, and other cars with the same engine. They also have to code to allow the direct read-out of MPG, with good accuracy. I'm not sure what they are using for display/control, but I don't think it was anything as complex as "FAST".

09-19-2006, 10:44 AM
With the more modern ECUs (say from the early 90s up P4 and Bosch controllers), they have enough speed in the data and they put a lot of it on the bus to allow an external device to make the calculations based on the data they send.

The calculations are above (and often times a lot of it is precalculated and shoved out on the bus for interpretation). This allows for "smart" instrument clusters and driver information centers (that show things like Trip meters, oil life %, MPG, time traveled, etc.). The OEM stuff is pretty cool ... and if you can talk on the bus with an external device, a lot of stuff is available!

09-19-2006, 02:01 PM
Observation, on my 88 Corvette, when I changed to FMS 24 lb injectors and BEFORE I did any tuning and changed the Inj. constant, my AVG MPG went up to 32 MPG on a long trip. I was baffled until I realized that the ECM was cutting back the PW so much due to the higher fuel flow.

As in Ken's formula's, change one of those constants, or in my case change the flow and not the constant and the calculation is off proportionately.

After tuning my BLM's back to ~128 the AVG MPG display came back in line at around 26-27 MPG on the highway.

09-24-2006, 02:22 PM
If you have a MAF, then you can directly measure the air mass.

In the end, the ECU knows exactly how much fuel it has commanded the injectors to deliver and usually has some sort of input from the speedometer that tells it distance traveled.

I'll go with this scenario, since it's simpler, and the engine in question is a MAF system anyway....

I know that the ECU knows the vehicle speed/distance traveled.

But, while the ECU knows that, given the size of injectors (say stock) that it knows it's dealing with, "X amount of fuel is delivered at Y pulsewidth when the fuel pressure is Z".

However, how does the ECU know what Z is, since the fuel pressure regulator is strictly vacuum operated? If I understand correctly (and I admit I'm sort of guessing), the engine doesn't really know how much vacuum is in the system, and thus doesn't know Z. Since that's the case, how can it determine X?

My apologies in advance if I'm neglecting something obvious. Once it gets pointed out to me, I'll be wearing my dunce cap! :confused: (ok, so maybe I should be wearing it already....)

09-25-2006, 10:01 AM
Z isn't related to the vacuum in the manifold ... the DIFFERENTIAL pressure across the injector stays the same (that's the function of the regulator). The pressure that affects the injector flow rate is:



FRP = pressure at the fuel rail (absolute)
MAP = Manifold Absolute Pressure

09-25-2006, 08:45 PM
Ok, I'm going to have to do a slow dawning of realization and go "...oooohhhhhhhhh"

Ahh . . and because the differential stays the same, the injector ALWAYS flows X amount of fuel at Y pulsewidth.

Thanks for the clarification!