Line |
Branch |
Decision |
Exec |
Source |
1 |
|
|
|
/* |
2 |
|
|
|
* @file logicdata_csv_reader.h |
3 |
|
|
|
* |
4 |
|
|
|
* @date Jun 26, 2021 |
5 |
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2021 |
6 |
|
|
|
*/ |
7 |
|
|
|
|
8 |
|
|
|
const int NORMAL_ORDER[2] = {0, 1}; |
9 |
|
|
|
|
10 |
|
|
|
const int REVERSE_ORDER[2] = {1, 0}; |
11 |
|
|
|
|
12 |
|
|
|
class CsvReader { |
13 |
|
|
|
public: |
14 |
|
|
65 |
CsvReader(size_t triggerCount, size_t vvtCount) : CsvReader(triggerCount, vvtCount, 0.0) {} |
15 |
|
|
67 |
CsvReader(size_t triggerCount, size_t vvtCount, double timestampOffset) |
16 |
|
|
134 |
: m_triggerCount(triggerCount) |
17 |
|
|
67 |
, m_vvtCount(vvtCount) |
18 |
|
|
67 |
, m_timestampOffset(timestampOffset) |
19 |
|
|
|
{ |
20 |
|
|
67 |
} |
21 |
|
|
|
~CsvReader(); |
22 |
|
|
|
|
23 |
|
|
|
/* when reading two cam channels it's either on intake one exhaust or two intakes on different banks */ |
24 |
|
|
|
bool twoBanksSingleCamMode = true; |
25 |
|
|
|
|
26 |
|
|
|
void open(const char *fileName, const int* triggerColumnIndeces = NORMAL_ORDER, const int *vvtColumnIndeces = NORMAL_ORDER); |
27 |
|
|
|
bool haveMore(); |
28 |
|
|
|
void processLine(EngineTestHelper *eth); |
29 |
|
|
|
void readLine(EngineTestHelper *eth); |
30 |
|
|
|
double readTimestampAndValues(double *v); |
31 |
|
|
|
|
32 |
|
|
|
bool flipOnRead = false; |
33 |
|
|
|
bool flipVvtOnRead = false; |
34 |
|
|
|
int readingOffset = 0; |
35 |
|
|
|
double lastTimeStamp = 0.0; |
36 |
|
|
|
|
37 |
|
|
20 |
int lineIndex() const { |
38 |
|
|
20 |
return m_lineIndex; |
39 |
|
|
|
} |
40 |
|
|
|
|
41 |
|
|
|
cyclic_buffer<double, 720> history; |
42 |
|
|
|
|
43 |
|
|
|
private: |
44 |
|
|
|
const size_t m_triggerCount; |
45 |
|
|
|
const size_t m_vvtCount; |
46 |
|
|
|
const double m_timestampOffset; |
47 |
|
|
|
|
48 |
|
|
|
FILE *fp = nullptr; |
49 |
|
|
|
char buffer[255]; |
50 |
|
|
|
|
51 |
|
|
|
bool currentState[TRIGGER_INPUT_PIN_COUNT] = {0, 0}; |
52 |
|
|
|
bool currentVvtState[CAM_INPUTS_COUNT] = {0, 0}; |
53 |
|
|
|
|
54 |
|
|
|
int m_lineIndex = -1; |
55 |
|
|
|
|
56 |
|
|
|
const int* triggerColumnIndeces; |
57 |
|
|
|
const int* vvtColumnIndeces; |
58 |
|
|
|
}; |
59 |
|
|
|
|
60 |
|
|
|
|