rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Private Attributes
WallFuelController Class Reference

#include <wall_fuel.h>

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

Public Types

using interface_t = IWallFuelController
 

Public Member Functions

void onFastCallback () override
 
bool getEnable () const override
 
float getAlpha () const override
 
float getBeta () const override
 
- Public Member Functions inherited from EngineModule
virtual void initNoConfiguration ()
 
virtual void setDefaultConfiguration ()
 
virtual void onConfigurationChange (engine_configuration_s const *)
 
virtual void onSlowCallback ()
 
virtual void onEngineStop ()
 
virtual void onIgnitionStateChanged (bool)
 
virtual bool needsDelayedShutoff ()
 
virtual void onEnginePhase (float, efitick_t, angle_t, angle_t)
 

Protected Member Functions

float computeTau () const
 
float computeBeta () const
 

Private Attributes

bool m_enable = false
 
float m_alpha = 0
 
float m_beta = 0
 

Detailed Description

Definition at line 33 of file wall_fuel.h.

Member Typedef Documentation

◆ interface_t

Definition at line 35 of file wall_fuel.h.

Member Function Documentation

◆ computeBeta()

float WallFuelController::computeBeta ( ) const
protected

Definition at line 105 of file wall_fuel.cpp.

105 {
108 }
109
110 // Default to normal operating temperature in case of
111 // CLT failure, this is not critical to get perfect
112 float clt = Sensor::get(SensorType::Clt).value_or(90);
113
114 float beta = interpolate2d(
115 clt,
118 );
119
120 // If you have a MAP sensor, apply MAP correction
122 auto map = Sensor::get(SensorType::Map).value_or(60);
123
124 beta *= interpolate2d(
125 map,
128 );
129 }
130
131 // Clamp to 0..1 (you can't have more than 100% of the fuel hit the wall!)
132 return clampF(0, beta, 1);
133}
virtual bool hasSensor() const
Definition sensor.h:141
virtual SensorResult get() const =0
static constexpr persistent_config_s * config
static constexpr engine_configuration_s * engineConfiguration
static CCM_OPTIONAL FunctionalSensor clt(SensorType::Clt, MS2NT(10))
scaled_channel< uint8_t, 100, 1 > wwBetaMapValues[WWAE_TABLE_SIZE]
scaled_channel< uint8_t, 100, 1 > wwBetaCltValues[WWAE_TABLE_SIZE]

Referenced by onFastCallback().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ computeTau()

float WallFuelController::computeTau ( ) const
protected

Definition at line 76 of file wall_fuel.cpp.

76 {
79 }
80
81 // Default to normal operating temperature in case of
82 // CLT failure, this is not critical to get perfect
83 float clt = Sensor::get(SensorType::Clt).value_or(90);
84
85 float tau = interpolate2d(
86 clt,
89 );
90
91 // If you have a MAP sensor, apply MAP correction
93 auto map = Sensor::get(SensorType::Map).value_or(60);
94
95 tau *= interpolate2d(
96 map,
99 );
100 }
101
102 return tau;
103}
scaled_channel< uint8_t, 100, 1 > wwTauMapValues[WWAE_TABLE_SIZE]
scaled_channel< uint8_t, 100, 1 > wwTauCltValues[WWAE_TABLE_SIZE]

Referenced by onFastCallback().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAlpha()

float WallFuelController::getAlpha ( ) const
inlineoverridevirtual

Implements IWallFuelController.

Definition at line 43 of file wall_fuel.h.

43 {
44 return m_alpha;
45 }

◆ getBeta()

float WallFuelController::getBeta ( ) const
inlineoverridevirtual

Implements IWallFuelController.

Definition at line 47 of file wall_fuel.h.

47 {
48 return m_beta;
49 }

◆ getEnable()

bool WallFuelController::getEnable ( ) const
inlineoverridevirtual

Implements IWallFuelController.

Definition at line 39 of file wall_fuel.h.

39 {
40 return m_enable;
41 }

Referenced by WallFuel::adjust().

Here is the caller graph for this function:

◆ onFastCallback()

void WallFuelController::onFastCallback ( )
overridevirtual

Reimplemented from EngineModule.

Definition at line 135 of file wall_fuel.cpp.

135 {
136 // disable wall wetting cranking
137 // TODO: is this correct? Why not correct for cranking?
139 m_enable = false;
140 return;
141 }
142
143 float tau = computeTau();
144 float beta = computeBeta();
145
146 // if tau or beta is really small, we get div/0.
147 // you probably meant to disable wwae.
148 if (tau < 0.01f || beta < 0.01f) {
149 m_enable = false;
150 return;
151 }
152
154
155 // Ignore low RPM
156 if (rpm < 100) {
157 m_enable = false;
158 return;
159 }
160
161 float alpha = expf_taylor(-120 / (rpm * tau));
162
163 // If beta is larger than alpha, the system is underdamped.
164 // For reasonable values {tau, beta}, this should only be possible
165 // at extremely low engine speeds (<300rpm ish)
166 // Clamp beta to less than alpha.
167 if (beta > alpha) {
168 beta = alpha;
169 }
170
171 // Store parameters so the model can read them
172 m_alpha = alpha;
173 m_beta = beta;
174 m_enable = true;
175}
RpmCalculator rpmCalculator
Definition engine.h:306
bool isCranking() const override
static float getOrZero(SensorType type)
Definition sensor.h:83
float computeBeta() const
float computeTau() const
Definition wall_fuel.cpp:76
static EngineAccessor engine
Definition engine.h:413
Here is the call graph for this function:

Field Documentation

◆ m_alpha

float WallFuelController::m_alpha = 0
private

Definition at line 57 of file wall_fuel.h.

Referenced by getAlpha(), and onFastCallback().

◆ m_beta

float WallFuelController::m_beta = 0
private

Definition at line 58 of file wall_fuel.h.

Referenced by getBeta(), and onFastCallback().

◆ m_enable

bool WallFuelController::m_enable = false
private

Definition at line 56 of file wall_fuel.h.

Referenced by getEnable(), and onFastCallback().


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