You can include one model in another by using a Model block, which represents a reference to another model, called a referenced model. For simulation and code generation, the referenced model effectively replaces the Model block that references it. The model that contains a referenced model is its parent model. A collection of parent and referenced models constitutes a model reference hierarchy.
You can organize large models hierarchically, similar to using subsystems. Like libraries, referenced models allow you to use the same capability repeatedly without having to redefine it. Referenced models provide several advantages that are unavailable with subsystems and/or library blocks. Several of these advantages result from Simulink® compiling a referenced model independent of the context of the referenced model, including:
Inclusion by reference
Incremental code generation
Independent configuration sets
To get started using model referencing, see Overview of Model Referencing.
|Model||Include multiple model implementations as block in another model|
||Find Model blocks and referenced models at all levels or at top level only|
||Display graph of model reference dependencies|
||Convert subsystem to model reference|
||Build standalone executable or model reference target for model; except where noted, this function requires a Simulink Coder license|
You can include one model in another by using Model blocks.
Determine when to use model referencing to meet your modeling requirements.
Configure a model for use in a model reference hierarchy.
Model referencing has some limitations relating to features such as simulation modes, masking, and debugging.
Use a Model block to reference another model, using Inport and Outport blocks for the interface.
Determine when to convert a subsystem to a referenced model and select the appropriate options for the conversion.
Use the Model Reference Conversion Advisor or Simulink.Subsystem.convertToModelReference function to convert subsystems to referenced models.
Refresh a Model block to update its internal representation so that it reflects changes in the interface of the model that it references.
Examine a model reference hierarchy.
Display representation of block contents on the face of a block
When you model a reusable component as a referenced model, to configure each instance of the component to use different values for block parameters, create model arguments.
Execute referenced models conditionally, similarly to how you can execute conditional subsystems.
To have bus data cross model reference boundaries, use a bus object (Simulink.Bus) to define the bus.
In a referenced model, you can log any signal configured for signal logging. You can override signal logging settings in referenced models.
Use S-functions with model referencing.
A referenced model can inherit sample times from the model that references it.
Select the simulation mode for simulating models in a model reference hierarchy.
A simulation target, or SIM target, is a MEX-file that implements a referenced model that executes in accelerator mode.
Use Simulink cache files to share referenced model build artifacts without repeating the cost of a first-time build.
Simulate a model that contains multiple instances of a referenced model.
Simulate conditional referenced models.