rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Public Member Functions
FuelComputer Class Referencefinal

#include <fuel_computer.h>

Inheritance diagram for FuelComputer:
Inheritance graph
[legend]
Collaboration diagram for FuelComputer:
Collaboration graph
[legend]

Public Member Functions

float getStoichiometricRatio () const override
 
float getTargetLambda (float rpm, float load) const override
 
float getTargetLambdaLoadAxis (float defaultLoad) const override
 
- Public Member Functions inherited from FuelComputerBase
mass_t getCycleFuel (mass_t airmass, float rpm, float load) override
 
- Public Member Functions inherited from IFuelComputer
temperature_t getTCharge (float rpm, float tps)
 
float getLoadOverride (float defaultLoad, load_override_e overrideMode) const
 

Additional Inherited Members

- Data Fields inherited from fuel_computer_s
float totalFuelCorrection = (float)0
 
running_fuel_s running
 
scaled_channel< uint16_t, 100, 1 > afrTableYAxis = (uint16_t)0
 
scaled_channel< uint16_t, 10000, 1 > targetLambda = (uint16_t)0
 
scaled_channel< uint16_t, 1000, 1 > targetAFR = (uint16_t)0
 
scaled_channel< uint16_t, 1000, 1 > stoichiometricRatio = (uint16_t)0
 
float sdTcharge_coff = (float)0
 
float sdAirMassInOneCylinder = (float)0
 
float normalizedCylinderFilling = (float)0
 
uint8_t brokenInjector = (uint8_t)0
 
uint8_t unused88 = (uint8_t)0
 
uint16_t idealEngineTorque = (uint16_t)0
 
bool injectorHwIssue: 1 {}
 
bool unusedBit_13_1: 1 {}
 
bool unusedBit_13_2: 1 {}
 
bool unusedBit_13_3: 1 {}
 
bool unusedBit_13_4: 1 {}
 
bool unusedBit_13_5: 1 {}
 
bool unusedBit_13_6: 1 {}
 
bool unusedBit_13_7: 1 {}
 
bool unusedBit_13_8: 1 {}
 
bool unusedBit_13_9: 1 {}
 
bool unusedBit_13_10: 1 {}
 
bool unusedBit_13_11: 1 {}
 
bool unusedBit_13_12: 1 {}
 
bool unusedBit_13_13: 1 {}
 
bool unusedBit_13_14: 1 {}
 
bool unusedBit_13_15: 1 {}
 
bool unusedBit_13_16: 1 {}
 
bool unusedBit_13_17: 1 {}
 
bool unusedBit_13_18: 1 {}
 
bool unusedBit_13_19: 1 {}
 
bool unusedBit_13_20: 1 {}
 
bool unusedBit_13_21: 1 {}
 
bool unusedBit_13_22: 1 {}
 
bool unusedBit_13_23: 1 {}
 
bool unusedBit_13_24: 1 {}
 
bool unusedBit_13_25: 1 {}
 
bool unusedBit_13_26: 1 {}
 
bool unusedBit_13_27: 1 {}
 
bool unusedBit_13_28: 1 {}
 
bool unusedBit_13_29: 1 {}
 
bool unusedBit_13_30: 1 {}
 
bool unusedBit_13_31: 1 {}
 

Detailed Description

Definition at line 31 of file fuel_computer.h.

Member Function Documentation

◆ getStoichiometricRatio()

float FuelComputer::getStoichiometricRatio ( ) const
overridevirtual

Implements FuelComputerBase.

Definition at line 28 of file fuel_computer.cpp.

28 {
30
31
32 if (primary < 5) {
33 // Config compatibility: this field may be zero on ECUs with very old defaults
34 criticalError("Please set stoichRatioPrimary");
35 return 0;
36 }
37
38 // Without an ethanol/flex sensor, return primary configured stoich ratio
40 return primary;
41 }
42
44
45 if (secondary < 5) {
46 // Config compatibility: this field may be zero on ECUs with very old defaults
47 criticalError("Please set stoichRatioSecondary");
48 return 0;
49 }
50
52
53 // TODO: what do do if flex sensor fails?
54
55 // Linear interpolate between primary and secondary stoich ratios
56 return interpolateClamped(0, primary, 100, secondary, flex.Value);
57}
virtual bool hasSensor() const
Definition sensor.h:141
virtual SensorResult get() const =0
float interpolateClamped(float x1, float y1, float x2, float y2, float x)
static constexpr engine_configuration_s * engineConfiguration
@ FuelEthanolPercent
Here is the call graph for this function:

◆ getTargetLambda()

float FuelComputer::getTargetLambda ( float  rpm,
float  load 
) const
overridevirtual

Implements FuelComputerBase.

Definition at line 60 of file fuel_computer.cpp.

60 {
61 float target = interpolate3d(
65 );
66
67 // Add any blends if configured
68 for (size_t i = 0; i < efi::size(config->targetAfrBlends); i++) {
69 auto result = calculateBlend(config->targetAfrBlends[i], rpm, load);
70
71 engine->outputChannels.targetAfrBlendParameter[i] = result.BlendParameter;
74 engine->outputChannels.targetAfrBlendYAxis[i] = result.TableYAxis;
75
76 target += result.Value;
77 }
78
79 return target;
80}
TunerStudioOutputChannels outputChannels
Definition engine.h:109
static EngineAccessor engine
Definition engine.h:413
static constexpr persistent_config_s * config
BlendResult calculateBlend(blend_table_s &cfg, float rpm, float load)
scaled_channel< uint8_t, 2, 1 > targetAfrBlendBias[TARGET_AFR_BLEND_COUNT]
scaled_channel< int16_t, 10, 1 > targetAfrBlendYAxis[TARGET_AFR_BLEND_COUNT]
scaled_channel< int16_t, 10, 1 > targetAfrBlendParameter[TARGET_AFR_BLEND_COUNT]
scaled_channel< int16_t, 10, 1 > targetAfrBlendOutput[TARGET_AFR_BLEND_COUNT]
scaled_channel< uint8_t, 147, 1 > lambdaTable[FUEL_LOAD_COUNT][FUEL_RPM_COUNT]
Here is the call graph for this function:

◆ getTargetLambdaLoadAxis()

float FuelComputer::getTargetLambdaLoadAxis ( float  defaultLoad) const
overridevirtual

Implements FuelComputerBase.

Definition at line 82 of file fuel_computer.cpp.

82 {
84}
float getLoadOverride(float defaultLoad, load_override_e overrideMode) const
Here is the call graph for this function:

The documentation for this class was generated from the following files: