Skip to content

Commit 12f90df

Browse files
committed
Updated utils.py and requirements.txt
1 parent 0c686cc commit 12f90df

File tree

4 files changed

+29
-24
lines changed

4 files changed

+29
-24
lines changed

examples/data-processing/dbc_files/tp_uds.dbc

+7-7
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ BU_:
3737

3838

3939
BO_ 2028 Battery: 62 Vector__XXX
40-
SG_ M_SID_0x220101_StateOfChargeBMS m257 : 56|8@1+ (0.5,0) [0|0] "%" Vector__XXX
41-
SG_ response m98M : 15|16@0+ (1,0) [0|0] "unit" Vector__XXX
42-
SG_ service M : 7|8@0+ (1,0) [0|0] "" Vector__XXX
40+
SG_ M_SID_0x220101_StateOfChargeBMS m257 : 64|8@1+ (0.5,0) [0|0] "%" Vector__XXX
41+
SG_ response m98M : 23|16@0+ (1,0) [0|0] "unit" Vector__XXX
42+
SG_ service M : 15|8@0+ (1,0) [0|0] "" Vector__XXX
4343

4444
BO_ 1979 Temperature: 54 Vector__XXX
45-
SG_ M_SID_0x220100_IndoorTemp m256 : 64|8@1+ (0.5,-40) [0|0] "degC" Vector__XXX
46-
SG_ response m98 : 15|16@0+ (1,0) [0|0] "unit" Vector__XXX
47-
SG_ service M : 7|8@0+ (1,0) [0|0] "" Vector__XXX
48-
SG_ M_SID_0x220100_OutdoorTemp : 79|8@0+ (0.5,-40) [0|0] "" Vector__XXX
45+
SG_ M_SID_0x220100_IndoorTemp m256 : 72|8@1+ (0.5,-40) [0|0] "degC" Vector__XXX
46+
SG_ response m98 : 23|16@0+ (1,0) [0|0] "unit" Vector__XXX
47+
SG_ service M : 15|8@0+ (1,0) [0|0] "" Vector__XXX
48+
SG_ M_SID_0x220100_OutdoorTemp : 87|8@0+ (0.5,-40) [0|0] "" Vector__XXX
4949

5050

5151

examples/data-processing/dbc_files/tp_uds_nissan.dbc

+6-6
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ BU_:
3737

3838

3939
BO_ 1979 SoC_Temp: 55 Vector__XXX
40-
SG_ SoC m1 : 271|24@0+ (1e-04,0) [0|0] "%" Vector__XXX
41-
SG_ BatPackTemp1 m4 : 32|8@1+ (1,0) [0|0] "%" Vector__XXX
42-
SG_ BatPackTemp2 m4 : 56|8@1+ (1,0) [0|0] "%" Vector__XXX
43-
SG_ BatPackTemp4 m4 : 104|8@1+ (1,0) [0|0] "%" Vector__XXX
44-
SG_ response m97M : 8|8@1+ (1,0) [0|0] "" Vector__XXX
45-
SG_ service M : 0|8@1+ (1,0) [0|0] "" Vector__XXX
40+
SG_ SoC m1 : 279|24@0+ (0.0001,0) [0|0] "%" Vector__XXX
41+
SG_ BatPackTemp1 m4 : 40|8@1+ (1,0) [0|0] "%" Vector__XXX
42+
SG_ BatPackTemp2 m4 : 64|8@1+ (1,0) [0|0] "%" Vector__XXX
43+
SG_ BatPackTemp4 m4 : 112|8@1+ (1,0) [0|0] "%" Vector__XXX
44+
SG_ response m97M : 16|8@1+ (1,0) [0|0] "" Vector__XXX
45+
SG_ service M : 8|8@1+ (1,0) [0|0] "" Vector__XXX
4646

4747

4848

examples/data-processing/requirements.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ J1939-PGN==0.4
1919
jmespath==0.10.0
2020
mdf-iter>=0.0.7
2121
multidict==5.1.0
22-
numpy==1.20.3
23-
pandas==1.2.4
22+
numpy==1.23.2
23+
pandas==1.4.3
2424
pathlib2==2.3.5
2525
python-dateutil==2.8.1
2626
pytz==2021.1

examples/data-processing/utils.py

+14-9
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,12 @@ def extract_phys(self, df_raw):
172172
for db in self.db_list:
173173
df_decoder = can_decoder.DataFrameDecoder(db)
174174

175-
df_phys_temp = pd.DataFrame()
175+
df_phys_temp = []
176176
for length, group in df_raw.groupby("DataLength"):
177177
df_phys_group = df_decoder.decode_frame(group)
178-
df_phys_temp = df_phys_temp.append(df_phys_group)
178+
df_phys_temp.append(df_phys_group)
179179

180-
df_phys = df_phys.append(df_phys_temp.sort_index())
180+
df_phys = pd.concat(df_phys_temp,ignore_index=False).sort_index()
181181

182182
# remove duplicates in case multiple DBC files contain identical signals
183183
df_phys["datetime"] = df_phys.index
@@ -274,9 +274,10 @@ def __init__(self, tp_type=""):
274274
"SINGLE_FRAME": 0x00,
275275
"FIRST_FRAME": 0x10,
276276
"CONSEQ_FRAME": 0x20,
277-
"ff_payload_start": 2,
277+
"ff_payload_start": 1,
278278
"bam_pgn": -1,
279279
"res_id_list_hex": [
280+
"0x7A8",
280281
"0x7E0",
281282
"0x7E9",
282283
"0x7EA",
@@ -287,6 +288,10 @@ def __init__(self, tp_type=""):
287288
"0x7EF",
288289
"0x7EA",
289290
"0x7BB",
291+
"0x7C8",
292+
"0x7CE",
293+
"0x7D1",
294+
"0x17fe007b",
290295
],
291296
}
292297

@@ -383,13 +388,13 @@ def calculate_sa(self, frame_id):
383388
return sa
384389

385390
def construct_new_tp_frame(self, base_frame, payload_concatenated, can_id):
386-
new_frame = base_frame
387-
new_frame.at["DataBytes"] = payload_concatenated
388-
new_frame.at["DLC"] = 0
389-
new_frame.at["DataLength"] = len(payload_concatenated)
391+
new_frame = base_frame.copy(deep=True)
392+
new_frame.loc["DataBytes"] = payload_concatenated
393+
new_frame.loc["DLC"] = 0
394+
new_frame.loc["DataLength"] = len(payload_concatenated)
390395

391396
if can_id:
392-
new_frame.at["ID"] = can_id
397+
new_frame.loc["ID"] = can_id
393398

394399
return new_frame
395400

0 commit comments

Comments
 (0)