Main Content

Model References

Reuse models as blocks in other models

A model reference is a reference to another model using a Model block. These references create model hierarchy. Each referenced model has a defined interface that specifies the properties of its inputs and outputs. The defined interface makes the behavior of the referenced model independent of its context in the model hierarchy. For simulation and code generation, a referenced model executes like a single block, or atomic unit, when the parent model executes. Model references are ideal for code reuse, unit testing, parallel builds, and large components. They can also reduce file contention and merge issues.

To determine whether referenced models meet your modeling requirements, see Component-Based Modeling Guidelines.

To learn about code generation for model reference hierarchies, see Referenced Models (Simulink Coder).

To create a protected model, see Model Protection (Simulink Coder).


ModelReference another model to create model hierarchy
Variant ModelTemplate subsystem containing Subsystem, Model, or Subsystem Reference blocks as variant choices


expand all

depviewAnalyze and visualize model referencing dependencies with or without library dependencies
find_mdlrefsFind referenced models and Model blocks in model hierarchy
Simulink.BlockDiagram.refreshBlocksUpdate variants, linked blocks, and model references to reflect changes
Simulink.BlockPathFully specified Simulink block path
Simulink.fileGenControlSpecify root folders for files generated by diagram updates and model builds
Simulink.ModelReference.refreshForce update to Model block to reflect changes to referenced model
Simulink.SubSystem.convertToModelReferenceConvert subsystem to model reference
slbuildBuild standalone executable file or model reference target for model
slxcinfoQuery contents of Simulink cache files
slxcunpackUnpack simulation and code generation targets from Simulink cache file
Simulink.ProtectedModel.createHarnessCreate harness model that provides isolated environment for testing protected model
Simulink.ProtectedModel.getPublisherReturn information about publisher that signed the protected model
Simulink.ProtectedModel.verifySignatureVerify digital signature on protected model
Simulink.ProtectedModel.suppressSignatureVerificationSuppress digital signature verification of protected models

Model Settings

expand all

RebuildOption to conditionally, always, or never rebuild model reference targets
Never rebuild diagnosticDiagnostic action to take when model reference target must be rebuilt
Enable parallel model reference buildsOption to build a model reference hierarchy in parallel whenever possible
MATLAB worker initialization for buildsOptions for how to initialize MATLAB workers for parallel builds
Enable strict scheduling checks for referenced modelsOption to check consistency of scheduling and sample time in referenced models
Total number of instances allowed per top modelNumber of references to this model that can occur in another model
Propagate sizes of variable-size signalsOption to specify how variable-size signals propagate through referenced models
Minimize algebraic loop occurrencesOption to try to eliminate artificial algebraic loops related to referenced model
Propagate all signal labels out of the modelOption to pass propagated signal names out of referenced model
Use local solver when referencing modelOption to use local solver for referenced model
Model dependenciesUser-created files and data that potentially impact simulation results
Perform consistency check on parallel poolOption to perform checks on parallel pool before starting parallel build
Include custom code for referenced modelsOption to use custom code in model reference simulation target
Pass fixed-size scalar root inputs by value for code generationOption to pass scalar input to model by reference or value
Model block version mismatchDiagnostic action to take when Model block does not represent current version of referenced model
Port and parameter mismatchDiagnostic action to take when port or parameter does not match between Model block and referenced model
Invalid root Inport/Outport block connectionDiagnostic action to take for invalid internal connections to root-level output port blocks
Unsupported data loggingDiagnostic action to take when data logging is unsupported
No explicit final value for model argumentsDiagnostic action to take for model argument with default value at top-level model reference


Model Reference Conversion AdvisorConvert subsystems to referenced models
Referenced Files PaneView, save, and close referenced subsystems and models


Determine When to Reference Models

Create Model References

Configure Model References

Simulate Model Hierarchies