Subsystem methods
Customize generated function names for subsystems and Simulink functions
Model Configuration Pane: Code Generation / Identifiers
Description
Customize generated function names for subsystems and Simulink® functions.
Dependencies
This parameter:
Appears only for ERT-based targets.
Requires Embedded Coder® when generating code.
Settings
$R$N$M$F
(default) | stringEnter a macro that specifies whether, and in what order, certain text is to be included in the generated identifier. The macro can include a combination of the following format tokens.
Token | Description |
---|---|
$F | Insert method name (for example, |
$H | Insert tag indicating system hierarchy level. For root-level blocks, the tag is the text Empty for Stateflow® functions. |
$M | Insert name-mangling text if required to avoid naming collisions. Required. |
$N | Insert name of object (block, signal or signal object, state, parameter or parameter object) for which identifier is being generated. |
$R | Insert root model name into identifier, replacing unsupported characters with the underscore (_) character. Required for model referencing. |
$U | Insert text that you specify for the |
Tips
Avoid name collisions in general. One way is to avoid using default block names (for example,
Gain1
,Gain2
...) when your model has many blocks of the same type.Where possible, increase the Maximum identifier length to accommodate the length of the identifiers you expect to generate. Reserve at least three characters for name-mangling text.
To control the case (upper or lower case) of the text that each token represents, include decorators such as
[U_]
in your macro. See Control Case of Identifiers by Using Basic Token Decorators.If you specify
$R
, the value you specify for Maximum identifier length must be large enough to accommodate full expansions of the$R
and$M
tokens.When a name conflict occurs between an identifier within the scope of a higher-level model and an identifier within the scope of a referenced model, the code generator preserves the identifier from the referenced model. Name mangling is performed on the identifier in the higher-level model.
Name mangling conventions do not apply to type names (that is,
typedef
statements) generated for global data types. The Maximum identifier length setting does not apply to type definitions. If you specify$R
, the code generator includes the model name in thetypedef
.This option does not impact objects (such as signals and parameters) that have a storage class other than
Auto
(such asImportedExtern
orExportedGlobal
).For referenced models, if the Subsystem methods parameter does not contain a
$R
token (which represents the name of the reference model), code generation prepends the$R
token to the identifier format.You can use the Model Advisor to identify models in a model referencing hierarchy for which code generation changes configuration parameter settings.
On the Modeling tab, select Model Advisor.
Select By Task.
Run the Check code generation identifier formats used for model reference check.
Recommended Settings
Application | Setting |
---|---|
Debugging | No impact |
Traceability | Use default |
Efficiency | No impact |
Safety precaution | No recommendation |
Programmatic Use
Parameter: CustomSymbolStrFcn |
Type: character vector |
Value: valid combination of tokens |
Default: $R$N$M$F |
Version History
Introduced before R2006a