alphan
This commit is contained in:
parent
01b9272867
commit
8f27fc8b53
|
@ -595,6 +595,8 @@ case LM_REAL_MAF:
|
|||
return "LM_REAL_MAF";
|
||||
case LM_SPEED_DENSITY:
|
||||
return "LM_SPEED_DENSITY";
|
||||
case LM_ALPHA_N_2:
|
||||
return "LM_ALPHA_N_2";
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
#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
|
||||
);
|
||||
|
||||
return {
|
||||
airmass,
|
||||
tps.Value
|
||||
};
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
#include "speed_density_base.h"
|
||||
|
||||
class AlphaNAirmass : public SpeedDensityBase {
|
||||
public:
|
||||
AlphaNAirmass(const ValueProvider3D& veTable) : SpeedDensityBase(veTable) {}
|
||||
|
||||
AirmassResult getAirmass(int rpm) override;
|
||||
};
|
|
@ -12,6 +12,7 @@ CONTROLLERS_ALGO_SRC_CPP = $(PROJECT_DIR)/controllers/algo/advance_map.cpp \
|
|||
$(PROJECT_DIR)/controllers/gauges/lcd_menu_tree.cpp \
|
||||
$(PROJECT_DIR)/controllers/algo/event_registry.cpp \
|
||||
$(PROJECT_DIR)/controllers/algo/airmass/airmass.cpp \
|
||||
$(PROJECT_DIR)/controllers/algo/airmass/alphan_airmass.cpp \
|
||||
$(PROJECT_DIR)/controllers/algo/airmass/maf_airmass.cpp \
|
||||
$(PROJECT_DIR)/controllers/algo/airmass/speed_density_airmass.cpp \
|
||||
$(PROJECT_DIR)/controllers/algo/airmass/speed_density_base.cpp \
|
||||
|
|
|
@ -733,6 +733,8 @@ case LM_REAL_MAF:
|
|||
return "LM_REAL_MAF";
|
||||
case LM_SPEED_DENSITY:
|
||||
return "LM_SPEED_DENSITY";
|
||||
case LM_ALPHA_N_2:
|
||||
return "LM_ALPHA_N_2";
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include "global.h"
|
||||
#include "airmass.h"
|
||||
#include "alphan_airmass.h"
|
||||
#include "maf_airmass.h"
|
||||
#include "speed_density_airmass.h"
|
||||
#include "fuel_math.h"
|
||||
|
@ -171,11 +172,13 @@ float getInjectionDurationForAirmass(float airMass, float afr DECLARE_ENGINE_PAR
|
|||
|
||||
static SpeedDensityAirmass sdAirmass(veMap);
|
||||
static MafAirmass mafAirmass(veMap);
|
||||
static AlphaNAirmass alphaNAirmass(veMap);
|
||||
|
||||
AirmassModelBase* getAirmassModel(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
switch (CONFIG(fuelAlgorithm)) {
|
||||
case LM_SPEED_DENSITY: return &sdAirmass;
|
||||
case LM_REAL_MAF: return &mafAirmass;
|
||||
case LM_ALPHA_N_2: return &alphaNAirmass;
|
||||
default: return nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -193,7 +196,9 @@ floatms_t getBaseFuel(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
|
||||
floatms_t baseFuel;
|
||||
|
||||
if ((CONFIG(fuelAlgorithm) == LM_SPEED_DENSITY) || (engineConfiguration->fuelAlgorithm == LM_REAL_MAF)) {
|
||||
if ((CONFIG(fuelAlgorithm) == LM_SPEED_DENSITY) ||
|
||||
(engineConfiguration->fuelAlgorithm == LM_REAL_MAF) ||
|
||||
(engineConfiguration->fuelAlgorithm == LM_ALPHA_N_2)) {
|
||||
// airmass modes - get airmass first, then convert to fuel
|
||||
auto model = getAirmassModel(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
efiAssert(CUSTOM_ERR_ASSERT, model != nullptr, "Invalid airmass mode", 0.0f);
|
||||
|
|
|
@ -443,6 +443,9 @@ typedef enum {
|
|||
*/
|
||||
LM_REAL_MAF = 4,
|
||||
|
||||
// todo: rename after LM_ALPHA_N is removed
|
||||
LM_ALPHA_N_2 = 5,
|
||||
|
||||
Force_4_bytes_size_engine_load_mode = ENUM_32_BITS,
|
||||
} engine_load_mode_e;
|
||||
|
||||
|
|
|
@ -75,6 +75,7 @@ float getEngineLoadT(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
case LM_SPEED_DENSITY:
|
||||
return getMap(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
case LM_ALPHA_N:
|
||||
case LM_ALPHA_N_2:
|
||||
return Sensor::get(SensorType::Tps1).value_or(0);
|
||||
case LM_REAL_MAF:
|
||||
return getRealMaf(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
|
|
@ -457,7 +457,7 @@ int sensorSnifferRpmThreshold;+Disable sensor sniffer above this rpm;"RPM",
|
|||
int rpmHardLimit;set rpm_hard_limit X;"rpm", 1, 0, 0, 20000.0, 2
|
||||
|
||||
|
||||
#define engine_load_mode_e_enum "MAF", "Alpha-N/TPS", "INVALID", "SPEED DENSITY", "MAF Air Charge", "INVALID", "INVALID"
|
||||
#define engine_load_mode_e_enum "MAF", "Alpha-N/TPS", "INVALID", "SPEED DENSITY", "MAF Air Charge", "Alpha-N", "INVALID"
|
||||
|
||||
|
||||
custom engine_load_mode_e 4 bits, U32, @OFFSET@, [0:2], @@engine_load_mode_e_enum@@
|
||||
|
|
Loading…
Reference in New Issue