Skip to content

Instantly share code, notes, and snippets.

@brandonros
Last active August 3, 2020 02:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brandonros/172b33f92bac2af840dd4ae14e4b026a to your computer and use it in GitHub Desktop.
Save brandonros/172b33f92bac2af840dd4ae14e4b026a to your computer and use it in GitHub Desktop.
VE (volumetric efficiency) calculator
// from https://atgtraining.com/atg-volumetric-efficiency-calculator/
const calculateVe = ({engineSize, rpm, maf, iat, cylinder, pressuure, mafSelection, iatSelection, pressureSelection}) => {
let val = 0, cid = 0, lb = 0, degc = 0, degf = 0, tempK = 0, v = 0, molorMass = 0.28705, gb_air_vol = 0, gsec = 0;
let gb_theo_air_vol = 0, lMin = 0, estv = 0, load = 0, cylAir = 0, refCylAir = 0, estGross = 0, estRWHP = 0;
cid = engineSize / 0.0163871;
if (mafSelection == 0) { // g/sec
lb = maf * 0.00220462 * 60;
} else { // lb/min
gsec = maf / (0.00220462 * 60);
maf = gsec;
lb = gsec * 0.00220462 * 60;
}
if (iatSelection == 0) { // fahrenheit
degc = (iat - 32) * 5 / 9;
} else { // celsius
degf = iat * 9 / 5 + 32;
degc = (degf - 32) * 5 / 9;
}
tempK = degc + 273.15;
degc = (degc).toFixed(2);
tempK = (tempK).toFixed(2);
if (pressureSelection == 0) { // kPa
} else { // in/hg
pressuure = pressuure / 0.2953;
}
v = (maf * tempK * 0.28705) / pressuure;
gb_air_vol = v * 60;
gb_theo_air_vol = engineSize * rpm / 2;
estv = (gb_air_vol / gb_theo_air_vol) * 100;
cylAir = maf * 120 / (rpm * cylinder);
refCylAir = engineSize * 1.168 / cylinder;
estGross = lb * 10;
estRWHP = estGross * 0.85;
load = (cylAir / refCylAir) * 100;
return {
cylAir,
refCylAir,
estGross,
estRWHP,
estv,
load
}
}
console.log(calculateVe({
// constant
engineSize: parseFloat('4.0'), // liters
cylinder: parseInt('8'),
// unit selections
mafSelection: 0,
iatSelection: 0,
pressureSelection: 0,
// variables
rpm: parseInt('6500'), // rpm
maf: parseFloat('145.00'), // g/sec
iat: parseInt('100'), // fahrenheit
pressuure: parseFloat('101.325'), // kaPa
}))
@brandonros
Copy link
Author

AFR below 10: too rich; can seriously foul spark plugs and eventually wash the oil off cylinder walls
AFR above 13: too lean; run too hot

@brandonros
Copy link
Author

In terms of air/fuel ratio, pump gas is usually around 12.5:1 for maximum power and you add fuel with boost for safety. 10.5 or 11 isn't uncommon on boosted engines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment