Avoid Identifier Name Collisions with Referenced Models
Within a model that uses referenced models, collisions between the names of the models are not allowed. When generating code from a model that uses model referencing:
You must include the
$Rtoken in the Identifier format control parameter specifications (in addition to the
The Maximum identifier length must be large enough to accommodate full expansions of the
$Mtokens. If Maximum identifier length is too small, a code generation error occurs.
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 identifier from the referenced model is preserved. Name mangling is performed on the identifier from the higher-level model.
If your model contains two referenced models with the same input or output port names, and
one of the referenced models contains an atomic subsystem with Function packaging set to
Nonreuseable function, a name
conflict can occur and the build process produces an error.
Use Model Advisor to Detect Identifier Names Changed During Code Generation
For a referenced model, if the following parameters on have specifications that do not
$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 referenced models in a model referencing hierarchy for which code generation changes these configuration parameter settings.
In the Modeling tab, click Model Advisor.
Select By Task.
Run the Check code generation identifier formats used for model reference check.