-
-
Notifications
You must be signed in to change notification settings - Fork 222
/
test_real_cranking_miata_na6.cpp
154 lines (138 loc) · 8.1 KB
/
test_real_cranking_miata_na6.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/*
* test_real_cranking_miata_na6.cpp
*
* @date May 11, 2019
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#include "engine_test_helper.h"
extern int timeNowUs;
extern WarningCodeState unitTestWarningCodeState;
static void fireTriggerEvent(EngineTestHelper*eth, double timestampS, trigger_wheel_e channel, bool isFall) {
trigger_event_e event;
// in this trigger data file second channel is the primary
// interesting how logic analyzer and trigger are flipped - logical '1' from logicdata file seems to be 'falling'
// for trigger definition?!
if (channel == T_PRIMARY && isFall == false) {
event = SHAFT_PRIMARY_RISING;
} else if (channel == T_PRIMARY && isFall == true) {
event = SHAFT_PRIMARY_FALLING;
} else if (channel == T_SECONDARY && isFall == false) {
event = SHAFT_SECONDARY_RISING;
} else {
event = SHAFT_SECONDARY_FALLING;
}
Engine *engine = ð->engine;
EXPAND_Engine;
timeNowUs = 1'000'000 * timestampS;
printf("MIATANA: posting time=%d event=%d\n", timeNowUs, event);
engine->triggerCentral.handleShaftSignal(event, getTimeNowNt() PASS_ENGINE_PARAMETER_SUFFIX);
}
TEST(cranking, hardcodedRealCranking) {
WITH_ENGINE_TEST_HELPER(MIATA_NA6_VAF);
#define EVENT(timestamp, channel, value) { fireTriggerEvent(ð, timestamp, channel, value); }
/*
* Generated using logicdata2c tool
*/
// looks like na_cranking4.logicdata file
/* 3 */ EVENT(/* timestamp*/0.597303, T_SECONDARY, /*value*/false);
/* 4 */ EVENT(/* timestamp*/0.69078225, T_SECONDARY, /*value*/true);
/* 5 */ EVENT(/* timestamp*/0.753783, T_PRIMARY, /*value*/true);
/* 6 */ EVENT(/* timestamp*/0.79334275, T_SECONDARY, /*value*/false);
/* 7 */ EVENT(/* timestamp*/0.85266675, T_SECONDARY, /*value*/true);
/* 8 */ EVENT(/* timestamp*/0.93424725, T_PRIMARY, /*value*/true);
/* 9 */ EVENT(/* timestamp*/0.9441, T_SECONDARY, /*value*/false);
/* 10 */ EVENT(/* timestamp*/0.98209725, T_PRIMARY, /*value*/false);
/* 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);
ASSERT_EQ( 0, GET_RPM()) << "RPM at the 14";
/* 14 */ EVENT(/* timestamp*/1.194742, T_PRIMARY, /*value*/true);
// first synch & fast spinning RPM
ASSERT_EQ( 31, GET_RPM()) << "RPM at the 14";
/* 15 */ EVENT(/* timestamp*/1.20417975, T_SECONDARY, /*value*/false);
/* 16 */ EVENT(/* timestamp*/1.25380075, T_SECONDARY, /*value*/true);
/* 17 */ EVENT(/* timestamp*/1.30114225, T_PRIMARY, /*value*/true);
ASSERT_EQ( 0, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#realCranking";
/* 18 */ EVENT(/* timestamp*/1.3341915, T_SECONDARY, /*value*/false);
/* 19 */ EVENT(/* timestamp*/1.383534, T_SECONDARY, /*value*/true);
ASSERT_EQ( 67, GET_RPM()) << "RPM at the 19";
// second synch
/* 22 */ EVENT(/* timestamp*/1.45352675, T_PRIMARY, /*value*/true);
ASSERT_EQ( 33, GET_RPM()) << "RPM at the 22";
/* 23 */ EVENT(/* timestamp*/1.46291525, T_SECONDARY, /*value*/false);
/* 25 */ EVENT(/* timestamp*/1.49939025, T_PRIMARY, /*value*/false);
/* 27 */ EVENT(/* timestamp*/1.511785, T_SECONDARY, /*value*/true);
/* 28 */ EVENT(/* timestamp*/1.5908545, T_SECONDARY, /*value*/false);
/* 31 */ EVENT(/* timestamp*/1.6399845, T_SECONDARY, /*value*/true);
/* 32 */ EVENT(/* timestamp*/1.70975875, T_PRIMARY, /*value*/true);
/* 33 */ EVENT(/* timestamp*/1.7194455, T_SECONDARY, /*value*/false);
/* 36 */ EVENT(/* timestamp*/1.7697125, T_SECONDARY, /*value*/true);
/* 37 */ EVENT(/* timestamp*/1.817179, T_PRIMARY, /*value*/true);
/* 38 */ EVENT(/* timestamp*/1.8511055, T_SECONDARY, /*value*/false);
/* 41 */ EVENT(/* timestamp*/1.9011835, T_SECONDARY, /*value*/true);
/* 42 */ EVENT(/* timestamp*/1.97691675, T_PRIMARY, /*value*/true);
/* 43 */ EVENT(/* timestamp*/1.9822455, T_SECONDARY, /*value*/false);
ASSERT_EQ( 233, GET_RPM()) << "RPM at the 17";
/* 44 */ EVENT(/* timestamp*/2.001249, T_PRIMARY, /*value*/false);
ASSERT_EQ( 233, GET_RPM()) << "RPM at the 17";
/* 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);
/* 52 */ EVENT(/* timestamp*/2.08529325, T_PRIMARY, /*value*/true);
/* 53 */ EVENT(/* timestamp*/2.089132, T_SECONDARY, /*value*/false);
/* 54 */ EVENT(/* timestamp*/2.107152, T_SECONDARY, /*value*/true);
/* 56 */ EVENT(/* timestamp*/2.12253625, T_PRIMARY, /*value*/true);
/* 58 */ EVENT(/* timestamp*/2.136714, T_SECONDARY, /*value*/false);
/* 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);
/* 62 */ EVENT(/* timestamp*/2.20460875, T_PRIMARY, /*value*/false);
/* 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);
/* 66 */ EVENT(/* timestamp*/2.30276125, T_PRIMARY, /*value*/true);
/* 67 */ EVENT(/* timestamp*/2.308357, T_SECONDARY, /*value*/false);
/* 68 */ EVENT(/* timestamp*/2.33551175, T_SECONDARY, /*value*/true);
/* 69 */ EVENT(/* timestamp*/2.3601205, T_PRIMARY, /*value*/true);
/* 70 */ EVENT(/* timestamp*/2.382952, T_SECONDARY, /*value*/false);
/* 71 */ EVENT(/* timestamp*/2.41535525, T_SECONDARY, /*value*/true);
/* 74 */ EVENT(/* timestamp*/2.45321725, T_PRIMARY, /*value*/true);
/* 75 */ EVENT(/* timestamp*/2.4577005, T_SECONDARY, /*value*/false);
/* 76 */ EVENT(/* timestamp*/2.47348125, T_PRIMARY, /*value*/false);
/* 77 */ EVENT(/* timestamp*/2.47796125, T_SECONDARY, /*value*/true);
/* 80 */ EVENT(/* timestamp*/2.51159275, T_SECONDARY, /*value*/false);
/* 81 */ EVENT(/* timestamp*/2.533664, T_SECONDARY, /*value*/true);
/* 84 */ EVENT(/* timestamp*/2.56564675, T_PRIMARY, /*value*/true);
/* 85 */ EVENT(/* timestamp*/2.57087425, T_SECONDARY, /*value*/false);
/* 86 */ EVENT(/* timestamp*/2.59612075, T_SECONDARY, /*value*/true);
/* 89 */ EVENT(/* timestamp*/2.61853375, T_PRIMARY, /*value*/true);
/* 90 */ EVENT(/* timestamp*/2.6365195, T_SECONDARY, /*value*/false);
/* 93 */ EVENT(/* timestamp*/2.6573605, T_SECONDARY, /*value*/true);
/* 94 */ EVENT(/* timestamp*/2.68447975, T_PRIMARY, /*value*/true);
/* 95 */ EVENT(/* timestamp*/2.68829075, T_SECONDARY, /*value*/false);
/* 96 */ EVENT(/* timestamp*/2.701797, T_PRIMARY, /*value*/false);
/* 98 */ EVENT(/* timestamp*/2.705553, T_SECONDARY, /*value*/true);
/* 100 */ EVENT(/* timestamp*/2.73171175, T_SECONDARY, /*value*/false);
/* 101 */ EVENT(/* timestamp*/2.7466575, T_SECONDARY, /*value*/true);
/* 104 */ EVENT(/* timestamp*/2.76736375, T_PRIMARY, /*value*/true);
/* 105 */ EVENT(/* timestamp*/2.770612, T_SECONDARY, /*value*/false);
/* 106 */ EVENT(/* timestamp*/2.7848735, T_SECONDARY, /*value*/true);
/* 109 */ EVENT(/* timestamp*/2.79669, T_PRIMARY, /*value*/true);
/* 110 */ EVENT(/* timestamp*/2.808129, T_SECONDARY, /*value*/false);
/* 113 */ EVENT(/* timestamp*/2.8232045, T_SECONDARY, /*value*/true);
/* 114 */ EVENT(/* timestamp*/2.84438125, T_PRIMARY, /*value*/true);
/* 115 */ EVENT(/* timestamp*/2.847948, T_SECONDARY, /*value*/false);
/* 117 */ EVENT(/* timestamp*/2.86067075, T_PRIMARY, /*value*/false);
/* 119 */ EVENT(/* timestamp*/2.8642345, T_SECONDARY, /*value*/true);
/* 120 */ EVENT(/* timestamp*/2.89112225, T_SECONDARY, /*value*/false);
/* 123 */ EVENT(/* timestamp*/2.9089625, T_SECONDARY, /*value*/true);
/* 124 */ EVENT(/* timestamp*/2.93429275, T_PRIMARY, /*value*/true);
/* 125 */ EVENT(/* timestamp*/2.93850475, T_SECONDARY, /*value*/false);
/* 128 */ EVENT(/* timestamp*/2.958108, T_SECONDARY, /*value*/true);
/* 129 */ EVENT(/* timestamp*/2.974461, T_PRIMARY, /*value*/true);
/* 130 */ EVENT(/* timestamp*/2.98846325, T_SECONDARY, /*value*/false);
/* 133 */ EVENT(/* timestamp*/3.00650825, T_SECONDARY, /*value*/true);
/* 134 */ EVENT(/* timestamp*/3.031735, T_PRIMARY, /*value*/true);
ASSERT_EQ( 0, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#realCranking";
ASSERT_EQ( 719, GET_RPM()) << "RPM at the end";
}