only:int rpm -> float rpm

This commit is contained in:
Matthew Kennedy 2024-09-25 03:20:18 -04:00 committed by Andrey
parent 4ba6cf4185
commit af2e425761
5 changed files with 13 additions and 13 deletions

View File

@ -70,7 +70,7 @@ bool LaunchControlBase::isInsideTpsCondition() const {
return engineConfiguration->launchTpsThreshold < tps.Value; return engineConfiguration->launchTpsThreshold < tps.Value;
} }
LaunchCondition LaunchControlBase::calculateRPMLaunchCondition(const int rpm) { LaunchCondition LaunchControlBase::calculateRPMLaunchCondition(const float rpm) {
const int launchRpm = engineConfiguration->launchRpm; const int launchRpm = engineConfiguration->launchRpm;
const int preLaunchRpm = launchRpm - engineConfiguration->launchRpmWindow; const int preLaunchRpm = launchRpm - engineConfiguration->launchRpmWindow;
if (rpm < preLaunchRpm) { if (rpm < preLaunchRpm) {
@ -82,7 +82,7 @@ LaunchCondition LaunchControlBase::calculateRPMLaunchCondition(const int rpm) {
} }
} }
LaunchCondition LaunchControlBase::calculateLaunchCondition(const int rpm) { LaunchCondition LaunchControlBase::calculateLaunchCondition(const float rpm) {
const LaunchCondition currentRpmLaunchCondition = calculateRPMLaunchCondition(rpm); const LaunchCondition currentRpmLaunchCondition = calculateRPMLaunchCondition(rpm);
activateSwitchCondition = isInsideSwitchCondition(); activateSwitchCondition = isInsideSwitchCondition();
rpmLaunchCondition = (currentRpmLaunchCondition == LaunchCondition::Launch); rpmLaunchCondition = (currentRpmLaunchCondition == LaunchCondition::Launch);
@ -112,7 +112,7 @@ void LaunchControlBase::update() {
return; return;
} }
const int rpm = Sensor::getOrZero(SensorType::Rpm); const float rpm = Sensor::getOrZero(SensorType::Rpm);
const LaunchCondition launchCondition = calculateLaunchCondition(rpm); const LaunchCondition launchCondition = calculateLaunchCondition(rpm);
isLaunchCondition = (launchCondition == LaunchCondition::Launch); isLaunchCondition = (launchCondition == LaunchCondition::Launch);
isPreLaunchCondition = (launchCondition == LaunchCondition::PreLaunch); isPreLaunchCondition = (launchCondition == LaunchCondition::PreLaunch);

View File

@ -27,8 +27,8 @@ public:
bool isInsideSpeedCondition() const; bool isInsideSpeedCondition() const;
bool isInsideTpsCondition() const; bool isInsideTpsCondition() const;
bool isInsideSwitchCondition(); bool isInsideSwitchCondition();
LaunchCondition calculateRPMLaunchCondition(int rpm); LaunchCondition calculateRPMLaunchCondition(float rpm);
LaunchCondition calculateLaunchCondition(int rpm); LaunchCondition calculateLaunchCondition(float rpm);
bool isLaunchSparkRpmRetardCondition() const; bool isLaunchSparkRpmRetardCondition() const;
bool isLaunchFuelRpmRetardCondition() const; bool isLaunchFuelRpmRetardCondition() const;

View File

@ -74,7 +74,7 @@ angle_t HpfpLobe::findNextLobe() {
} }
// As a percent of the full pump stroke // As a percent of the full pump stroke
float HpfpQuantity::calcFuelPercent(int rpm) { float HpfpQuantity::calcFuelPercent(float rpm) {
float fuel_requested_cc_per_cycle = float fuel_requested_cc_per_cycle =
engine->engineState.injectionMass[0] * (1.f / fuelDensity) * engineConfiguration->cylindersCount; engine->engineState.injectionMass[0] * (1.f / fuelDensity) * engineConfiguration->cylindersCount;
float fuel_requested_cc_per_lobe = fuel_requested_cc_per_cycle / engineConfiguration->hpfpCamLobes; float fuel_requested_cc_per_lobe = fuel_requested_cc_per_cycle / engineConfiguration->hpfpCamLobes;
@ -95,7 +95,7 @@ static float getLoad() {
} }
} }
float HpfpQuantity::calcPI(int rpm, float calc_fuel_percent) { float HpfpQuantity::calcPI(float rpm, float calc_fuel_percent) {
float load = getLoad(); float load = getLoad();
float possibleValue = m_pressureTarget_kPa - (engineConfiguration->hpfpTargetDecay * float possibleValue = m_pressureTarget_kPa - (engineConfiguration->hpfpTargetDecay *
@ -136,7 +136,7 @@ float HpfpQuantity::calcPI(int rpm, float calc_fuel_percent) {
return p_control_percent + i_control_percent; return p_control_percent + i_control_percent;
} }
angle_t HpfpQuantity::pumpAngleFuel(int rpm, HpfpController *model) { angle_t HpfpQuantity::pumpAngleFuel(float rpm, HpfpController *model) {
// Math based on fuel requested // Math based on fuel requested
model->fuel_requested_percent = calcFuelPercent(rpm); model->fuel_requested_percent = calcFuelPercent(rpm);
@ -155,7 +155,7 @@ angle_t HpfpQuantity::pumpAngleFuel(int rpm, HpfpController *model) {
void HpfpController::onFastCallback() { void HpfpController::onFastCallback() {
// Pressure current/target calculation // Pressure current/target calculation
int rpm = Sensor::getOrZero(SensorType::Rpm); float rpm = Sensor::getOrZero(SensorType::Rpm);
isHpfpInactive = rpm < rpm_spinning_cutoff || isHpfpInactive = rpm < rpm_spinning_cutoff ||
!isGdiEngine() || !isGdiEngine() ||

View File

@ -44,7 +44,7 @@ public:
/** /**
* Calculate where the pump should become active, in degrees before pump lobe TDC * Calculate where the pump should become active, in degrees before pump lobe TDC
*/ */
angle_t pumpAngleFuel(int rpm, HpfpController *model); angle_t pumpAngleFuel(float rpm, HpfpController *model);
/** /**
* Calculate the percent of the pump stroke needed to replace the fuel injected. Also * Calculate the percent of the pump stroke needed to replace the fuel injected. Also
@ -56,7 +56,7 @@ public:
* Return value is nominally 0-100, but may be outside that range (including negative) if * Return value is nominally 0-100, but may be outside that range (including negative) if
* model parameters are not accurate. * model parameters are not accurate.
*/ */
float calcFuelPercent(int rpm); float calcFuelPercent(float rpm);
/** /**
* Calculates the PI controller contribution as a percent. This amount should be added to * Calculates the PI controller contribution as a percent. This amount should be added to
@ -68,7 +68,7 @@ public:
* Return value is nominally 0-100, but may be outside that range (including negative) if * Return value is nominally 0-100, but may be outside that range (including negative) if
* model parameters are not accurate. The sum of this and calc_fuel_percent will be 0-100. * model parameters are not accurate. The sum of this and calc_fuel_percent will be 0-100.
*/ */
float calcPI(int rpm, float calc_fuel_percent); float calcPI(float rpm, float calc_fuel_percent);
/** /**
* Reset internal state due to a stopped engine. * Reset internal state due to a stopped engine.

View File

@ -350,7 +350,7 @@ static void onTdcCallback(void *) {
} }
#endif /* EFI_UNIT_TEST */ #endif /* EFI_UNIT_TEST */
int rpm = Sensor::getOrZero(SensorType::Rpm); float rpm = Sensor::getOrZero(SensorType::Rpm);
addEngineSnifferTdcEvent(rpm); addEngineSnifferTdcEvent(rpm);
#if EFI_TOOTH_LOGGER #if EFI_TOOTH_LOGGER
LogTriggerTopDeadCenter(getTimeNowNt()); LogTriggerTopDeadCenter(getTimeNowNt());