Accelerating the pace of engineering and science

# Documentation

### Contents

• Functions
• Examples and How To
• Concepts

## Solver Pane

### Solver Overview

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.

#### Configuration

1. Select a solver type from the Type list.

2. Select a solver from the Solver list.

3. Set the parameters displayed for the selected type and solver combination.

4. Apply the changes.

#### Tips

• To open the Solver pane, in the Simulink® Editor, select Simulation > Model Configuration Parameters > Solver.

• 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-step 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.

### Start time

Specify the start time for the simulation or generated code as a double-precision value, scaled to seconds.

#### Settings

Default: 0.0

• A start time must be less than or equal to the stop time. For example, use a nonzero start time to delay the start of a simulation while running an initialization script.

• 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.

#### Command-Line Information

 Parameter: StartTime Type: string Value: any valid value Default: '0.0'

#### Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precaution0.0

### Stop time

Specify the stop time for the simulation or generated code as a double-precision value, scaled to seconds.

#### Settings

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.

#### Command-Line Information

 Parameter: StopTime Type: string Value: any valid value Default: '10.0'

#### Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionA positive value

### Type

Select the type of solver you want to use to simulate your model.

#### Settings

Default: Variable-step

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.

Fixed-step

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.

#### Dependencies

Selecting Variable-step enables the following parameters:

• Solver

• Max step size

• Min step size

• Initial step size

• Relative tolerance

• Absolute tolerance

• Shape preservation

• Initial step size

• Number of consecutive min steps

• Zero-crossing control

• Time tolerance

• Algorithm

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 rate transitions for data transfers

#### Command-Line Information

 Parameter: SolverType Type: string Value: 'Variable-step' | 'Fixed-step' Default: 'Variable-step'

#### Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionFixed-step

### Solver

Select the solver you want to use to compute the model's states during simulation or code generation.

#### Settings

The available solvers change depending on which solver Type you selected:

Fixed-step Solvers.

Default: ode3 (Bogacki-Shampine)

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)`
Discrete (no continuous states)

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.
ode8 (Dormand-Prince RK8(7))

Uses the eighth-order Dormand-Prince formula to compute the model state at the next time step as an explicit function of the current value of the state and the state derivatives approximated at intermediate points.

ode5 (Dormand-Prince)

Uses the fifth-order Dormand-Prince formula to compute the model state at the next time step as an explicit function of the current value of the state and the state derivatives approximated at intermediate points.

ode4 (Runge-Kutta)

Uses the fourth-order Runge-Kutta (RK4) formula to compute the model state at the next time step as an explicit function of the current value of the state and the state derivatives.

ode2 (Heun)

Uses the Heun integration method to compute the model state at the next time step as an explicit function of the current value of the state and the state derivatives.

ode1 (Euler)

Uses the Euler integration method to compute the model state at the next time step as an explicit function of the current value of the state and the state derivatives.

ode14x (extrapolation)

Uses a combination of Newton's method and extrapolation from the current value to compute the model's state at the next time step, as an implicit function of the state and the state derivative at the next time step. 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.

Variable-step Solvers.

Default: ode45 (Dormand-Prince)

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, and therefore only needs the solution at the preceding time point.

Use ode45 as a first try for most problems.

Discrete (no continuous states)

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.

ode23 (Bogacki-Shampine)

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, and therefore only needs the solution at 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, and thus generally needs the solutions at several preceding time points to compute the current solution.

ode113 can be more efficient than ode45 at stringent tolerances.

ode15s (stiff/NDF)

Computes the model's state at the next time step using variable-order numerical differentiation formulas (NDFs). These are related to, but more efficient than the backward differentiation formulas (BDFs), also known as Gear's method.

ode15s is a multistep solver, and thus generally needs 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.

ode23s (stiff/Mod. Rosenbrock)

Computes the model's state at the next time step using a modified Rosenbrock formula of order 2.

ode23s is a one-step solver, and therefore only needs the solution at the preceding time point.

ode23s is more efficient than ode15s at crude tolerances, and can solve stiff problems for which ode15s is ineffective.

ode23t (Mod. stiff/Trapezoidal)

Computes the model's state at the next time step using an implementation of the trapezoidal rule with a "free" interpolant.

ode23t is a one-step solver, and therefore only needs the solution at the preceding time point.

Use ode23t if the problem is only moderately stiff and you need a solution with no numerical damping.

ode23tb (stiff/TR-BDF2)

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.

#### Tips

• Identifying the optimal solver for a model requires experimentation, for an in-depth discussion, see Choosing a SolverChoosing 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 also increases simulation time.

• The degree of computational complexity increases for oden, as n increases.

• As computational complexity increases, the accuracy of the results also increases.

#### Dependencies

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:

• Fixed-step size (fundamental sample time)

• Periodic sample time constraint

• Tasking mode for periodic sample times

• Automatically handle rate transition for data transfers

• Higher priority value indicates higher task priority

Selecting ode14x (extrapolation) enables the following parameters:

• Fixed-step size (fundamental sample time)

• Extrapolation order

• Number Newton's iterations

• Periodic sample time constraint

• Tasking mode for periodic sample times

• Automatically handle rate transition for data transfers

• Higher priority value indicates higher task priority

Selecting the Discrete (no continuous states) variable-step solver enables the following parameters:

• Max step size

• Automatically handle rate transition for data transfers

• Higher priority value indicates higher task priority

• Zero-crossing control

• Time tolerance

• Number of consecutive zero crossings

• Algorithm

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

• Shape preservation

• Number of consecutive min steps

• Automatically handle rate transition for data transfers

• Higher priority value indicates higher task priority

• Zero-crossing control

• Time tolerance

• Number of consecutive zero crossings

• Algorithm

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

• Solver reset method

• Number of consecutive min steps

• Relative tolerance

• Absolute tolerance

• Shape preservation

• Maximum order

• Automatically handle rate transition for data transfers

• Higher priority value indicates higher task priority

• Zero-crossing control

• Time tolerance

• Number of consecutive zero crossings

• Algorithm

#### Command-Line Information

 Parameter: Solver Type: string Value: 'VariableStepDiscrete' | 'ode45' | 'ode23' | 'ode113' | 'ode15s' | 'ode23s' | 'ode23t' | 'ode23tb' | 'FixedStepDiscrete' |'ode8'| 'ode5' | 'ode4' | 'ode3' | 'ode2' | 'ode1' | 'ode14x' Default: 'ode45'

#### Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionDiscrete (no continuous states)

### Max step size

Specify the largest time step that the solver can take.

#### Settings

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

${h}_{\mathrm{max}}=\frac{{t}_{stop}-{t}_{start}}{50}$

#### Tips

• Generally, the default maximum step size is sufficient. If you are concerned about the solver missing significant behavior, change the parameter to prevent the solver from taking too large a step.

• Max step size determines the step size of the variable-step solver.

• 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.

#### Dependencies

This parameter is enabled only if the solver Type is set to Variable-step.

#### Command-Line Information

 Parameter: MaxStep Type: string Value: any valid value Default: 'auto'

#### Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

### Initial step size

Specify the size of the first time step that the solver takes.

#### Settings

Default: auto

By default, the solver selects an initial step size by examining the derivatives of the states at the start time.

#### Tips

• 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.

#### Dependencies

This parameter is enabled only if the solver Type is set to Variable-step.

#### Command-Line Information

 Parameter: InitialStep Type: string Value: any valid value Default: 'auto'

#### Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

### Min step size

Specify the smallest time step that the solver can take.

#### Settings

Default: auto

• The default value (auto) sets an unlimited number of warnings and a minimum step size on the order of machine precision.

• You can specify either a real number greater than zero, or a two-element vector for which the first element is the minimum step size and the second element is the maximum number of minimum step size warnings before an error was issued.

#### Tips

• 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 violationMin 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.

• Min step size determines the step size of the variable step ODE solver. The size is limited by the smallest discrete sample time in the model.

#### Dependencies

This parameter is enabled only if the solver Type is set to Variable-step.

#### Command-Line Information

 Parameter: MinStep Type: string Value: any valid value Default: 'auto'

#### Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

### Relative tolerance

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 size.

#### Settings

Default: 1e-3

• Setting the relative tolerance to auto is actually the default value of 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%.

#### Tips

• The acceptable error at each time step is a function of both the Relative tolerance and the Absolute tolerance. For more information about how these settings work together, see Specifying Variable-Step Solver Error TolerancesSpecifying Variable-Step Solver Error Tolerances.

• During each time step, the solver computes the state values at the end of the step and also determines 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.

#### Dependencies

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 TolerancesSpecifying Variable-Step Solver Error Tolerances.

#### Command-Line Information

 Parameter: RelTol Type: string Value: any valid value Default: '1e-3'

#### Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

### Absolute tolerance

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 size.

#### Settings

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 thus far assumed 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.

#### Tips

• The acceptable error at each time step is a function of both the Relative tolerance and the Absolute tolerance. For more information about how these settings work together, see Specifying Variable-Step Solver Error TolerancesSpecifying Variable-Step Solver Error Tolerances.

• The Integrator, Second-Order Integrator, Variable Transport Delay, 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 states, for example, if they vary widely in magnitude.

• If you set the Absolute tolerance too low, the solver might take too many steps around near-zero state values, and thus slow 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.

#### Dependencies

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 TolerancesSpecifying Variable-Step Solver Error Tolerances.

#### Command-Line Information for Configuration Parameters

 Parameter: AbsTol Type: string | numeric value Value: 'auto' | positive real scalar Default: 'auto'

#### Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

### Shape preservation

At each time step use derivative information to improve integration accuracy.

#### Settings

Default: Disable all

Disable all

Do not perform Shape preservation on any signals.

Enable all

Perform Shape preservation on all signals.

#### Tips

• The default setting (Disable all) usually provides good accuracy for most models.

• Setting to Enable all will increase accuracy in those models having signals whose derivative exhibits a high rate of change, but simulation time may be increased.

#### Dependencies

This parameter is enabled only if you use a continuous-step solver.

#### Command-Line Information

 Parameter: ShapePreserveControl Type: string Value: 'EnableAll | 'DisableAll Default: 'DisableAll

#### Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

### Maximum order

Select the order of the numerical differentiation formulas (NDFs) used in the ode15s solver.

#### Settings

Default: 5

5

Specifies that the solver uses fifth order NDFs.

1

Specifies that the solver uses first order NDFs.

2

Specifies that the solver uses second order NDFs.

3

Specifies that the solver uses third order NDFs.

4

Specifies that the solver uses fourth order NDFs.

#### Tips

• 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.

#### Dependencies

This parameter is enabled only if Solver is set to ode15s.

#### Command-Line Information

 Parameter: MaxOrder Type: integer Value: 1 | 2 | 3 | 4 | 5 Default: 5

#### Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

### Solver reset method

Select how the solver behaves during a reset, such as when it detects a zero crossing.

#### Settings

Default: Fast

Fast

Specifies that the solver will not recompute the Jacobian matrix at a solver reset.

Robust

Specifies that the solver will recompute the Jacobian matrix needed by the integration step at every solver reset.

#### Tips

• 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.

#### Dependencies

This parameter is enabled only if you select one of the following solvers:

• ode15s (Stiff/NDF)

• ode23t (Mod. Stiff/Trapezoidal)

• ode23tb (Stiff/TR-BDF2)

#### Command-Line Information

 Parameter: SolverResetMethod Type: string Value: 'Fast' | 'Robust' Default: 'Fast'

#### Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

### Number of consecutive min steps

Specify the maximum number of consecutive minimum step size violations allowed during simulation.

#### Settings

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 sizeMin step size).

• Simulink software counts the number of consecutive violations that it detects. If the count exceeds the value of Number of consecutive min steps, Simulink software displays either a warning or error message as specified by the Min step size violation diagnostic (see Min step size violationMin step size violation).

#### Dependencies

This parameter is enabled only if you set:

• Solver Type to Variable-step.

• Solver to a continuous variable step solver.

#### Command-Line Information

 Parameter: MaxConsecutiveMinStep Type: string Value: any valid value Default: '1'

#### Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

### Solver Jacobian Method

#### Settings

Default: Auto

auto

Sparse perturbation

Full perturbation

Sparse analytical

Full analytical

#### Tips

• The default setting (Auto) usually provides good accuracy for most models.

#### Dependencies

This parameter is enabled only if an implicit solver is used.

#### Command-Line Information

 Parameter: SolverJacobianMethodControl Type: string Value: 'auto' | 'SparsePerturbation'|'FullPerturbation' | 'SparseAnalytical' |'FullAnalytical' Default: 'auto'

#### Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

### Tasking mode for periodic sample times

Select how blocks with periodic sample times execute.

#### Settings

Default: Auto

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 together (for example, calculating output and updating discrete states).

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.

#### Tips

• For multirate models, Simulink treats an Auto setting as a MultiTasking setting.

• A model that is multirate and uses multitasking (that is, uses a setting of Auto or MultiTasking) cannot reference a multirate model that uses a SingleTasking setting.

• 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.

#### Dependency

This parameter is enabled by selecting Fixed-step solver type.

#### Command-Line Information

 Parameter: SolverMode Type: string Value: 'Auto' | 'SingleTasking' | 'MultiTasking' Default: 'Auto'

#### Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

### Automatically handle rate transition for data transfer

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 optional determinism of data transfers for periodic tasks.

#### Settings

Default: Off

On

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.

Off

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 OptionsRate Transition Block Options in the Simulink Coder™ documentation for further details.

#### Tips

• 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.

#### Command-Line Information

 Parameter: AutoInsertRateTranBlk Type: string Value: 'on' | 'off' Default: 'off'

#### Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact for simulation or during development
Off for production code generation
EfficiencyNo impact
Safety precautionOff

### Deterministic data transfer

Control whether the Rate Transition block parameter Ensure deterministic data transfer (maximum delay) is set for auto-inserted Rate Transition blocks

Default: Whenever possible

Always

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 if 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.

Whenever possible

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.

Never (minimum delay)

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.

#### Dependencies

This parameter is enabled only if Automatically handle rate transition for data transfer is checked.

#### Command-Line Information

 Parameter: InsertRTBMode Type: string Value: 'Always' | 'Whenever possible'| 'Never (minimum delay)' Default: 'Whenever possible'

#### Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precaution'Whenever possible'

### Higher priority value indicates higher task priority

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

#### Settings

Default: Off

On

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.

Off

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.

#### Command-Line Information

 Parameter: PositivePriorityOrder Type: string Value: 'on' | 'off' Default: 'off'

#### Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

### Zero-crossing control

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.

#### Settings

Default: Use local settings

Use local settings

Specifies that zero-crossing detection be enabled on a block-by-block basis. For a list of applicable blocks, see Simulating Dynamic Systems

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.

Enable all

Enables zero-crossing detection for all blocks in the model.

Disable all

Disables zero-crossing detection for all blocks in the model.

#### Tips

• 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 DetectionZero-crossing Detection for more information.

• Selecting Enable all or Disable all overrides the local zero-crossing detection setting for individual blocks.

#### Dependencies

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:

• Time tolerance

• Number of consecutive zero crossings

• Algorithm

#### Command-Line Information

 Parameter: ZeroCrossControl Type: string Value: 'UseLocalSettings' | 'EnableAll' | 'DisableAll' Default: 'UseLocalSettings'

#### Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

### Time tolerance

Specify a tolerance factor that controls how closely zero-crossing events must occur to be considered consecutive.

#### Settings

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 Time 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 violationConsecutive zero-crossings violation).

#### Tips

• 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 to increase the threshold at which Simulink software triggers the Consecutive zero-crossings violation diagnostic.

#### Dependencies

This parameter is enabled only if Zero-crossing control is set to either Use local settings or Enable all.

#### Command-Line Information

 Parameter: ConsecutiveZCsStepRelTol Type: string Value: any valid value Default: '10*128*eps'

#### Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

### Number of consecutive zero crossings

Specify the number of consecutive zero crossings that can occur before Simulink software displays a warning or an error.

Default: 1000

#### Tips

• 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.

#### Dependencies

This parameter is enabled only if Zero-crossing control is set to either Use local settings or Enable all.

#### Command-Line Information

 Parameter: MaxConsecutiveZCs Type: string Value: any valid value Default: '1000'

#### Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

### Algorithm

Specifies the algorithm to detect zero crossings when a variable-step solver is used.

#### Settings

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 Signal 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 detects zero-crossings accurately, but might cause longer simulation run times for systems with strong "chattering" or Zeno behavior.

#### Tips

• The adaptive zero-crossing algorithm is especially useful in systems having strong "chattering", or Zeno behavior. In such systems, this algorithm yields shorter simulation run times compared to the nonadaptive algorithm. See Zero-Crossing DetectionZero-Crossing Detection for more information.

#### Dependencies

• This parameter is enabled only if the solver Type is set to Variable-step.

• Selecting Adaptive enables the Signal threshold parameter.

#### Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

### Signal threshold

Specifies the deadband region used during the detection of zero crossings. Signals falling within this region are defined as having crossed through zero.

The signal threshold is a real number, greater than or equal to zero.

#### Settings

Default: Auto

Auto

The signal threshold is determined automatically by the adaptive algorithm.

String

Use the specified value for the signal threshold. The value must be a real number equal to or greater than zero.

#### Tips

• Entering too small of a value for the Signal Threshold parameter will result in long simulation run times.

• Entering a large Signal Threshold value may improve the simulation speed (especially in systems having extensive chattering). However, making the value too large may reduce the simulation accuracy.

#### Dependency

This parameter is enabled if the zero-crossing Algorithm is set to Adaptive.

#### Command-Line Information

 Parameter: ZCThreshold Type: string Value: 'auto' | any real number greater than or equal to zero Default: 'auto'

#### Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

### Periodic sample time constraint

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.

#### Settings

Default: Unconstrained

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.

Ensure sample time independent

Specifies that Model blocks inherit sample time from the context in which they are used. You cannot use a referenced model that has intrinsic sample times in a triggered subsystem or iterator subsystem. If you plan on referencing this model in a triggered or iterator subsystem, you should select Ensure sample time independent so that Simulink can detect sample time problems while unit testing this model.

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)Fixed-step size (fundamental sample time)).

Specified

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.

#### Tips

During simulation, Simulink software checks to ensure that the model satisfies the constraints. If the model does not satisfy the specified constraint, then Simulink software displays an error message.

#### Dependencies

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 rate transitions for data transfers

Selecting Specified enables the following parameters:

• Sample time properties

• Tasking mode for periodic sample times

• Higher priority value indicates higher task priority

• Automatically handle rate transitions for data transfers

#### Command-Line Information

 Parameter: SampleTimeConstraint Type: string Value: 'unconstrained' | 'STIndependent' | 'Specified' Default: 'unconstrained'

#### Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionSpecified or Ensure sample time independent

### Fixed-step size (fundamental sample time)

Specify the step size used by the selected fixed-step solver.

#### Settings

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 greatest common divisor 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.

• If the model specifies no periodic rates and the stop time is Inf, Simulink uses 0.2 as the step size.

#### Dependencies

This parameter is enabled only if the Periodic sample time constraint is set to Unconstrained.

#### Command-Line Information

 Parameter: FixedStep Type: string Value: any valid value Default: 'auto'

#### Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

### Sample time properties

Specify and assign priorities to the sample times that this model implements.

#### Settings

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.

Format.

`[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 TimeSpecifying Sample Time for more details and options for specifying sample time.

Example.

`[[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.

#### Tips

• 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 Purely 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.

#### Dependencies

This parameter is enabled by selecting Specified from the Periodic sample time constraint list.

#### Command-Line Information

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

#### Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionPeriod, offset, and priority of each sample time in the model; faster sample times must have higher priority than slower sample times

### Extrapolation order

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.

#### Settings

Default: 4

1

Specifies first order extrapolation.

2

Specifies second order extrapolation.

3

Specifies third order extrapolation.

4

Specifies fourth order extrapolation.

#### Tip

Selecting a higher order produces a more accurate solution, but is more computationally intensive per step size.

#### Dependencies

This parameter is enabled by selecting ode14x (extrapolation) from the Solver list.

#### Command-Line Information

 Parameter: ExtrapolationOrder Type: integer Value: 1 | 2 | 3 | 4 Default: 4

#### Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

### Number Newton's iterations

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.

#### Settings

Default: 1
Minimum: 1
Maximum: 2147483647

More iterations produce a more accurate solution, but are more computationally intensive per step size.

#### Dependencies

This parameter is enabled by selecting ode14x (extrapolation) from the Solver list.

#### Command-Line Information

 Parameter: NumberNewtonIterations Type: integer Value: any valid number Default: 1

#### Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

### Allow tasks to execute concurrently on target

Enable concurrent tasking behavior for model.

#### Settings

Default: On

On

Enable the model to be configured for concurrent tasking.

Off

Disable the model from being configured for concurrent tasking.

Tip.

• If the referenced mode has a single rate, you do not need to select this check box to enable concurrent tasking behavior.

• To remove this parameter, in the Model Explorer right-click and select Configuration > Hide Concurrent Execution options.

Dependencies.  This parameter check box is visible only if you convert an existing configuration set to one for concurrent execution. To enable this parameter, in the Model Explorer hierarchy pane, right-click and select Configuration > Show Concurrent Execution options. The Dialog pane is displayed with the Allow tasks to execute concurrently on target check box and a Configure Tasks button.

• If this parameter check box is selected when you click the Configure Tasks button, the Concurrent Execution dialog box is displayed.

• If this parameter check box is cleared, the following parameters are enabled:

• Periodic sample time constraint

• Tasking mode for periodic sample times

• Automatically handle rate transition for data transfer

• Higher priority value indicates higher task priority

• To make this parameter check box and button visible with the command-line information, set the EnableConcurrentExecution to 'on'. By default, this parameter is set to 'off'.

#### Command-Line Information

 Parameter: ConcurrentTasks Type: string Value: 'on' | 'off' Default: 'on'

#### Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precaution0.0