40 #if EFI_ENGINE_CONTROL
44 float baseCrankingFuel;
46 baseCrankingFuel = baseFuel;
66 bool alreadyWarned =
false;
75 if (e85Mult <= 0.1f) {
125 float correction =
baroCorrection * iatCorrection * cltCorrection * postCrankingFuelCorrection;
127 #if EFI_ANTILAG_SYSTEM
131 #if EFI_LAUNCH_CONTROL
137 float runningFuel = baseFuel * correction;
155 case LM_SPEED_DENSITY:
return &
sdAirmass;
174 #if EFI_ENGINE_CONTROL
184 auto airmass = model->getAirmass(rpm,
true);
203 if (std::isnan(baseFuelMass)) {
212 if (std::isnan(rpm)) {
216 if (std::isnan(load)) {
226 if (std::isnan(value)) {
244 case IM_SIMULTANEOUS:
245 case IM_SINGLE_POINT:
261 case IM_SIMULTANEOUS: {
269 return 1.0f / cylCount;
272 case IM_SINGLE_POINT:
285 return 100 * totalInjectiorAmountPerCycle / engineCycleDuration;
291 return 100 * totalInjectiorAmountPerCycle / engineCycleDuration;
322 float injectionFuelMass = cycleFuelMass * durationMultiplier;
335 float tpsAccelPerInjection = durationMultiplier * tpsAccelEnrich;
338 return injectionFuelMass * (1 + tpsAccelPerInjection);
342 return injectionFuelMass + tpsFuelMass;
391 float correction = interpolate3d(
397 if (std::isnan(correction) || correction < 0.01) {
409 #if EFI_ANTILAG_SYSTEM
412 auto AlsFuelAdd = interpolate3d(
425 #if EFI_ENGINE_CONTROL
444 return idealGasLaw(cylDisplacement, 101.325f, 273.15f + 20.0f);
448 auto trimPercent = interpolate3d(
457 return (100 + trimPercent) / 100;
467 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
crankingFuel("crankingFuel", SensorCategory.SENSOR_INPUTS, FieldType.INT, 1140, 1.0, -1.0, -1.0, "")
revolutionCounterSinceStart("revolutionCounterSinceStart", SensorCategory.SENSOR_INPUTS, FieldType.INT16, 54, 1.0, 0.0, 0.0, "")
normalizedCylinderFilling("Air: Normalized cyl filling", SensorCategory.SENSOR_INPUTS, FieldType.INT, 880, 1.0, 0.0, 100.0, "%")
baroCorrection("Fuel: Barometric pressure mult", SensorCategory.SENSOR_INPUTS, FieldType.INT, 1156, 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
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
scaled_channel< int8_t, 5, 1 > table[FUEL_TRIM_SIZE][FUEL_TRIM_SIZE]
uint16_t injectorStagingRpmBins[INJ_STAGING_COUNT]
float crankingFuelCoef[CRANKING_CURVE_SIZE]
float cltTimingExtra[CLT_TIMING_CURVE_SIZE]
float crankingCycleFuelCoef[CRANKING_CYCLE_CLT_SIZE][CRANKING_CURVE_SIZE]
uint8_t injectorStagingTable[INJ_STAGING_COUNT][INJ_STAGING_COUNT]
fuel_cyl_trim_s fuelTrims[12]
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]
uint16_t fuelTrimRpmBins[FUEL_TRIM_SIZE]
float cltFuelCorrBins[CLT_CURVE_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]
uint16_t fuelTrimLoadBins[FUEL_TRIM_SIZE]
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 crankingCycleFuelCltBins[CRANKING_CYCLE_CLT_SIZE]
int16_t injectionPhase[FUEL_LOAD_COUNT][FUEL_RPM_COUNT]
float iatFuelCorrBins[IAT_CURVE_SIZE]
float crankingCycleBins[CRANKING_CURVE_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)