Skip to content

Commit 748fa18

Browse files
author
Martin
committed
Updated to support multiple DBC files in asammdf script
1 parent 58e71ee commit 748fa18

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

examples/other/asammdf-basics/asammdf_basics.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,17 @@
1313
mdf_extension = ".MF4"
1414
input_folder = "input"
1515
output_folder = "output"
16-
dbc_file = "CSS-Electronics-SAE-J1939-DEMO.dbc"
17-
1816

1917
# load MDF/DBC files from input folder
2018
path = Path(__file__).parent.absolute()
2119
path_in = Path(path, input_folder)
2220
path_out = Path(path, output_folder)
23-
path_in_dbc = Path(path_in, dbc_file)
2421

22+
dbc_files = {"CAN": [(dbc, 0) for dbc in list(path_in.glob("*" + ".DBC"))]}
2523
logfiles = list(path_in.glob("*" + mdf_extension))
26-
dbc = {"CAN": [(path_in_dbc, 0)]}
2724

2825
signals = ["EngineSpeed", "WheelBasedVehicleSpeed"]
29-
print("Log file(s): ", logfiles, "\nDBC(s): ", dbc)
26+
print("Log file(s): ", logfiles, "\nDBC(s): ", dbc_files)
3027

3128
# concatenate MDF files from input folder and export as CSV incl. timestamps (localized time)
3229
mdf = MDF.concatenate(logfiles)
@@ -44,7 +41,7 @@
4441
mdf.save(Path(path_out, "filtered"), overwrite=True)
4542

4643
# DBC convert the unfiltered MDF + save & export resampled data
47-
mdf_scaled = mdf.extract_bus_logging(dbc, ignore_invalid_signals=True)
44+
mdf_scaled = mdf.extract_bus_logging(dbc_files, ignore_invalid_signals=True)
4845

4946
mdf_scaled.save("scaled", overwrite=True)
5047
mdf_scaled.export(

0 commit comments

Comments
 (0)