| Simulink® | ![]() |

Specify the simulation start and stop time, and the solver configuration for the simulation. Use the Solver pane to set up a solver for a model's active configuration set.
A solver computes a dynamic system's states at successive time steps over a specified time span, using information provided by the model.
Select a solver type from the Type list.
Select a solver from the Solver list.
Set the parameters displayed for the selected type and solver combination.
Apply the changes.
Simulation time is not the same as clock time. For example, running a simulation for 10 seconds usually does not take 10 seconds. Total simulation time depends on factors such as model complexity, solver step sizes, and computer speed.
Fixed-point solver type is required for code generation, unless you use an S-function or RSim target.
Variable-step solver type can significantly shorten the time required to simulate models in which states change rapidly or which contain discontinuities.
Specify the start time for the simulation or generated code as a double-precision value, scaled to seconds.
Default: 0.0
A start time other than 0.0 is an offset, and must be less than or equal to the stop time. An example of when you might use an offset is to set up a delay to accommodate some type of initialization.
The values of block parameters with initial conditions must match the initial condition settings at the specified start time.
Simulation time is not the same as clock time. For example, running a simulation for 10 seconds usually does not take 10 seconds. Total simulation time depends on factors such as model complexity, solver step sizes, and computer speed.
| Parameter: StartTime |
| Type: string |
| Value: any valid value |
| Default: '0.0' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | 0.0 |
Specify the stop time for the simulation or generated code as a double-precision value, scaled to seconds.
Default: 10
Stop time must be greater than or equal to the start time.
Specify inf to run a simulation or generated program until you explicitly pause or stop it.
If the stop time is the same as the start time, the simulation or generated program runs for one step.
Simulation time is not the same as clock time. For example, running a simulation for 10 seconds usually does not take 10 seconds. Total simulation time depends on factors such as model complexity, solver step sizes, and computer speed.
If your model includes blocks that depend on absolute time and you are creating a design that runs indefinitely, see Blocks That Depend on Absolute Time.
| Parameter: StopTime |
| Type: string |
| Value: any valid value |
| Default: '10.0' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | Any positive value |
Select the type of solver you want to use to simulate your model.
Default: Variable-step
Step size varies from step to step, depending on model dynamics. A variable-step solver:
Reduces step size when model states change rapidly, to maintain accuracy.
Increases step size when model states change slowly, to avoid unnecessary steps.
Variable-step is recommended for models in which states change rapidly or that contain discontinuities. In these cases, a variable-step solver requires fewer time steps than a fixed-step solver to achieve a comparable level of accuracy. This can significantly shorten simulation time.
Step size remains constant throughout the simulation.
Required for code generation, unless you use an S-function or RSim target.
Note The solver computes the next time as the sum of the current time and the step size. |
Selecting Variable-step enables the following parameters:
Solver
Max step size
Min step size
Initial step size
Relative tolerance
Absolute tolerance
Zero crossing control
Consecutive min step size violations allowed
Consecutive zero crossings relative tolerance
Number of consecutive zero crossings allowed
Selecting Fixed-step enables the following parameters:
Solver
Periodic sample time constraint
Fixed-step size (fundamental sample time)
Tasking mode for periodic sample times
Higher priority value indicates higher task priority
Automatically handle data transfers between tasks
| Parameter: SolverType |
| Type: string |
| Value: 'Variable-step' | 'Fixed-step' |
| Default: 'Variable-step' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | Fixed-step |
Select the solver you want to use to compute the model's states during simulation or code generation.
The available solvers change depending on which solver Type you selected:
Default: ode3 (Bogacki-Shampine)
Computes the model's state at the next time step as an explicit function of the current value of the state and the state derivatives, using the Bogacki-Shampine Formula integration technique to compute the state derivatives. In the following example, X is the state, DX is the state derivative, and h is the step size:
X(n+1) = X(n) + h * DX(n)
Computes the time of the next time step by adding a fixed step size to the current time.
Use this solver for models with no states or discrete states only, using a fixed step size. Relies on the model's blocks to update discrete states.
The accuracy and length of time of the resulting simulation depends on the size of the steps taken by the simulation: the smaller the step size, the more accurate the results but the longer the simulation takes.
Note The fixed-step discrete solver cannot be used to simulate models that have continuous states. |
Computes the model's state at the next time step as an explicit function of the current value of the state and the state derivatives, using the Dormand-Prince Formula integration technique to compute the state derivatives. In the following example, X is the state, DX is the state derivative, and h is the step size:
X(n+1) = X(n) + h * DX(n)
Computes the model's state at the next time step as an explicit function of the current value of the state and the state derivatives, using the Fourth-Order Runge-Kutta (RK4) Formula integration technique. In the following example, X is the state, DX is the state derivative, and h is the step size:
X(n+1) = X(n) + h * DX(n)
Computes the model's state at the next time step as an explicit function of the current value of the state and the state derivatives, using the Heun's Method integration technique. In the following example, X is the state, DX is the state derivative, and h is the step size:
X(n+1) = X(n) + h * DX(n)
Computes the model's state at the next time step as an explicit function of the current value of the state and the state derivatives, using the Euler's Method integration technique. In the following example, X is the state, DX is the state derivative, and h is the step size:
X(n+1) = X(n) + h * DX(n)
Computes the model's state at the next time step as an implicit function of the state and state derivative at the next time step, using a combination of Newton's method and extrapolation from the current value. In the following example, X is the state, DX is the state derivative, and h is the step size:
X(n+1) - X(n) - h * DX(n+1) = 0
This solver requires more computation per step than an explicit solver, but is more accurate for a given step size.
Default: ode45 (Dormand-Prince)
Computes the model's state at the next time step using an explicit Runge-Kutta (4,5) formula (the Dormand-Prince pair) for numerical integration.
ode45 is a one-step solver, needing only the solution to the preceding time point.
Use ode45 as a first try for most problems.
Computes the time of the next step by adding a step size that varies depending on the rate of change of the model's states.
Use this solver for models with no states or discrete states only, using a variable step size.
Computes the model's state at the next time step using an explicit Runge-Kutta (2,3) formula (the Bogacki-Shampine pair) for numerical integration.
ode23 is a one-step solver, needing only the solution to the preceding time point.
ode23 is more efficient than ode45 at crude tolerances and in the presence of mild stiffness.
Computes the model's state at the next time step using a variable-order Adams-Bashforth-Moulton PECE numerical integration technique.
ode113 is a multistep solver, generally needing the solutions at several preceding time points to compute the current solution.
ode113 can be more efficient than ode45 at stringent tolerances.
Computes the model's state at the next time step using variable-order numerical differentiation formulas (NDFs). These are related to but are more efficient than the backward differentiation formulas, BDFs (also known as Gear's method).
ode15s is a multistep solver, generally needing the solutions at several preceding time points to compute the current solution.
ode15s is efficient for stiff problems. Try this solver if ode45 fails or is inefficient.
Computes the model's state at the next time step using a modified Rosenbrock formula of order 2.
ode23s is a one-step solver, needing only the solution to the preceding time point.
ode23s is more efficient than ode15s at crude tolerances, and can solve stiff problems for which ode15s is ineffective.
Computes the model's state at the next time step using an implementation of the trapezoidal rule using a "free" interpolant.
ode23t is a one-step solver, needing only the solution to the preceding time point.
Use ode23t if the problem is only moderately stiff and you need a solution without numerical damping.
Computes the model's state at the next time step using a multistep implementation of TR-BDF2, an implicit Runge-Kutta formula with a trapezoidal rule first stage, and a second stage consisting of a backward differentiation formula of order two. By construction, the same iteration matrix is used in evaluating both stages.
ode23tb is more efficient than ode15s at crude tolerances, and can solve stiff problems for which ode15s is ineffective.
Identifying the optimal solver for a model requires experimentation, for an in-depth discussion, see Choosing a Solver.
The optimal solver balances acceptable accuracy with the shortest simulation time.
Simulink® software uses a discrete solver for any model with no states or discrete states only, even if you specify a continuous solver.
A smaller step size increases accuracy, but increases simulation time.
The degree of computational complexity increases for oden, as n increases.
As computational complexity increases, accuracy of results increases.
Selecting the ode1 (Euler) , ode2 (Huen), ode 3 (Bogacki-Shampine), ode4 (Runge-Kutta), ode 5 (Dormand-Prince), or discrete (no continuous states) fixed-step solvers enables the following parameters:
Periodic sample time constraint
Fixed-step size (fundamental sample time)
Tasking mode for periodic sample times
Higher priority value indicates higher task priority
Automatically handle data transfers between tasks
Selecting ode14x (extrapolation) enables the following parameters:
Periodic sample time constraint
Fixed-step size (fundamental sample time)
Extrapolation order
Number Newton's iterations
Tasking mode for periodic sample times
Higher priority value indicates higher task priority
Automatically handle data transfers between tasks
Selecting the discrete (no continuous states) variable-step solver enables the following parameters:
Max step size
Zero crossing control
Consecutive zero crossings relative tolerance
Number of consecutive zero crossings allowed
Selecting ode45 (Dormand-Prince), ode23 (Bogacki-Shampine), ode113 (Adams), or ode23s (stiff/Mod. Rosenbrock) enables the following parameters:
Max step size
Min step size
Initial step size
Relative tolerance
Absolute tolerance
Zero crossing control
Consecutive min step size violations allowed
Consecutive zero crossings relative tolerance
Number of consecutive zero crossings allowed
Selecting ode15s (stiff/NDF), ode23t (Mod. stiff/Trapezoidal), or ode23tb (stiff/TR-BDF2) enables the following parameters:
Max step size
Min step size
Initial step size
Relative tolerance
Absolute tolerance
Maximum order
Zero crossing control
Solver reset method
Consecutive min step size violations allowed
Consecutive zero crossings relative tolerance
Number of consecutive zero crossings allowed
| Parameter: Solver |
| Type: string |
| Value: 'VariableStepDiscrete' | 'ode45' | 'ode23' | 'ode113' | 'ode15s' | 'ode23s' | 'ode23t' | 'ode23tb' | 'FixedStepDiscrete' | 'ode5' | 'ode4' | 'ode3' | 'ode2' | 'ode1' | 'ode14x' |
| Default: 'ode45' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | discrete (no continuous states) |
Specify the largest time step that the solver can take.
Default: auto
For the discrete solver, the default value (auto) is the model's shortest sample time.
For continuous solvers, the default value (auto) is determined from the start and stop times. If the stop time equals the start time or is inf, Simulink software chooses 0.2 seconds as the maximum step size. Otherwise, it sets the maximum step size to
![]()
Generally, the default maximum step size is sufficient. If you are concerned about the solver's missing significant behavior, change the parameter to prevent the solver from taking too large a step.
If the time span of the simulation is very long, the default step size might be too large for the solver to find the solution.
If your model contains periodic or nearly periodic behavior and you know the period, set the maximum step size to some fraction (such as 1/4) of that period.
In general, for more output points, change the refine factor, not the maximum step size. For more information, see Specifying Output Options.
This parameter is enabled only if the solver Type is set to Variable-step.
| Parameter: MaxStep |
| Type: string |
| Value: any valid value |
| Default: 'auto' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
Specify the size of the first time step that the solver takes.
Default: auto
By default, the solver selects an initial step size by examining the derivatives of the states at the start time.
Be careful when increasing the initial step size. If the first step size is too large, the solver might step over important behavior.
The initial step size parameter is a suggested first step size. The solver tries this step size but reduces it if error criteria are not satisfied.
This parameter is enabled only if the solver Type is set to Variable-step.
| Parameter: InitialStep |
| Type: string |
| Value: any valid value |
| Default: 'auto' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
Specify the smallest time step that the solver can take.
Default: auto
The default value (auto) sets a minimum step size on the order of machine precision and an unlimited number of warnings.
You can specify either a real number greater than zero, or a two-element vector where the first element is the minimum step size and the second element is the maximum number of minimum step size warnings before issuing an error.
If the solver takes a smaller step to meet error tolerances, it issues a warning indicating the current effective relative tolerance.
Setting the second element to zero results in an error the first time the solver must take a step smaller than the specified minimum. This is equivalent to changing the Min step size violation diagnostic to error on the Diagnostics pane (see Min step size violation).
Setting the second element to -1 results in an unlimited number of warnings. This is also the default if the input is a scalar.
This parameter is enabled only if the solver Type is set to Variable-step.
| Parameter: MinStep |
| Type: string |
| Value: any valid value |
| Default: 'auto' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
Specify the largest acceptable solver error, relative to the size of each state during each time step. If the relative error exceeds this tolerance, the solver reduces the time step.
Default: 1e-3
The relative tolerance is a percentage of the state's value.
The default value (1e-3) means that the computed state is accurate to within 0.1%.
The acceptable error at each time step is a function of both Relative tolerance and Absolute tolerance. For more information about how these settings work together, see Specifying Variable-Step Solver Error Tolerances.
During each time step, the solver computes the state values at the end of the step and also determine the local error, the estimated error of these state values. If the error is greater than the acceptable error for any state, the solver reduces the step size and tries again.
The default relative tolerance value is sufficient for most applications. Decreasing the relative tolerance value can slow down the simulation.
To check the accuracy of a simulation after you run it, you can reduce the relative tolerance to 1e-4 and run it again. If the results of the two simulations are not significantly different, you can feel confident that the solution has converged.
This parameter is enabled only if you set:
Solver Type to Variable-step.
Solver to a continuous variable step solver.
This parameter works along with Absolute tolerance to determine the acceptable error at each time step. For more information about how these settings work together, see Specifying Variable-Step Solver Error Tolerances.
| Parameter: RelTol |
| Type: string |
| Value: any valid value |
| Default: '1e-3' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
Specify the largest acceptable solver error, as the value of the measured state approaches zero. If the absolute error exceeds this tolerance, the solver reduces the time step.
Default: auto
The default value (auto) initially sets the absolute tolerance for each state to 1e-6. As the simulation progresses, the absolute tolerance for each state is reset to the maximum value that the state has assumed thus far, times the relative tolerance for that state.
For example, if a state goes from 0 to 1 and the Relative tolerance is 1e-3, then by the end of the simulation the Absolute tolerance is set to 1e-3.
If the computed setting is not suitable, you can determine an appropriate setting yourself.
The acceptable error at each time step is a function of both Relative tolerance and Absolute tolerance. For more information about how these settings work together, see Specifying Variable-Step Solver Error Tolerances.
The Integrator, Transfer Fcn, State-Space, and Zero-Pole blocks allow you to specify absolute tolerance values for solving the model states that they compute or that determine their output. The absolute tolerance values that you specify in these blocks override the global setting in the Configuration Parameters dialog box.
You might want to override the Absolute tolerance setting using blocks if the global setting does not provide sufficient error control for all of your model's states, such as if they vary widely in magnitude.
If you set the Absolute tolerance too low, the solver may take too many steps around near-zero state values, slowing down the simulation.
To check the accuracy of a simulation after you run it, you can reduce the absolute tolerance and run it again. If the results of the two simulations are not significantly different, you can feel confident that the solution has converged.
If your simulation results do not seem accurate, and your model has states whose values approach zero, the Absolute tolerance may be too large. Reduce the Absolute tolerance to force the simulation to take more steps around areas of near-zero state values.
This parameter is enabled only if you set:
Solver Type to Variable-step.
Solver to a continuous variable step solver.
This parameter works along with Relative tolerance to determine the acceptable error at each time step. For more information about how these settings work together, see Specifying Variable-Step Solver Error Tolerances.
| Parameter: AbsTol |
| Type: string |
| Value: any valid value |
| Default: 'auto' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
Select the order of the numerical differentiation formulas (NDFs) used in the ode15s solver.
Default: 5
Specifies that the solver use fifth order NDFs.
Specifies that the solver use first order NDFs.
Specifies that the solver use second order NDFs.
Specifies that the solver use third order NDFs.
Specifies that the solver use fourth order NDFs.
Although the higher order formulas are more accurate, they are less stable.
If your model is stiff and requires more stability, reduce the maximum order to 2 (the highest order for which the NDF formula is A-stable).
As an alternative, you can try using the ode23s solver, which is a lower order (and A-stable) solver.
This parameter is enabled only if Solver is set to ode15s.
| Parameter: MaxOrder |
| Type: integer |
| Value: 1 | 2 | 3 | 4 | 5 |
| Default: 5 |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
Select how the solver behaves during a reset, such as when it detects a zero crossing.
Default: Fast
Specifies that the solver not recompute the Jacobian matrix at a solver reset.
Specifies that the solver recompute the Jacobian matrix needed by the integration step at every solver reset.
Selecting Fast speeds up the simulation. However, it can result in incorrect solutions in some cases.
If you suspect that the simulation is giving incorrect results, try the Robust setting. If there is no difference in simulation results between the fast and robust settings, revert to the fast setting.
This parameter is enabled only if you select one of the following solvers:
ode15s (Stiff/NDF)
ode23t (Mod. Stiff/Trapezoidal)
ode23tb (Stiff/TR-BDF2)
| Parameter: SolverResetMethod |
| Type: string |
| Value: 'Fast' | 'Robust' |
| Default: 'Fast' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
Specify the maximum number of consecutive minimum step size violations allowed during simulation.
Default: 1
A minimum step size violation occurs when a variable-step continuous solver takes a smaller step than that specified by the Min step size property (see Min step size).
Simulink software counts the number of consecutive violations that it detects. If the count exceeds the value of Consecutive min step size violations allowed, Simulink software displays either a warning or error message as specified by the Min step size violation diagnostic (see Min step size violation).
This parameter is enabled only if you set:
Solver Type to Variable-step.
Solver to a continuous variable step solver.
| Parameter: MaxConsecutiveMinStep |
| Type: string |
| Value: any valid value |
| Default: '1' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
At each time step use derivative information to improve integration accuracy.
Default: Disable all
Do not perform states shape preservation on any signals
Perform states shape preservation on all signals.
The default setting (Disable all) usually provides good accuracy for most models.
Setting to Enable all will increase accuracy in those models having signals who's derivative exhibits a high rate of change, but simulation time may be increased.
This parameter is enabled only if a continuous step solver is used.
| Parameter: ShapePreserveControl |
| Type: string |
| Value: 'EnableAll' | 'DisableAll' |
| Default: 'DisableAll' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
Select how blocks with periodic sample times execute.
Default: Auto
Specifies that single-tasking execution is used if:
Your model contains one sample time.
Your model contains a continuous and a discrete sample time, and the fixed-step size is equal to the discrete sample time.
Selects multitasking execution for models operating at different sample rates.
Specifies that all blocks are processed through each stage of simulation (for example, calculating output and updating discrete states) together.
Specifies that groups of blocks with the same execution priority are processed through each stage of simulation (for example, calculating output and updating discrete states) based on task priority. Multitasking mode helps to create valid models of real-world multitasking systems, where sections of your model represent concurrent tasks.
The Multitask rate transition parameter on the Diagnostics > Sample Time pane allows you to adjust error checking for sample rate transitions between blocks that operate at different sample rates.
This parameter is enabled by selecting Fixed-step solver type.
| Parameter: SolverMode |
| Type: string |
| Value: 'Auto' | 'SingleTasking' | 'MultiTasking' |
| Default: 'Auto' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
Specify whether Simulink software automatically inserts hidden Rate Transition blocks between blocks that have different sample rates to ensure the integrity of data transfers between tasks and optionally ensure determinism of data transfers for periodic tasks.
Default: Off
Inserts hidden Rate Transition blocks between blocks when rate transitions are detected. Handles rate transitions for asynchronous and periodic tasks. Simulink software adds the hidden blocks configured to ensure data integrity for data transfers. Selecting this option also enables the parameter Deterministic data transfer, which allows you to control the level of data transfer determinism for periodic tasks.
Does not insert hidden Rate Transition blocks when rate transitions are detected. If Simulink software detects invalid transitions, you must adjust the model such that the sample rates for the blocks in question match or manually add a Rate Transition block.
See Rate Transition Block Options in the Real-Time Workshop® documentation for further details.
Selecting this parameter allows you to handle rate transition issues automatically. This saves you from having to manually insert Rate Transition blocks to avoid invalid rate transitions, including invalid asynchronous-to-periodic and asynchronous-to-asynchronous rate transitions, in multirate models.
For asynchronous tasks, Simulink software configures the inserted blocks to ensure data integrity but not determinism during data transfers.
| Parameter: AutoInsertRateTranBlk |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'off' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | Off |
Control whether the Rate Transition block parameter Ensure deterministic data transfer (maximum delay) is set for auto-inserted Rate Transition blocks
Default: Whenever possible
Specifies that the block parameter Ensure deterministic data transfer (maximum delay) is always set for auto-inserted Rate Transition blocks.
If Always is selected and a model needs to auto-insert a Rate Transition block to handle a rate transition that is not between two periodic sample-times related by an integer multiple, Simulink errors out.
Specifies that the block parameter Ensure deterministic data transfer (maximum delay) is set for auto-inserted Rate Transition blocks whenever possible. If an auto-inserted Rate Transition block handles data transfer between two periodic sample-times that are related by an integer multiple, Ensure deterministic data transfer (maximum delay) is set; otherwise, it is cleared.
Specifies that the block parameter Ensure deterministic data transfer (maximum delay) is never set for auto-inserted Rate Transition blocks.
Note Clearing the Rate Transition block parameter Ensure deterministic data transfer (maximum delay) can provide reduced latency for models that do not require determinism. See the description of Ensure deterministic data transfer (maximum delay) on the Rate Transition block reference page for more information. |
This parameter is enabled only if Automatically handle rate transition for data transfer is checked.
| Parameter: InsertRTBMode |
| Type: string |
| Value: 'Always' | 'Whenever possible'| 'Never (minimum delay)' |
| Default: 'Whenever possible' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | 'Whenever possible' |
Specify whether the real-time system targeted by the model assigns higher or lower priority values to higher priority tasks when implementing asynchronous data transfers
Default: Off
Real-time system assigns higher priority values to higher priority tasks, for example, 8 has a higher task priority than 4. Rate Transition blocks treat asynchronous transitions between rates with lower priority values and rates with higher priority values as low-to-high rate transitions.
Real-time system assigns lower priority values to higher priority tasks, for example, 4 has a higher task priority than 8. Rate Transition blocks treat asynchronous transitions between rates with lower priority values and rates with higher priority values as high-to-low rate transitions.
| Parameter: PositivePriorityOrder |
| Type: string |
| Value: 'on' | 'off' |
| Default: 'off' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
Enables zero-crossing detection during variable-step simulation of the model. For most models, this speeds up simulation by enabling the solver to take larger time steps.
Default: Use local settings
Specifies that zero-crossing detection be enabled on a block-by-block basis. You can enable zero-crossing detection on a block-by-block basis. For a list of those blocks, see
To specify zero-crossing detection for one of these blocks, open the block's parameter dialog box and select the Enable zero crossing detection option.
Enables zero-crossing detection for all blocks in the model.
Disables zero-crossing detection for all blocks in the model.
For most models, enabling zero-crossing detection speeds up simulation by allowing the solver to take larger time steps.
If a model has extreme dynamic changes, disabling this option can speed up the simulation but can also decrease the accuracy of simulation results. See Zero Crossing Detection for more information.
Selecting Enable all or Disable all overrides the local zero-crossing detection setting for individual blocks.
This parameter is enabled only if the solver Type is set to Variable-step.
Selecting either Use local settings or Enable all enables the following parameters:
Consecutive zero crossings relative tolerance
Number of consecutive zero crossings allowed
Zero crossing threshold algorithm
| Parameter: ZeroCrossControl |
| Type: string |
| Value: 'UseLocalSettings' | 'EnableAll' | 'DisableAll' |
| Default: 'UseLocalSettings' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
Specify a tolerance factor that controls how closely zero-crossing events must occur to be considered consecutive.
Default: 10*128*eps
Simulink software defines zero crossings as consecutive if the time between events is less than a particular interval. The following figure depicts a simulation timeline during which Simulink software detects zero crossings ZC1 and ZC2, bracketed at successive time steps t1 and t2.

Simulink software determines that the zero crossings are consecutive if
dt < RelTolZC * t2
where dt is the time between zero crossings and RelTolZC is the Consecutive zero crossings relative tolerance.
Simulink software counts the number of consecutive zero crossings that it detects. If the count exceeds the value of Number of consecutive zero crossings allowed, Simulink software displays either a warning or error as specified by the Consecutive zero crossings violation diagnostic (see Consecutive zero crossings violation).
Simulink software resets the counter each time it detects nonconsecutive zero crossings (successive zero crossings that fail to meet the relative tolerance setting), therefore, decreasing the relative tolerance value may afford your model's behavior more time to recover.
If your model experiences excessive zero crossings, you can also increase the Number of consecutive zero crossings allowed to increase the threshold at which Simulink software triggers the Consecutive zero crossings violation diagnostic.
This parameter is enabled only if Zero crossing control is set to either Use local settings or Enable all.
| Parameter: ConsecutiveZCsStepRelTol |
| Type: string |
| Value: any valid value |
| Default: '10*128*eps' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
Specify the number of consecutive zero crossings that can occur before Simulink software displays a warning or error.
Default: 1000
Simulink software counts the number of consecutive zero crossings that it detects. If the count exceeds the specified value, Simulink software displays either a warning or error as specified by the Consecutive zero crossings violation diagnostic (see Consecutive zero crossings violation).
Simulink software defines zero crossings as consecutive if the time between events is less than a particular interval (see Consecutive zero crossings relative tolerance).
If your model experiences excessive zero crossings, you can increase this parameter to increase the threshold at which Simulink software triggers the Consecutive zero crossings violation diagnostic. This may afford your model's behavior more time to recover.
Simulink software resets the counter each time it detects nonconsecutive zero crossings, therefore, decreasing the relative tolerance value may also afford your model's behavior more time to recover.
This parameter is enabled only if Zero crossing control is set to either Use local settings or Enable all.
| Parameter: MaxConsecutiveZCs |
| Type: string |
| Value: any valid value |
| Default: '1000' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
Specifies the algorithm to detect zero-crossings when a variable-step solver is used.
Default: Non-adaptive
Use an improved zero-crossing algorithm which dynamically activates and deactivates zero crossing bracketing. With this algorithm you can set a zero crossing tolerance. See Zero crossing location threshold to learn how to set the zero crossing tolerance.
Use the nonadaptive zero crossing algorithm present in the Simulink software prior to Version 7.0 (R2008a). This option is provided for backward compatibility.
The Adaptive zero crossing algorithm is especially useful in systems having strong "chattering", or Zeno behavior. In these systems this algorithm yields shorter simulation run times compared to the non-adaptive algorithm. See Zero Crossing Detection for more information.
This parameter is enabled only if the solver Type is set to Variable-step.
Selecting Adaptive enables the Zero crossing location threshold parameter.
| Parameter: ZeroCrossAlgorithm |
| Type: string |
| Value: 'Non-adaptive' | 'Adaptive' |
| Default: 'Non-adaptive' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
Specifies the deadband region used during the detection of zero crossings. Signals falling within this region are defined as having crossed through zero.
The zero crossing tolerance is a real number, greater than or equal to zero.
Default: Auto
The zero crossing tolerance is determined automatically by the adaptive algorithm.
Use the specified value for the zero crossing tolerance. The value must be a real number equal to or greater than zero.
Do not confuse the Zero Crossing Tolerance with the Consecutive zero crossings relative tolerance parameter.
Entering too small of a small value for the Zero Crossing Location Tolerance parameter will result in long simulation run times and increased difficulty in detecting a zero crossing.
Entering a large Zero Crossing Location Tolerance value may improve the simulation speed (especially in those systems with large chattering). Making the value too large may reduce simulation accuracy.
This parameter is enabled if the Zero crossing algorithm is set to Adaptive.
| Parameter: ZcDetectionTol |
| Type: string |
| Value: 'auto' | any real number greater than or equal to zero |
| Default: 'auto' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
Select constraints on the sample times defined by this model. If the model does not satisfy the specified constraints during simulation, Simulink software displays an error message.
Default: Unconstrained
Specifies no constraints. Selecting this option causes Simulink software to display a field for entering the solver step size.
Use the Fixed step size (fundamental sample time) option to specify solver step size.
Specifies that Model blocks inherit sample time from the context in which they are used. This option is required if you use the Model block in a triggered subsystem. For more information, see:
Simulink software checks to ensure that this model can inherit its sample times from a model that references it without altering its behavior. Models that specify a step size (i.e., a base sample time) cannot satisfy this constraint. For this reason, selecting this option causes Simulink software to hide the group's step size field (see Fixed-step size (fundamental sample time)).
Specifies that Simulink software check to ensure that this model operates at a specified set of prioritized periodic sample times. Use the Sample time properties option to specify and assign priorities to model sample times.
Executing Multitasking Models explains how to use this option for multitasking models.
During simulation, Simulink software checks to ensure that the model satisfies the constraints. If the model does not satisfy the specified constraint, Simulink software displays an error message.
This parameter is enabled only if the solver Type is set to Fixed-step.
Selecting Unconstrained enables the following parameters:
Fixed-step size (fundamental sample time)
Tasking mode for periodic sample times
Higher priority value indicates higher task priority
Automatically handle data transfers between tasks
Selecting Specified enables the following parameters:
Sample time properties
Tasking mode for periodic sample times
Higher priority value indicates higher task priority
Automatically handle data transfers between tasks
| Parameter: SampleTimeConstraint |
| Type: string |
| Value: 'unconstrained' | 'STIndependent' | 'Specified' |
| Default: 'unconstrained' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | Specified or Ensure sample time independent |
Specify the step size used by the selected fixed-step solver.
Default: auto
Entering auto (the default) in this field causes Simulink software to choose the step size.
If the model specifies one or more periodic sample times, Simulink software chooses a step size equal to the least common denominator of the specified sample times. This step size, known as the fundamental sample time of the model, ensures that the solver will take a step at every sample time defined by the model.
If the model does not define any periodic sample times, Simulink software chooses a step size that divides the total simulation time into 50 equal steps.
This parameter is enabled only if the Periodic sample time constraint is set to Unconstrained.
| Parameter: FixedStep |
| Type: string |
| Value: any valid value |
| Default: 'auto' |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
Specify and assign priorities to the sample times that this model implements.
No Default
Enter an Nx3 matrix with rows that specify the model's discrete sample time properties in order from fastest rate to slowest rate.
Faster sample times must have higher priorities.
[period, offset, priority]
| period | The time interval (sample rate) at which updates occur during the simulation. |
| offset | A time interval indicating an update delay. The block is updated later in the sample interval than other blocks operating at the same sample rate. |
| priority | Execution priority of the real-time task associated with the sample rate. |
See Specifying Sample Time for more detail and options for specifying sample time.
[[0.1, 0, 10]; [0.2, 0, 11]; [0.3, 0, 12]]
Declares that the model should specify three sample times.
Sets the fundamental sample time period to 0.1 second.
Assigns priorities of 10, 11, and 12 to the sample times.
Assumes higher priority values indicate lower priorities — the Higher priority value indicates higher task priority option is not selected.
If the model's fundamental rate differs from the fastest rate specified by the model, specify the fundamental rate as the first entry in the matrix followed by the specified rates, in order from fastest to slowest. See Determining Step Size for Discrete Systems.
If the model operates at one rate, enter the rate as a three-element vector in this field — for example, [0.1, 0, 10].
When you update a model, Simulink software displays an error message if what you specify does not match the sample times defined by the model.
If Periodic sample time constraint is set to Unconstrained, Simulink software assigns priority 40 to the model base sample rate. If Higher priority value indicates higher task priority is selected, Simulink software assigns priorities 39, 38, 37, and so on, to subrates of the base rate. Otherwise, it assigns priorities 41, 42, 43, and so on, to the subrates.
Continuous rate is assigned a higher priority than is the discrete base rate regardless of whether Periodic sample time constraint is Specified or Unconstrained.
This parameter is enabled by selecting Specified from the Periodic sample time constraint list.
| Parameter: SampleTimeProperty |
| Type: structure |
| Value: any valid matrix |
| Default: [] |
Note If you specify SampleTimeProperty at the command line, you must enter the sample time properties as a structure with the following fields:
|
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | Period, offset, and priority of each sample time in the model; faster sample times must have higher priority than slower sample times |
Select the extrapolation order used by the ode14x solver to compute a model's states at the next time step from the states at the current time step.
Default: 4
Specifies first order extrapolation.
Specifies second order extrapolation.
Specifies third order extrapolation.
Specifies fourth order extrapolation.
Selecting a higher order produces a more accurate solution, but is more computationally intensive per step size.
This parameter is enabled by selecting ode14x (extrapolation) from the Solver list.
| Parameter: ExtrapolationOrder |
| Type: integer |
| Value: 1 | 2 | 3 | 4 |
| Default: 4 |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
Specify the number of Newton's method iterations used by the ode14x solver to compute a model's states at the next time step from the states at the current time step.
Default: 1
Minimum: 1
Maximum: 2147483647
More iterations produce a more accurate solution, but is more computationally intensive per step size.
This parameter is enabled by selecting ode14x (extrapolation) from the Solver list.
| Parameter: NumberNewtonIterations |
| Type: integer |
| Value: any valid number |
| Default: 1 |
| Application | Setting |
|---|---|
| Debugging | No impact |
| Traceability | No impact |
| Efficiency | No impact |
| Safety precaution | No impact |
![]() | Model Configuration Pane | Data Import/Export Pane | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |