only:int rpm -> float rpm

This commit is contained in:
Matthew Kennedy 2024-09-25 02:21:39 -04:00 committed by Andrey
parent ee8f7dc488
commit ba94d94925
16 changed files with 22 additions and 24 deletions

View File

@ -25,5 +25,5 @@ void initIgnitionAdvanceControl();
class IgnitionState : public ignition_state_s {
public:
floatms_t getSparkDwell(int rpm);
floatms_t getSparkDwell(float rpm);
};

View File

@ -14,7 +14,7 @@ static float getVeLoadAxis(ve_override_e mode, float passedLoad) {
}
}
float AirmassVeModelBase::getVe(int rpm, float load, bool postState) const {
float AirmassVeModelBase::getVe(float rpm, float load, bool postState) const {
efiAssert(ObdCode::OBD_PCM_Processor_Fault, m_veTable != nullptr, "VE table null", 0);
// Override the load value if necessary

View File

@ -9,7 +9,7 @@ struct AirmassResult {
};
struct AirmassModelBase {
virtual AirmassResult getAirmass(int rpm, bool postState) = 0;
virtual AirmassResult getAirmass(float rpm, bool postState) = 0;
};
class AirmassVeModelBase : public AirmassModelBase {
@ -17,7 +17,7 @@ public:
explicit AirmassVeModelBase(const ValueProvider3D& veTable);
// Retrieve the user-calibrated volumetric efficiency from the table
float getVe(int rpm, percent_t load, bool postState) const;
float getVe(float rpm, percent_t load, bool postState) const;
private:
const ValueProvider3D* const m_veTable;

View File

@ -2,7 +2,7 @@
#include "alphan_airmass.h"
AirmassResult AlphaNAirmass::getAirmass(int rpm, bool postState) {
AirmassResult AlphaNAirmass::getAirmass(float rpm, bool postState) {
auto tps = Sensor::get(SensorType::Tps1);
if (!tps.Valid) {

View File

@ -6,5 +6,5 @@ class AlphaNAirmass : public SpeedDensityBase {
public:
explicit AlphaNAirmass(const ValueProvider3D& veTable) : SpeedDensityBase(veTable) {}
AirmassResult getAirmass(int rpm, bool postState) override;
AirmassResult getAirmass(float rpm, bool postState) override;
};

View File

@ -4,7 +4,7 @@
class LuaAirmass final : public AirmassModelBase {
public:
AirmassResult getAirmass(int /*rpm*/, bool /*postState*/) override {
AirmassResult getAirmass(float /*rpm*/, bool /*postState*/) override {
return m_airmass;
}

View File

@ -31,7 +31,7 @@ float MafAirmass::getMaf() const {
}
}
AirmassResult MafAirmass::getAirmass(int rpm, bool postState) {
AirmassResult MafAirmass::getAirmass(float rpm, bool postState) {
float maf = getMaf();
return getAirmassImpl(maf, rpm, postState);
@ -41,7 +41,7 @@ AirmassResult MafAirmass::getAirmass(int rpm, bool postState) {
* Function block now works to create a standardised load from the cylinder filling as well as tune fuel via VE table.
* @return total duration of fuel injection per engine cycle, in milliseconds
*/
AirmassResult MafAirmass::getAirmassImpl(float massAirFlow, int rpm, bool postState) const {
AirmassResult MafAirmass::getAirmassImpl(float massAirFlow, float rpm, bool postState) const {
// If the engine is stopped, MAF is meaningless
if (rpm == 0) {
return {};

View File

@ -6,10 +6,10 @@ class MafAirmass final : public AirmassVeModelBase {
public:
explicit MafAirmass(const ValueProvider3D& veTable) : AirmassVeModelBase(veTable) {}
AirmassResult getAirmass(int rpm, bool postState) override;
AirmassResult getAirmass(float rpm, bool postState) override;
// Compute airmass based on flow & engine speed
AirmassResult getAirmassImpl(float massAirFlow, int rpm, bool postState) const;
AirmassResult getAirmassImpl(float massAirFlow, float rpm, bool postState) const;
private:
float getMaf() const;

View File

@ -1,7 +1,7 @@
#include "pch.h"
#include "speed_density_airmass.h"
AirmassResult SpeedDensityAirmass::getAirmass(int rpm, bool postState) {
AirmassResult SpeedDensityAirmass::getAirmass(float rpm, bool postState) {
ScopePerf perf(PE::GetSpeedDensityFuel);
auto map = getMap(rpm, postState);
@ -50,7 +50,7 @@ float SpeedDensityAirmass::getAirflow(float rpm, float map, bool postState) {
return massPerCycle * rpm / 60;
}
float SpeedDensityAirmass::getMap(int rpm, bool postState) const {
float SpeedDensityAirmass::getMap(float rpm, bool postState) const {
float fallbackMap = m_mapEstimationTable->getValue(rpm, Sensor::getOrZero(SensorType::Tps1));
#if EFI_TUNER_STUDIO

View File

@ -9,11 +9,11 @@ public:
, m_mapEstimationTable(&mapEstimationTable)
{}
AirmassResult getAirmass(int rpm, bool postState) override;
AirmassResult getAirmass(float rpm, bool postState) override;
AirmassResult getAirmass(float rpm, float map, bool postState);
float getAirflow(float rpm, float map, bool postState);
float getMap(int rpm, bool postState) const;
float getMap(float rpm, bool postState) const;
private:
const ValueProvider3D* const m_mapEstimationTable;

View File

@ -174,7 +174,7 @@ float getMaxAirflowAtMap(float map) {
#if EFI_ENGINE_CONTROL
// Per-cylinder base fuel mass
static float getBaseFuelMass(int rpm) {
static float getBaseFuelMass(float rpm) {
ScopePerf perf(PE::GetBaseFuel);
// airmass modes - get airmass first, then convert to fuel
@ -303,7 +303,7 @@ static float getCycleFuelMass(bool isCranking, float baseFuelMass) {
* @returns Mass of each individual fuel injection, in grams
* in case of single point injection mode the amount of fuel into all cylinders, otherwise the amount for one cylinder
*/
float getInjectionMass(int rpm) {
float getInjectionMass(float rpm) {
ScopePerf perf(PE::GetInjectionDuration);
// Always update base fuel - some cranking modes use it

View File

@ -26,7 +26,7 @@ float getCltFuelCorrection();
angle_t getCltTimingCorrection();
float getCrankingFuel(float baseFuel);
float getCrankingFuel3(float baseFuel, uint32_t revolutionCounterSinceStart);
float getInjectionMass(int rpm);
float getInjectionMass(float rpm);
percent_t getInjectorDutyCycle(int rpm);
percent_t getInjectorDutyCycleStage2(int rpm);
float getStage2InjectionFraction(int rpm, float fuelLoad);

View File

@ -74,7 +74,7 @@ void setSingleCoilDwell() {
/**
* @return Spark dwell time, in milliseconds. 0 if tables are not ready.
*/
floatms_t IgnitionState::getSparkDwell(int rpm) {
floatms_t IgnitionState::getSparkDwell(float rpm) {
#if EFI_ENGINE_CONTROL && EFI_SHAFT_POSITION_INPUT
float dwellMs;
if (engine->rpmCalculator.isCranking()) {
@ -99,7 +99,7 @@ floatms_t IgnitionState::getSparkDwell(int rpm) {
if (std::isnan(dwellMs) || dwellMs <= 0) {
// this could happen during engine configuration reset
warning(ObdCode::CUSTOM_ERR_DWELL_DURATION, "invalid dwell: %.2f at rpm=%d", dwellMs, rpm);
warning(ObdCode::CUSTOM_ERR_DWELL_DURATION, "invalid dwell: %.2f at rpm=%.0f", dwellMs, rpm);
return 0;
}
return dwellMs;

View File

@ -31,8 +31,6 @@ floatms_t getEngineCycleDuration(int rpm);
float getFuelingLoad();
float getIgnitionLoad();
floatms_t getSparkDwell(int rpm);
ignition_mode_e getCurrentIgnitionMode();
size_t getFiringOrderCylinderId(size_t index);

View File

@ -91,7 +91,7 @@ public:
MockVp3d veTable;
MOCK_METHOD(AirmassResult, getAirmass, (int rpm, bool postState), (override));
MOCK_METHOD(AirmassResult, getAirmass, (float rpm, bool postState), (override));
};
class MockInjectorModel2 : public IInjectorModel {

View File

@ -145,7 +145,7 @@ TEST(AirmassModes, VeOverride) {
struct DummyAirmassModel : public AirmassVeModelBase {
DummyAirmassModel(const ValueProvider3D& veTable) : AirmassVeModelBase(veTable) {}
AirmassResult getAirmass(int rpm, bool postState) override {
AirmassResult getAirmass(float rpm, bool postState) override {
// Default load value 10, will be overriden
getVe(rpm, 10.0f, postState);