Purpose of “Total number of instances possible for each top-level model”

10 views (last 30 days)
When using a child model containing a Scope block inside a parent model via Model Reference,
and simulating the parent model versus linearizing it with linmod,
an error occurs unless the “Total number of instances allowed per top model” configuration parameter is changed.
What is the purpose of this parameter?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 18 Jun 2025
The “Total number of instances allowed per top model” parameter defines the maximum number of simultaneous instances
of a referenced model that can be used per top model.
Its purposes include:
  • Controlling memory usage
  • Preventing unintended behavior from blocks that hold state, such as Scope blocks or stateful computations
If set to 1, the referenced model can only be instantiated once at a time.
In your case, one instance is created by the parent model, and another is invoked during linmod,
requiring two instances, thus exceeding the limit and causing an error.
Therefore, the parameter should be adjusted based on use case:
  • For simulation only: 1 is sufficient
  • For analysis (e.g., linmod) included: set to 2 or more

More Answers (0)

Categories

Find more on Large-Scale Modeling in Help Center and File Exchange

Tags

No tags entered yet.

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!