Select the method to determine when to rebuild simulation and Simulink® Coder™ targets for referenced models before updating, simulating, or generating code from the model.
Category: Model Referencing
If any changes detected
Always rebuild targets for referenced models. This setting requires the most processing time because it can trigger unnecessary builds. To make all model reference targets up to date, use this setting before you deploy a model.
If any changes detected
Conditionally rebuild targets for referenced models when Simulink detects a change that could affect simulation results. To perform extensive change detection on dependencies of referenced models, use this setting.
If Simulink finds no changes in known dependencies, it computes the structural checksum of the model. The structural checksum detects changes that occur in user-created dependencies that are not specified using the Model dependencies configuration parameter. If the structural checksum has changed, Simulink rebuilds the model reference target.
If any changes in known dependencies detected
Conditionally rebuild targets for referenced models when Simulink detects a change that could affect simulation results. To reduce the time required for change detection, use this setting.
If Simulink finds no changes in known or potential dependencies, it does not compute the structural checksum of the model and does not rebuild the model reference target. To avoid invalid simulation results, you must list all user-created dependencies in the Model dependencies parameter.
Do not rebuild targets for referenced models. This setting requires the least processing time and, when available, uses Simulink cache files for faster simulations. To avoid rebuilds when developing a model, use this setting.
If model reference targets are out of date, the simulation may present invalid results. To have Simulink check for changes in known target dependencies and report if the model reference targets may be out of date, use the Never rebuild diagnostic parameter. To manually rebuild model reference targets, use the
For information on using and sharing Simulink cache files, see Share Simulink Cache Files for Faster Simulation.
- Known target dependencies
Known target dependencies are files and data external to model files that Simulink examines for changes when checking if a model reference target is up to date. Simulink automatically computes a set of known target dependencies. Examples of known target dependencies are:
Changes to the model workspace, if its data source is a MAT-file or MATLAB® file
Enumerated type definitions
User-written S-functions and their TLC files
Files specified in the Model dependencies parameter
External files used by Stateflow®, a MATLAB Function block, or a MATLAB System block
Dataflow subsystems – Analysis of dataflow subsystems requires that the simulation target rebuilds to profile and rebuilds again to partition the subsystem. In addition, the simulation target must rebuild if the machine running the simulation has fewer cores than the subsystem is partitioned to use, for example, if the simulation target was last built on a machine with a greater number of cores. For more information, see Simulation of Dataflow Domains (DSP System Toolbox).
- Potential target dependencies
Potential target dependencies are files and data external to model files and model configuration settings that Simulink examines for changes when checking if a model reference target is up to date. Simulink automatically computes a set of potential target dependencies. Examples of potential target dependencies are:
Changes to global variables
Changes to targets of models referenced by this model
The Configuration Parameters > Diagnostics > Data Validity > Signal resolution parameter when set to either
Explicit and implicitor
Explicit and warn implicit
Simulink examines each potential target dependency to determine whether its state triggers a structural checksum check.
- User-created dependencies
User-created dependencies are files that Simulink does not automatically identify, in spite of their potential impact on simulation results. Examples of user-created dependencies are:
MATLAB files that contain code executed by callbacks
MAT-files that contain definitions for variables used by the model that are loaded as part of a customized initialization script
You can add user-created dependencies to the set of known target dependencies by using the Model dependencies parameter.
- Structural checksum
A structural checksum is a computation used to detect changes in the model that can affect simulation results. When Simulink computes the structural checksum, it loads and compiles the model. To compile the model, Simulink must execute callbacks and access all variables that the model uses. The structural checksum detects changes in user-created dependencies, regardless of whether you have specified those user-created dependencies in the Model dependencies parameter.
For more information about the kinds of changes that affect the structural checksum, see
Models in a model hierarchy can have different rebuild settings. When you update, simulate, or generate code for a model, the rebuild setting for that model applies to all its referenced models.
Models that execute in normal mode do not generate simulation targets and are unaffected by Rebuild settings.
To improve rebuild detection speed and accuracy, use the Model dependencies configuration parameter to specify user-created dependencies.
This flow chart describes the processing Simulink performs when you set Rebuild to either
If any changes detectedor
If any changes in known dependencies detected.
This example explains the difference between the
If any changes detectedand
If any changes in known dependencies detectedsettings.
If you change a MATLAB file that is executed as part of a callback script that you have not listed in the Model dependencies parameter:
If any changes detectedcauses a rebuild because the change affects the structural checksum of the model.
If any changes in known dependencies detecteddoes not cause a rebuild because no known target dependency has changed.
Never enables the Never rebuild diagnostic parameter.
|Equivalent Rebuild Value|
If you use the
Starting in R2019b,
If any changes detected ignores
cosmetic changes, such as repositioning a block.