asammdf icon indicating copy to clipboard operation
asammdf copied to clipboard

Message name info

Open StefanoX1 opened this issue 3 years ago • 6 comments

Hi, I'm using asammdf 7.0 for MDF (v. 4.0) analisys. but in mdf struct ( mdf = MDF(fileName) ) I can't find the message name info. Example:

fileName = r'myfile.MDF' mdf = MDF(fileName , remove_source_from_channel_names = False)

<Signal mySignal: samples=[0. ... 0.] timestamps=[9.96739000e-01 ... 1.10694713e+04] invalidation_bits=None unit="°C" conversion=None source=<asammdf.blocks.source_utils.Source object at 0x0000025A35B785E0> comment="{For VehicleX: Range_MIN = -10}" mastermeta="('t', 1)" raw=False display_names={} attachment=None>

mdf.get('mySignal').source.get_details() ' ECU source on bus CAN: name=[ 'NODE' ] path=[]'

Using mdfreader library, I find this information in the mdfreader struct :

import mdfreader yop = mdfreader.Mdf(fileName )

yop

{..... 'mySignal': {'unit': '°C', 'description': '{For VehicleX: Range_MIN = -10} ', 'master': 't_51_51', 'masterType': 0, 'data': array([0., ..., 0.]), 'axis': [], 'id': ((51, 0, 72), ('mySignal', 'NODE', None), ('MESSAGE_NAME', 'NODE', 'Message'))}}

How can I find this information using asammdf 7.0?

Best Regards, Stefano Perone

StefanoX1 avatar Feb 25 '22 09:02 StefanoX1

Hello Stefano, it is not clear to me what is going on there. A demo file would be really helpful

danielhrisca avatar Feb 25 '22 11:02 danielhrisca

Hi Daniel, unfortunately I cannot attach the file used. Is there any other 'library output' that might be useful?

StefanoX1 avatar Feb 25 '22 11:02 StefanoX1

Maybe a MDFValidator screenshot with the relevant blocks

danielhrisca avatar Feb 25 '22 11:02 danielhrisca

Hi Daniel, I used the 'demo.py' script to create an mdf file and I opened this file using MDFValidator tool. I'd like to read the value of the 'cg_tx_acq_name' field (in demo.mf4\Header Block\Data Group 2\Channel Group 1) using an asammdf method.

StefanoX1 avatar Feb 25 '22 17:02 StefanoX1

I have a similar problem right now and cannot figure how to find (and edit) the information that is shown in turbolab as follows:

Bildschirmfoto 2022-03-07 um 16 18 28

Is is possible?

hanneskaeufler-bmw avatar Mar 07 '22 15:03 hanneskaeufler-bmw

for i, group in enumerate(mdf.groups):
    group.channel_group.acq_name = 'cg_tx_acq_name'

    if group.channel_group.source is not None:
        group.channel_group.source.name = 'cg_si_acq_source/si_tx_name'
        group.channel_group.source.path = 'cg_si_acq_source/si_tx_path'

    for j, ch in enumerate(group.channels):
        ch.name = 'cn_tx_name'

        if ch.source is not None:
            ch.source.name = 'cn_si_source/si_tx_name'
            ch.source.path = 'cn_si_source/si_tx_path'
            ch.source.comment = 'cn_si_source/si_md_comment'

danielhrisca avatar Jun 24 '22 12:06 danielhrisca

@danielhrisca this code shows an error.

if group.channel_group.source is not None: AttributeError: 'ChannelGroup' object has no attribute 'source'

How could we solve it?

Thank you

elon1992 avatar Nov 14 '22 06:11 elon1992

acq_source instead of source

danielhrisca avatar Nov 14 '22 06:11 danielhrisca