fuel economy calculations can be done quite a few different ways, instantaneous MPGs should always be fairly similar between all methods, but trip MPG is where things can get messed up.
the way most factory installations work is by accumulating the total amount of time the injectors are open, knowing the injector flowrate and knowing the distance traveled. distance traveled and injector on-time require accumulators, essentially they'll total up to "amount of fuel injected" and "distance traveled". in standard units, probably "gallons injected" and "miles traveled", after which only a single division operation will give you a MPG value.
the way a lot of aftermarket units calculate fuel economy is different... because OBD2 SAE requirements don't specify an accumulating injector ontime value to be available for streaming, they won't have that capability. instead, it has to be estimated knowing RPM and injector pulsewidth and a guess at injector flowrate. another method is using calculated airflow and target AFR to guess at fuel flow. neither of these methods work very well for trip numbers without significant tweaking.
__________________
|