Documentation

Set Configuration Parameters for Model Referencing

A referenced model uses a configuration set in the same way that any other model does, as described inManage a Configuration Set. By default, every model in a hierarchy has its own configuration set. Each model uses its configuration set the same way that it would if the model executed independently.

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 referencing. 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. SeeDiagnostics That Are Ignored in Accelerator Modefor 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

Manually eliminating all configuration parameter incompatibilities can be tedious when:

  • A model reference hierarchy contains many referenced models that have incompatible parameter values

  • A changed parameter value must propagate to many referenced models

You can control or eliminate such overhead by using configuration references to assign an externally stored configuration set to multiple models. SeeManage a Configuration Referencefor details.

Configuration Requirements for All Referenced Model Simulation

Some configuration parameter options can cause problems if set:

  • In certain ways, as indicated in the tables

  • Differently in a referenced model than in a parent model

Where possible, Simulink resolves violations of these requirements automatically, but most cases require changes to the parameters in some or all models.

Dialog Box Pane Option Requirement
Solver Start time The start time of the top model and all referenced models must be the same, but need not be zero.
Stop time Simulink usesStop timeof the top model for simulation, overriding any differingStop timein a referenced model.
Type
Solver
TheTypeandSolverof the top model apply throughout the hierarchy. SeeSolver Settings.
Data Import/Export Initial state Can beonfor the top model, but must beofffor a referenced model.

Math and Data Types

Default parameter behavior If the parent model has this option set toInlined, then the referenced model cannot be set toTunable.

Application lifespan (days)

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

Model Referencing Total number of instances allowed per top model Must not beZeroin a referenced model. SpecifyingOnerather thanMultipleis preferable or required sometimes. SeeNumber of Model Instances Setting.

Solver Settings

Model referencing works with both fixed-step and variable-step solvers. All models in a model reference 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 Type Referenced Model Solver Type Compatibility
Fixed step Fixed step Allowed
Variable step Variable Step Allowed
Variable step Fixed step Allowed unless the referenced model is multirate and specifies both a discrete sample time and a continuous sample time
Fixed Step Variable step Error

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, seeSolversandSolver Types.

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. TheConfiguration Parameters>Model Referencing>Total number of instances allowed per top modelparameter provides this specification. SeeTotal number of instances allowed per top modelfor more information. 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 reference 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 reference. An error occurs if the model cannot be multiply referenced, even if only one reference exists.

SettingTotal number of instances allowed per top modeltoMultiple引用了一个模型,只有一次可以增加e execution efficiency slightly. However, this setting does not affect data values that result from simulation or from executing codeSimulink Coder™generates. SpecifyingMultiplewhen 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 settingTotal number of instances allowed per top modeltoOne. For details, seeSpecify Reusability of Referenced Models.

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 thanNone:

  • Array bounds exceeded(ArrayBoundsChecking)

  • Inf or NaN block output(SignalInfNanChecking)

  • Simulation range checking(SignalRangeChecking)

  • Division by singular matrix(CheckMatrixSingularityMsg)

  • Wrap on overflow(IntegerOverflowMsg)

也为模型,引用在加速器模式下,Simulink ignores theseConfiguration Parameters>Diagnostics>Data Validity>Data Store Memory blockparameters if you set them to a value other thanDisable all. For details, seeData Store Diagnostics.

  • Detect read before write(ReadBeforeWriteMsg)

  • Detect write after read(WriteAfterReadMsg)

  • Detect write after write(WriteAfterWriteMsg)

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

  1. In the Simulink Editor, selectAnalysis>Model Advisor.

  2. SelectBy Task.

  3. Run theCheck diagnostic settings ignored during accelerated model reference simulationcheck.

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.

Accelerated Simulation and Code Generation Changes Settings

Note

Configuration parameters on theCode Generationpane of the Configuration Parameters dialog box do not affect simulation in either normal or accelerator mode.Code Generationparameters affect only code generation bySimulink Coderitself. Accelerated mode simulation requires code generation to create a simulation target. Simulink uses default values for allCode Generationparameters when generating the target, and restores the original parameter values after code generation is complete.

During model referencing simulation in accelerator and rapid accelerator mode, Simulink temporarily sets severalConfiguration Parameters>Diagnostics>Data Validityparameter settings toNone, if they are set toWarningorError. You can use the Model Advisor to check for parameters that change. For details, seeDiagnostic Configuration Parameters Ignored in Accelerator Mode.

If theConfiguration Parameters>Code Generation>Symbolsparameters hold identifier information about the name of a referenced model and do not use a$Rtoken, code generation prepends the$Rtoken to the name of the model. You can use the Model Advisor to check for changed model names. See .

Was this topic helpful?