Set Configuration Parameters for Model Hierarchies

A referenced model uses a configuration set the same way that it would if the model executed independently. By default, every model in a hierarchy has its own configuration set. When you open a referenced model in the context of a model hierarchy, access its configuration parameters by clicking the Model Settings button arrow, then selecting Model Settings under Referenced Model.

Because each model can have its own configuration set, configuration parameter values can be different in different models. Furthermore, some parameter values are intrinsically incompatible with model references. The Simulink® response to an inconsistent or unusable configuration parameter depends on the parameter:

  • Where an inconsistency has no significance, or a trivial resolution without risk exists, Simulink ignores or resolves the inconsistency without posting a warning.

  • Where a nontrivial and possibly acceptable solution exists, Simulink resolves the conflict silently, resolves it with a warning, or generates an error. See Diagnostics That Are Ignored in Accelerator Mode for details.

  • Where no acceptable resolution is possible, Simulink generates an error. Change some or all parameter values to eliminate the problem.

Manage Configuration Parameters by Using Configuration References

To assign an externally stored configuration set to multiple models, you can use configuration references. Configuration references help you eliminate configuration parameter incompatibilities.

You can propagate the configuration reference of a top model to an individual referenced model or to all referenced models in the model hierarchy. For an example, see Share a Configuration Across Referenced Models.

Configuration Requirements for All Referenced Model Simulation

Some configuration parameter options can cause incompatibilities in model hierarchies. Where possible, Simulink resolves violations of these requirements automatically, but most cases require changes to the parameters in some or all models.

Dialog Box PaneOptionRequirement
SolverStart time

The compiled start time of the top model and all referenced models must be the same.

The compiled start time is the first simulation step after the specified start time. Simulation steps are increments of the fastest discrete rate in the model, beginning from zero.

Stop timeSimulink uses the Stop time of the top model for simulation, overriding any differing Stop time in a referenced model.
TypeThe Type and Solver of the top model apply throughout the hierarchy. See Solver Settings.
Solver
Data Import/ExportInitial stateCan be selected for the top model, but must be cleared for a referenced model.

Math and Data Types

Application lifespan (days)

For code generation, the setting must be the same for the parent and referenced models.

For simulation, the setting can be different for the parent and referenced models.

Model ReferencingTotal number of instances allowed per top modelMust not be Zero in a referenced model. Specifying One rather than Multiple is preferable or required sometimes. See Number of Model Instances Setting.
Code Generation > OptimizationDefault parameter behaviorIf the parent model has this option set to Inlined, then the referenced model cannot be set to Tunable.

Solver Settings

Model referencing works with both fixed-step and variable-step solvers. All models in a model hierarchy use the same solver, which is always the solver specified by the top model. An error occurs if the solver type specified by the top model is incompatible with the solver type specified by any referenced model.

Top Model Solver TypeReferenced Model Solver TypeCompatibility
Fixed-stepFixed-stepAllowed
Variable-stepVariable-stepAllowed
Variable-stepFixed-stepAllowed unless the referenced model is multirate and specifies both a discrete sample time and a continuous sample time
Fixed-stepVariable-stepError

If an incompatibility exists between the top model solver and any referenced model solver, one or both models must change to use compatible solvers. For information about solvers, see Compare Solvers and Solver Selection Criteria.

Number of Model Instances Setting

A referenced model must specify that it is available to be referenced, and whether it can be referenced at most once or can have multiple instances. The Total number of instances allowed per top model parameter provides this specification. The possible values for this parameter are:

  • Zero — A model cannot reference this model. An error occurs if a reference to the model occurs in another model.

  • One — A model hierarchy can reference the model at most once. An error occurs if more than one instance of the model exists. This value is sometimes preferable or required.

  • Multiple — A model hierarchy can reference the model more than once, if it contains no constructs that preclude multiple references. An error occurs if the model cannot be referenced multiple times, even if only one reference exists.

Setting Total number of instances allowed per top model to Multiple for a model that is referenced only once can reduce execution efficiency slightly. However, this setting does not affect data values that result from simulation or from executing code Simulink Coder™ generates. Specifying Multiple when only one model instance exists avoids having to change or rebuild the model when reusing the model:

  • In the same hierarchy

  • Multiple times in a different hierarchy

Some model properties and constructs require setting Total number of instances allowed per top model to One. For details, see Model Reuse.

Diagnostics That Are Ignored in Accelerator Mode

For models referenced in accelerator mode, Simulink ignores the values of these configuration parameter settings if you set them to a value other than None:

  • Array bounds exceeded (ArrayBoundsChecking)

  • Inf or NaN block output (SignalInfNanChecking)

  • Simulation range checking (SignalRangeChecking)

  • Division by singular matrix (CheckMatrixSingularityMsg)

  • Wrap on overflow (IntegerOverflowMsg)

Also, for models referenced in accelerator mode, Simulink ignores these Configuration Parameters > Diagnostics > Data Validity > Data Store Memory block parameters if you set them to a value other than Disable all. For details, see Data Store Diagnostics.

  • Detect read before write (ReadBeforeWriteMsg)

  • Detect write after read (WriteAfterReadMsg)

  • Detect write after write (WriteAfterWriteMsg)

During model reference simulation in accelerator mode, Simulink temporarily sets several Configuration Parameters > Diagnostics > Data Validity parameter settings to None, if they are set to Warning or Error. You can use the Model Advisor to check for parameters that change. For details, see Diagnostics That Are Ignored in Accelerator Mode.

You can use the Model Advisor to identify models referenced in accelerator mode for which Simulink ignores the configuration parameters listed above.

  1. On the Modeling tab, click Model Advisor.

  2. Select the top model, then click OK.

  3. Select By Task > Model Referencing > Check diagnostic settings ignored during accelerated model reference simulation.

  4. Click the Run This Check button.

To see the results of running the identified diagnostics with settings to produce warnings or errors, simulate the model in normal mode. Inspect the diagnostic warnings and then simulate in accelerator mode.

Note

Configuration parameters on the Code Generation pane of the Configuration Parameters dialog box do not affect simulation in either normal or accelerator mode. Code Generation parameters affect only code generation by Simulink Coder itself. Accelerator mode simulation requires code generation to create a simulation target. Simulink uses default values for all Code Generation parameters when generating the target, and restores the original parameter values after code generation is complete.

Related Topics