0

I want to convert a blf-file (containing CAN-data) to a mdf (not mf4). I'm able to decode the CAN-frames using the corresponding dbc-files, the messages are stored in a list and then converted into a pandas dataframe.

I create an empty MDF-object from asammdf, append the dataframe and try to save it. But I run into an error.

mdf=MDF()
mdf=mdf.convert(version='3.00')
mdf.append(df)
mdf.save('test.mdf')

gp.channels = gp_channels = []

AttributeError: 'dict' object has no attribute 'channels'

The error comes from line 2097 in mdf_v3.py (source file to asammdf library). However, if I do not convert the version to 3.00, and keep the default 4.10. Then there is no error, and the conversion happens without any error.

Appreciate some help, anybody know how I can use asammdf to create a mdf3-file from a dataframe?

fejz1234
  • 5
  • 6
  • I've added a fix for this issue in this commit https://github.com/danielhrisca/asammdf/commit/500606e0a8ff5fc8b1193df4938166faa5d26744. It will included in the 7.3.3 release – danielhrisca Feb 28 '23 at 06:36
  • @danielhrisca Thank you. Another thing, I'm trying to split BLF to MDF using cantools and asammdf. I obtain a list of dictionaries (from the decoded CAN-messages) containing signal values and their names, is there a way to append those to a MDF-object without creating a dataframe? The list is very large, with 600k dictionaries. I'm not able to create a dataframe of the list, so I'm exploring other options. Each dictionary has this form {'SignalA'=1,'SignalB'=10 ,'SignalC'=4}, but of course signals vary within each dictionary (signalA might not always be in each dictionary, etc). – fejz1234 Mar 24 '23 at 09:33

0 Answers0