Use Local Solvers in Referenced Models
When you use referenced models to represent system components, you can configure each referenced model to use a local solver. When you use a local solver in a referenced model, the software solves the model reference as a separate set of differential equations using the local solver. The referenced model can use a solver that is the same or different from the solver used in the top model. Whether the local solver is the same or different, the local solver can use a different, smaller (since R2024a) or larger step size.
Using a local solver can facilitate system composition and integration. When you use local solvers, you can solve referenced models in system-level simulations using the same solver and step size used to design and test each model in isolation. Using local solvers can also reduce the number of configuration adjustments you need to make to configuration parameters in referenced models while integrating the model into a larger system.
For some systems, using a local solver can improve simulation performance by allowing you to:
Choose a solver that is more appropriate to solve the system in the referenced model
Use different step sizes for different components to reduce the number of redundant calculations in systems that have a wide range of dynamics among components.
The choice of solver and solver settings involves a trade off between speed and accuracy in simulation. When you use local solvers, you can make different choices based on the requirements for each component.
For an example about using a local solver, see Improve Simulation Performance by Using Local Solvers.
How Local Solvers Work
In a typical simulation that uses only one solver, the simulation loop executes in three phases for each major time step: output, update, and advance. In each phase, each block in the model executes the block method that corresponds to the phase according to the execution order.
Output — Calculates block output values
Update — Typically calculates discrete state values
Advance — Calculates continuous state values and determines the next major time step based on the solver selection, the solver parameter values, and the system dynamics
When you use a local solver, the local solver computes state values for the referenced model during the update method for the referenced model. As part of the update method, the local solver performs a local advance for the model reference to calculate the next local time step. Because the local solver advance occurs before the system-level advance phase, the local solver execution gets ahead of the execution for the top model. When the local advance phase uses values that come from the parent model, the local solver extrapolates those values to the local time.
The top solver advance phase and the output phase for the next time step both occur between each local advance. In the top solver advance and output phases, the top solver might use values that are calculated by the local solver. Because the local solver is ahead of the top solver, the local solver provides interpolated values to the top solver.
Because using a local solver involves interpolation and extrapolation, simulation results might not match between equivalent simulations of the same model with and without the use of the local solver.
How to Configure Local Solvers
Configure the settings for a local solver using a combination of the configuration parameters for the referenced model and the block parameters for each Model block that references the model. The configuration parameter values in the referenced model have the same value for every instance of that model. You can configure the Model block parameter values differently for each model reference instance.
Configure these options using the configuration parameters of the referenced model:
Use local solver when referencing model — Select this parameter to use a local solver for the model when referenced in a model hierarchy.
When you select this parameter, the Solver parameter value and related parameter values for the referenced model apply to the local solver.
Type — Select
Variable-step
(since R2025a) orFixed-step
.Solver — Select
auto
to have the software choose a solver, or select a solver other than the discrete solver, which is not supported as a local solver.Solver details — Configure the local solver details, such as step size.
For a list of the related configuration parameters, see Variable-Step Solver Details or Fixed-Step Solver Details.
Zero-crossing options — Configure zero-crossing detection for the local solver. (since R2025a)
For a list of the related configuration parameters, see Variable-Step Zero-Crossing Detection or Fixed-Step Zero-Crossing Detection.
Configure these options using the Model block parameters:
Communication step size — The discrete rate at which the Model block executes in the parent model (since R2024a)
Input signal handling — How the local solver extrapolates inputs from the parent model during the local advance stage
Output signal handling — How the parent solver interpolates required values from the model reference during the parent advance phase
Additional Considerations for Local Solvers
You must determine whether a local solver provides benefit based on the dynamics and characteristics of your system. When evaluating where a local solver might provide benefit, look for model components that:
Operate with time constants one or more orders of magnitude larger than other parts of the system
Have continuous states that are decoupled from the rest of the system
Local solvers for referenced models operate on continuous states in the referenced model. Because using a local solver for a referenced model with only discrete states has no effect on simulation results, local solvers are not supported for models that do not contain continuous states. When a model contains no continuous states, the software always uses the discrete solver. The fixed-step discrete solver is not supported as a local solver.
Model hierarchies that contain one or more referenced models configured to use a local solver do not support:
Multitasking execution
Linearization
Code generation
Model hierarchies that contain one or more referenced models configured to use a local solver support these capabilities for only normal mode simulations:
Saving or restoring a model operating point (since R2025a)
Fast restart (since R2025a)
Referenced models configured to use a local solver do not support software-in-the-loop (SIL) or processor-in-the-loop (PIL) simulation.
Local solvers are not supported for referenced models that directly or indirectly reference another model that has both continuous and discrete sample times, except when the model with continuous and discrete sample times:
Also uses a local solver
Directly or indirectly references another model that uses a local solver
Local solvers are not supported for models referenced by Model blocks:
Inside for-each subsystems
With initialize, reset, or terminate ports
That have variable-size signals at the model interface
When the top solver or a parent solver is implicit, the Solver Jacobian Method configuration parameter value for the top or
parent model must be the default value auto
or
Full perturbation
.