asammdf icon indicating copy to clipboard operation
asammdf copied to clipboard

v7.0.7: MDF concatenation does not work if timestamps overlap

Open MatinF opened this issue 3 years ago • 6 comments

Hi Daniel,

I've done some tests with MDF log files from 2 CANedge devices that record data in parallel.

If I try to concatenate raw CAN bus data from these two devices in asammdf, the expected result would be that their original timestamps would be retained. For example, in my test I log data for both devices over the period 17:26 to 17:32 and would thus expect the concatenated log file to also cover 17:26 to 17:32.

However, in practice, asammdf puts the log files in sequence so that the concatenated data covers 17:26 to 17:38 - with the log files being fully separated.

Is it possible to modify this behavior so that the timestamps are correctly injected when files are concatenated like this? I am not sure if this has drastic negative speed implications, but currently it is not e.g. possible to "merge" data from multiple devices into one.

Martin

MatinF avatar May 21 '22 21:05 MatinF

If they are measured in parallel then you want to use the stack method (https://asammdf.readthedocs.io/en/latest/api.html#asammdf.mdf.MDF.stack)

danielhrisca avatar May 21 '22 22:05 danielhrisca

Thanks for the tip Daniel. It does seem to make sense in terms of what it produces for the raw CAN bus data. However, if I then try to DBC decode the stacked file, I get an error as below when trying to plot any of the signals: image

MatinF avatar May 22 '22 18:05 MatinF

The CAN bus channel number is probably the same in the two files.

danielhrisca avatar Jun 03 '22 05:06 danielhrisca

Yes, the data in both files are across both Bus Channel 1 and 2. But since it looks to make sense for the raw data, I'm not sure why that would necessarily cause the DBC decoding to fail?

MatinF avatar Jun 06 '22 06:06 MatinF

The DBC decode will place decodes data from both files in the same channel. This means that the decoded data from the second measurement will actually get appended to the decoded data from the first measurement , with the result that the timestamp will not be monotonously increasing

danielhrisca avatar Jun 06 '22 08:06 danielhrisca

Ok would it be an option in that case to pre-sort the stacked file by timestamps before performing the actual DBC decoding? Or maybe I'm missing a factor that would make this problematic

MatinF avatar Jun 06 '22 10:06 MatinF