VNT - Use a J1939 dbc file to translate frames from .mf4 file?
5 次查看(过去 30 天)
显示 更早的评论
Hello,
I am trying out the Vehicle Network Toolbox. I wonder how I can convert the raw frames loaded from an .mf4 file to J1939 messages using a J1939 .dbc file.
I have two channels in my log. One is J1939 and the other CANOpen. I have .dbc files for both. For CANOpen I get a time table with named messages when I do this;
m = mdf('CANOPEN_and_J1939.mf4');
db = canDatabase('CANOpen.dbc');
group = 2;
data = read(m, group, m.ChannelNames{group});
msgTimetable = canMessageTimetable(data, db);
If I change group to 1 and use my J1939 .dbc file I should see the decoded messages from the J1939 bus. But this does not work. Why?
The J1939 database comes stock from a Vector CANalyzer. Running the same log and in CANAlyzer with same .dbc file gives me all messages/signals as expected.
How do I use my J1939.dbc in Matlab VNT to translate data from my .mf4 file?
0 个评论
回答(1 个)
Harimurali
2024-2-11
编辑:Walter Roberson
2024-2-11
Hi Markus,
A slightly different approach needs to be followed for J1939 compared to "CANOpen". The vehicle network toolbox provides functions specifically for J1939 communication that should be used to effectively convert the raw frames loaded from a mf4 file to J1939 messages using a J1939 dbc file. Here is an example MATLAB script that demonstrates the same:
%Read all data in channel group 1 to a timetable
data = mdfRead("CANOPEN_and_J1939.mf4", GroupNumber=1) % 1x1 cell array
canData = data{1} % timetable of ASAM standard logging format data
% Open the DBC-file
canDB = canDatabase("J1939_dbcfile.dbc")
% convert the timetable to J1939 parameter group timetable
j1939PGTimetable = j1939ParameterGroupTimetable(canData, canDB)
% multiple J1939 signal timetables for each individual PG
signalTimetables = j1939SignalTimetable(j1939PGTimetable)
The "j1939ParameterGroupTimetable" function takes the input messages as an array of J1939 parameter group objects and returns a J1939 parameter group timetable. The timetable contains the decoded data (PGN, Priority, Data, etc.) from the input J1939 traffic. The "j1939SignalTimetable" function is used to repackage signal data from each unique PGN on the bus into a seperate signal timetables.
Refer the following documentation for decoding J1939 data from MDF files using the vehicle network toolbox: https://www.mathworks.com/help/releases/R2023b/vnt/ug/decoding-j1939-data-from-mdf-files.html
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Vehicle Network Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!