rusefi-1/firmware/controllers/algo/airmass/alphan_airmass.cpp

28 lines
653 B
C++
Raw Normal View History

2020-07-25 01:14:35 -07:00
#include "alphan_airmass.h"
#include "sensor.h"
AirmassResult AlphaNAirmass::getAirmass(int rpm) {
auto tps = Sensor::get(SensorType::Tps1);
if (!tps.Valid) {
// We are fully reliant on TPS - if the TPS fails, stop the engine.
return {};
}
// In this case, VE directly describes the cylinder filling relative to the ideal
float ve = getVe(rpm, tps.Value);
// TODO: should this be barometric pressure and/or temperature compensated?
float airmass = getAirmassImpl(
ve / 100.0f,
101.325f, // std atmosphere pressure
273.0f + 20.0f // std atmosphere pressure
2020-07-25 02:05:33 -07:00
PASS_ENGINE_PARAMETER_SUFFIX
2020-07-25 01:14:35 -07:00
);
return {
airmass,
tps.Value
};
}