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

#include <launch_control.h>

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

Public Member Functions

 LaunchControlBase ()
 
void update ()
 
float getFuelCoefficient () const
 
bool isInsideSpeedCondition () const
 
bool isInsideTpsCondition () const
 
bool isInsideSwitchCondition ()
 
LaunchCondition calculateRPMLaunchCondition (float rpm)
 
LaunchCondition calculateLaunchCondition (float rpm)
 
bool isLaunchSparkRpmRetardCondition () const
 
bool isLaunchFuelRpmRetardCondition () const
 
float getSparkSkipRatio () const
 

Private Member Functions

bool isLaunchRpmRetardCondition () const
 
float calculateSparkSkipRatio (float rpm) const
 

Private Attributes

float sparkSkipRatio = 0.0f
 

Additional Inherited Members

- Data Fields inherited from launch_control_state_s
int retardThresholdRpm = (int)0
 
bool launchActivatePinState: 1 {}
 
bool isPreLaunchCondition: 1 {}
 
bool isLaunchCondition: 1 {}
 
bool isSwitchActivated: 1 {}
 
bool isClutchActivated: 1 {}
 
bool isBrakePedalActivated: 1 {}
 
bool isValidInputPin: 1 {}
 
bool activateSwitchCondition: 1 {}
 
bool rpmLaunchCondition: 1 {}
 
bool rpmPreLaunchCondition: 1 {}
 
bool speedCondition: 1 {}
 
bool tpsCondition: 1 {}
 
bool luaLaunchState: 1 {}
 
bool unusedBit_14_13: 1 {}
 
bool unusedBit_14_14: 1 {}
 
bool unusedBit_14_15: 1 {}
 
bool unusedBit_14_16: 1 {}
 
bool unusedBit_14_17: 1 {}
 
bool unusedBit_14_18: 1 {}
 
bool unusedBit_14_19: 1 {}
 
bool unusedBit_14_20: 1 {}
 
bool unusedBit_14_21: 1 {}
 
bool unusedBit_14_22: 1 {}
 
bool unusedBit_14_23: 1 {}
 
bool unusedBit_14_24: 1 {}
 
bool unusedBit_14_25: 1 {}
 
bool unusedBit_14_26: 1 {}
 
bool unusedBit_14_27: 1 {}
 
bool unusedBit_14_28: 1 {}
 
bool unusedBit_14_29: 1 {}
 
bool unusedBit_14_30: 1 {}
 
bool unusedBit_14_31: 1 {}
 

Detailed Description

Definition at line 20 of file launch_control.h.

Constructor & Destructor Documentation

◆ LaunchControlBase()

LaunchControlBase::LaunchControlBase ( )

Member Function Documentation

◆ calculateLaunchCondition()

LaunchCondition LaunchControlBase::calculateLaunchCondition ( float  rpm)

Definition at line 97 of file launch_control.cpp.

97 {
98 const LaunchCondition currentRpmLaunchCondition = calculateRPMLaunchCondition(rpm);
100 rpmLaunchCondition = (currentRpmLaunchCondition == LaunchCondition::Launch);
101 rpmPreLaunchCondition = (currentRpmLaunchCondition == LaunchCondition::PreLaunch);
104
106 return currentRpmLaunchCondition;
107 } else {
109 }
110}
LaunchCondition calculateRPMLaunchCondition(float rpm)
bool isInsideSpeedCondition() const
bool isInsideTpsCondition() const
LaunchCondition

Referenced by update().

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

◆ calculateRPMLaunchCondition()

LaunchCondition LaunchControlBase::calculateRPMLaunchCondition ( float  rpm)

Definition at line 74 of file launch_control.cpp.

74 {
75 if ((engineConfiguration->launchActivationMode == SWITCH_INPUT_LAUNCH)
79 ) {
80 // We need perform Shift Torque Reduction stuff (see
81 // https://github.com/rusefi/rusefi/issues/5608#issuecomment-2391500472 and
82 // https://github.com/rusefi/rusefi/issues/5608#issuecomment-2391772899 for details)
84 }
85
86 const int launchRpm = engineConfiguration->launchRpm;
87 const int preLaunchRpm = launchRpm - engineConfiguration->launchRpmWindow;
88 if (rpm < preLaunchRpm) {
90 } else if (launchRpm <= rpm) {
92 } else {
94 }
95}
static constexpr engine_configuration_s * engineConfiguration

Referenced by calculateLaunchCondition().

Here is the caller graph for this function:

◆ calculateSparkSkipRatio()

float LaunchControlBase::calculateSparkSkipRatio ( float  rpm) const
private

Definition at line 150 of file launch_control.cpp.

150 {
151 float result = 0.0f;
153 if (isLaunchCondition) {
154 result = 1.0f;
155 } else if (isPreLaunchCondition) {
156 const int launchRpm = engineConfiguration->launchRpm;
157 const int sparkSkipStartRpm = launchRpm - engineConfiguration->launchRpmWindow;
158 if (sparkSkipStartRpm <= rpm) {
159 const float initialIgnitionCutRatio = engineConfiguration->initialIgnitionCutPercent / 100.0f;
160 const int sparkSkipEndRpm = launchRpm - engineConfiguration->launchCorrectionsEndRpm;
161 const float finalIgnitionCutRatio = engineConfiguration->finalIgnitionCutPercentBeforeLaunch / 100.0f;
162 result = interpolateClamped(sparkSkipStartRpm, initialIgnitionCutRatio, sparkSkipEndRpm, finalIgnitionCutRatio, rpm);
163 }
164 }
165 }
166 return result;
167}
float interpolateClamped(float x1, float y1, float x2, float y2, float x)

Referenced by update().

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

◆ getFuelCoefficient()

float LaunchControlBase::getFuelCoefficient ( ) const

Definition at line 118 of file launch_control.cpp.

Referenced by getRunningFuel().

Here is the caller graph for this function:

◆ getSparkSkipRatio()

float LaunchControlBase::getSparkSkipRatio ( ) const
inline

Definition at line 36 of file launch_control.h.

36{ return sparkSkipRatio; }

Referenced by EngineState::updateSparkSkip().

Here is the caller graph for this function:

◆ isInsideSpeedCondition()

bool LaunchControlBase::isInsideSpeedCondition ( ) const

Returns True when Vehicle speed ALLOWS launch control

Definition at line 49 of file launch_control.cpp.

49 {
51 return true; // allow launch, speed does not matter
52 }
53
55
57}
static float getOrZero(SensorType type)
Definition sensor.h:83

Referenced by calculateLaunchCondition().

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

◆ isInsideSwitchCondition()

bool LaunchControlBase::isInsideSwitchCondition ( )

We can have active condition from switch or from clutch. In case we are dependent on VSS we just return true.

Definition at line 22 of file launch_control.cpp.

22 {
26
28#if !EFI_SIMULATOR
31 }
32#endif // EFI_PROD_CODE
34 } else if (isClutchActivated) {
35 return getClutchDownState();
36 } else if (isBrakePedalActivated) {
37 return getBrakePedalState();
38 } else if (engineConfiguration->launchActivationMode == LUA_LAUNCH) {
39 return luaLaunchState;
40 } else {
41 // ALWAYS_ACTIVE_LAUNCH
42 return true;
43 }
44}
bool getBrakePedalState()
Definition engine.cpp:243
bool getClutchDownState()
Definition engine.cpp:223
bool efiReadPin(brain_pin_e pin)
Definition io_pins.cpp:89
bool isBrainPinValid(brain_pin_e brainPin)

Referenced by calculateLaunchCondition().

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

◆ isInsideTpsCondition()

bool LaunchControlBase::isInsideTpsCondition ( ) const

Returns false if TPS is invalid or TPS > preset threshold

Definition at line 62 of file launch_control.cpp.

62 {
64
65 // Disallow launch without valid TPS
66 if (!tps.Valid) {
67 return false;
68 }
69
70 // todo: should this be 'launchTpsThreshold <= tps.Value' so that nicely calibrated TPS of zero does not prevent launch?
71 return engineConfiguration->launchTpsThreshold < tps.Value;
72}
virtual SensorResult get() const =0
@ DriverThrottleIntent

Referenced by calculateLaunchCondition().

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

◆ isLaunchFuelRpmRetardCondition()

bool LaunchControlBase::isLaunchFuelRpmRetardCondition ( ) const

Definition at line 146 of file launch_control.cpp.

Referenced by LimpManager::updateState().

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

◆ isLaunchRpmRetardCondition()

bool LaunchControlBase::isLaunchRpmRetardCondition ( ) const
private

Definition at line 138 of file launch_control.cpp.

Referenced by isLaunchFuelRpmRetardCondition(), and isLaunchSparkRpmRetardCondition().

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

◆ isLaunchSparkRpmRetardCondition()

bool LaunchControlBase::isLaunchSparkRpmRetardCondition ( ) const

Definition at line 142 of file launch_control.cpp.

Referenced by LimpManager::updateState().

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

◆ update()

void LaunchControlBase::update ( )

Definition at line 122 of file launch_control.cpp.

122 {
124 return;
125 }
126
127 const float rpm = Sensor::getOrZero(SensorType::Rpm);
128 const LaunchCondition launchCondition = calculateLaunchCondition(rpm);
129 isLaunchCondition = (launchCondition == LaunchCondition::Launch);
131
132 //and still recalculate in case user changed the values
134
136}
float calculateSparkSkipRatio(float rpm) const
LaunchCondition calculateLaunchCondition(float rpm)

Referenced by EngineState::periodicFastCallback().

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

Field Documentation

◆ sparkSkipRatio

float LaunchControlBase::sparkSkipRatio = 0.0f
private

Definition at line 44 of file launch_control.h.

Referenced by getSparkSkipRatio(), and update().


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