Why is the "createComponentAsModel" function generating a model with incorrect data types in MATLAB R2018b?

9 views (last 30 days)
I am trying to use the "createComponentAsModel" function to generate an AUTOSAR MBD Model from my custom ARXML file.
Please run the below command in the command window of installed MATLAB R2019a version to get release specific documentation of the function:
>> web(fullfile(docroot, 'autosar/ref/arxml.importer.createcomponentasmodel.html'))
The issue that I encountered is that the generated model contains different datatype definitions compared to the datatypes I defined in the ARXML file
For example, if I were to define a "float32" type in the ARXML file, the generated model would have a "uint32" type instead.
Is this a bug with the function?
Please follow the below link to search for the required information regarding the current release:

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 29 Jul 2024
Edited: MathWorks Support Team on 29 Aug 2024
According to the AUTOSAR specification for platform types, "float32", and "float" should follow IEEE754 encoding.
The encoding type for "float32" has been set to "NONE" in your ARXML file which is why the generated model has an incorrect datatype.
<SW-BASE-TYPE UUID="BB616C701EE7">
<SHORT-NAME>float32</SHORT-NAME>
<CATEGORY>FIXED_LENGTH</CATEGORY>
<BASE-TYPE-SIZE>32</BASE-TYPE-SIZE>
<BASE-TYPE-ENCODING>NONE</BASE-TYPE-ENCODING>
<NATIVE-DECLARATION>float</NATIVE-DECLARATION>
</SW-BASE-TYPE>
The issue will be resolved once you set the "BASE_ENCODING_TYPE" to IEEE754 as shown below.
<SW-BASE-TYPE UUID="BB616C701EE7">
<SHORT-NAME>float32</SHORT-NAME>
<CATEGORY>FIXED_LENGTH</CATEGORY>
<BASE-TYPE-SIZE>32</BASE-TYPE-SIZE>
<BASE-TYPE-ENCODING>IEEE754</BASE-TYPE-ENCODING>
<NATIVE-DECLARATION>float</NATIVE-DECLARATION>
</SW-BASE-TYPE>

More Answers (0)

Categories

Find more on AUTOSAR Blockset in Help Center and File Exchange

Products


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!