Main Content

Preserve Alias Type Names for Data Types

Preserve Simulink.AliasType names in generated code

Model Configuration Pane: PLC Code Generation / Identifiers


The Preserve alias type names for data types parameter specifies that the generated code must preserve alias data types from your model. Using the Simulink.AliasType class, you can create an alias for a built-in Simulink® data type. If you assign an alias data type to signals and parameters in your model, when you use this option, the generated code uses your alias data type to define variables corresponding to the signals and parameters.

For instance, you can create an alias SAFEBOOL from the base data type boolean. If you assign the type SAFEBOOL to signals and parameters in your model, the variables in the generated code corresponding to those signals and parameters also have the type SAFEBOOL. Using this alias type SAFEBOOL, you can conform to PLCopen safety specifications that suggest using safe data types for differentiation between safety-relevant and standard signals.


off (default) | on

The generated code preserves alias data types from your model.

For your generated code to be successfully imported to your target IDE, the IDE must support your alias names.


The generated code does not preserve alias types from your model. Instead, the base type of the Simulink.AliasType class determines the variable data type in generated code.


The alias that you define for a Simulink type must have the same semantic meaning as the base Simulink type. It must not be a data type already supported in Structured Text and semantically different from the base Simulink type. For instance, WORD is a data type supported in Structured Text but is semantically different from an integer type. If you define an alias WORD for a Simulink built-in integer type, for instance uint16, and preserve the alias name, the type WORD that appears in your generated code is used semantically as a WORD and not as an INT. The generated code has a different meaning from the semantics of the model.

Recommended Settings

DebuggingNo impact
EfficiencyNo impact
Safety precautionNo impact

Programmatic Use

Parameter: PLC_PreserveAliasType
Type: string
Value: 'on' | 'off'
Default: 'off'

Version History

Introduced in R2016b