Construction of Generated Identifiers
For generic real-time (GRT) and rapid simulation (RSim) targets, the code generator automatically constructs identifiers for variables and functions in the generated code. These identifiers represent:
Signals and parameters that have the
Subsystem function names that you do not define
Generated identifiers consist of these components in this order.
The root model name
The name of the Simulink® object that the identifier represents
Optionally, unique name-mangling text
The code generator conditionally generates the name-mangling text to resolve potential conflicts with other generated identifiers. If the Maximum identifier length parameter value is too short to fit the generated name, the code generator truncates the root model name and Simulink object name, but does not truncate the name-mangling text. If the maximum identifier length is too short to fit the name-mangling text, the code generator returns an error. For information about avoiding this error, see Specify Identifier Length to Avoid Naming Collisions.
The code generator reserves certain words for its own use as keywords of the generated code language. You can specify custom reserved keywords by using the Reserved names model configuration parameter. For more information, see Reserved Keywords.
With an Embedded Coder® license, you can specify parameters to control identifier formats, mangle length, scalar inlined parameters, and Simulink data object naming rules. For more information, see Customize Generated Identifier Naming Rules (Embedded Coder) and Identifier Format Control (Embedded Coder).
Specify Identifier Length to Avoid Naming Collisions
The Maximum identifier length model configuration property allows you to limit the number of characters in function, type definition, and variable names. The default is 31 characters. This is also the minimum length you can specify. The maximum is 256 characters.
If the Maximum identifier length parameter value is not large enough to accommodate full expansions of the model name and Simulink object name, the code generator truncates those strings in the generated identifier. To avoid this outcome, it is good practice to:
Avoid using default block names when the model includes multiple blocks of the same type.
Use atomic and reusable subsystems.
Increase the value of the Maximum identifier length parameter to accommodate the length of the identifier you expect to generate.
- Customize Generated Identifier Naming Rules (Embedded Coder)