cannect 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cannect/__init__.py +30 -0
- cannect/api/__init__.py +0 -0
- cannect/config.py +114 -0
- cannect/core/__init__.py +0 -0
- cannect/core/ascet/__init__.py +3 -0
- cannect/core/ascet/amd.py +698 -0
- cannect/core/ascet/formula.py +33 -0
- cannect/core/ascet/oid.py +29 -0
- cannect/core/ascet/ws.py +154 -0
- cannect/core/can/__init__.py +2 -0
- cannect/core/can/ascet/__init__.py +3 -0
- cannect/core/can/ascet/_db2code.py +344 -0
- cannect/core/can/ascet/_db2elem.py +399 -0
- cannect/core/can/ascet/comdef.py +256 -0
- cannect/core/can/ascet/comrx.py +139 -0
- cannect/core/can/ascet/diag.py +691 -0
- cannect/core/can/db/__init__.py +4 -0
- cannect/core/can/db/reader.py +148 -0
- cannect/core/can/db/schema.py +269 -0
- cannect/core/can/db/specification/__init__.py +0 -0
- cannect/core/can/db/specification/message.py +230 -0
- cannect/core/can/db/specification/styles.py +81 -0
- cannect/core/can/db/specification/wrapper.py +161 -0
- cannect/core/can/db/vcs.py +104 -0
- cannect/core/can/rule.py +229 -0
- cannect/core/can/testcase/__init__.py +0 -0
- cannect/core/can/testcase/unitcase/__init__.py +0 -0
- cannect/core/can/testcase/unitcase/asw2can.py +48 -0
- cannect/core/can/testcase/unitcase/decode.py +63 -0
- cannect/core/can/testcase/unitcase/diagnosis.py +479 -0
- cannect/core/can/testcase/unitcase/encode.py +60 -0
- cannect/core/ir/__init__.py +2 -0
- cannect/core/ir/changehistory.py +310 -0
- cannect/core/ir/delivereables.py +71 -0
- cannect/core/ir/diff.py +97 -0
- cannect/core/ir/ir.py +581 -0
- cannect/core/ir/sdd.py +148 -0
- cannect/core/mdf.py +66 -0
- cannect/core/subversion.py +136 -0
- cannect/core/testcase/__init__.py +3 -0
- cannect/core/testcase/plotter.py +181 -0
- cannect/core/testcase/style.py +981 -0
- cannect/core/testcase/testcase.py +160 -0
- cannect/core/testcase/unitcase.py +227 -0
- cannect/errors.py +20 -0
- cannect/schema/__init__.py +5 -0
- cannect/schema/candb.py +226 -0
- cannect/schema/datadictionary.py +60 -0
- cannect/utils/__init__.py +3 -0
- cannect/utils/excel.py +29 -0
- cannect/utils/logger.py +81 -0
- cannect/utils/ppt.py +236 -0
- cannect/utils/tools.py +207 -0
- cannect-1.0.0.dist-info/METADATA +214 -0
- cannect-1.0.0.dist-info/RECORD +58 -0
- cannect-1.0.0.dist-info/WHEEL +5 -0
- cannect-1.0.0.dist-info/licenses/LICENSE +21 -0
- cannect-1.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
from cannect.core.can.rule import naming
|
|
2
|
+
from cannect.core.testcase.unitcase import UnitTestCase
|
|
3
|
+
from pandas import Series
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class SignalDecodingUnit(UnitTestCase):
|
|
7
|
+
|
|
8
|
+
def __init__(self, sig:Series, **override):
|
|
9
|
+
nm = naming(sig)
|
|
10
|
+
sg = sig.SignalRenamed if sig.SignalRenamed else sig.name
|
|
11
|
+
var = f"{sg}_Can"
|
|
12
|
+
if sg in ["Power_Limit_Dchg", "Power_Limit_Chg"]:
|
|
13
|
+
var = f"{sg}_Bms"
|
|
14
|
+
if sig["ECU"] == "MHSG" and not sig["Message"] == "SCU_DIAG2":
|
|
15
|
+
var = f"{sg}_Mhsg"
|
|
16
|
+
unit = '-' if not sig.Unit else sig.Unit
|
|
17
|
+
index = self._index(sig)
|
|
18
|
+
buff = "\n".join([f"{nm.buffer}_[{n}]" for n in index])
|
|
19
|
+
vals = '\n'.join(['Unconcerned'] * len(index))
|
|
20
|
+
expr = f"{index[0]}:{index[-1]}" if len(index) > 1 else f"{index[0]}"
|
|
21
|
+
kwargs = {
|
|
22
|
+
"Category": "UNIT",
|
|
23
|
+
"Group": "CAN",
|
|
24
|
+
"Test Case Name": "Signal Decoding Test",
|
|
25
|
+
"Test Purpose, Description": f"{sg} @{nm}({sig.ID}) Decoding Test",
|
|
26
|
+
"Test Execution (TE) - Description": f"CAN Signal: Transmit {sg} @{nm}\n"
|
|
27
|
+
f"- ON Vehicle: Followed by the specification\n"
|
|
28
|
+
f"- ON T-Bench: Comprehensive range transmission",
|
|
29
|
+
"TE-Variable": f"{nm.counter}\n"
|
|
30
|
+
f"{buff}",
|
|
31
|
+
"TE-Compare": "'=",
|
|
32
|
+
"TE-Value": f"△1\n"
|
|
33
|
+
f"{vals}",
|
|
34
|
+
"Expected Results (ER) - Description": f"ON Receiving\n"
|
|
35
|
+
f"- Message Counter = △1\n"
|
|
36
|
+
f"- Signal Variable = Buffer[{expr}]\n"
|
|
37
|
+
f"Compatible Signal Quality with DB",
|
|
38
|
+
"ER-Variable": f"{var}",
|
|
39
|
+
"ER-Compare": "'=",
|
|
40
|
+
"ER-Value": f"{nm.buffer}_[{expr}]",
|
|
41
|
+
"Test Result Description": f"ON Receiving\n"
|
|
42
|
+
f"- {nm.counter} = △1\n"
|
|
43
|
+
f"- {var} = {nm.buffer}_[{expr}]\n"
|
|
44
|
+
f" * Length(Bit): {sig.Length}\n"
|
|
45
|
+
f" * Start Bit: {sig.StartBit}\n\n"
|
|
46
|
+
f"Compatible Signal Quality with DB\n"
|
|
47
|
+
f"- Factor: {sig.Factor}\n"
|
|
48
|
+
f"- Offset: {sig.Offset}\n"
|
|
49
|
+
f"- Min: {sig.Offset} [{unit}]\n"
|
|
50
|
+
f"- Max: {sig.Factor * (2 ** sig.Length - 1) + sig.Offset} [{unit}]",
|
|
51
|
+
}
|
|
52
|
+
kwargs.update(override)
|
|
53
|
+
super().__init__(**kwargs)
|
|
54
|
+
return
|
|
55
|
+
|
|
56
|
+
@staticmethod
|
|
57
|
+
def _index(sig:Series) -> range:
|
|
58
|
+
start_byte = sig.StartBit // 8
|
|
59
|
+
end_bit = sig.StartBit + sig.Length
|
|
60
|
+
end_byte = end_bit // 8
|
|
61
|
+
if (end_bit / 8) > end_byte:
|
|
62
|
+
end_byte += 1
|
|
63
|
+
return range(start_byte, end_byte, 1)
|
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
from cannect.core.can.rule import naming
|
|
2
|
+
from cannect.core.testcase.unitcase import UnitTestCase
|
|
3
|
+
from cannect.schema.datadictionary import DataDictionary
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def detection(message:str, **override) -> UnitTestCase:
|
|
7
|
+
"""
|
|
8
|
+
UNIT TEST CASE FOR CAN MESSAGE AUTO-DETECTION
|
|
9
|
+
"""
|
|
10
|
+
nm = naming(message)
|
|
11
|
+
dd = DataDictionary()
|
|
12
|
+
dd.detection_time = nm.detectionThresholdTime
|
|
13
|
+
dd.detection_limit = nm.detectionThreshold
|
|
14
|
+
dd.message_counter_valid = nm.messageCountValid
|
|
15
|
+
dd.detection_counter = nm.detectionCounter
|
|
16
|
+
dd.detection_eep = nm.eep
|
|
17
|
+
dd.detection_enable = nm.detectionEnable
|
|
18
|
+
dd.diagnosis_enable = nm.diagnosisEnable
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
# VARIABLE NAMING
|
|
22
|
+
# TE-VARIABLE
|
|
23
|
+
te = "\n".join([v for v in [
|
|
24
|
+
dd.detection_time,
|
|
25
|
+
dd.detection_limit,
|
|
26
|
+
dd.message_counter_valid
|
|
27
|
+
] if v])
|
|
28
|
+
tv = "\n".join(['△1' if v == dd.message_counter_valid else '-' for v in te.split("\n")])
|
|
29
|
+
|
|
30
|
+
# ER-VARIABLE
|
|
31
|
+
er = "\n".join([v for v in [
|
|
32
|
+
dd.detection_counter,
|
|
33
|
+
dd.detection_eep,
|
|
34
|
+
dd.detection_enable,
|
|
35
|
+
dd.diagnosis_enable
|
|
36
|
+
] if v])
|
|
37
|
+
ev = "\n".join(['△1', '0 → 1', '0 → 1 → 0', '0 → 1'])
|
|
38
|
+
|
|
39
|
+
kwargs = {
|
|
40
|
+
"Category": "UNIT",
|
|
41
|
+
"Group": "CAN",
|
|
42
|
+
"Test Case Name": "Message Detection",
|
|
43
|
+
"Test Purpose, Description": f"Message: {nm}\n"
|
|
44
|
+
f"1) Message Auto-Detect and Store To EEPROM\n"
|
|
45
|
+
f"2) Message Diagnosis Enabled",
|
|
46
|
+
"Test Execution (TE) - Description": f"1) Message: '{nm}' Exist On CAN BUS\n"
|
|
47
|
+
f"2) Trigger IG ON To Enter Detection\n",
|
|
48
|
+
"TE-Variable": f"{te}",
|
|
49
|
+
"TE-Compare": "'=",
|
|
50
|
+
"TE-Value": f"{tv}",
|
|
51
|
+
"Expected Results (ER) - Description": f"1) Message Auto-Detect and Store To EEPROM\n"
|
|
52
|
+
f"2) Message Diagnosis Enabled",
|
|
53
|
+
"ER-Variable": f"{er}",
|
|
54
|
+
"ER-Compare": "'=",
|
|
55
|
+
"ER-Value": f"{ev}",
|
|
56
|
+
"Test Result Description": f"Message: {nm}\n"
|
|
57
|
+
f"1) Message Auto-Detect and Store To EEPROM\n"
|
|
58
|
+
f" - {dd.detection_enable} = 1\n"
|
|
59
|
+
f" - {dd.diagnosis_enable} = 0\n"
|
|
60
|
+
f" - {dd.detection_counter} = △1\n"
|
|
61
|
+
f" * {dd.detection_eep} = 0\n\n"
|
|
62
|
+
f"2) Message Diagnosis Enabled\n"
|
|
63
|
+
f" - {dd.detection_enable} = 0\n"
|
|
64
|
+
f" - {dd.diagnosis_enable} = 1\n"
|
|
65
|
+
f" - {dd.detection_counter} = {dd.detection_limit}\n"
|
|
66
|
+
f" * {dd.detection_eep} = 0 → 1"
|
|
67
|
+
}
|
|
68
|
+
kwargs.update(override)
|
|
69
|
+
return UnitTestCase(**kwargs)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def diagnosis_counter(message:str, **override) -> UnitTestCase:
|
|
73
|
+
"""
|
|
74
|
+
UNIT TEST CASE FOR CAN MESSAGE COUNTER DIAGNOSIS
|
|
75
|
+
"""
|
|
76
|
+
nm = naming(message)
|
|
77
|
+
dd = DataDictionary()
|
|
78
|
+
dd.message_valid = nm.messageCountValid
|
|
79
|
+
dd.diagnosis_enable = nm.diagnosisEnable
|
|
80
|
+
dd.debounce_threshold = nm.debounceTime
|
|
81
|
+
dd.debounce_timer = nm.debounceTimerMsg
|
|
82
|
+
dd.diagnosis_bit = nm.diagnosisMsg
|
|
83
|
+
dd.deve = nm.deveMsg
|
|
84
|
+
|
|
85
|
+
# VARIABLE NAMING
|
|
86
|
+
# TE-VARIABLE
|
|
87
|
+
te = "\n".join([v for v in [
|
|
88
|
+
dd.message_valid,
|
|
89
|
+
dd.diagnosis_enable,
|
|
90
|
+
dd.debounce_threshold
|
|
91
|
+
] if v])
|
|
92
|
+
tv = "\n".join(['Simulated', '1', '2.0'])
|
|
93
|
+
|
|
94
|
+
# ER-VARIABLE
|
|
95
|
+
er = "\n".join([v for v in [
|
|
96
|
+
dd.debounce_timer,
|
|
97
|
+
dd.diagnosis_bit,
|
|
98
|
+
dd.deve,
|
|
99
|
+
] if v])
|
|
100
|
+
ev = "\n".join(['△0.1', '0:No Diag / 1:Diag', 'DSM'])
|
|
101
|
+
|
|
102
|
+
kwargs = {
|
|
103
|
+
"Category": "UNIT",
|
|
104
|
+
"Group": "CAN",
|
|
105
|
+
"Test Case Name": "Message Diagnosis",
|
|
106
|
+
"Test Purpose, Description": f"Message: {nm}\n"
|
|
107
|
+
f"1) Diagnosis Debounce on Message Counter Fault\n"
|
|
108
|
+
f"2) Diagnosis Report",
|
|
109
|
+
"Test Execution (TE) - Description": f"1) Message: '{nm}' Exist On CAN BUS\n"
|
|
110
|
+
f"2) Simulate Message Fail Case",
|
|
111
|
+
"TE-Variable": f"{te}",
|
|
112
|
+
"TE-Compare": "'=",
|
|
113
|
+
"TE-Value": f"{tv}",
|
|
114
|
+
"Expected Results (ER) - Description": f"1) Diagnosis Debounce on Message Counter Fault\n"
|
|
115
|
+
f"2) Diagnosis Report",
|
|
116
|
+
"ER-Variable": f"{er}",
|
|
117
|
+
"ER-Compare": "'=",
|
|
118
|
+
"ER-Value": f"{ev}",
|
|
119
|
+
"Test Result Description": f"Message: {nm}\n"
|
|
120
|
+
f"{dd.diagnosis_enable} = 1"
|
|
121
|
+
f"1) Diagnosis Debounce on Message Counter Fault\n"
|
|
122
|
+
f"1.1) Debounce Case"
|
|
123
|
+
f" - {dd.message_valid} = 0\n"
|
|
124
|
+
f" - {dd.debounce_timer} = +△0.1\n"
|
|
125
|
+
f" * ~{dd.debounce_threshold}\n\n"
|
|
126
|
+
f"1.2) Healing Case"
|
|
127
|
+
f" - {dd.message_valid} = 0 → 1\n"
|
|
128
|
+
f" - {dd.debounce_timer} = -△0.1\n"
|
|
129
|
+
f" * ~0\n\n"
|
|
130
|
+
f"2) Diagnosis Report\n"
|
|
131
|
+
f" - {dd.debounce_timer} = {dd.debounce_threshold}\n"
|
|
132
|
+
f" - {dd.diagnosis_bit} = 1\n"
|
|
133
|
+
f" * {dd.deve} = 1.6E+04"
|
|
134
|
+
}
|
|
135
|
+
kwargs.update(override)
|
|
136
|
+
return UnitTestCase(**kwargs)
|
|
137
|
+
|
|
138
|
+
def diagnosis_alive(message:str, **override) -> UnitTestCase:
|
|
139
|
+
"""
|
|
140
|
+
UNIT TEST CASE FOR CAN ALIVE COUNTER DIAGNOSIS
|
|
141
|
+
"""
|
|
142
|
+
nm = naming(message)
|
|
143
|
+
dd = DataDictionary()
|
|
144
|
+
dd.alive_valid = nm.aliveCountValid
|
|
145
|
+
dd.diagnosis_enable = nm.diagnosisEnable
|
|
146
|
+
dd.debounce_threshold = nm.debounceTime
|
|
147
|
+
dd.debounce_timer = nm.debounceTimerAlv
|
|
148
|
+
dd.diagnosis_bit = nm.diagnosisAlv
|
|
149
|
+
dd.deve = nm.deveAlv
|
|
150
|
+
|
|
151
|
+
# VARIABLE NAMING
|
|
152
|
+
# TE-VARIABLE
|
|
153
|
+
te = "\n".join([v for v in [
|
|
154
|
+
dd.alive_valid,
|
|
155
|
+
dd.diagnosis_enable,
|
|
156
|
+
dd.debounce_threshold
|
|
157
|
+
] if v])
|
|
158
|
+
tv = "\n".join(['Simulated', '1', '2.0'])
|
|
159
|
+
|
|
160
|
+
# ER-VARIABLE
|
|
161
|
+
er = "\n".join([v for v in [
|
|
162
|
+
dd.debounce_timer,
|
|
163
|
+
dd.diagnosis_bit,
|
|
164
|
+
dd.deve,
|
|
165
|
+
] if v])
|
|
166
|
+
ev = "\n".join(['△0.1', '0:No Diag / 1:Diag', 'DSM'])
|
|
167
|
+
|
|
168
|
+
kwargs = {
|
|
169
|
+
"Category": "UNIT",
|
|
170
|
+
"Group": "CAN",
|
|
171
|
+
"Test Case Name": "Alive Counter Diagnosis",
|
|
172
|
+
"Test Purpose, Description": f"Message: {nm}\n"
|
|
173
|
+
f"1) Diagnosis Debounce on Alive Counter Fault\n"
|
|
174
|
+
f"2) Diagnosis Report",
|
|
175
|
+
"Test Execution (TE) - Description": f"1) Message: '{nm}' Exist On CAN BUS\n"
|
|
176
|
+
f"2) Simulate Alive Fail Case\n",
|
|
177
|
+
"TE-Variable": f"{te}",
|
|
178
|
+
"TE-Compare": "'=",
|
|
179
|
+
"TE-Value": f"{tv}",
|
|
180
|
+
"Expected Results (ER) - Description": f"1) Diagnosis Debounce on Alive Counter Fault\n"
|
|
181
|
+
f"2) Diagnosis Report",
|
|
182
|
+
"ER-Variable": f"{er}",
|
|
183
|
+
"ER-Compare": "'=",
|
|
184
|
+
"ER-Value": f"{ev}",
|
|
185
|
+
"Test Result Description": f"Message: {nm}\n"
|
|
186
|
+
f"{dd.diagnosis_enable} = 1"
|
|
187
|
+
f"1) Diagnosis Debounce on Alive Counter Fault\n"
|
|
188
|
+
f"1.1) Debounce Case"
|
|
189
|
+
f" - {dd.alive_valid} = 0\n"
|
|
190
|
+
f" - {dd.debounce_timer} = +△0.1\n"
|
|
191
|
+
f" * ~{dd.debounce_threshold}\n\n"
|
|
192
|
+
f"1.2) Healing Case"
|
|
193
|
+
f" - {dd.alive_valid} = 0 → 1\n"
|
|
194
|
+
f" - {dd.debounce_timer} = -△0.1\n"
|
|
195
|
+
f" * ~0\n\n"
|
|
196
|
+
f"2) Diagnosis Report\n"
|
|
197
|
+
f" - {dd.debounce_timer} = {dd.debounce_threshold}\n"
|
|
198
|
+
f" - {dd.diagnosis_bit} = 1\n"
|
|
199
|
+
f" * {dd.deve} = 1.6E+04"
|
|
200
|
+
}
|
|
201
|
+
kwargs.update(override)
|
|
202
|
+
return UnitTestCase(**kwargs)
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
def diagnosis_crc(message:str, **override) -> UnitTestCase:
|
|
206
|
+
"""
|
|
207
|
+
UNIT TEST CASE FOR CAN CRC DIAGNOSIS
|
|
208
|
+
"""
|
|
209
|
+
nm = naming(message)
|
|
210
|
+
dd = DataDictionary()
|
|
211
|
+
dd.crc_valid = nm.crcValid
|
|
212
|
+
dd.diagnosis_enable = nm.diagnosisEnable
|
|
213
|
+
dd.debounce_threshold = nm.debounceTime
|
|
214
|
+
dd.debounce_timer = nm.debounceTimerCrc
|
|
215
|
+
dd.diagnosis_bit = nm.diagnosisCrc
|
|
216
|
+
dd.deve = nm.deveCrc
|
|
217
|
+
|
|
218
|
+
# VARIABLE NAMING
|
|
219
|
+
# TE-VARIABLE
|
|
220
|
+
te = "\n".join([v for v in [
|
|
221
|
+
dd.crc_valid,
|
|
222
|
+
dd.diagnosis_enable,
|
|
223
|
+
dd.debounce_threshold
|
|
224
|
+
] if v])
|
|
225
|
+
tv = "\n".join(['Simulated', '1', '2.0'])
|
|
226
|
+
|
|
227
|
+
# ER-VARIABLE
|
|
228
|
+
er = "\n".join([v for v in [
|
|
229
|
+
dd.debounce_timer,
|
|
230
|
+
dd.diagnosis_bit,
|
|
231
|
+
dd.deve,
|
|
232
|
+
] if v])
|
|
233
|
+
ev = "\n".join(['△0.1', '0:No Diag / 1:Diag', 'DSM'])
|
|
234
|
+
|
|
235
|
+
kwargs = {
|
|
236
|
+
"Category": "UNIT",
|
|
237
|
+
"Group": "CAN",
|
|
238
|
+
"Test Case Name": "CRC Diagnosis",
|
|
239
|
+
"Test Purpose, Description": f"Message: {nm}\n"
|
|
240
|
+
f"1) Diagnosis Debounce on CRC Fault\n"
|
|
241
|
+
f"2) Diagnosis Report",
|
|
242
|
+
"Test Execution (TE) - Description": f"1) Message: '{nm}' Exist On CAN BUS\n"
|
|
243
|
+
f"2) Simulate CRC Fail Case\n",
|
|
244
|
+
"TE-Variable": f"{te}",
|
|
245
|
+
"TE-Compare": "'=",
|
|
246
|
+
"TE-Value": f"{tv}",
|
|
247
|
+
"Expected Results (ER) - Description": f"1) Diagnosis Debounce on CRC Fault\n"
|
|
248
|
+
f"2) Diagnosis Report",
|
|
249
|
+
"ER-Variable": f"{er}",
|
|
250
|
+
"ER-Compare": "'=",
|
|
251
|
+
"ER-Value": f"{ev}",
|
|
252
|
+
"Test Result Description": f"Message: {nm}\n"
|
|
253
|
+
f"{dd.diagnosis_enable} = 1"
|
|
254
|
+
f"1) Diagnosis Debounce on CRC Fault\n"
|
|
255
|
+
f"1.1) Debounce Case"
|
|
256
|
+
f" - {dd.crc_valid} = 0\n"
|
|
257
|
+
f" - {dd.debounce_timer} = +△0.1\n"
|
|
258
|
+
f" * ~{dd.debounce_threshold}\n\n"
|
|
259
|
+
f"1.2) Healing Case"
|
|
260
|
+
f" - {dd.crc_valid} = 0 → 1\n"
|
|
261
|
+
f" - {dd.debounce_timer} = -△0.1\n"
|
|
262
|
+
f" * ~0\n\n"
|
|
263
|
+
f"2) Diagnosis Report\n"
|
|
264
|
+
f" - {dd.debounce_timer} = {dd.debounce_threshold}\n"
|
|
265
|
+
f" - {dd.diagnosis_bit} = 1\n"
|
|
266
|
+
f" * {dd.deve} = 1.6E+04"
|
|
267
|
+
}
|
|
268
|
+
kwargs.update(override)
|
|
269
|
+
return UnitTestCase(**kwargs)
|
|
270
|
+
|
|
271
|
+
def fid_inhibit(message:str, **override) -> UnitTestCase:
|
|
272
|
+
"""
|
|
273
|
+
UNIT TEST CASE FOR CAN FID INHIBIT
|
|
274
|
+
"""
|
|
275
|
+
nm = naming(message)
|
|
276
|
+
dd = DataDictionary()
|
|
277
|
+
dd.fid = nm.fid
|
|
278
|
+
dd.debounce_threshold = nm.debounceTime
|
|
279
|
+
dd.debounce_timer_msg = nm.debounceTimerMsg
|
|
280
|
+
dd.debounce_timer_alv = nm.debounceTimerAlv
|
|
281
|
+
dd.debounce_timer_crc = nm.debounceTimerCrc
|
|
282
|
+
|
|
283
|
+
# VARIABLE NAMING
|
|
284
|
+
# TE-VARIABLE
|
|
285
|
+
te = "\n".join([v for v in [
|
|
286
|
+
"IgKey_On",
|
|
287
|
+
dd.fid,
|
|
288
|
+
dd.debounce_threshold,
|
|
289
|
+
] if v])
|
|
290
|
+
tv = "\n".join(['1', '(NOT) 128 (Inhibit)', '2.0'])
|
|
291
|
+
|
|
292
|
+
# ER-VARIABLE
|
|
293
|
+
er = "\n".join([v for v in [
|
|
294
|
+
dd.debounce_timer_msg,
|
|
295
|
+
dd.debounce_timer_alv,
|
|
296
|
+
dd.debounce_timer_crc,
|
|
297
|
+
] if v])
|
|
298
|
+
ev = "\n".join([dd.debounce_threshold, dd.debounce_threshold, dd.debounce_threshold])
|
|
299
|
+
|
|
300
|
+
kwargs = {
|
|
301
|
+
"Category": "UNIT",
|
|
302
|
+
"Group": "CAN",
|
|
303
|
+
"Test Case Name": "Fid Inhibit",
|
|
304
|
+
"Test Purpose, Description": f"Message: {nm}\n"
|
|
305
|
+
f"1) After message error occurs, verify Fid operation during Init\n",
|
|
306
|
+
"Test Execution (TE) - Description": f"Init Task operation in message fault condition\n"
|
|
307
|
+
f"IG OFF → ON\n",
|
|
308
|
+
"TE-Variable": f"{te}",
|
|
309
|
+
"TE-Compare": "'=",
|
|
310
|
+
"TE-Value": f"{tv}",
|
|
311
|
+
"Expected Results (ER) - Description": f"1) After a {nm} error occurs, initialize the Diagnostic Timer value to the timer threshold during Init operation\n",
|
|
312
|
+
"ER-Variable": f"{er}",
|
|
313
|
+
"ER-Compare": "'=",
|
|
314
|
+
"ER-Value": f"{ev}",
|
|
315
|
+
"Test Result Description": f"1) After a {nm} error occurs, initialize the Diagnostic Timer value to the timer threshold during Init operation\n"
|
|
316
|
+
f" - Fid operation : {dd.fid} != 128 (Inhibit)\n"
|
|
317
|
+
f" - Init Task operation : IGN Triggered\n"
|
|
318
|
+
f" - {dd.debounce_timer_msg} = {dd.debounce_threshold}\n"
|
|
319
|
+
f" - {dd.debounce_timer_alv} = {dd.debounce_threshold}\n"
|
|
320
|
+
f" - {dd.debounce_timer_crc} = {dd.debounce_threshold}\n"
|
|
321
|
+
|
|
322
|
+
}
|
|
323
|
+
kwargs.update(override)
|
|
324
|
+
return UnitTestCase(**kwargs)
|
|
325
|
+
|
|
326
|
+
def error_clear(message:str, **override) -> UnitTestCase:
|
|
327
|
+
"""
|
|
328
|
+
UNIT TEST CASE FOR CAN ERROR CLEAR
|
|
329
|
+
"""
|
|
330
|
+
nm = naming(message)
|
|
331
|
+
dd = DataDictionary()
|
|
332
|
+
dd.eep_reset = nm.eepReset
|
|
333
|
+
dd.eep = nm.eep
|
|
334
|
+
dd.diagnosis_bit_msg = nm.diagnosisMsg
|
|
335
|
+
dd.diagnosis_bit_alv = nm.diagnosisCrc
|
|
336
|
+
dd.diagnosis_bit_crc = nm.diagnosisAlv
|
|
337
|
+
dd.deve_msg = nm.deveMsg
|
|
338
|
+
dd.deve_alv = nm.deveAlv
|
|
339
|
+
dd.deve_crc = nm.deveCrc
|
|
340
|
+
|
|
341
|
+
# VARIABLE NAMING
|
|
342
|
+
# TE-VARIABLE
|
|
343
|
+
te = "\n".join([v for v in [
|
|
344
|
+
"DAux_TrigClr_C",
|
|
345
|
+
dd.eep_reset,
|
|
346
|
+
dd.eep,
|
|
347
|
+
] if v])
|
|
348
|
+
tv = "\n".join(['255 → 0', '255 → 0', '0'])
|
|
349
|
+
|
|
350
|
+
# ER-VARIABLE
|
|
351
|
+
er = "\n".join([v for v in [
|
|
352
|
+
dd.diagnosis_bit_msg,
|
|
353
|
+
dd.diagnosis_bit_alv,
|
|
354
|
+
dd.diagnosis_bit_crc,
|
|
355
|
+
dd.deve_msg,
|
|
356
|
+
dd.deve_alv,
|
|
357
|
+
dd.deve_crc,
|
|
358
|
+
] if v])
|
|
359
|
+
ev = "\n".join(['1 → 0', '1 → 0', '1 → 0','1.6E+04 → 0','1.6E+04 → 0','1.6E+04 → 0'])
|
|
360
|
+
|
|
361
|
+
kwargs = {
|
|
362
|
+
"Category": "UNIT",
|
|
363
|
+
"Group": "CAN",
|
|
364
|
+
"Test Case Name": "Error Clear",
|
|
365
|
+
"Test Purpose, Description": f"Message: {nm}\n"
|
|
366
|
+
f"1) EEP Reset \n"
|
|
367
|
+
f"2) Error Clear \n",
|
|
368
|
+
"Test Execution (TE) - Description": f"1) Clear All {nm} DEve Report\n"
|
|
369
|
+
f" - DAux_TrigClr_C = 255 → 0\n"
|
|
370
|
+
f"2) Clear DEve Report after EEP Reset",
|
|
371
|
+
"TE-Variable": f"{te}",
|
|
372
|
+
"TE-Compare": "'=",
|
|
373
|
+
"TE-Value": f"{tv}",
|
|
374
|
+
"Expected Results (ER) - Description": f"1) When Clear the DEve Report, DEve reoccurs due to the EEP\n"
|
|
375
|
+
f"2) After EEP Reset and Clear DEve Report, Error Clear" ,
|
|
376
|
+
"ER-Variable": f"{er}",
|
|
377
|
+
"ER-Compare": "'=",
|
|
378
|
+
"ER-Value": f"{ev}",
|
|
379
|
+
"Test Result Description": f"1) When EEP SET, Clear DTC\n"
|
|
380
|
+
f" - Cannot Clear DTC : Error reoccurs\n"
|
|
381
|
+
f" - {dd.eep} = 1\n"
|
|
382
|
+
f" - {dd.diagnosis_bit_msg} = 0 → 1\n"
|
|
383
|
+
f" - {dd.diagnosis_bit_alv} = 0 → 1\n"
|
|
384
|
+
f" - {dd.diagnosis_bit_crc} = 0 → 1\n"
|
|
385
|
+
f" - {dd.deve_msg} = 0 → 1.6E+04\n"
|
|
386
|
+
f" - {dd.deve_alv} = 0 → 1.6E+04\n"
|
|
387
|
+
f" - {dd.deve_crc} = 0 → 1.6E+04\n"
|
|
388
|
+
f"2) When EEP RESET, Clear DTC\n"
|
|
389
|
+
f" - Clear DTC Successfully: Error Cleared\n"
|
|
390
|
+
f" - {dd.eep} = 0\n"
|
|
391
|
+
f" - {dd.diagnosis_bit_msg} = 0\n"
|
|
392
|
+
f" - {dd.diagnosis_bit_alv} = 0\n"
|
|
393
|
+
f" - {dd.diagnosis_bit_crc} = 0\n"
|
|
394
|
+
f" - DFRM_DEveID_A_[] = 0\n"
|
|
395
|
+
|
|
396
|
+
}
|
|
397
|
+
kwargs.update(override)
|
|
398
|
+
return UnitTestCase(**kwargs)
|
|
399
|
+
|
|
400
|
+
def clear_edr(message:str, **override) -> UnitTestCase:
|
|
401
|
+
"""
|
|
402
|
+
UNIT TEST CASE FOR CAN CLEAR EDR ARRAY
|
|
403
|
+
"""
|
|
404
|
+
nm = naming(message)
|
|
405
|
+
dd = DataDictionary()
|
|
406
|
+
dd.eep_reset = nm.eepReset
|
|
407
|
+
dd.eep = nm.eep
|
|
408
|
+
dd.deve_msg = nm.deveMsg
|
|
409
|
+
dd.deve_alv = nm.deveAlv
|
|
410
|
+
dd.deve_crc = nm.deveCrc
|
|
411
|
+
|
|
412
|
+
# VARIABLE NAMING
|
|
413
|
+
# TE-VARIABLE
|
|
414
|
+
te = "\n".join([v for v in [
|
|
415
|
+
dd.eep_reset,
|
|
416
|
+
dd.eep,
|
|
417
|
+
] if v])
|
|
418
|
+
tv = "\n".join(['255 → 0', '1 → 0'])
|
|
419
|
+
|
|
420
|
+
# ER-VARIABLE
|
|
421
|
+
er = "\n".join([v for v in [
|
|
422
|
+
"DEve_stEDR93DTC_A[ ]",
|
|
423
|
+
] if v])
|
|
424
|
+
ev = "\n".join(["refer to ER"]),
|
|
425
|
+
|
|
426
|
+
kwargs = {
|
|
427
|
+
"Category": "UNIT",
|
|
428
|
+
"Group": "CAN",
|
|
429
|
+
"Test Case Name": "EDR CLEAR",
|
|
430
|
+
"Test Purpose, Description": f"Message: {nm}\n"
|
|
431
|
+
f"1) When EEP RESET : CLEAR EDR \n"
|
|
432
|
+
f"2) When EEP SET : EDR SET \n",
|
|
433
|
+
"Test Execution (TE) - Description": f"1) EEP RESET\n"
|
|
434
|
+
f" - {dd.eep_reset} : 255 → 0\n"
|
|
435
|
+
f"2) EEP SET\n"
|
|
436
|
+
f" - IgKey_On = True\n"
|
|
437
|
+
f" - Message Auto-Detect and Store To EEPROM",
|
|
438
|
+
"TE-Variable": f"{te}",
|
|
439
|
+
"TE-Compare": "'=",
|
|
440
|
+
"TE-Value": f"{tv}",
|
|
441
|
+
"Expected Results (ER) - Description": f"1) When EEP RESET, Clear EDR bit corresponding to the Deve\n"
|
|
442
|
+
f"2) When EEP SET, Set EDR bit corresponding to the Deve" ,
|
|
443
|
+
"ER-Variable": f"{er}",
|
|
444
|
+
"ER-Compare": "'=",
|
|
445
|
+
"ER-Value": f"{ev}",
|
|
446
|
+
"Test Result Description": f"1) When EEP RESET, Clear EDR\n"
|
|
447
|
+
f" - {dd.eep} = 1 → 0\n"
|
|
448
|
+
f" - DEve_stEDR93DTC_A[Array_id].BitPosn = 1 → 0\n"
|
|
449
|
+
f" - Array_id = DFC_id / 16\n"
|
|
450
|
+
f" - BitPosn = DFC_id % 16\n"
|
|
451
|
+
f" - DFC_id : Check the DSMDOC file\n"
|
|
452
|
+
|
|
453
|
+
f"2) When EEP SET, Set EDR\n"
|
|
454
|
+
f" - {dd.eep} = 0 → 1\n"
|
|
455
|
+
f" - DEve_stEDR93DTC_A[Array_id].BitPosn = 1 → 0\n"
|
|
456
|
+
f" - Array_id = DFC_id / 16\n"
|
|
457
|
+
f" - BitPosn = DFC_id % 16\n"
|
|
458
|
+
f" - DFC_id : Check the DSMDOC file\n"
|
|
459
|
+
}
|
|
460
|
+
kwargs.update(override)
|
|
461
|
+
return UnitTestCase(**kwargs)
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
if __name__ == "__main__":
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
# md = Amd(r"E:\SVN\model\ascet\trunk\HNB_GASOLINE\_29_CommunicationVehicle\CANInterface\ABS\MessageDiag\CanFDABSD\CanFDABSD.zip")
|
|
468
|
+
# vr = md.main.dataframe('Element')["name"]
|
|
469
|
+
# det = detection("ABS_ESC_01_10ms", vr)
|
|
470
|
+
|
|
471
|
+
det = detection("ABS_ESC_01_10ms")
|
|
472
|
+
alive = diagnosis_alive("ABS_ESC_01_10ms")
|
|
473
|
+
crc = diagnosis_crc("ABS_ESC_01_10ms"),
|
|
474
|
+
fid = fid_inhibit("ABS_ESC_01_10ms")
|
|
475
|
+
clear = error_clear("ABS_ESC_01_10ms")
|
|
476
|
+
print(det)
|
|
477
|
+
print(alive)
|
|
478
|
+
print(clear)
|
|
479
|
+
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
from cannect.core.can.rule import naming
|
|
2
|
+
from cannect.core.testcase.unitcase import UnitTestCase
|
|
3
|
+
from pandas import Series
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class SignalEncodingUnit(UnitTestCase):
|
|
7
|
+
|
|
8
|
+
def __init__(self, sig:Series, **override):
|
|
9
|
+
nm = naming(sig)
|
|
10
|
+
sg = sig.SignalRenamed if sig.SignalRenamed else sig.name
|
|
11
|
+
var = f"{sg}_Ems"
|
|
12
|
+
if sg in ["CLU_LoFuelWrngSta", "DATC_OutTempSnsrVal", "VVDIN_EMS_ANTI_STKBACK_POS"]:
|
|
13
|
+
var = f"{sg}_Can"
|
|
14
|
+
if sig["Message"] in ["EMS_CVVD1", "EMS_LDCBMS1"]:
|
|
15
|
+
var = f"{sg}_Can"
|
|
16
|
+
if sig["Message"] in ["MASTER_CTRL_REQ", "MASTER_EXT_REQ"]:
|
|
17
|
+
var = f"{sg}_Mhsg"
|
|
18
|
+
|
|
19
|
+
index = self._index(sig)
|
|
20
|
+
buff = "\n".join([f"{nm.buffer}_[{n}]" for n in index])
|
|
21
|
+
expr = f"{index[0]}:{index[-1]}" if len(index) > 1 else f"{index[0]}"
|
|
22
|
+
kwargs = {
|
|
23
|
+
"Category": "UNIT",
|
|
24
|
+
"Group": "CAN",
|
|
25
|
+
"Test Case Name": "Signal Encoding Test",
|
|
26
|
+
"Test Purpose, Description": f"{sg} @{nm}({sig.ID}) Decoding Test",
|
|
27
|
+
"Test Execution (TE) - Description": f"CAN Signal: Automatically transmitted {sg} @{nm}\n"
|
|
28
|
+
f"- ON Vehicle: Nothing to do\n"
|
|
29
|
+
f"- ON T-Bench: Nothing to do",
|
|
30
|
+
"TE-Variable": f"{var}",
|
|
31
|
+
"TE-Compare": "'=",
|
|
32
|
+
"TE-Value": f"ASW-Dependent",
|
|
33
|
+
"Expected Results (ER) - Description": f"ON Transmitting\n"
|
|
34
|
+
f"- Buffer[{expr}] = Signal Variable\n"
|
|
35
|
+
f"Compatible Signal Quality with DB",
|
|
36
|
+
"ER-Variable": f"{buff}",
|
|
37
|
+
"ER-Compare": "'=",
|
|
38
|
+
"ER-Value": f"{var}",
|
|
39
|
+
"Test Result Description": f"ON Transmitting\n"
|
|
40
|
+
f"- {nm.buffer}_[{expr}] = {var}\n"
|
|
41
|
+
f" * Length(Bit): {sig.Length}\n"
|
|
42
|
+
f" * Start Bit: {sig.StartBit}\n\n"
|
|
43
|
+
f"Compatible Signal Quality with DB\n"
|
|
44
|
+
f"- Factor: {sig.Factor}\n"
|
|
45
|
+
f"- Offset: {sig.Offset}\n"
|
|
46
|
+
f"- Min: {sig.Offset} [{sig.Unit}]\n"
|
|
47
|
+
f"- Max: {sig.Factor * (2 ** sig.Length - 1) + sig.Offset} [{sig.Unit}]",
|
|
48
|
+
}
|
|
49
|
+
kwargs.update(override)
|
|
50
|
+
super().__init__(**kwargs)
|
|
51
|
+
return
|
|
52
|
+
|
|
53
|
+
@staticmethod
|
|
54
|
+
def _index(sig:Series) -> range:
|
|
55
|
+
start_byte = sig.StartBit // 8
|
|
56
|
+
end_bit = sig.StartBit + sig.Length
|
|
57
|
+
end_byte = end_bit // 8
|
|
58
|
+
if (end_bit / 8) > end_byte:
|
|
59
|
+
end_byte += 1
|
|
60
|
+
return range(start_byte, end_byte, 1)
|