girishchandranc / autosarfactory

AutosarFactory is a python package which helps user to read/create/modify AUTOSAR standard arxml files.
MIT License
87 stars 28 forks source link

AUTOSAR schema version #8

Closed toolsh closed 1 year ago

toolsh commented 1 year ago

Hi girishchandranc, This is really a good tool to read and write arxml. Which AUTOSAR schema version is supported currently? Is there a way to support different versions? I use it to read an arxml of autosar-00048.xsd and get an error that PROCESS-DESIGN-TO-MACHINE-DESIGN-MAPPING-SET is not supported. I would like to understand how autosarfactory.py is organized/coded so that I can make changes to let it support autosar-00048.xsd.

Thanks for your support.

girishchandranc commented 1 year ago

Hi @toolsh, Sorry for the delayed response as the email notification was in my spam and noticed the issue only while checking the github project now.

The autosarfactory only supports a single Autosar version(Autosar R22-11 schema 00051.xsd) at the moment. As you could already imagine, the python file is purely auto-generated so, making manual changes isn't a feasible solution. I think, supporting multiple Autosar versions is the best way to go. But, I am still figuring out how it could be incorporated.

I could see that the model element "PROCESS-DESIGN-TO-MACHINE-DESIGN-MAPPING-SET" is removed since the Autosar version R21-11. Is that an element of interest to you? If so, then we should try supporting the schema corresponding to version below R21-11 so that you are not blocked from reading the file. But, if you are not interested in this element, then maybe removing it from the arxml file could also help.

Do you get errors for more elements? Can you please provide more details. Thanks and Best Regards!

Manchey commented 1 year ago

Hi @girishchandranc , As you said " the python file is purely auto-generated", is there a tutorial / code about how to generated the python file? Is it generated from the Autosar schema file (e.g. AUTOSAR_00051.xsd) ?

Thanks for your support.

girishchandranc commented 1 year ago

Hi @Manchey , Sorry for the delayed response. Unfortunately, there isn't a guide to generate the python file. It's actually generated from another github project, which is unfortunately private since it doesn't meet the needed quality standards and all. So, there isn't a tutorial for it.

I intend to support multiple AR versions in future and so, probably, will provide an option to load the right model based on an argument which takes the AR version.

Sorry that isn't the response you were looking for.

On the other hands, could you please let me know why you need the model to be generated for a specific version? Just to understand. Thanks!

girishchandranc commented 1 year ago

Closing ticket as no feedback yet.

Manchey commented 1 year ago

Hi @girishchandranc, thanks for your reply and sorry for the dealyed response.

On the other hands, could you please let me know why you need the model to be generated for a specific version? Just to understand.

I wanna use this package to parse my arxml file which is base on autosar R19-11, and there's some error happens which i think maybe due to the different autosar version. So if there's some tutorial about how to support different autosar version, i can generate the model for my specified version.

And here's the traceback log just in case you are interested:

Traceback (most recent call last):
  File ".\test.py", line 135, in parse_arxml
    root, status = autosarfactory.read([arxml_file])
  File "C:\ProgramData\Anaconda3\lib\site-packages\autosarfactory-0.2.3-py3.7.egg\autosarfactory\autosarfactory.py", line 42, in read
    status &= __read_file(file)
  File "C:\ProgramData\Anaconda3\lib\site-packages\autosarfactory-0.2.3-py3.7.egg\autosarfactory\autosarfactory.py", line 72, in __read_file
    asrRootNode = AUTOSAR()._build(tree.getroot(), file)
  File "C:\ProgramData\Anaconda3\lib\site-packages\autosarfactory-0.2.3-py3.7.egg\autosarfactory\autosarfactory.py", line 47448, in _build
    buildarPackages_node = ARPackage()._build(self, arPackages_node, file)
  File "C:\ProgramData\Anaconda3\lib\site-packages\autosarfactory-0.2.3-py3.7.egg\autosarfactory\autosarfactory.py", line 259743, in _build
    buildarPackages_node = ARPackage()._build(self, arPackages_node, file)
  File "C:\ProgramData\Anaconda3\lib\site-packages\autosarfactory-0.2.3-py3.7.egg\autosarfactory\autosarfactory.py", line 259733, in _build
    buildelements_node = __str_to_class__(elements_obj_dict[etree.QName(elements_node).localname])()._build(self, elements_node, file)
KeyError: 'TRANSFORMATION-PROPS-TO-SERVICE-INTERFACE-ELEMENT-MAPPING-SET'

I followed your advice just removed the 'TRANSFORMATION-PROPS-TO-SERVICE-INTERFACE-ELEMENT-MAPPING-SET' part in my arxml file and now it works fine. Thanks again for your help and this great tool!

girishchandranc commented 10 months ago

Hi @Manchey, Hi @toolsh , I am happy to inform you that now there exists autosarfacrory corresponding to multiple Autosar versions ranging from Autosar 4.0.3 until R22-11. So, in case if you are looking for specific version, you may find it in the folder autosar_releases.

Thank you.