blob: 36eebf3d97cc6603603cc35c83914ab0f7ed6892 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
// divide MAF by 100 because our function return MAF*100
// but multiply by 100 for double digits precision
// divide MAF by 14.7 air/fuel ratio to have g of fuel/s
// divide by 730 (g/L at 15�C) according to Canadian Gov to have L/s
// multiply by 3600 to get litre per hour
// formula: (3600 * MAF) / (14.7 * 730 * VSS)
// = maf*0.3355/vss L/km
// mul by 100 to have L/100km
// if maf is 0 it will just output 0
if(vss<toggle_speed)
cons=(maf*3355)/10000; // L/h, do not use float so mul first then divide
else
cons=(maf*3355)/(vss*100); // L/100kmh, 100 comes from the /10000*100
|