add check of bailed on dwell count #6373

This commit is contained in:
kifir 2024-04-24 15:59:41 +03:00 committed by rusefillc
parent a734efdf87
commit 80cf6d1943
5 changed files with 17 additions and 15 deletions

View File

@ -223,10 +223,13 @@ public:
#if EFI_UNIT_TEST #if EFI_UNIT_TEST
bool needTdcCallback = true; bool needTdcCallback = true;
int bailedOnDwell = 0; private:
int bailedOnDwellCount = 0;
public:
int getBailedOnDwellCount() const { return bailedOnDwellCount; }
void incrementBailedOnDwellCount() { bailedOnDwellCount++; }
#endif /* EFI_UNIT_TEST */ #endif /* EFI_UNIT_TEST */
int getGlobalConfigurationVersion(void) const; int getGlobalConfigurationVersion(void) const;

View File

@ -55,10 +55,6 @@ public:
scheduling_s dwellStartTimer; scheduling_s dwellStartTimer;
AngleBasedEvent sparkEvent; AngleBasedEvent sparkEvent;
#if EFI_UNIT_TEST
bool bailedOnDwell = false;
#endif
scheduling_s trailingSparkCharge; scheduling_s trailingSparkCharge;
scheduling_s trailingSparkFire; scheduling_s trailingSparkFire;

View File

@ -334,7 +334,7 @@ void turnSparkPinHighStartCharging(IgnitionEvent *event) {
} }
#if EFI_UNIT_TEST #if EFI_UNIT_TEST
event->bailedOnDwell = skippedDwellDueToTriggerNoised; engine->incrementBailedOnDwellCount();
#endif #endif

View File

@ -65,4 +65,6 @@ TEST(OddFireRunningMode, hd) {
eth.assertEvent5("spark down2#3", 3, (void*)fireSparkAndPrepareNextSchedule, eth.angleToTimeUs(-180 + cylinderTwo - timing)); eth.assertEvent5("spark down2#3", 3, (void*)fireSparkAndPrepareNextSchedule, eth.angleToTimeUs(-180 + cylinderTwo - timing));
eth.assertEvent5("fuel down2#6", 6, (void*)turnInjectionPinLow, eth.angleToTimeUs(540 + PORT_INJECTION_OFFSET + cylinderTwo)); eth.assertEvent5("fuel down2#6", 6, (void*)turnInjectionPinLow, eth.angleToTimeUs(540 + PORT_INJECTION_OFFSET + cylinderTwo));
eth.assertEvent5("spark down2#7", 7, (void*)fireSparkAndPrepareNextSchedule, eth.angleToTimeUs(180 + cylinderOne - timing)); eth.assertEvent5("spark down2#7", 7, (void*)fireSparkAndPrepareNextSchedule, eth.angleToTimeUs(180 + cylinderOne - timing));
ASSERT_EQ(2, engine->getBailedOnDwellCount()) << "Please check if our dwell algorithm have really got better.";
} }

View File

@ -1,7 +1,7 @@
#include "pch.h" #include "pch.h"
#include "logicdata_csv_reader.h" #include "logicdata_csv_reader.h"
static void testNoOverdwell(const char* file, bool instantRpm) { static void testNoOverdwell(const char* file, bool instantRpm, const int expectedBailedOnDwellCount) {
CsvReader reader(1, /* vvtCount */ 0); CsvReader reader(1, /* vvtCount */ 0);
reader.open(file); reader.open(file);
@ -49,29 +49,30 @@ static void testNoOverdwell(const char* file, bool instantRpm) {
reader.processLine(&eth); reader.processLine(&eth);
} }
// nothing to check here, just that no coils got stuck on ASSERT_EQ(expectedBailedOnDwellCount, engine->getBailedOnDwellCount())
<< "Please check if our dwell algorithm have really got better.";
} }
TEST(RealNoisyTrigger, AvoidOverdwell1NoInstant) { TEST(RealNoisyTrigger, AvoidOverdwell1NoInstant) {
testNoOverdwell("tests/trigger/resources/noisy-trigger-1.csv", false); testNoOverdwell("tests/trigger/resources/noisy-trigger-1.csv", false, 25);
} }
TEST(RealNoisyTrigger, AvoidOverdwell1WithInstant) { TEST(RealNoisyTrigger, AvoidOverdwell1WithInstant) {
testNoOverdwell("tests/trigger/resources/noisy-trigger-1.csv", true); testNoOverdwell("tests/trigger/resources/noisy-trigger-1.csv", true, 23);
} }
TEST(RealNoisyTrigger, AvoidOverdwell2NoInstant) { TEST(RealNoisyTrigger, AvoidOverdwell2NoInstant) {
testNoOverdwell("tests/trigger/resources/noisy-trigger-2.csv", false); testNoOverdwell("tests/trigger/resources/noisy-trigger-2.csv", false, 89);
} }
TEST(RealNoisyTrigger, AvoidOverdwell2WithInstant) { TEST(RealNoisyTrigger, AvoidOverdwell2WithInstant) {
testNoOverdwell("tests/trigger/resources/noisy-trigger-2.csv", true); testNoOverdwell("tests/trigger/resources/noisy-trigger-2.csv", true, 85);
} }
TEST(RealNoisyTrigger, AvoidOverdwell3NoInstant) { TEST(RealNoisyTrigger, AvoidOverdwell3NoInstant) {
testNoOverdwell("tests/trigger/resources/noisy-trigger-3.csv", false); testNoOverdwell("tests/trigger/resources/noisy-trigger-3.csv", false, 25);
} }
TEST(RealNoisyTrigger, AvoidOverdwell3WithInstant) { TEST(RealNoisyTrigger, AvoidOverdwell3WithInstant) {
testNoOverdwell("tests/trigger/resources/noisy-trigger-3.csv", true); testNoOverdwell("tests/trigger/resources/noisy-trigger-3.csv", true, 22);
} }