rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions
ThrottleModelBase Struct Referenceabstract

#include <throttle_model.h>

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

Public Types

using interface_t = ThrottleModelBase
 

Public Member Functions

void onSlowCallback () override
 
float estimateThrottleFlow (float tip, float tps, float map, float iat)
 
expected< floatestimateThrottleFlow (float map, float tps)
 
float partThrottleFlow (float tps, float flowCorrection) const
 
float partThrottleFlow (float tps, float pressureRatio, float p_up, float iat) const
 
float throttlePositionForFlow (float flow, float pressureRatio, float p_up, float iat) const
 
- Public Member Functions inherited from EngineModule
virtual void initNoConfiguration ()
 
virtual void setDefaultConfiguration ()
 
virtual void onConfigurationChange (engine_configuration_s const *)
 
virtual void onFastCallback ()
 
virtual void onEngineStop ()
 
virtual void onIgnitionStateChanged (bool)
 
virtual bool needsDelayedShutoff ()
 
virtual void onEnginePhase (float, efitick_t, angle_t, angle_t)
 

Protected Member Functions

virtual float effectiveArea (float tps) const =0
 
virtual float maxEngineFlow (float map) const =0
 

Additional Inherited Members

- Data Fields inherited from throttle_model_s
bool throttleUseWotModel: 1 {}
 
bool unusedBit_1_1: 1 {}
 
bool unusedBit_1_2: 1 {}
 
bool unusedBit_1_3: 1 {}
 
bool unusedBit_1_4: 1 {}
 
bool unusedBit_1_5: 1 {}
 
bool unusedBit_1_6: 1 {}
 
bool unusedBit_1_7: 1 {}
 
bool unusedBit_1_8: 1 {}
 
bool unusedBit_1_9: 1 {}
 
bool unusedBit_1_10: 1 {}
 
bool unusedBit_1_11: 1 {}
 
bool unusedBit_1_12: 1 {}
 
bool unusedBit_1_13: 1 {}
 
bool unusedBit_1_14: 1 {}
 
bool unusedBit_1_15: 1 {}
 
bool unusedBit_1_16: 1 {}
 
bool unusedBit_1_17: 1 {}
 
bool unusedBit_1_18: 1 {}
 
bool unusedBit_1_19: 1 {}
 
bool unusedBit_1_20: 1 {}
 
bool unusedBit_1_21: 1 {}
 
bool unusedBit_1_22: 1 {}
 
bool unusedBit_1_23: 1 {}
 
bool unusedBit_1_24: 1 {}
 
bool unusedBit_1_25: 1 {}
 
bool unusedBit_1_26: 1 {}
 
bool unusedBit_1_27: 1 {}
 
bool unusedBit_1_28: 1 {}
 
bool unusedBit_1_29: 1 {}
 
bool unusedBit_1_30: 1 {}
 
bool unusedBit_1_31: 1 {}
 
scaled_channel< int16_t, 100, 1 > throttleModelCrossoverAngle = (int16_t)0
 
uint8_t alignmentFill_at_6 [2] = {}
 
float throttleEstimatedFlow = (float)0
 

Detailed Description

Definition at line 7 of file throttle_model.h.

Member Typedef Documentation

◆ interface_t

Definition at line 9 of file throttle_model.h.

Member Function Documentation

◆ effectiveArea()

virtual float ThrottleModelBase::effectiveArea ( float  tps) const
protectedpure virtual

Implemented in ThrottleModel.

Referenced by partThrottleFlow().

Here is the caller graph for this function:

◆ estimateThrottleFlow() [1/2]

expected< float > ThrottleModelBase::estimateThrottleFlow ( float  map,
float  tps 
)

Definition at line 134 of file throttle_model.cpp.

134 {
135 // Inputs
137
138 auto tip = getThrottleInletPressure();
139
140 if (!tip || !iat) {
141 return unexpected;
142 }
143
144 return estimateThrottleFlow(tip.Value, tps, map, iat.Value);
145}
virtual SensorResult get() const =0
static CCM_OPTIONAL FunctionalSensor iat(SensorType::Iat, MS2NT(10))
float estimateThrottleFlow(float tip, float tps, float map, float iat)
expected< float > getThrottleInletPressure()
Here is the call graph for this function:

◆ estimateThrottleFlow() [2/2]

float ThrottleModelBase::estimateThrottleFlow ( float  tip,
float  tps,
float  map,
float  iat 
)

Definition at line 92 of file throttle_model.cpp.

92 {
93 // How much flow would the engine pull at 0.95 PR?
94 // The throttle won't flow much more than this in any scenario, even if the throttle could move more flow.
95 constexpr float crossoverPr = 0.95f;
96 float p95Flow = maxEngineFlow(tip * crossoverPr);
97
98 // What throttle position gives us that flow at 0.95 PR?
99 float throttleAngle95Pr = throttlePositionForFlow(p95Flow, crossoverPr, tip, iat);
100 throttleModelCrossoverAngle = throttleAngle95Pr;
101
102 bool useWotModel = tps > throttleAngle95Pr;
103 throttleUseWotModel = useWotModel;
104
105 if (useWotModel) {
106 // "WOT" model
107
108 // Maximum flow if the throttle was removed
109 float maximumPossibleFlow = maxEngineFlow(tip);
110
111 // Linearly interpolate between the P95 point and wide open, where the engine flows its max
112 return interpolateClamped(throttleAngle95Pr, p95Flow, 100, maximumPossibleFlow, tps);
113 } else {
114 float pressureRatio = map / tip;
115
116 return partThrottleFlow(tps, pressureRatio, tip, iat);
117 }
118}
float interpolateClamped(float x1, float y1, float x2, float y2, float x)
pressureRatio("Fuel: Injector pressure ratio", SensorCategory.SENSOR_INPUTS, FieldType.INT, 1188, 1.0, 0.0, 100.0, "")
virtual float maxEngineFlow(float map) const =0
float partThrottleFlow(float tps, float flowCorrection) const
float throttlePositionForFlow(float flow, float pressureRatio, float p_up, float iat) const
scaled_channel< int16_t, 100, 1 > throttleModelCrossoverAngle

Referenced by estimateThrottleFlow(), and onSlowCallback().

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

◆ maxEngineFlow()

virtual float ThrottleModelBase::maxEngineFlow ( float  map) const
protectedpure virtual

Implemented in ThrottleModel.

Referenced by estimateThrottleFlow().

Here is the caller graph for this function:

◆ onSlowCallback()

void ThrottleModelBase::onSlowCallback ( )
overridevirtual

Reimplemented from EngineModule.

Definition at line 147 of file throttle_model.cpp.

Here is the call graph for this function:

◆ partThrottleFlow() [1/2]

float ThrottleModelBase::partThrottleFlow ( float  tps,
float  flowCorrection 
) const

Definition at line 40 of file throttle_model.cpp.

40 {
41 return effectiveArea(tps) * flowCorrection;
42}
virtual float effectiveArea(float tps) const =0

Referenced by estimateThrottleFlow(), partThrottleFlow(), and throttlePositionForFlow().

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

◆ partThrottleFlow() [2/2]

float ThrottleModelBase::partThrottleFlow ( float  tps,
float  pressureRatio,
float  p_up,
float  iat 
) const

Definition at line 44 of file throttle_model.cpp.

44 {
46}
static float flowCorrections(float pressureRatio, float p_up, float iat)
Here is the call graph for this function:

◆ throttlePositionForFlow()

float ThrottleModelBase::throttlePositionForFlow ( float  flow,
float  pressureRatio,
float  p_up,
float  iat 
) const

Definition at line 77 of file throttle_model.cpp.

77 {
78 // What does the bare throttle flow at wide open?
79 float wideOpenFlow = partThrottleFlow(100, pressureRatio, p_up, iat);
80
81 // If the target flow is more than the throttle can flow, return 100% since the throttle
82 // can't open any further
83 // If we don't do this, trying to solve using the solver may diverge
84 if (flow > wideOpenFlow) {
85 return 100;
86 }
87
88 InverseFlowSolver solver(this, flow, pressureRatio, p_up, iat);
89 return solver.solve(50, 0.1).value_or(0);
90}

Referenced by estimateThrottleFlow().

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

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