mirror of https://github.com/FOME-Tech/fome-fw.git
int rpm -> float rpm
This commit is contained in:
parent
c880ba4ec5
commit
28fc04ee3d
|
@ -195,7 +195,7 @@ void EngineState::periodicFastCallback() {
|
|||
#endif // EFI_ENGINE_CONTROL
|
||||
}
|
||||
|
||||
void EngineState::updateTChargeK(int rpm, float tps) {
|
||||
void EngineState::updateTChargeK(float rpm, float tps) {
|
||||
#if EFI_ENGINE_CONTROL
|
||||
float newTCharge = engine->fuelComputer.getTCharge(rpm, tps);
|
||||
if (!std::isnan(newTCharge)) {
|
||||
|
|
|
@ -17,7 +17,7 @@ public:
|
|||
EngineState();
|
||||
void periodicFastCallback();
|
||||
void updateSlowSensors();
|
||||
void updateTChargeK(int rpm, float tps);
|
||||
void updateTChargeK(float rpm, float tps);
|
||||
|
||||
/**
|
||||
* always 360 or 720, never zero
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "fuel_math.h"
|
||||
#include "fuel_computer.h"
|
||||
|
||||
mass_t FuelComputerBase::getCycleFuel(mass_t airmass, int rpm, float load) {
|
||||
mass_t FuelComputerBase::getCycleFuel(mass_t airmass, float rpm, float load) {
|
||||
load = getTargetLambdaLoadAxis(load);
|
||||
|
||||
float stoich = getStoichiometricRatio();
|
||||
|
@ -56,7 +56,7 @@ float FuelComputer::getStoichiometricRatio() const {
|
|||
}
|
||||
|
||||
|
||||
float FuelComputer::getTargetLambda(int rpm, float load) const {
|
||||
float FuelComputer::getTargetLambda(float rpm, float load) const {
|
||||
return interpolate3d(
|
||||
config->lambdaTable,
|
||||
config->lambdaLoadBins, load,
|
||||
|
|
|
@ -10,20 +10,20 @@ class ValueProvider3D;
|
|||
#include "fuel_computer_generated.h"
|
||||
|
||||
struct IFuelComputer : public fuel_computer_s {
|
||||
virtual mass_t getCycleFuel(mass_t airmass, int rpm, float load) = 0;
|
||||
temperature_t getTCharge(int rpm, float tps);
|
||||
virtual mass_t getCycleFuel(mass_t airmass, float rpm, float load) = 0;
|
||||
temperature_t getTCharge(float rpm, float tps);
|
||||
float getLoadOverride(float defaultLoad, load_override_e overrideMode) const;
|
||||
private:
|
||||
float getTChargeCoefficient(int rpm, float tps);
|
||||
float getTChargeCoefficient(float rpm, float tps);
|
||||
};
|
||||
|
||||
// This contains the math of the fuel model, but doesn't actually read any configuration
|
||||
class FuelComputerBase : public IFuelComputer {
|
||||
public:
|
||||
mass_t getCycleFuel(mass_t airmass, int rpm, float load) override;
|
||||
mass_t getCycleFuel(mass_t airmass, float rpm, float load) override;
|
||||
|
||||
virtual float getStoichiometricRatio() const = 0;
|
||||
virtual float getTargetLambda(int rpm, float load) const = 0;
|
||||
virtual float getTargetLambda(float rpm, float load) const = 0;
|
||||
virtual float getTargetLambdaLoadAxis(float defaultLoad) const = 0;
|
||||
};
|
||||
|
||||
|
@ -31,7 +31,7 @@ public:
|
|||
class FuelComputer final : public FuelComputerBase {
|
||||
public:
|
||||
float getStoichiometricRatio() const override;
|
||||
float getTargetLambda(int rpm, float load) const override;
|
||||
float getTargetLambda(float rpm, float load) const override;
|
||||
float getTargetLambdaLoadAxis(float defaultLoad) const override;
|
||||
};
|
||||
|
||||
|
|
|
@ -274,13 +274,13 @@ float getInjectionModeDurationMultiplier() {
|
|||
}
|
||||
}
|
||||
|
||||
percent_t getInjectorDutyCycle(int rpm) {
|
||||
percent_t getInjectorDutyCycle(float rpm) {
|
||||
floatms_t totalInjectiorAmountPerCycle = engine->engineState.injectionDuration * getNumberOfInjections(engineConfiguration->injectionMode);
|
||||
floatms_t engineCycleDuration = getEngineCycleDuration(rpm);
|
||||
return 100 * totalInjectiorAmountPerCycle / engineCycleDuration;
|
||||
}
|
||||
|
||||
percent_t getInjectorDutyCycleStage2(int rpm) {
|
||||
percent_t getInjectorDutyCycleStage2(float rpm) {
|
||||
floatms_t totalInjectiorAmountPerCycle = engine->engineState.injectionDurationStage2 * getNumberOfInjections(engineConfiguration->injectionMode);
|
||||
floatms_t engineCycleDuration = getEngineCycleDuration(rpm);
|
||||
return 100 * totalInjectiorAmountPerCycle / engineCycleDuration;
|
||||
|
@ -400,7 +400,7 @@ float getBaroCorrection() {
|
|||
}
|
||||
}
|
||||
|
||||
percent_t getFuelALSCorrection(int rpm) {
|
||||
percent_t getFuelALSCorrection(float rpm) {
|
||||
#if EFI_ANTILAG_SYSTEM
|
||||
if (engine->antilagController.isAntilagCondition) {
|
||||
float throttleIntent = Sensor::getOrZero(SensorType::DriverThrottleIntent);
|
||||
|
@ -409,7 +409,7 @@ percent_t getFuelALSCorrection(int rpm) {
|
|||
config->alsFuelAdjustmentLoadBins, throttleIntent,
|
||||
config->alsFuelAdjustmentrpmBins, rpm
|
||||
);
|
||||
return AlsFuelAdd;
|
||||
return AlsFuelAdd;
|
||||
} else
|
||||
#endif /* EFI_ANTILAG_SYSTEM */
|
||||
{
|
||||
|
@ -439,7 +439,7 @@ float getStandardAirCharge() {
|
|||
return idealGasLaw(cylDisplacement, 101.325f, 273.15f + 20.0f);
|
||||
}
|
||||
|
||||
float getCylinderFuelTrim(size_t cylinderNumber, int rpm, float fuelLoad) {
|
||||
float getCylinderFuelTrim(size_t cylinderNumber, float rpm, float fuelLoad) {
|
||||
auto trimPercent = interpolate3d(
|
||||
config->fuelTrims[cylinderNumber].table,
|
||||
config->fuelTrimLoadBins, fuelLoad,
|
||||
|
@ -453,7 +453,7 @@ float getCylinderFuelTrim(size_t cylinderNumber, int rpm, float fuelLoad) {
|
|||
|
||||
static Hysteresis stage2Hysteresis;
|
||||
|
||||
float getStage2InjectionFraction(int rpm, float load) {
|
||||
float getStage2InjectionFraction(float rpm, float load) {
|
||||
if (!engineConfiguration->enableStagedInjection) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ void initFuelMap();
|
|||
float getRunningFuel(float baseFuel);
|
||||
|
||||
float getBaroCorrection();
|
||||
percent_t getFuelALSCorrection(int rpm);
|
||||
percent_t getFuelALSCorrection(float rpm);
|
||||
int getNumberOfInjections(injection_mode_e mode);
|
||||
angle_t getInjectionOffset(float rpm, float load);
|
||||
float getIatFuelCorrection();
|
||||
|
@ -27,12 +27,12 @@ angle_t getCltTimingCorrection();
|
|||
float getCrankingFuel(float baseFuel);
|
||||
float getCrankingFuel3(float baseFuel, uint32_t revolutionCounterSinceStart);
|
||||
float getInjectionMass(float rpm);
|
||||
percent_t getInjectorDutyCycle(int rpm);
|
||||
percent_t getInjectorDutyCycleStage2(int rpm);
|
||||
float getStage2InjectionFraction(int rpm, float fuelLoad);
|
||||
percent_t getInjectorDutyCycle(float rpm);
|
||||
percent_t getInjectorDutyCycleStage2(float rpm);
|
||||
float getStage2InjectionFraction(float rpm, float fuelLoad);
|
||||
|
||||
float getStandardAirCharge();
|
||||
float getCylinderFuelTrim(size_t cylinderNumber, int rpm, float fuelLoad);
|
||||
float getCylinderFuelTrim(size_t cylinderNumber, float rpm, float fuelLoad);
|
||||
|
||||
struct AirmassModelBase;
|
||||
AirmassModelBase* getAirmassModel(engine_load_mode_e mode);
|
||||
|
|
|
@ -26,14 +26,14 @@
|
|||
#include "advance_map.h"
|
||||
#include "gppwm_channel.h"
|
||||
|
||||
floatms_t getEngineCycleDuration(int rpm) {
|
||||
floatms_t getEngineCycleDuration(float rpm) {
|
||||
return getCrankshaftRevolutionTimeMs(rpm) * (getEngineRotationState()->getOperationMode() == TWO_STROKE ? 1 : 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return number of milliseconds in one crank shaft revolution
|
||||
*/
|
||||
floatms_t getCrankshaftRevolutionTimeMs(int rpm) {
|
||||
floatms_t getCrankshaftRevolutionTimeMs(float rpm) {
|
||||
if (rpm == 0) {
|
||||
return NAN;
|
||||
}
|
||||
|
|
|
@ -25,8 +25,8 @@ void setFlatInjectorLag(float value);
|
|||
*/
|
||||
#define getOneDegreeTimeUs(rpm) (1000000.0f * 60 / 360 / (rpm))
|
||||
|
||||
floatms_t getCrankshaftRevolutionTimeMs(int rpm);
|
||||
floatms_t getEngineCycleDuration(int rpm);
|
||||
floatms_t getCrankshaftRevolutionTimeMs(float rpm);
|
||||
floatms_t getEngineCycleDuration(float rpm);
|
||||
|
||||
float getFuelingLoad();
|
||||
float getIgnitionLoad();
|
||||
|
|
|
@ -30,7 +30,7 @@ fuel_Map3D_t veMap;
|
|||
#define tpMin 0
|
||||
#define tpMax 100
|
||||
|
||||
float IFuelComputer::getTChargeCoefficient(int rpm, float tps) {
|
||||
float IFuelComputer::getTChargeCoefficient(float rpm, float tps) {
|
||||
// First, do TPS mode since it doesn't need any of the airflow math.
|
||||
if (engineConfiguration->tChargeMode == TCHARGE_MODE_RPM_TPS) {
|
||||
float minRpmKcurrentTPS = interpolateMsg("minRpm", tpMin,
|
||||
|
@ -71,7 +71,7 @@ float IFuelComputer::getTChargeCoefficient(int rpm, float tps) {
|
|||
|
||||
// http://rusefi.com/math/t_charge.html
|
||||
/***panel:Charge Temperature*/
|
||||
temperature_t IFuelComputer::getTCharge(int rpm, float tps) {
|
||||
temperature_t IFuelComputer::getTCharge(float rpm, float tps) {
|
||||
const auto clt = Sensor::get(SensorType::Clt);
|
||||
const auto iat = Sensor::get(SensorType::Iat);
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ using ::testing::FloatEq;
|
|||
class MockFuelComputer : public FuelComputerBase {
|
||||
public:
|
||||
MOCK_METHOD(float, getStoichiometricRatio, (), (const, override));
|
||||
MOCK_METHOD(float, getTargetLambda, (int rpm, float load), (const, override));
|
||||
MOCK_METHOD(float, getTargetLambda, (float rpm, float load), (const, override));
|
||||
MOCK_METHOD(float, getTargetLambdaLoadAxis, (float defaultLoad), (const, override));
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue