MATLAB: When exporting a component to ARXML and re-importing it, why are certain component elements removed

arxmlautosarAUTOSAR Blocksetimplementationroundtrip

I am working on a round-trip AUTOSAR workflow where I generate ARXML from an AUTOSAR component (without implementation) and then re-import it. However, when it is re-imported, certain elements of the component are being deleted (inports, data transfers, etc.). Why is this the case, and how can I fix it?

Best Answer

This is expected behavior for components without an implementation. ARXML by design does not include the implementation of a component. It only contains information about the structure or "architecture" of the component.
When you generate ARXML from a component, it first generates C code for that component, and then generates ARXML to describe that C code. When the AUTOSAR component lacks implementation (i.e. just the "architecture" of the component), then the C code optimizes out certain "unused" elements of the component. Since the ARXML must describe the C code, the ARXML will also lack these elements.
To work around this, ensure that there is some implementation in the component, even if it is "dummy" implementation, before generating code and ARXML. It does not matter what implementation is included (since the implementation is not included in the ARXML), so long as all the inports and outports are used.
In many AUTOSAR development organizations, a system architect will design the architecture of various components in an AUTOSAR authoring tool, and then export ARXML to give to their engineers for developing the implementation of the various components. Simulink/System Composer do not constitute a complete AUTOSAR authoring tool.
An enhancement request has been submitted. For now, the above workarounds are necessary to accommodate this workflow.