# How is AFR calculated from ODBII readings

In another post (A most intriguing cold-start misfire mystery) I found this quote:

Mass air flow = 3.66 g/s Fuel flow = 1.27 l/h, Fuel rail pressure = 380 kPa

This indicates to me that AFR is around 14.88, close to stoich.

How is AFR calculated from these numbers? I know it's the ratio of air mass to fuel mass, but it's making the units work that I'm getting a little lost. In this case the air mass flow rate is in grams per second, and the fuel flow rate is liters per hour. Grams is a measure of mass, and liters a measure of liquid volume. Does this require knowing the density of the fuel to make the calculation?

As always thank you to @Zaid for getting me thinking.

• Remember that AFR isn't calculated from fuel flow, but from the amount of oxygen in the exhaust (measured by an O2 sensor). This will change, even for a fixed fuel flow, if you change ignition timing, valve timing, etc. w.r.t. Zaid's calculation... yes, I'd assume you'd need the density, and then you can do a simple mass ratio, but this doesn't necessarily represent actual AFRs, since the charge combustion may not be perfect (i.e. there will be unburned fuel in the exhaust, which will give a smaller lambda value). – Shamtam Apr 20 '16 at 0:22
• The original post implies that the calculation was made the rate of mass flow for air, and the volumetric measurement of fuel flow. That's why I was wondering how the calculation was done. Those numbers can be readily obtained from OBDII data which would make getting the AFR easy. And that seems really handy to have in one's toolbox. – cdunn Apr 20 '16 at 0:41
• Right. I meant to confirm that your are correct in that you'd need the density of the fuel (or of the air, I suppose). – Shamtam Apr 20 '16 at 2:00
• Not really sure how this working, taking a guess here. Would the ecu be able to figure out the mass of the fuel given the ambient temperature and engine temperature? Wondering how much if this follows a 'standard', and then uses a 'correction factor' and 'modifiers' from the various sensors. Some interesting info on the ECUs for 84-95 dodge cars. This uses a speed density system, but the calculations should be somewhat similar. thedodgegarage.com/turbo_pfi.html – rpmerf Apr 20 '16 at 12:37

Assuming that liquid fuel is incompressible, the missing piece of the puzzle here is fuel density, which is around 700 kg/m³.

So the fuel mass flow rate is as follows:

Mass flow rate = Density * Volumetric flow rate
= 700 kg/m³ * 1.27 l/h
= 0.2469 g/s ¹


Dividing the air mass flow rate by mass flow rate yields the AFR number:

AFR = air mass flow rate / fuel mass flow rate
= 3.66 g/s / 0.2469 g/s
= 14.82


(I may have mistyped 0.2469 as 0.2459 when performing the original calculation, hence the discrepancy in the result)

¹ - Calculated here

• A college professor of mine back when dinosaurs and slide rules roamed the earth, taught me that to really double check yourself on a calculation, the units must work out. I'm having real trouble with the density times volumetric flow rate units. The units for density and flow rate look right. If we multiply them we should get grams / second. What we start with is (kg)(liter) / (hour)(cubic meter). The conversion between kg and g is obvious, as is hour to second, but how does liter / cubic meter get dropped? They don't appear in the final desired units, how do they get converted out? – cdunn Apr 28 '16 at 21:10
• Given that logically it works, and the answer is right where we expect it, I'm sure the calculation is correct. I just hate when magic happens and we get what we expect. Someday there won't be a check available and I'll get the answer wrong with no understanding of why.. And I hate it when that happens.. – cdunn Apr 28 '16 at 21:13
• @cdunn I just punched it into wolframalpha.com and let it figure out the unit conversion nastiness :) – Zaid Apr 28 '16 at 21:19
• lol, Ok, I'll go figure it out, cuz it has o work out. we know it's right, so there's a conversion that make it work.. I'll post it when I find it.. – cdunn Apr 28 '16 at 21:29
• Where's my brain.. If you see it please tell it to come home, I miss it terribly. liters and cubic meters are both measures of volume. That's the root of it. I have to double check that conversion but I bet that's it. Not sure why this was not obvious to me... lol That wolframalpha.com is a very cool site btw. – cdunn Apr 28 '16 at 21:36