MATLAB: When are Simulink.AliasTypes created in Simulink for Application data types and Implementation data types, and how are they exported upon code generation with AUTOSAR

aliasaliastypesapplicationarxmldataimplementationimportsimulinksimulink.aliastypestypes

For a top-down workflow (import from ARXML), in which cases are Simulink.AliasTypes created? Are they created for Application data types or Implementation data types?
Also, is there any way to tell whether a given Simulink.AliasType has been imported from an Application data type or an Implementation data type? How is the type definition going to be exported to "Rte_type.h" upon code generation?

Best Answer

I understand that you are concerned that having a type represent and ADT or an IDT may influence whether a definition is generated in “Rte_type.h”. Let me clarify that the generation of the definitions in “Rte_type.h” is independent of whether a given type represents an ADT or an IDT.
The type definition will be generated in “Rte_type.h” as long as the type is used in the model, “Rte_type.h” is set as HeaderFile, and the DataScope property is set to “Exported”.
For a top-down workflow in Simulink:
  • For Application data types imported from ARXML, Simulink.AliasTypes are created in Simulink.
  • For the case of Implementation types:
  • If they are referencing a base type, Simulink.AliasTypes will be created in Simulink.
  • For the specific case of the base type being an Integer type with non-standard word length, they will be represented as Simulink.NumericTypes.
  • For all other cases, Implementation data types are imported as Simulink.NumericTypes.
Regarding how Simulink.AliasTypes are exported when generating code from Simulink, let me clarify the current behaviour:
  • Simulink.AliasTypes that have been created upon import from ARXML will preserve their “DataTypeMappingSet”, which can be accessed through the API “<https://www.mathworks.com/help/autosar/ref/autosar.api.getautosarproperties.html autosar.api.getAUTOSARProperties> ”, as follows:
>> arProps = autosar.api.getAUTOSARProperties(modelName);
>> mappingSet = arProps.find('', "DataTypeMappingSet")
>> listADT = find(arProps,[],'ApplicationDataType') % List the ADTs in the model.
>> listIDT = find(arProps,[],'ImplementationDataType') % List the IDTs in the model.
  • Please be aware that this API will allow you to view the IDTs and ADTs, but it does not allow to modify any of the mappings.
  • Therefore, for a Simulink.AliasType that has been created on import, and that represents an ADT, Simulink will generate that type as an ADT in the ARXML when following a round-trip workflow. If the imported type represents an IDT, an IDT will be generated.
  • Simulink.AliasTypes created directly in Simulink (bottom-up workflow) will always be interpreted as IDTs in the generated code. It is currently not possible to select whether a given Simulink.AliasTypes represents an IDT or an ADT.