The following Simulink® Coder™ limitations apply to model referencing. In addition to these limitations, a model hierarchy used for code generation must satisfy:
The Simulink requirements and limitations listed in:
The Simulink Coder requirements applicable to the code generation target, as listed in Configuration Parameter Requirements.
If you have an Embedded Coder® license, some restrictions exist on grouped storage classes in referenced models. For details, see Storage Class Limitations.
To Workspace blocks and Scope blocks are ignored when the Simulink Coder software generates code for a referenced model. The resulting code is the same as if the constructs did not exist.
Code generated for referenced models cannot log data to MAT-files. If data logging is enabled for a referenced model, the Simulink Coder software disables the option before code generation and re-enables it afterwards.
If you log states for a model that contains referenced models, the ordering of the states in the output is determined by block sorted order, and might not match between simulation output and generated code MAT-file logging output.
When a top model uses the Data Import/Export > Initial state parameter in the Configuration Parameters dialog box to specify initial conditions, the Simulink Coder software does not initialize the discrete states of the referenced models during code generation.
If a referenced model used for code generation has at least one of the following
characteristics, the model must specify the configuration parameter Total number of instances allowed per top
model as One
. Other instances of the model can
exist in the hierarchy. If you do not set the parameter to
One
, or more than one instance of the model exists in
the hierarchy, an error occurs. The characteristics are:
The model references another model that has been set to single instance.
The model contains an internal signal or state with a storage class that
is not supported for multi-instance models. Internal signals and states must
have the storage class set to Auto
or Model
default
. The default storage class for internal data must be a
multi-instance storage class.
The model uses at least one of these Stateflow® constructs:
Machine-parented data
Machine-parented events
Stateflow graphical functions
The model contains an S-function that is:
Inlined but has not set the option
SS_OPTION_WORKS_WITH_CODE_REUSE
Not inlined
The model contains a function-call subsystem that:
The Simulink engine forces to be a function
Is called by a wide signal
A referenced model cannot use noninlined S-functions generated by the Simulink Coder software.
The Simulink Coder S-function target does not support model referencing.
For additional information, see S-Functions in Referenced Models (Simulink).
If you generate code for an atomic subsystem as a reusable function, inputs or outputs that connect the subsystem to a referenced model might prevent code reuse, as described in Generate Reentrant Code from Subsystems.
The Simulink Coder S-function target does not support model referencing.
When a model contains a trigger or enable port, you cannot generate standalone Simulink Coder code.