| Using Simulink | ![]() |
The Model Referencing pane allows you to specify options for including other models in this model and this model in other models and for building simulation and code generation targets.
| Note The option descriptions use the term this model to refer to the model that you are configuring and the term referenced model to designate models referenced by this model. |
The pane includes controls for specifying options for
Rebuild options for all referenced models
This group allows you to specify rebuild options for models directly or indirectly referenced by this model. It includes the following controls.
Rebuild targets. This control specifies whether to rebuild simulation and Real-Time Workshop targets for referenced models before updating, simulating, or generating code from this model. This includes models indirectly referenced by this model. The options, in order from safe and slow to fast and risky, are
Always rebuild all targets referenced by this model before simulating, updating, or generating code from it.
Rebuild the target for a referenced model if Simulink detects any changes of any kind in the target's dependencies. The dependencies include
This also checks for changes in the compiled form of the referenced model. Checking the compiled model can detect some changes that occur even in dependencies that you do not specify.
Rebuild a target if Simulink detects any changes in known target dependencies (see above) since the target was last built. This option ignores cosmetic changes, such as annotation changes, in the referenced model and in any block library dependencies, thus preventing unnecessary rebuilds. However, before selecting it, you should be certain that you have specified every user-created dependency (e.g., M-files or MAT-files) for this model to ensure that all targets that need to be rebuilt are rebuilt. Otherwise, invalid simulation results may occur.
Note that this option cannot detect changes in unspecified dependencies, such as M-files used to initialize block masks. If you suspect that a model has such unknown dependencies, you can still guarantee valid simulation by selecting the Always rebuild targets or the If any changes detected option.
Never rebuild targets before simulating or generating code from this model. If you are certain that your targets are up-to-date, you can use this option to avoid time-consuming target dependency checking when simulating, updating, or generating code from a model. Use this option with caution because it may lead to invalid results if referenced model targets are not in fact up-to-date.
Note
It is a good idea to use the Always rebuild targets option before deployment of a model to assure that all the model reference targets are up-to-date.
|
Never rebuild targets diagnostic. This control appears only if you select the Never rebuild targets option. It allows you to specify the diagnostic action that Simulink should take if it detects a target that needs to be rebuilt. The options are
Selecting None bypasses dependency checking, and thus enables faster updating, simulation, and code generation, but can cause models that are not up-to-date to malfunction or generate incorrect results.
Options for referencing this model
This group of controls specifies options for including this model in other models. It includes the following controls.
Total number of instances allowed per top model. This option allows you to specify how many references to this model (i.e., the model you are configuring) can safely occur in another model. The options are
If you specify None, and a reference to this model occurs in another model (including its model references), Simulink displays an error when you try to simulate or update the root model. Simulink similarly displays an error, if you specify One and multiple references to this model occur in a root model (including its model references). If you specify multiple and Simulink determines that for some reason this model cannot be multiply referenced, Simulink displays an error when the model that references it is compiled or simulated. This occurs even if the model is referenced only once.
Model dependencies. Specifies files on which this model relies. They are typically MAT-files and M-files used to initialize parameters and to provide data.
Specify the dependencies as a cell array of strings, where each cell array entry is the filename or path of a dependent file. These filenames may include spaces and must include file extensions (e.g.,.m,.mat, etc.).
Prefix the token $MDL to a dependency to indicate that the path to the dependency is relative to the location of this model file.
If Simulink cannot find a specified dependent file when you update or simulate a model that references this model, Simulink displays a warning.
Pass scalar root inputs by value. Checking this option causes a model that calls (i.e., references) this model to pass this model's scalar inputs by value. Otherwise, the calling model passes the inputs by reference, i.e., it passes the addresses of the inputs rather than the input values.
Passing roots by value allows this model to read its scalar inputs from register or local memory which is faster than reading the inputs from their original locations. However, this option can lead to incorrect results if the model's root scalar inputs can change within a time step. This can happen, for instance, if this model's inputs and outputs share memory locations (e.g., as a result of a feedback loop) and the model is invoked multiple times in a time step (i.e., by a Function-Call Subsystem). In such cases, this model sees scalar input changes that occur in the same time step only if the inputs are passed by reference. That is why this option is off by default. If you are certain that this model is not referenced in contexts where its inputs can change within a time step, select this option to generate more efficient code for this model.
| Note Selecting this option can affect reuse of code generated for subsystems. See the Real-Time Workshop documentation for more information. |
Minimize algebraic loop occurrences. Checking this option causes Simulink to try to eliminate algebraic loops involving this model from models that reference it. Enabling this option disables conditional input branch optimization for simulation and the Real-Time Workshop single update/output function optimization for code generation. See Eliminating Algebraic Loops for more information.
| Hardware Implementation Pane | Diagnosing Simulation Errors | ![]() |
© 1994-2005 The MathWorks, Inc.