44 float baseCrankingFuel;
46 baseCrankingFuel = baseFuel;
49 baseCrankingFuel = interpolate3d(
50 config->crankingCycleBaseFuel,
63 auto e0Mult = interpolate2d(
clt,
config->crankingFuelBins,
config->crankingFuelCoef);
65 bool alreadyWarned =
false;
72 auto e85Mult = interpolate2d(
clt,
config->crankingFuelBins,
config->crankingFuelCoefE100);
74 if (e85Mult <= 0.1f) {
95 ? interpolate2d(tps.Value,
config->crankingTpsBins,
config->crankingTpsCoef)
123 float correction =
baroCorrection * iatCorrection * cltCorrection * postCrankingFuelCorrection;
125#if EFI_ANTILAG_SYSTEM
129#if EFI_LAUNCH_CONTROL
134#ifdef MODULE_VVL_CONTROLLER
140 float runningFuel = baseFuel * correction;
158 if (mode == engine_load_mode_e::UNSUPPORTED_ENUM_VALUE) {
164 case engine_load_mode_e::LM_SPEED_DENSITY:
return &
sdAirmass;
165 case engine_load_mode_e::LM_REAL_MAF:
return &
mafAirmass;
180#if EFI_ENGINE_CONTROL
190 auto airmass = model->getAirmass(rpm,
true);
209 if (std::isnan(baseFuelMass)) {
218 if (std::isnan(rpm)) {
222 if (std::isnan(load)) {
228 config->injPhaseLoadBins, load,
229 config->injPhaseRpmBins, rpm
232 if (std::isnan(value)) {
250 case IM_SIMULTANEOUS:
251 case IM_SINGLE_POINT:
267 case IM_SIMULTANEOUS: {
275 return 1.0f / cylCount;
278 case IM_SINGLE_POINT:
291 return 100 * totalInjectiorAmountPerCycle / engineCycleDuration;
297 return 100 * totalInjectiorAmountPerCycle / engineCycleDuration;
328 float injectionFuelMass = cycleFuelMass * durationMultiplier;
338 float tpsFuelMass = 0;
345 float tpsAccelPerInjection = durationMultiplier * tpsAccelEnrich;
349 case AE_MODE_PERCENT_ADDER:
351 tpsFuelMass = injectionFuelMass * tpsAccelPerInjection;
354 case AE_MODE_MS_ADDER:
360 case AE_MODE_PREDICTIVE_MAP:
370 return injectionFuelMass + tpsFuelMass;
392 return interpolate2d(
clt.Value,
config->cltFuelCorrBins,
config->cltFuelCorr);
401 return interpolate2d(
iat.Value,
config->iatFuelCorrBins,
config->iatFuelCorr);
407 if (revolutionCounter >
config->postCrankingDurationBins[efi::size(
config->postCrankingDurationBins) - 1])
416 float postCrankingFactor = interpolate3d(
417 config->postCrankingFactor,
419 config->postCrankingDurationBins, revolutionCounter
423 if (postCrankingFactor < 1.0f)
424 postCrankingFactor = 1.0f;
426 return postCrankingFactor;
434 float correction = interpolate3d(
436 config->baroCorrPressureBins, pressure,
440 if (std::isnan(correction) || correction < 0.01) {
452#if EFI_ANTILAG_SYSTEM
455 auto AlsFuelAdd = interpolate3d(
456 config->ALSFuelAdjustment,
457 config->alsFuelAdjustmentLoadBins, throttleIntent,
458 config->alsFuelAdjustmentrpmBins, rpm
468#if EFI_ENGINE_CONTROL
487 return idealGasLaw(cylDisplacement, STD_ATMOSPHERE, C_K_OFFSET + STD_IAT);
490PUBLIC_API_WEAK_SOMETHING_WEIRD
492 auto trimPercent = interpolate3d(
493 config->fuelTrims[cylinderNumber].table,
494 config->fuelTrimLoadBins, fuelLoad,
495 config->fuelTrimRpmBins, rpm
501 return (100 + trimPercent) / 100;
511 float frac = 0.01f * interpolate3d(
512 config->injectorStagingTable,
513 config->injectorStagingLoadBins, load,
514 config->injectorStagingRpmBins, rpm
FuelComputer fuelComputer
LaunchControlBase launchController
RpmCalculator rpmCalculator
AntilagSystemBase antilagController
AirmassModelBase * mockAirmassModel
constexpr auto & module()
floatms_t injectionDuration
floatms_t injectionDurationStage2
mass_t getCycleFuel(mass_t airmass, float 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])
float getFuelCoefficient() const
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)
float getFuelCoefficient() const
float interpolateClamped(float x1, float y1, float x2, float y2, float x)
LimpManager * getLimpManager()
injection_mode_e getCurrentInjectionMode()
static EngineAccessor engine
static constexpr persistent_config_s * config
static constexpr engine_configuration_s * engineConfiguration
floatms_t getEngineCycleDuration(float rpm)
bool warning(ObdCode code, const char *fmt,...)
void firmwareError(ObdCode code, const char *fmt,...)
percent_t getInjectorDutyCycleStage2(float rpm)
static mapEstimate_Map3D_t mapEstimationTable
static float getBaseFuelMass(float rpm)
void initFuelMap()
Initialize fuel map data structure.
float getStage2InjectionFraction(float rpm, float load)
float getPostCrankingFuelCorrection()
float getRunningFuel(float baseFuel)
int getNumberOfInjections(injection_mode_e mode)
static SpeedDensityAirmass sdAirmass(veMap, mapEstimationTable)
AirmassModelBase * getAirmassModel(engine_load_mode_e mode)
angle_t getInjectionOffset(float rpm, float load)
static MafAirmass mafAirmass(veMap)
float getIatFuelCorrection()
float getCrankingFuel(float baseFuel)
float getBaroCorrection()
float getCrankingFuel3(float baseFuel, uint32_t revolutionCounterSinceStart)
static AlphaNAirmass alphaNAirmass(veMap)
float getMaxAirflowAtMap(float map)
float getCycleFuelMass(bool isCranking, float baseFuelMass)
percent_t getFuelALSCorrection(float rpm)
float getCltFuelCorrection()
Engine warm-up fuel correction.
PUBLIC_API_WEAK_SOMETHING_WEIRD float getCylinderFuelTrim(size_t cylinderNumber, float rpm, float fuelLoad)
static Hysteresis stage2Hysteresis
float getStandardAirCharge()
float getInjectionModeDurationMultiplier()
float getInjectionMass(float rpm)
percent_t getInjectorDutyCycle(float 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
baroCorrection("Fuel: Barometric pressure mult", SensorCategory.SENSOR_INPUTS, FieldType.INT, 1372, 1.0, -1.0, -1.0, "")
crankingFuel("crankingFuel", SensorCategory.SENSOR_INPUTS, FieldType.INT, 1360, 1.0, -1.0, -1.0, "")
normalizedCylinderFilling("Air: Normalized cyl filling", SensorCategory.SENSOR_INPUTS, FieldType.INT, 924, 1.0, 0.0, 100.0, "%")
revolutionCounterSinceStart("revolutionCounterSinceStart", SensorCategory.SENSOR_INPUTS, FieldType.INT16, 64, 1.0, 0.0, 0.0, "")
mass_t idealGasLaw(float volume, float pressure, float temperature)
float getLoadOverride(float defaultLoad, load_override_e overrideMode) const
scaled_channel< uint16_t, 100, 1 > baseFuel
float coolantTemperatureCoefficient
scaled_channel< uint16_t, 100, 1 > fuel
cranking_fuel_s crankingFuel
float normalizedCylinderFilling
float sdAirMassInOneCylinder
float totalFuelCorrection
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)