Quick maths/logic proof check needed for engine air intake
Discussion
Via OBDII I can read off SAE values for things.
One value is MassAirFlow (MAF) in grams per second.
Internally my ECU uses milligrams/stroke for a limiter map.
So I want to convert g/s > mg/stroke
//test inputs
var vGramPerSecond = 100
var vRpm = 2000
//few engine details
var vStroke = 4
var vCylinderCount = 4
var vIntakeStrokePerRot = (vStroke/2) * vCylinderCount
var vRotPerSecond = vRpm / 60
var vIntakeStrokePerSecond = vRotPerSecond * vIntakeStrokePerRot
var vGramPerIntakeStroke = vGramPerSecond / vIntakeStrokePerSecond
var vmGramPerIntakeStroke = vGramPerIntakeStroke * 1000
vmGramPerIntakeStroke = what I want
Will test it tomorrow on the way to work, but just curious if anyone can spot any glaring errors... probably in and around the intake strokes conversion.
Thanks for any feedback.
Dave
One value is MassAirFlow (MAF) in grams per second.
Internally my ECU uses milligrams/stroke for a limiter map.
So I want to convert g/s > mg/stroke
//test inputs
var vGramPerSecond = 100
var vRpm = 2000
//few engine details
var vStroke = 4
var vCylinderCount = 4
var vIntakeStrokePerRot = (vStroke/2) * vCylinderCount
var vRotPerSecond = vRpm / 60
var vIntakeStrokePerSecond = vRotPerSecond * vIntakeStrokePerRot
var vGramPerIntakeStroke = vGramPerSecond / vIntakeStrokePerSecond
var vmGramPerIntakeStroke = vGramPerIntakeStroke * 1000
vmGramPerIntakeStroke = what I want

Will test it tomorrow on the way to work, but just curious if anyone can spot any glaring errors... probably in and around the intake strokes conversion.
Thanks for any feedback.
Dave
Mr Whippy said:
Via OBDII I can read off SAE values for things.
One value is MassAirFlow (MAF) in grams per second.
Internally my ECU uses milligrams/stroke for a limiter map.
So I want to convert g/s > mg/stroke
//test inputs
var vGramPerSecond = 100
var vRpm = 2000
//few engine details
var vStroke = 4
var vCylinderCount = 4
var vIntakeStrokePerRot = (vStroke/2) * vCylinderCount
var vRotPerSecond = vRpm / 60
var vIntakeStrokePerSecond = vRotPerSecond * vIntakeStrokePerRot
var vGramPerIntakeStroke = vGramPerSecond / vIntakeStrokePerSecond
var vmGramPerIntakeStroke = vGramPerIntakeStroke * 1000
vmGramPerIntakeStroke = what I want
Will test it tomorrow on the way to work, but just curious if anyone can spot any glaring errors... probably in and around the intake strokes conversion.
Thanks for any feedback.
Dave
Should work fine.One value is MassAirFlow (MAF) in grams per second.
Internally my ECU uses milligrams/stroke for a limiter map.
So I want to convert g/s > mg/stroke
//test inputs
var vGramPerSecond = 100
var vRpm = 2000
//few engine details
var vStroke = 4
var vCylinderCount = 4
var vIntakeStrokePerRot = (vStroke/2) * vCylinderCount
var vRotPerSecond = vRpm / 60
var vIntakeStrokePerSecond = vRotPerSecond * vIntakeStrokePerRot
var vGramPerIntakeStroke = vGramPerSecond / vIntakeStrokePerSecond
var vmGramPerIntakeStroke = vGramPerIntakeStroke * 1000
vmGramPerIntakeStroke = what I want

Will test it tomorrow on the way to work, but just curious if anyone can spot any glaring errors... probably in and around the intake strokes conversion.
Thanks for any feedback.
Dave
Hehe, well the values looked a bit low...
Problem is the MAF internal values are things like mg/R or mg/stroke, so it's working out what they mean by stroke or R...
I've altered the piston count to 1, so it's measuring actual full crank revolutions and the numbers are making more sense now to what I expect.
I'll have to proof it somehow though, by limiting the output of the engine at a specific rpm and MAF on the associated map, and check to see where the output drops (view rate of change of speed) vs the MAF output I have generated, and see if they intersect
All very fun though, just making my brain hurt, the hardest part is knowing what data you want and how to collect it the best way
Dave
Problem is the MAF internal values are things like mg/R or mg/stroke, so it's working out what they mean by stroke or R...
I've altered the piston count to 1, so it's measuring actual full crank revolutions and the numbers are making more sense now to what I expect.
I'll have to proof it somehow though, by limiting the output of the engine at a specific rpm and MAF on the associated map, and check to see where the output drops (view rate of change of speed) vs the MAF output I have generated, and see if they intersect

All very fun though, just making my brain hurt, the hardest part is knowing what data you want and how to collect it the best way

Dave
Gassing Station | Engines & Drivetrain | Top of Page | What's New | My Stuff