Flex fuel cranking improvements (#4043)

* improve flex cranking

* call it e85

* don't re-warn

* warning name

* ui
This commit is contained in:
Matthew Kennedy 2022-04-04 14:41:36 -07:00 committed by GitHub
parent f554733ea2
commit 72dabf4057
5 changed files with 32 additions and 9 deletions

View File

@ -43,7 +43,8 @@ void setDefaultCranking() {
1.0,
1.0
};
copyArray(config->crankingFuelCoef, crankingCoef);
copyArray(config->crankingFuelCoef, crankingCoef);
copyArray(config->crankingFuelCoefE100, crankingCoef);
// Deg C
static const float crankingBins[] = {

View File

@ -64,11 +64,29 @@ float getCrankingFuel3(
auto clt = Sensor::get(SensorType::Clt).value_or(20);
auto e0Mult = interpolate2d(clt, config->crankingFuelBins, config->crankingFuelCoef);
if (Sensor::hasSensor(SensorType::FuelEthanolPercent)) {
auto e100 = interpolate2d(clt, config->crankingFuelBins, config->crankingFuelCoefE100);
bool alreadyWarned = false;
if (e0Mult <= 0.1f) {
warning(CUSTOM_ERR_ZERO_E0_MULT, "zero e0 multiplier");
alreadyWarned = true;
}
auto flex = Sensor::get(SensorType::FuelEthanolPercent);
engine->engineState.cranking.coolantTemperatureCoefficient = priv::linterp(e0Mult, e100, flex.value_or(50));
if (engineConfiguration->flexCranking && Sensor::hasSensor(SensorType::FuelEthanolPercent)) {
auto e85Mult = interpolate2d(clt, config->crankingFuelBins, config->crankingFuelCoefE100);
if (e85Mult <= 0.1f) {
warning(CUSTOM_ERR_ZERO_E85_MULT, "zero e85 multiplier");
alreadyWarned = true;
}
// If failed flex sensor, default to 50% E
auto flex = Sensor::get(SensorType::FuelEthanolPercent).value_or(50);
engine->engineState.cranking.coolantTemperatureCoefficient =
interpolateClamped(
0, e0Mult,
85, e85Mult,
flex
);
} else {
engine->engineState.cranking.coolantTemperatureCoefficient = e0Mult;
}
@ -86,7 +104,8 @@ float getCrankingFuel3(
engine->engineState.cranking.fuel = crankingFuel * 1000;
if (crankingFuel <= 0) {
// don't re-warn for zero fuel when we already warned for a more specific problem
if (!alreadyWarned && crankingFuel <= 0) {
warning(CUSTOM_ERR_ZERO_CRANKING_FUEL, "Cranking fuel value %f", crankingFuel);
}
return crankingFuel;

View File

@ -2072,6 +2072,8 @@ typedef enum {
CUSTOM_ERR_PWM_CALLBACK_ASSERT = 6713,
CUSTOM_ERR_PWM_SWITCH_ASSERT = 6714,
CUSTOM_ERR_ZERO_E0_MULT = 6715,
CUSTOM_ERR_ZERO_E85_MULT = 6716,
CUSTOM_INVALID_ADC = 6720,
CUSTOM_INVALID_MODE_SETTING = 6721,

View File

@ -1064,7 +1064,7 @@ custom idle_mode_e 4 bits, U32, @OFFSET@, [0:0], "Open Loop + Closed Loop", "Ope
bit useFixedBaroCorrFromMap
bit useSeparateAdvanceForCranking,"Table","Fixed (auto taper)";+In Constant mode, timing is automatically tapered to running as RPM increases.\nIn Table mode, the "Cranking ignition advance" table is used directly.
bit useAdvanceCorrectionsForCranking;+This enables the various ignition corrections during cranking (IAT, CLT, FSIO and PID idle).\nYou probably don't need this.
bit unused1476b19
bit flexCranking;Enable a second cranking table to use for E100 flex fuel, interpolating between the two based on flex fuel sensor.
bit unused1476b20
bit useIacPidMultTable;+This flag allows to use a special 'PID Multiplier' table (0.0-1.0) to compensate for nonlinear nature of IAC-RPM controller
bit isBoostControlEnabled

View File

@ -490,7 +490,7 @@ enable2ndByteCanID = false
yBins = crankingFuelCoef
gauge = CLTGauge
curve = crankingCltCurveE100, "Cranking Coolant Temperature Multiplier (Flex Fuel E100)"
curve = crankingCltCurveE100, "Cranking Coolant Temperature Multiplier (Flex Fuel E85)"
columnLabel = "Coolant", "Multiplier"
xAxis = -40, 120, 9
yAxis = 0, 3, 10
@ -1437,7 +1437,7 @@ menuDialog = main
subMenu = std_separator
subMenu = crankingCltCurve, "Fuel CLT multiplier"
subMenu = crankingCltCurveE100, "Fuel CLT multiplier (Flex Fuel E100)", 0, { flexSensorPin != @@ADC_CHANNEL_NONE@@ }
subMenu = crankingCltCurveE100, "Fuel CLT multiplier (Flex Fuel E85)", 0, { flexSensorPin != @@ADC_CHANNEL_NONE@@ && flexCranking }
subMenu = crankingDurationCurve, "Fuel duration multiplier"
subMenu = crankingTpsCurve, "Fuel TPS multiplier"
subMenu = std_separator
@ -3299,6 +3299,7 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@\x00\x31\x00\x00"
field = "Enable flood clear", isCylinderCleanupEnabled
field = "Enable faster engine spin-up", isFasterEngineSpinUpEnabled
field = "Use Advance Corrections for cranking", useAdvanceCorrectionsForCranking
field = "Use Flex Fuel cranking table", flexCranking
; Cranking->Cranking Settings
dialog = crankingDialog, "Cranking Settings"