MATLAB Answers

How to Use createEnumeration with externally defined enumeration data type?

13 views (last 30 days)
Mahmoud Hassanien
Mahmoud Hassanien on 12 Mar 2021
Commented: Thomas Jensen on 15 Apr 2021 at 17:28
I have an AUTOSAR SWC and I have an interface with enumeration data type; ModeRequest. I want the generated ARXML to use this enumeration as a data type but not with the default path of the SWC. On the integration level of the whole SW, there is a compu method called CM_ModeRequest. and it's at path /DataTypes/CompuMethod. I want my SWC to use this compumethod and to refer to /DataTypes/ModeRequest for the data type.
my enumeration name is: ModeRequest
The compu method used for this type is CompuMethod
The path I want to refere to (external) is /DataTypes
I tried to use the function createEnumeration
dataObj = autosar.api.getAUTOSARProperties('MySWC');
createEnumeration(dataObj,'ModeRequest','/DataTypes/CompuMethods',...
'/DataTypes');
Also I tried
dataObj = autosar.api.getAUTOSARProperties('MySWC');
createEnumeration(dataObj,'ModeRequest','/DataTypes/CompuMethods/CM_ModeRequest',...
'/DataTypes');
but I get an error The specified qualified path "/DataTypes" is not a valid
ImplementationDataType path. To create Simulink Enumeration, provide a
valid path.
I also tried
dataObj = autosar.api.getAUTOSARProperties('FSM');
createEnumeration(dataObj,'ModeRequest','/DataTypes/CompuMethods/CM_ModeRequest',...
'/DataTypes/ModeRequest');
but I get the error The AUTOSAR element does not exist at
'/DataTypes/ModeRequest'.
I don't know what to do to refer to this externally defined data type
Thanks in advance
  1 Comment
Thomas Jensen
Thomas Jensen on 15 Apr 2021 at 17:28
Hi Mahmoud,
Have you tried to create an ARXML file with the definition of the enumeration and import it as it described in https://nl.mathworks.com/help/autosar/ref/arxml.importer.updateautosarproperties.html?
I have never tried to do it, but I this that might work.
Best regards,

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by