I pulled this copy paste from a MegaSquirt site. Wich does lead me a bit closer to making a MAP to MAF signal converter
The Ideal Gas Law
You might remember from high school physics classes that an ideal gas (which air is reasonably close to) obeys the relationship:
PV = nRT
Where:
P = pressure,
V = volume,
n = number of moles (which is related to the mass of the gas, i.e. 1 mol = 6.023x1023 molecules of the gas, and n = mass (in grams)/molar mass(MM)),
R = the ideal gas constant,
and T = the absolute temperature.
What does this have to do with fuel injection? In order to know how much fuel to inject, we need to know how much air is going into the engine so the chemically correct mixture (called “stoichiometric”) can be achieved. So for a fuel injected engine, we use sensors to determine the pressure in the intake manifold and the air temperature. However, the temperature in this equation is “absolute temperature” measured in Kelvins which is equal to degrees Celsius + 273º.
The volumetric efficiency (VE) is a percentage that tells us the pressure inside the cylinder versus the pressure in the manifold. We know the volume (V) from the displacement of the engine. Thus we can calculate the mass of air (M) in the cylinder (proportional to n) from
n = PV/RT
=> M = n x MM = PV/RT x MM
= (VE * MAP * CYL_DISP) / (R * (IAT-32) * 5/9 + 273)) x MMair
Since:
P = VE * MAP (i.e. the pressure in the cylinder in kPa),
V = CYL_DISP = the displacement of one cylinder (in liters),
R = 8.3143510 J/mol K,
and T = (IAT-32)* 5/9 + 273 to convert IAT from ºFahrenheit to Kelvin.
Note that we can combine the constants R and MMair into one, and we will ignore them from this point on since they can be hard-coded into the assembly language code and neglected after that.