simplify cranking corrections (#1510)
This commit is contained in:
parent
8a362ac2f9
commit
c8fb6993ac
|
@ -52,7 +52,6 @@ DISPLAY_TEXT(eol);
|
|||
|
||||
DISPLAY(DISPLAY_IF(isCrankingState)) floatms_t getCrankingFuel3(
|
||||
floatms_t baseFuel,
|
||||
float coolantTemperature,
|
||||
uint32_t revolutionCounterSinceStart DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
// these magic constants are in Celsius
|
||||
float baseCrankingFuel;
|
||||
|
@ -71,10 +70,12 @@ DISPLAY(DISPLAY_IF(isCrankingState)) floatms_t getCrankingFuel3(
|
|||
|
||||
/**
|
||||
* Cranking fuel is different depending on engine coolant temperature
|
||||
* If the sensor is failed, use 20 deg C
|
||||
*/
|
||||
auto clt = Sensor::get(SensorType::Clt);
|
||||
DISPLAY_TEXT(Coolant_coef);
|
||||
engine->engineState.DISPLAY_PREFIX(cranking).DISPLAY_FIELD(coolantTemperatureCoefficient) = cisnan(coolantTemperature) ? 1 : interpolate2d("crank", coolantTemperature, config->crankingFuelBins,
|
||||
config->crankingFuelCoef);
|
||||
engine->engineState.DISPLAY_PREFIX(cranking).DISPLAY_FIELD(coolantTemperatureCoefficient) =
|
||||
interpolate2d("crank", clt.value_or(20), config->crankingFuelBins, config->crankingFuelCoef);
|
||||
DISPLAY_SENSOR(CLT);
|
||||
DISPLAY_TEXT(eol);
|
||||
|
||||
|
@ -83,6 +84,13 @@ DISPLAY(DISPLAY_IF(isCrankingState)) floatms_t getCrankingFuel3(
|
|||
DISPLAY_TEXT(TPS_coef);
|
||||
engine->engineState.DISPLAY_PREFIX(cranking).DISPLAY_FIELD(tpsCoefficient) = tps.Valid ? 1 : interpolate2d("crankTps", tps.Value, engineConfiguration->crankingTpsBins,
|
||||
engineConfiguration->crankingTpsCoef);
|
||||
|
||||
|
||||
/*
|
||||
engine->engineState.DISPLAY_PREFIX(cranking).DISPLAY_FIELD(tpsCoefficient) =
|
||||
tps.Valid
|
||||
? interpolate2d("crankTps", tps.Value, engineConfiguration->crankingTpsBins, engineConfiguration->crankingTpsCoef)
|
||||
: 1; // in case of failed TPS, don't correct.*/
|
||||
DISPLAY_SENSOR(TPS);
|
||||
DISPLAY_TEXT(eol);
|
||||
|
||||
|
@ -489,8 +497,7 @@ float getBaroCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
* @return Duration of fuel injection while craning
|
||||
*/
|
||||
floatms_t getCrankingFuel(float baseFuel DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
return getCrankingFuel3(baseFuel, Sensor::get(SensorType::Clt).value_or(20),
|
||||
engine->rpmCalculator.getRevolutionCounterSinceStart() PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
return getCrankingFuel3(baseFuel, engine->rpmCalculator.getRevolutionCounterSinceStart() PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
}
|
||||
|
||||
float getStandardAirCharge(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
|
|
|
@ -34,7 +34,7 @@ float getCltFuelCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
|||
float getFuelCutOffCorrection(efitick_t nowNt, int rpm DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
angle_t getCltTimingCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
floatms_t getCrankingFuel(floatms_t baseFuel DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
floatms_t getCrankingFuel3(floatms_t baseFuel, float coolantTemperature, uint32_t revolutionCounterSinceStart DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
floatms_t getCrankingFuel3(floatms_t baseFuel, uint32_t revolutionCounterSinceStart DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
floatms_t getInjectionDuration(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
percent_t getInjectorDutyCycle(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
|
|
|
@ -112,13 +112,18 @@ TEST(misc, testFuelMap) {
|
|||
|
||||
engineConfiguration->cranking.baseFuel = 4;
|
||||
|
||||
// NAN in case we have issues with the CLT sensor
|
||||
EXPECT_NEAR( 6.0, getCrankingFuel3(2, NAN, 0 PASS_ENGINE_PARAMETER_SUFFIX), EPS4D);
|
||||
// Should use 20 degree correction in case of failed sensor
|
||||
Sensor::resetMockValue(SensorType::Clt);
|
||||
EXPECT_NEAR( 9.71999, getCrankingFuel3(2, 0 PASS_ENGINE_PARAMETER_SUFFIX), EPS4D);
|
||||
|
||||
EXPECT_NEAR(11.6, getCrankingFuel3(2, 0, 4 PASS_ENGINE_PARAMETER_SUFFIX), EPS4D);
|
||||
EXPECT_NEAR(5.82120, getCrankingFuel3(2, 8, 15 PASS_ENGINE_PARAMETER_SUFFIX), EPS4D);
|
||||
EXPECT_NEAR(6.000, getCrankingFuel3(2, 70, 0 PASS_ENGINE_PARAMETER_SUFFIX), EPS4D);
|
||||
EXPECT_NEAR(2.41379, getCrankingFuel3(2, 70, 50 PASS_ENGINE_PARAMETER_SUFFIX), EPS4D);
|
||||
Sensor::setMockValue(SensorType::Clt, 0);
|
||||
EXPECT_NEAR(11.6, getCrankingFuel3(2, 4 PASS_ENGINE_PARAMETER_SUFFIX), EPS4D);
|
||||
Sensor::setMockValue(SensorType::Clt, 8);
|
||||
EXPECT_NEAR(5.82120, getCrankingFuel3(2, 15 PASS_ENGINE_PARAMETER_SUFFIX), EPS4D);
|
||||
Sensor::setMockValue(SensorType::Clt, 70);
|
||||
EXPECT_NEAR(6.000, getCrankingFuel3(2, 0 PASS_ENGINE_PARAMETER_SUFFIX), EPS4D);
|
||||
Sensor::setMockValue(SensorType::Clt, 70);
|
||||
EXPECT_NEAR(2.41379, getCrankingFuel3(2, 50 PASS_ENGINE_PARAMETER_SUFFIX), EPS4D);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
#include "engine_test_helper.h"
|
||||
|
||||
TEST(engine, testPlainCrankingWithoutAdvancedFeatures) {
|
||||
printf("*************************************************** testPlainCrankingWithoutAdvancedFeatures\r\n");
|
||||
|
||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
||||
|
||||
setupSimpleTestEngineWithMafAndTT_ONE_trigger(ð);
|
||||
|
|
Loading…
Reference in New Issue