Main Content

createEnumeration

Create Simulink enumeration data type definition from imported AUTOSAR data elements

Description

createEnumeration(arProps,name,applicationDataTypePath) creates a Simulink® enumeration type from an AUTOSAR application data type. The function can be used to work with AUTOSAR elements that you imported by using updateAUTOSARProperties.

example

createEnumeration(arProps,name,compuMethodPath,implementationDataTypePath) creates a Simulink enumeration type from an AUTOSAR implementation data type and CompuMethod.

example

createEnumeration(arProps,compuMethodPath) creates a family of Simulink enumeration types from a BITFIELD_TEXTTABLE CompuMethod with path COMPUMETHODPATH. The family consists of a mask enum and one enum per BITFIELD group encountered in the BITFIELD_TEXTTABLE definition.

example

Examples

collapse all

Create a Simulink enumeration data type definition with the name myEnum from the AUTOSAR application data type at path /AUTOSAR_PlatformTypes/ApplicationDataTypes/MyAppType.

dataObj = autosar.api.getAUTOSARProperties(mdlName);
createEnumeration(dataObj,'myEnum',...
  '/AUTOSAR_PlatformTypes/ApplicationDataTypes/MyAppType');

Create a Simulink enumeration data type definition with the name myEnum from the AUTOSAR implementation data type at path /AUTOSAR_PlatformTypes/ImplementationDataTypes/uint16 by using the computation method from path /a/b/myCM.

dataObj = autosar.api.getAUTOSARProperties(mdlName);
createEnumeration(dataObj,'myEnum','/a/b/myCM',...
  '/AUTOSAR_PlatformTypes/ImplementationDataTypes/uint16');

Create a family of Simulink enumeration data type definitions by specifying the computation method path.

dataObj = autosar.api.getAUTOSARProperties(mdlName);
createEnumeration(dataObj,'/MdlDataDefinition/CompuMethods/ADTSBitTextTable');

Input Arguments

collapse all

AUTOSAR properties information for a model, previously returned by arProps = autosar.api.getAUTOSARProperties(model). The parameter model is a handle, character vector, or string scalar representing the model name.

Example: arProps

Data Types: function_handle

Name of enumeration data type created for Simulink representation of an AUTOSAR element.

In the Simulink environment, this enumeration data type is mapped to both an application data type and an implementation data type. The application data type for the enumeration provides application-level physical attributes such as real-world range of values, data structure, and physical semantics. The implementation data type provides implementation-level attributes, such as stored-integer minimum and maximum specifications and primitive type (for example, integer).

Example: 'myEnum'

Data Types: char | string

Path to AUTOSAR application data type for created Simulink enumeration data type. The application data type provides application-level physical attributes such as real-world range of values, data structure, and physical semantics. The application data type is used in simulation.

Example: '/AUTOSAR_PlatformTypes/ApplicationDataTypes/MyAppType'

Data Types: char | string

Path to the AUTOSAR CompuMethod, which is used to translate between the enumeration implementation data type and the enumeration application data type.

Example: '/a/b/myCM'

Data Types: char | string

Path to AUTOSAR implementation data type for created Simulink enumeration data type. The implementation data type provides implementation-level attributes, such as stored-integer minimum and maximum specifications and primitive type (for example, integer). Implementation data types are used in code generation.

Example: '/AUTOSAR_PlatformTypes/ImplementationDataTypes/uint16'

Data Types: char | string

Version History

Introduced in R2019a