40 #if EFI_ENGINE_CONTROL
44 float baseCrankingFuel;
46 baseCrankingFuel = baseFuel;
63 bool alreadyWarned =
false;
72 if (e85Mult <= 0.1f) {
122 float correction =
baroCorrection * iatCorrection * cltCorrection * postCrankingFuelCorrection;
124 #if EFI_ANTILAG_SYSTEM
128 #if EFI_LAUNCH_CONTROL
134 float runningFuel = baseFuel * correction;
152 case LM_SPEED_DENSITY:
return &
sdAirmass;
171 #if EFI_ENGINE_CONTROL
181 auto airmass = model->getAirmass(rpm,
true);
200 if (cisnan(baseFuelMass)) {
241 case IM_SIMULTANEOUS:
242 case IM_SINGLE_POINT:
258 case IM_SIMULTANEOUS: {
266 return 1.0f / cylCount;
269 case IM_SINGLE_POINT:
282 return 100 * totalInjectiorAmountPerCycle / engineCycleDuration;
288 return 100 * totalInjectiorAmountPerCycle / engineCycleDuration;
319 float injectionFuelMass = cycleFuelMass * durationMultiplier;
333 float tpsAccelPerInjection = durationMultiplier * tpsAccelEnrich;
337 return injectionFuelMass + tpsFuelMass;
385 float correction = interpolate3d(
391 if (cisnan(correction) || correction < 0.01) {
403 #if EFI_ANTILAG_SYSTEM
406 auto AlsFuelAdd = interpolate3d(
419 #if EFI_ENGINE_CONTROL
438 return idealGasLaw(cylDisplacement, 101.325f, 273.15f + 20.0f);
442 auto trimPercent = interpolate3d(
450 return (100 + trimPercent) / 100;
460 float frac = 0.01f * interpolate3d(
FuelComputer fuelComputer
LaunchControlBase launchController
RpmCalculator rpmCalculator
constexpr auto & module()
AntilagSystemBase antilagController
AirmassModelBase * mockAirmassModel
TpsAccelEnrichment tpsAccelEnrichment
floatms_t injectionDuration
floatms_t injectionDurationStage2
mass_t getCycleFuel(mass_t airmass, int rpm, float load) override
bool test(float value, float rising, float falling)
float getFuelCoefficient() const
float getLimitingFuelCorrection() const
void initTable(TValueInit(&table)[TRowNum][TColNum], const TXColumnInit(&columnBins)[TColNum], const TRowInit(&rowBins)[TRowNum])
bool isCranking() const override
uint32_t getRevolutionCounterSinceStart(void) const
virtual bool hasSensor() const
virtual SensorResult get() const =0
static float getOrZero(SensorType type)
float getAirflow(float rpm, float map, bool postState)
floatms_t getTpsEnrichment()
float interpolateClamped(float x1, float y1, float x2, float y2, float x)
LimpManager * getLimpManager()
injection_mode_e getCurrentInjectionMode()
floatms_t getEngineCycleDuration(int rpm)
bool warning(ObdCode code, const char *fmt,...)
void firmwareError(ObdCode code, const char *fmt,...)
float getCylinderFuelTrim(size_t cylinderNumber, int rpm, float fuelLoad)
static mapEstimate_Map3D_t mapEstimationTable
void initFuelMap()
Initialize fuel map data structure.
float getStage2InjectionFraction(int rpm, float load)
percent_t getFuelALSCorrection(int rpm)
float getRunningFuel(float baseFuel)
int getNumberOfInjections(injection_mode_e mode)
angle_t getCltTimingCorrection()
AirmassModelBase * getAirmassModel(engine_load_mode_e mode)
static float getCycleFuelMass(bool isCranking, float baseFuelMass)
static float getBaseFuelMass(int rpm)
static SpeedDensityAirmass sdAirmass(veMap, mapEstimationTable)
percent_t getInjectorDutyCycleStage2(int rpm)
angle_t getInjectionOffset(float rpm, float load)
static MafAirmass mafAirmass(veMap)
float getIatFuelCorrection()
percent_t getInjectorDutyCycle(int rpm)
float getCrankingFuel(float baseFuel)
float getBaroCorrection()
float getCrankingFuel3(float baseFuel, uint32_t revolutionCounterSinceStart)
static AlphaNAirmass alphaNAirmass(veMap)
float getMaxAirflowAtMap(float map)
float getCltFuelCorrection()
Engine warm-up fuel correction.
static Hysteresis stage2Hysteresis
float getStandardAirCharge()
float getInjectionModeDurationMultiplier()
float getInjectionMass(int rpm)
static CCM_OPTIONAL FunctionalSensor iat(SensorType::Iat, MS2NT(10))
static CCM_OPTIONAL FunctionalSensor clt(SensorType::Clt, MS2NT(10))
AirmassModelBase & getLuaAirmassModel()
@ CUSTOM_ERR_INVALID_INJECTION_MODE
@ OBD_Barometric_Press_Circ_Range_Perf
@ CUSTOM_ERR_ZERO_E85_MULT
@ CUSTOM_ERR_ZERO_CRANKING_FUEL
@ CUSTOM_ERR_ZERO_E0_MULT
persistent_config_s * config
engine_configuration_s * engineConfiguration
normalizedCylinderFilling("Air: Normalized cyl filling", SensorCategory.SENSOR_INPUTS, FieldType.INT, 872, 1.0, 0.0, 100.0, "%")
baroCorrection("Fuel: Barometric pressure mult", SensorCategory.SENSOR_INPUTS, FieldType.INT, 1144, 1.0, -1.0, -1.0, "")
revolutionCounterSinceStart("revolutionCounterSinceStart", SensorCategory.SENSOR_INPUTS, FieldType.INT16, 54, 1.0, 0.0, 0.0, "")
crankingFuel("crankingFuel", SensorCategory.SENSOR_INPUTS, FieldType.INT, 1128, 1.0, -1.0, -1.0, "")
mass_t idealGasLaw(float volume, float pressure, float temperature)
float getLoadOverride(float defaultLoad, load_override_e overrideMode) const
float coolantTemperatureCoefficient
float durationCoefficient
scaled_channel< uint16_t, 100, 1 > fuel
scaled_channel< int8_t, 5, 1 > table[TRIM_SIZE][TRIM_SIZE]
engine_load_mode_e fuelAlgorithm
bool enableStagedInjection
bool useRunningMathForCranking
cranking_parameters_s cranking
scaled_channel< uint16_t, 1000, 1 > displacement
load_override_e ignOverrideMode
injection_mode_e injectionMode
cranking_fuel_s crankingFuel
float normalizedCylinderFilling
float sdAirMassInOneCylinder
float totalFuelCorrection
uint16_t injectorStagingRpmBins[INJ_STAGING_COUNT]
float crankingFuelCoef[CRANKING_CURVE_SIZE]
float cltTimingExtra[CLT_TIMING_CURVE_SIZE]
uint8_t injectorStagingTable[INJ_STAGING_COUNT][INJ_STAGING_COUNT]
scaled_channel< int16_t, 10, 1 > ALSFuelAdjustment[4][4]
float baroCorrTable[BARO_CORR_SIZE][BARO_CORR_SIZE]
uint16_t injectorStagingLoadBins[INJ_STAGING_COUNT]
uint16_t mapEstimateRpmBins[FUEL_RPM_COUNT]
float baroCorrPressureBins[BARO_CORR_SIZE]
float crankingFuelBins[CRANKING_CURVE_SIZE]
float crankingCycleCoef[CRANKING_CURVE_SIZE]
float cltFuelCorrBins[CLT_CURVE_SIZE]
uint16_t fuelTrimRpmBins[TRIM_SIZE]
float crankingTpsCoef[CRANKING_CURVE_SIZE]
uint16_t injPhaseRpmBins[FUEL_RPM_COUNT]
float baroCorrRpmBins[BARO_CORR_SIZE]
float cltTimingBins[CLT_TIMING_CURVE_SIZE]
uint16_t alsFuelAdjustmentLoadBins[4]
scaled_channel< uint16_t, 100, 1 > crankingFuelCoefE100[CRANKING_CURVE_SIZE]
float iatFuelCorr[IAT_CURVE_SIZE]
scaled_channel< uint16_t, 100, 1 > mapEstimateTpsBins[FUEL_LOAD_COUNT]
float cltFuelCorr[CLT_CURVE_SIZE]
uint16_t injPhaseLoadBins[FUEL_LOAD_COUNT]
int16_t injectionPhase[FUEL_LOAD_COUNT][FUEL_RPM_COUNT]
float iatFuelCorrBins[IAT_CURVE_SIZE]
float crankingCycleBins[CRANKING_CURVE_SIZE]
uint16_t fuelTrimLoadBins[TRIM_SIZE]
uint16_t alsFuelAdjustmentrpmBins[4]
float crankingTpsBins[CRANKING_CURVE_SIZE]
scaled_channel< uint16_t, 100, 1 > mapEstimateTable[FUEL_LOAD_COUNT][FUEL_RPM_COUNT]
scaled_channel< uint16_t, 100, 1 > baseFuel
float postCrankingFuelCorrection
scaled_channel< uint16_t, 100, 1 > fuel
float intakeTemperatureCoefficient
float coolantTemperatureCoefficient
void wrapAngle(angle_t &angle, const char *msg, ObdCode code)