default fuel cleanup and injection phase change (#4836)

* default fuel cleanup and injection phase change

* happy tests

* changelog

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
This commit is contained in:
Matthew Kennedy 2022-11-29 23:41:49 -05:00 committed by GitHub
parent b511754fdc
commit 5576065eb9
6 changed files with 19 additions and 13 deletions

View File

@ -48,6 +48,7 @@ Release template (copy/paste this for new release):
- Fuel Priming reset fix #4627 - Fuel Priming reset fix #4627
- Slower than expected RPM information was slowing engine start #4629 - Slower than expected RPM information was slowing engine start #4629
- Fix 36-2-1 trigger (Mitsubishi 4B11, etc) #4635 - Fix 36-2-1 trigger (Mitsubishi 4B11, etc) #4635
- Improve injection phase table defaults #4808
### Removed ### Removed
- Idle timing deadzone #4729 - Idle timing deadzone #4729

View File

@ -81,20 +81,11 @@ static void setDefaultVETable() {
setRpmTableBin(config->veRpmBins, FUEL_RPM_COUNT); setRpmTableBin(config->veRpmBins, FUEL_RPM_COUNT);
setTable(config->veTable, 80); setTable(config->veTable, 80);
// setRpmTableBin(engineConfiguration->ve2RpmBins, FUEL_RPM_COUNT);
// setLinearCurve(engineConfiguration->ve2LoadBins, 10, 300, 1);
// ve2Map.setAll(0.81);
setRpmTableBin(config->lambdaRpmBins, FUEL_RPM_COUNT);
setRpmTableBin(config->baroCorrRpmBins, BARO_CORR_SIZE); setRpmTableBin(config->baroCorrRpmBins, BARO_CORR_SIZE);
setLinearCurve(config->baroCorrPressureBins, 75, 105, 1); setLinearCurve(config->baroCorrPressureBins, 75, 105, 1);
for (int i = 0; i < BARO_CORR_SIZE;i++) {
for (int j = 0; j < BARO_CORR_SIZE;j++) { // Default baro table is all 1.0, we can't recommend a reasonable default here
// Default baro table is all 1.0, we can't recommend a reasonable default here setTable(config->baroCorrTable, 1);
config->baroCorrTable[i][j] = 1;
}
}
} }
static void setDefaultFuelCutParameters() { static void setDefaultFuelCutParameters() {
@ -168,6 +159,8 @@ static void setDefaultLambdaTable() {
}; };
copyArray(config->lambdaLoadBins, mapBins); copyArray(config->lambdaLoadBins, mapBins);
setRpmTableBin(config->lambdaRpmBins, FUEL_RPM_COUNT);
static constexpr float rowValues[] = { static constexpr float rowValues[] = {
1, 1, 1, 1, // 30, 40, 50, 60 kpa 1, 1, 1, 1, // 30, 40, 50, 60 kpa
1, 0.95, 0.92, 0.90, // 70, 80, 90, 100 kpa 1, 0.95, 0.92, 0.90, // 70, 80, 90, 100 kpa
@ -238,9 +231,12 @@ void setDefaultFuel() {
setFuelTablesLoadBin(10, 160); setFuelTablesLoadBin(10, 160);
setRpmTableBin(config->injPhaseRpmBins, FUEL_RPM_COUNT); setRpmTableBin(config->injPhaseRpmBins, FUEL_RPM_COUNT);
setDefaultVETable(); setDefaultVETable();
setTable(config->injectionPhase, -180.0f);
setDefaultLambdaTable(); setDefaultLambdaTable();
// -400 will close the injector just before TDC at the end of the exhaust stroke,
// around the time the intake valve opens.
setTable(config->injectionPhase, -400.0f);
// Charge temperature estimation // Charge temperature estimation
engineConfiguration->tChargeMinRpmMinTps = 0.25; engineConfiguration->tChargeMinRpmMinTps = 0.25;
engineConfiguration->tChargeMinRpmMaxTps = 0.25; engineConfiguration->tChargeMinRpmMaxTps = 0.25;

View File

@ -8,6 +8,7 @@
TEST(issues, issueOneCylinderSpecialCase968) { TEST(issues, issueOneCylinderSpecialCase968) {
EngineTestHelper eth(GY6_139QMB); EngineTestHelper eth(GY6_139QMB);
setTable(config->injectionPhase, -180.0f);
engineConfiguration->isFasterEngineSpinUpEnabled = false; engineConfiguration->isFasterEngineSpinUpEnabled = false;
engine->tdcMarkEnabled = false; engine->tdcMarkEnabled = false;
// set injection_mode 1 // set injection_mode 1

View File

@ -9,6 +9,7 @@
TEST(engine, testPlainCrankingWithoutAdvancedFeatures) { TEST(engine, testPlainCrankingWithoutAdvancedFeatures) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(TEST_ENGINE);
setTable(config->injectionPhase, -180.0f);
engineConfiguration->isFasterEngineSpinUpEnabled = false; engineConfiguration->isFasterEngineSpinUpEnabled = false;
engine->tdcMarkEnabled = false; engine->tdcMarkEnabled = false;
engineConfiguration->cranking.baseFuel = 12; engineConfiguration->cranking.baseFuel = 12;

View File

@ -8,6 +8,7 @@
TEST(cranking, testFasterEngineSpinningUp) { TEST(cranking, testFasterEngineSpinningUp) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(TEST_ENGINE);
setTable(config->injectionPhase, -180.0f);
engine->tdcMarkEnabled = false; engine->tdcMarkEnabled = false;
// turn on FasterEngineSpinUp mode // turn on FasterEngineSpinUp mode
engineConfiguration->isFasterEngineSpinUpEnabled = true; engineConfiguration->isFasterEngineSpinUpEnabled = true;

View File

@ -237,6 +237,8 @@ extern bool_t debugSignalExecutor;
TEST(misc, testRpmCalculator) { TEST(misc, testRpmCalculator) {
EngineTestHelper eth(FORD_INLINE_6_1995); EngineTestHelper eth(FORD_INLINE_6_1995);
setTable(config->injectionPhase, -180.0f);
engine->tdcMarkEnabled = false; engine->tdcMarkEnabled = false;
// These tests were written when the default target AFR was 14.0, so replicate that // These tests were written when the default target AFR was 14.0, so replicate that
@ -606,6 +608,7 @@ void doTestFuelSchedulerBug299smallAndMedium(int startUpDelayMs) {
printf("*************************************************** testFuelSchedulerBug299 small to medium\r\n"); printf("*************************************************** testFuelSchedulerBug299 small to medium\r\n");
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(TEST_ENGINE);
setTable(config->injectionPhase, -180.0f);
engineConfiguration->isFasterEngineSpinUpEnabled = false; engineConfiguration->isFasterEngineSpinUpEnabled = false;
engine->tdcMarkEnabled = false; engine->tdcMarkEnabled = false;
eth.moveTimeForwardMs(startUpDelayMs); // nice to know that same test works the same with different anount of idle time on start eth.moveTimeForwardMs(startUpDelayMs); // nice to know that same test works the same with different anount of idle time on start
@ -853,6 +856,7 @@ TEST(big, testFuelSchedulerBug299smallAndMedium) {
TEST(big, testTwoWireBatch) { TEST(big, testTwoWireBatch) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(TEST_ENGINE);
setTable(config->injectionPhase, -180.0f);
setupSimpleTestEngineWithMafAndTT_ONE_trigger(&eth); setupSimpleTestEngineWithMafAndTT_ONE_trigger(&eth);
EXPECT_CALL(*eth.mockAirmass, getAirmass(_)) EXPECT_CALL(*eth.mockAirmass, getAirmass(_))
.WillRepeatedly(Return(AirmassResult{0.1008f, 50.0f})); .WillRepeatedly(Return(AirmassResult{0.1008f, 50.0f}));
@ -881,6 +885,7 @@ TEST(big, testTwoWireBatch) {
TEST(big, testSequential) { TEST(big, testSequential) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(TEST_ENGINE);
setTable(config->injectionPhase, -180.0f);
EXPECT_CALL(*eth.mockAirmass, getAirmass(_)) EXPECT_CALL(*eth.mockAirmass, getAirmass(_))
.WillRepeatedly(Return(AirmassResult{0.1008f, 50.0f})); .WillRepeatedly(Return(AirmassResult{0.1008f, 50.0f}));
@ -908,6 +913,7 @@ TEST(big, testSequential) {
TEST(big, testFuelSchedulerBug299smallAndLarge) { TEST(big, testFuelSchedulerBug299smallAndLarge) {
EngineTestHelper eth(TEST_ENGINE); EngineTestHelper eth(TEST_ENGINE);
setTable(config->injectionPhase, -180.0f);
engineConfiguration->isFasterEngineSpinUpEnabled = false; engineConfiguration->isFasterEngineSpinUpEnabled = false;
engine->tdcMarkEnabled = false; engine->tdcMarkEnabled = false;
setTestBug299(&eth); setTestBug299(&eth);