rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
alphan_airmass.cpp
Go to the documentation of this file.
1#include "pch.h"
2
3#include "alphan_airmass.h"
4#include "fuel_math.h"
5
6AirmassResult AlphaNAirmass::getAirmass(float rpm, bool postState) {
8
9 if (!tps.Valid) {
10 // We are fully reliant on TPS - if the TPS fails, stop the engine.
11 return {};
12 }
13
14 // In this case, VE directly describes the cylinder filling relative to the ideal
15 float ve = getVe(rpm, tps.Value, postState);
16
17 // optionally use real IAT instead of fixed air temperature
18 constexpr float standardIat = STD_IAT; // std atmosphere temperature
20 ? Sensor::get(SensorType::Iat).value_or(standardIat)
21 : standardIat;
22
23 float iatK = iat + 273/* todo reuse C_K_OFFSET which would require adjusting unit tests*/;
24
25 // TODO: should this be barometric pressure and/or temperature compensated?
26 mass_t airmass = getAirmassImpl(
27 ve,
28 STD_ATMOSPHERE,
29 iatK
30 );
31
32 return {
33 airmass,
34 tps.Value
35 };
36}
float getVe(float rpm, percent_t load, bool postState) const
Definition airmass.cpp:17
AirmassResult getAirmass(float rpm, bool postState) override
virtual SensorResult get() const =0
static mass_t getAirmassImpl(float ve, float manifoldPressure, float temperature)
static constexpr engine_configuration_s * engineConfiguration
static CCM_OPTIONAL FunctionalSensor iat(SensorType::Iat, MS2NT(10))