# Speed Density

## Algorithm

The MAP sensor is sampled crank-synchronously at fixed angles, five times per cycle, at 10bit precision, making the resolution 0.005V or 0.4kPa with a 400kPa sensor

## VE Table

This table shows how much air is in the cylinder at a given pressure. A few tricks have been done to have very high resolution in 8 bit mode:

• The table values are shifted by "VE Addend"
• The table values are multiplied by a factor named "VE multiplier"
• The VE multiplier is calculated using an exponent and a mantissa.

Tuning this table goes as follows:

• Make sure your injectors and injector deadtimes are set at least semi-correctly, or this table will look all sorts of messed up.
• Log REQ_AFR and compare it to actual AFR. Modify this table so that they match.
• As a sanity check, consider that at idle with consumers switched off, you should have roughly 18-21 LOAD if you are not running wild cams. Most setups will never need to alter anything but the VE table itself.
• If you run out of room at the low end (values at 0 and still too rich), but you still have room on top (for example max value is 200), subtract a number from VE Addend, and add it to the entire table. Now the result is the same as before, but you have more room to tune. Do the same if you run out of room at the top end, but have room at the bottom end.
• If you run out of dynamic range, meaning both the top end and bottom end - you can multiply up the VE multiplier and divide the VE addend and the entire table by the number you multiplied the multiplier by. Also works into the opposite direction if you find that you have way too much range and not enough precision.

## IAT correction

This is a multiplicative factor, that is needed to correct for the density of air due to the ideal gas law, the axis is IAT.
It's general shape is governed by PV = nRT, but some of it is empirical as well, due to the location of the sensor and heatsoak.