ebroecker / canmatrix

Converting Can (Controller Area Network) Database Formats .arxml .dbc .dbf .kcd ...
BSD 2-Clause "Simplified" License
907 stars 400 forks source link

Support for ECUC ARXMLs #281

Closed andraflandra closed 5 years ago

andraflandra commented 5 years ago

Hi, I am using an internal .arxml file I cannot show you but also a public one available here: https://raw.githubusercontent.com/nikidimitrow/Learning-AUTOSAR-fundamental/master/BasicsOfAUTOSAR/MyECU.ecuc.arxml

I get this readout in cmd (win10): ` C:\Python27\Scripts>canconvert -vv D:\user\ECUexample.arxml D:\user\ECUexampleAAA.xlsx INFO - convert - Importing D:\user\ECUexample.arxml ... DEBUG - arxml - Read arxml ... DEBUG - arxml - Done

DEBUG - arxml - Build arTree ... DEBUG - arxml - Done

DEBUG - arxml - DEBUG 0 frames in arxml... DEBUG - arxml - DEBUG 0 can-frame-triggering in arxml... DEBUG - arxml - DEBUG 0 SIGNAL-TO-PDU-MAPPINGS in arxml... DEBUG - arxml - DEBUG 0 I-SIGNAL-TO-I-PDU-MAPPING in arxml... INFO - convert - done

INFO - convert - Exporting D:\user\ECUexampleAAA.xlsx ... INFO - convert - done `

ebroecker commented 5 years ago

Hi @andraflandra this is an ECUC-ARXML.

Conversion will only work with an SYSTEM-DESCRIPTION-ARXML

andraflandra commented 5 years ago

How might I get this to work with ECUC-ARXML? Could your code be modified slightly or is a completely new solution needed?

edit:

Also, I found a System-ARXML file online and when trying to convert to .xlsx I get this: DEBUG - arxml - Read arxml ... DEBUG - arxml - Done

DEBUG - arxml - Build arTree ... DEBUG - arxml - Done

DEBUG - arxml - DEBUG 0 frames in arxml... DEBUG - arxml - DEBUG 0 can-frame-triggering in arxml... DEBUG - arxml - DEBUG 0 SIGNAL-TO-PDU-MAPPINGS in arxml... DEBUG - arxml - DEBUG 12 I-SIGNAL-TO-I-PDU-MAPPING in arxml...

And when trying to compare two .arxml files this happens: Traceback (most recent call last): File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main "main", fname, loader, pkg_name) File "c:\python27\lib\runpy.py", line 72, in _run_code exec code in run_globals File "C:\Python27\Scripts\cancompare.exe__main__.py", line 9, in File "c:\python27\lib\site-packages\canmatrix\compare.py", line 549, in main db1 = next(iter(canmatrix.formats.loadp(matrix1).values())) StopIteration

ebroecker commented 5 years ago

please try branch https://github.com/ebroecker/canmatrix/tree/iss281

pip install git+https://github.com/ebroecker/canmatrix@iss281#egg=canmatrix

andraflandra commented 5 years ago

First of all, thank you very much for your effort!

I can now convert the files but from the 1.329KB file all I get is a 6KB .xlsx table with only the first line of data as far as I can tell.

This is the readout in cmd: INFO - arxml - seems to be a ECUC arxml. Very limited support for extracting canmatrix. DEBUG - xls - DEBUG: Length of db.frames is 2

(this is the .arxml file I linked in the issue converted to .xlsx) ECUexampleCONVERTED.xlsx

Also, the actual, non-example .arxml files I need to convert are still getting the line of "DEBUG 0 frames". If there is any more info I can give you to make this work please let me know!,

edit: I also get this when trying to compare .arxml files: Traceback (most recent call last): File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main "main", fname, loader, pkg_name) File "c:\python27\lib\runpy.py", line 72, in _run_code exec code in run_globals File "C:\Python27\Scripts\canconvert.exe__main.py", line 9, in File "c:\python27\lib\site-packages\canmatrix\convert.py", line 402, in main convert(infile, outfileName, **cmdlineOptions.dict__) File "c:\python27\lib\site-packages\canmatrix\convert.py", line 43, in convert dbs = canmatrix.formats.loadp(infile, options) File "c:\python27\lib\site-packages\canmatrix\formats.py", line 64, in loadp return load(fileObject, importType, key, flatImport, options) File "c:\python27\lib\site-packages\canmatrix\formats.py", line 74, in load dbs = moduleInstance.load(fileObject, **options) File "c:\python27\lib\site-packages\canmatrix\arxml.py", line 1583, in load com_module = arGetPath(searchPoint, "ActiveEcuC/Com") File "c:\python27\lib\site-packages\canmatrix\arxml.py", line 908, in arGetPath ptr = ptr.getChild(p) AttributeError: 'lxml.etree._Element' object has no attribute 'getChild'

Thanks again.

ebroecker commented 5 years ago

@andraflandra what is the output of canconvert -vv your_non_example.arxml some_test.dbc

Is there actual a Can-Bus defined in the ARXML?

andraflandra commented 5 years ago

This is the output of said command in cmd:

C:\Users\user1>canconvert -vv D:\file.arxml D:\some_test.dbc
INFO - convert - Importing D:\file.arxml ...
DEBUG - arxml - Read arxml ...
DEBUG - arxml -  Done

DEBUG - arxml - Build arTree ...
DEBUG - arxml -  Done

DEBUG - arxml - DEBUG 0 frames in arxml...
DEBUG - arxml - DEBUG 0 can-frame-triggering in arxml...
DEBUG - arxml - DEBUG 0 SIGNAL-TO-PDU-MAPPINGS in arxml...
DEBUG - arxml - DEBUG 0 I-SIGNAL-TO-I-PDU-MAPPING in arxml...
INFO - convert - done

INFO - convert - Exporting D:\some_test.dbc ...
INFO - convert - done

However, this does not actually output/create any .dbc file. (but doing the line on the example code gets me the same 2 frame file but in .dbc)

As for your question, these are the opening lines of the file:

REDACTED
ebroecker commented 5 years ago

Hi @andraflandra ,

Thanks. what kind of ARXML is this? In what context did you get this file?

The debug output looks like there is no CAN communication defined in this ARXML:

DEBUG - arxml - DEBUG 0 frames in arxml...
DEBUG - arxml - DEBUG 0 can-frame-triggering in arxml...
DEBUG - arxml - DEBUG 0 SIGNAL-TO-PDU-MAPPINGS in arxml...
DEBUG - arxml - DEBUG 0 I-SIGNAL-TO-I-PDU-MAPPING in arxml...
andraflandra commented 5 years ago

It's from a model input, basically a database of host architecture for automotive. I do have a separate .dbc file that has CAN signals database on them.

I'm new to this so please excuse my ignorance.

ebroecker commented 5 years ago

If the ARXMLs describe a SWC (Software component) it will mostely certain not be any CAN information in it.

andraflandra commented 5 years ago

There are SWC components included so I would assume you are correct. Does this make it impossible to use canmatrix to port my kind of arxml to xlsx or can it be enhanced perhaps?

ebroecker commented 5 years ago

Sorry - this is a really complete other use case. Something like extracting sender/receiver ports or/and exporting client/server ports from SWC-ARXML is a complete other work than exporting CAN communication information

andraflandra commented 5 years ago

Thank you for all the help in any case. I will try to find a different solution or build my own.