2021-05-24 03:03:58 -07:00
|
|
|
/*
|
|
|
|
* @file test_real_cranking_miata_NA.cpp
|
|
|
|
*
|
|
|
|
* @date May 22, 2021
|
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2021
|
|
|
|
*/
|
|
|
|
|
2021-08-03 19:05:01 -07:00
|
|
|
#include "pch.h"
|
|
|
|
|
2021-06-25 21:33:28 -07:00
|
|
|
#include "logicdata_csv_reader.h"
|
2021-06-23 02:22:08 -07:00
|
|
|
#include <string>
|
2021-05-24 03:03:58 -07:00
|
|
|
|
2021-06-23 08:32:06 -07:00
|
|
|
TEST(cranking, realCrankingFromFile) {
|
2021-07-13 11:24:47 -07:00
|
|
|
CsvReader reader(2, /* vvtCount */ 0);
|
2022-09-24 20:01:42 -07:00
|
|
|
// this logic data file has first trigger channel in second column and second trigger channel in first column
|
|
|
|
reader.open("tests/trigger/resources/cranking_na_3.csv", REVERSE_ORDER);
|
2021-06-23 08:32:06 -07:00
|
|
|
|
2023-05-31 22:31:28 -07:00
|
|
|
EngineTestHelper eth (engine_type_e::FRANKENSO_MIATA_NA6_MAP);
|
2022-08-19 12:03:20 -07:00
|
|
|
engineConfiguration->alwaysInstantRpm = true;
|
2021-06-23 08:32:06 -07:00
|
|
|
|
|
|
|
ssize_t read;
|
|
|
|
|
2022-01-01 18:39:04 -08:00
|
|
|
for (int i = 0; i < 11; i++) {
|
2021-06-23 08:32:06 -07:00
|
|
|
reader.readLine(ð);
|
|
|
|
}
|
|
|
|
|
2022-01-20 20:19:48 -08:00
|
|
|
EXPECT_EQ(0, round(Sensor::getOrZero(SensorType::Rpm)))<< reader.lineIndex();
|
2021-07-01 18:29:04 -07:00
|
|
|
EXPECT_EQ( 0, eth.recentWarnings()->getCount());
|
2021-06-23 08:32:06 -07:00
|
|
|
|
2021-07-01 18:29:04 -07:00
|
|
|
// This tooth should be first sync point
|
2021-06-23 08:32:06 -07:00
|
|
|
reader.readLine(ð);
|
2021-06-24 22:43:15 -07:00
|
|
|
|
2022-01-20 20:19:48 -08:00
|
|
|
EXPECT_EQ(228, round(Sensor::getOrZero(SensorType::Rpm)))<< reader.lineIndex() << " @ 1";
|
2021-06-23 08:32:06 -07:00
|
|
|
|
2022-01-01 18:39:04 -08:00
|
|
|
for (int i = 0; i < 42; i++) {
|
2021-06-23 08:32:06 -07:00
|
|
|
reader.readLine(ð);
|
2021-06-18 19:52:01 -07:00
|
|
|
}
|
2022-08-19 12:03:20 -07:00
|
|
|
EXPECT_EQ(261, round(Sensor::getOrZero(SensorType::Rpm)))<< reader.lineIndex();
|
2021-05-24 03:03:58 -07:00
|
|
|
|
2021-06-24 19:21:30 -07:00
|
|
|
|
|
|
|
for (int i = 0; i < 30; i++) {
|
|
|
|
reader.readLine(ð);
|
|
|
|
}
|
2022-08-19 12:03:20 -07:00
|
|
|
EXPECT_EQ(738, round(Sensor::getOrZero(SensorType::Rpm)))<< reader.lineIndex() << " @ 2";
|
2021-06-24 19:21:30 -07:00
|
|
|
|
2021-06-23 08:32:06 -07:00
|
|
|
while (reader.haveMore()) {
|
|
|
|
reader.processLine(ð);
|
|
|
|
}
|
2021-07-01 06:19:16 -07:00
|
|
|
|
2022-08-19 12:03:20 -07:00
|
|
|
EXPECT_EQ(0, eth.recentWarnings()->getCount())<< "warningCounter#realCranking";
|
|
|
|
EXPECT_EQ(191, round(Sensor::getOrZero(SensorType::Rpm)))<< reader.lineIndex();
|
2021-05-24 03:03:58 -07:00
|
|
|
}
|