Stricter miata sync (#2891)
* strict mazda trigger shape * this is an even better gap * sync point moved so things are different now * fix * update instantrpm in test * s * s * this is safer * test * tests * instant rpm * cleanup
This commit is contained in:
parent
d8dc232edf
commit
025c32de00
|
@ -25,13 +25,18 @@
|
|||
|
||||
void initializeMazdaMiataNaShape(TriggerWaveform *s) {
|
||||
s->initialize(FOUR_STROKE_CAM_SENSOR);
|
||||
s->setTriggerSynchronizationGap2(4 * 0.75f, 4 * 1.4f);
|
||||
|
||||
// nominal gap is 0.325
|
||||
s->setTriggerSynchronizationGap2(0.1, 0.4);
|
||||
// nominal gap is ~1.6
|
||||
s->setSecondTriggerSynchronizationGap2(1.2, 1.8);
|
||||
|
||||
s->useRiseEdge = false;
|
||||
|
||||
s->bothFrontsRequired = true;
|
||||
s->gapBothDirections = true;
|
||||
|
||||
s->tdcPosition = 436.965;
|
||||
s->tdcPosition = 5.181;
|
||||
|
||||
/**
|
||||
* http://rusefi.com/forum/viewtopic.php?f=3&t=729&p=12983#p12983
|
||||
|
@ -41,7 +46,7 @@ void initializeMazdaMiataNaShape(TriggerWaveform *s) {
|
|||
|
||||
s->addEvent720(216.897031, T_PRIMARY, TV_RISE);
|
||||
s->addEvent720(232.640068, T_SECONDARY, TV_RISE);
|
||||
s->addEvent720(288.819688, T_PRIMARY, TV_FALL);
|
||||
s->addEvent720(288.819688, T_PRIMARY, TV_FALL); // <-- This edge is the sync point
|
||||
s->addEvent720(302.646323, T_SECONDARY, TV_FALL);
|
||||
|
||||
s->addEvent720(412.448056, T_SECONDARY, TV_RISE);
|
||||
|
|
|
@ -18,32 +18,33 @@ TEST(cranking, realCrankingFromFile) {
|
|||
|
||||
ssize_t read;
|
||||
|
||||
for (int i = 0; i < 18; i++) {
|
||||
for (int i = 0; i < 23; i++) {
|
||||
reader.readLine(ð);
|
||||
}
|
||||
|
||||
ASSERT_EQ( 229, GET_RPM())<< reader.lineIndex() << " @ 0";
|
||||
ASSERT_EQ( 0, eth.recentWarnings()->getCount())<< "warningCounter#got synch";
|
||||
EXPECT_EQ(0, GET_RPM())<< reader.lineIndex();
|
||||
EXPECT_EQ( 0, eth.recentWarnings()->getCount());
|
||||
|
||||
// This tooth should be first sync point
|
||||
reader.readLine(ð);
|
||||
|
||||
ASSERT_EQ( 213, GET_RPM())<< reader.lineIndex() << " @ 1";
|
||||
EXPECT_EQ(232, GET_RPM())<< reader.lineIndex() << " @ 1";
|
||||
|
||||
for (int i = 0; i < 30; i++) {
|
||||
reader.readLine(ð);
|
||||
}
|
||||
ASSERT_EQ( 223, GET_RPM())<< reader.lineIndex();
|
||||
ASSERT_EQ(224, GET_RPM())<< reader.lineIndex();
|
||||
|
||||
|
||||
for (int i = 0; i < 30; i++) {
|
||||
reader.readLine(ð);
|
||||
}
|
||||
ASSERT_EQ( 297, GET_RPM())<< reader.lineIndex() << " @ 2";
|
||||
ASSERT_EQ(456, GET_RPM())<< reader.lineIndex() << " @ 2";
|
||||
|
||||
while (reader.haveMore()) {
|
||||
reader.processLine(ð);
|
||||
}
|
||||
|
||||
ASSERT_EQ(0, eth.recentWarnings()->getCount())<< "warningCounter#realCranking";
|
||||
ASSERT_EQ(560, GET_RPM())<< reader.lineIndex();
|
||||
ASSERT_EQ(407, GET_RPM())<< reader.lineIndex();
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
#include "engine_test_helper.h"
|
||||
#include "logicdata_csv_reader.h"
|
||||
|
||||
extern int timeNowUs;
|
||||
extern WarningCodeState unitTestWarningCodeState;
|
||||
|
@ -53,29 +54,19 @@ TEST(cranking, hardcodedRealCranking) {
|
|||
/* 11 */ EVENT(/* timestamp*/0.99523975, T_SECONDARY, /*value*/true);
|
||||
/* 12 */ EVENT(/* timestamp*/1.076422, T_SECONDARY, /*value*/false);
|
||||
/* 13 */ EVENT(/* timestamp*/1.125428, T_SECONDARY, /*value*/true);
|
||||
EXPECT_EQ(0, GET_RPM());
|
||||
/* 14 */ EVENT(/* timestamp*/1.194742, T_PRIMARY, /*value*/true);
|
||||
// first synch & fast spinning RPM
|
||||
EXPECT_EQ(227, GET_RPM());
|
||||
/* 15 */ EVENT(/* timestamp*/1.20417975, T_SECONDARY, /*value*/false);
|
||||
EXPECT_EQ(233, GET_RPM());
|
||||
/* 16 */ EVENT(/* timestamp*/1.25380075, T_SECONDARY, /*value*/true);
|
||||
EXPECT_EQ(234, GET_RPM());
|
||||
/* 17 */ EVENT(/* timestamp*/1.30114225, T_PRIMARY, /*value*/true);
|
||||
EXPECT_EQ(219, GET_RPM());
|
||||
/* 18 */ EVENT(/* timestamp*/1.3341915, T_SECONDARY, /*value*/false);
|
||||
EXPECT_EQ(228, GET_RPM());
|
||||
/* 19 */ EVENT(/* timestamp*/1.383534, T_SECONDARY, /*value*/true);
|
||||
EXPECT_EQ( 248, GET_RPM());
|
||||
|
||||
// WHY DOES RPM GO SO LOW HERE?
|
||||
// It doesn't look like it drops in the logic analyzer trace (hint: it doesn't, there's a bug)
|
||||
|
||||
// second synch
|
||||
/* 22 */ EVENT(/* timestamp*/1.45352675, T_PRIMARY, /*value*/true);
|
||||
EXPECT_EQ(224, GET_RPM());
|
||||
/* 23 */ EVENT(/* timestamp*/1.46291525, T_SECONDARY, /*value*/false);
|
||||
EXPECT_EQ(231, GET_RPM());
|
||||
EXPECT_EQ(0, GET_RPM());
|
||||
// ^^ All teeth above are pre-sync ^^
|
||||
|
||||
// THIS TOOTH IS SYNC POINT!
|
||||
// Should get instantRpm from here on
|
||||
/* 25 */ EVENT(/* timestamp*/1.49939025, T_PRIMARY, /*value*/false);
|
||||
EXPECT_EQ(239, GET_RPM());
|
||||
/* 27 */ EVENT(/* timestamp*/1.511785, T_SECONDARY, /*value*/true);
|
||||
|
@ -85,24 +76,25 @@ TEST(cranking, hardcodedRealCranking) {
|
|||
/* 31 */ EVENT(/* timestamp*/1.6399845, T_SECONDARY, /*value*/true);
|
||||
EXPECT_EQ(234, GET_RPM());
|
||||
/* 32 */ EVENT(/* timestamp*/1.70975875, T_PRIMARY, /*value*/true);
|
||||
EXPECT_EQ(233, GET_RPM());
|
||||
EXPECT_EQ(225, GET_RPM());
|
||||
/* 33 */ EVENT(/* timestamp*/1.7194455, T_SECONDARY, /*value*/false);
|
||||
EXPECT_EQ(233, GET_RPM());
|
||||
EXPECT_EQ(231, GET_RPM());
|
||||
/* 36 */ EVENT(/* timestamp*/1.7697125, T_SECONDARY, /*value*/true);
|
||||
EXPECT_EQ(233, GET_RPM());
|
||||
EXPECT_EQ(231, GET_RPM());
|
||||
/* 37 */ EVENT(/* timestamp*/1.817179, T_PRIMARY, /*value*/true);
|
||||
EXPECT_EQ(233, GET_RPM());
|
||||
EXPECT_EQ(217, GET_RPM());
|
||||
/* 38 */ EVENT(/* timestamp*/1.8511055, T_SECONDARY, /*value*/false);
|
||||
EXPECT_EQ(233, GET_RPM());
|
||||
EXPECT_EQ(225, GET_RPM());
|
||||
/* 41 */ EVENT(/* timestamp*/1.9011835, T_SECONDARY, /*value*/true);
|
||||
EXPECT_EQ(233, GET_RPM());
|
||||
EXPECT_EQ(243, GET_RPM());
|
||||
/* 42 */ EVENT(/* timestamp*/1.97691675, T_PRIMARY, /*value*/true);
|
||||
EXPECT_EQ(233, GET_RPM());
|
||||
EXPECT_EQ(207, GET_RPM());
|
||||
/* 43 */ EVENT(/* timestamp*/1.9822455, T_SECONDARY, /*value*/false);
|
||||
EXPECT_EQ(233, GET_RPM());
|
||||
/* 44 */ EVENT(/* timestamp*/2.001249, T_PRIMARY, /*value*/false);
|
||||
EXPECT_EQ(233, GET_RPM());
|
||||
EXPECT_EQ(226, GET_RPM());
|
||||
|
||||
// Second sync point, should transition to non-instant RPM
|
||||
/* 44 */ EVENT(/* timestamp*/2.001249, T_PRIMARY, /*value*/false);
|
||||
EXPECT_EQ(239, GET_RPM());
|
||||
/* 45 */ EVENT(/* timestamp*/2.0070235, T_SECONDARY, /*value*/true);
|
||||
/* 48 */ EVENT(/* timestamp*/2.04448175, T_SECONDARY, /*value*/false);
|
||||
/* 49 */ EVENT(/* timestamp*/2.06135875, T_SECONDARY, /*value*/true);
|
||||
|
@ -114,7 +106,13 @@ TEST(cranking, hardcodedRealCranking) {
|
|||
/* 59 */ EVENT(/* timestamp*/2.1560195, T_SECONDARY, /*value*/true);
|
||||
/* 60 */ EVENT(/* timestamp*/2.18365925, T_PRIMARY, /*value*/true);
|
||||
/* 61 */ EVENT(/* timestamp*/2.188138, T_SECONDARY, /*value*/false);
|
||||
|
||||
// rpm should now only update at sync point
|
||||
EXPECT_EQ(239, GET_RPM());
|
||||
// Third sync point
|
||||
/* 62 */ EVENT(/* timestamp*/2.20460875, T_PRIMARY, /*value*/false);
|
||||
EXPECT_EQ(590, GET_RPM());
|
||||
|
||||
/* 63 */ EVENT(/* timestamp*/2.20940075, T_SECONDARY, /*value*/true);
|
||||
/* 64 */ EVENT(/* timestamp*/2.2446445, T_SECONDARY, /*value*/false);
|
||||
/* 65 */ EVENT(/* timestamp*/2.26826475, T_SECONDARY, /*value*/true);
|
||||
|
@ -162,6 +160,22 @@ TEST(cranking, hardcodedRealCranking) {
|
|||
/* 133 */ EVENT(/* timestamp*/3.00650825, T_SECONDARY, /*value*/true);
|
||||
/* 134 */ EVENT(/* timestamp*/3.031735, T_PRIMARY, /*value*/true);
|
||||
|
||||
EXPECT_EQ(0, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#realCranking";
|
||||
EXPECT_EQ(719, GET_RPM()) << "RPM at the end";
|
||||
EXPECT_EQ( 0, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#realCranking";
|
||||
|
||||
EXPECT_EQ(755, GET_RPM()) << "RPM at the end";
|
||||
}
|
||||
|
||||
TEST(cranking, naCrankFromFile) {
|
||||
CsvReader reader(2);
|
||||
int indeces[2] = {1, 0};
|
||||
reader.open("tests/trigger/recourses/cranking_na_4.csv", indeces);
|
||||
|
||||
WITH_ENGINE_TEST_HELPER(MIATA_NA6_VAF);
|
||||
|
||||
while (reader.haveMore()) {
|
||||
reader.processLine(ð);
|
||||
}
|
||||
|
||||
EXPECT_EQ(0, eth.recentWarnings()->getCount());
|
||||
EXPECT_EQ(698, GET_RPM());
|
||||
}
|
||||
|
|
|
@ -519,7 +519,7 @@ TEST(misc, testTriggerDecoder) {
|
|||
applyNonPersistentConfiguration(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
}
|
||||
testTriggerDecoder2("miata 1990", MIATA_1990, 8, 0.7015, 0.3890);
|
||||
testTriggerDecoder2("miata 1990", MIATA_1990, 4, 1 - 0.7015, 1 - 0.3890);
|
||||
testTriggerDecoder3("citroen", CITROEN_TU3JP, 0, 0.4833, 0.0, 2.9994);
|
||||
|
||||
testTriggerDecoder2("CAMARO_4", CAMARO_4, 40, 0.5, 0);
|
||||
|
|
Loading…
Reference in New Issue