Using Simulink Previous page   Next Page

The Solver Pane

The Solver configuration parameters pane allows you to specify a simulation start and stop time and select and configure a solver for a particular simulation configuration.

The Solver pane contains the following control groups.

Simulation time

This control group enables you to specify the simulation start and stop time. It contains the following controls.

Start time.   Specifies the simulation start time. The default start time is 0.0 seconds.

Stop time.   Specifies the simulation stop time. The default stop time is 10.0 seconds. Specify inf to cause the simulation to run until you pause or stop it.

Simulation time and actual clock time are not the same. For example, running a simulation for 10 seconds usually does not take 10 seconds. The amount of time it takes to run a simulation depends on many factors, including the model's complexity, the solver's step sizes, and the computer's speed.

Solver Options

The Solver options controls group allows you to specify the type of solver to be used and simulation options specific to that solver.

The contents of the group depends on the solver type.

General Solver Options

The follow options always appear.

Type.   Specifies the type of solver to be used to solve the currently selected model, either Fixed-step or Variable-step. See Choosing a Solver Type and Improving Simulation Performance and Accuracy for information on how to choose the solver type that best suits your application.

Solver.   Specifies the solver used to simulate this configuration of the current model. The associated pull-down list displays available solvers of the type specified by the Type control. To specify another solver of the specified type, select the solver from the pull-down list. See Choosing a Fixed-Step Solver and Choosing a Variable-Step Solver for information on how to choose the solvers listed in the Solver list.

The other controls that appear in this group depend on the type of solver you have selected.

Variable-Step Discrete Solver Options

The following options appear when you select the Simulink variable-step discrete solver.

Max step size.   Appears only if the solver Type is Variable-step. Specifies the largest time step the selected variable-step solver can take. The default auto causes Simulink to choose the model's shortest sample time as the maximum step size.

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

You can override this optimization on a block-by-block basis for the following types of blocks:

Abs
Integrator
Step
Backlash
MinMax
Switch
Dead Zone
Relay
Switch Case
Enable
Relational Operator
Trigger
Hit Crossing
Saturation

If
Sign

To override zero-crossing detection for an instance of one of these blocks, open the block's parameter dialog box and uncheck the Enable zero crossing detection option. You can enable or disable zero-crossing selectively for these blocks only if you have selected the Use local settings setting of the Zero crossing control control on the Solver pane of the Configuration Parameters dialog box.

Variable-Step Continuous Solver Options

The following options appear when you select any of the Simulink variable-step continuous solvers.

Max step size.   Specifies the largest time step the solver can take. The default is determined from the start and stop times. If the stop time equals the start time or is inf, Simulink chooses 0.2 sec. 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. Also, 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 Output options.

Initial step size.   By default, the solver selects an initial step size by examining the derivatives of the states at the start time. 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.

Min step size.   This option appears only for variable-step continuous solvers. Specifies the smallest time step the selected variable-step solver can take. If the solver needs to take a smaller step to meet error tolerances, it issues a warning indicating the current effective relative tolerance. This parameter can be 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 to be issued before issuing an error. 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 minimum step size violation diagnostic to error on the Diagnostics pane. Setting the second element to -1 results in an unlimited number of warnings. This is also the default if the input is a scalar. The default values for this parameter are a minimum step size on the order of machine precision and an unlimited number of warnings.

Relative tolerance.   Relative tolerance for this solver (see Specifying Variable-Step Solver Error Tolerances).

Absolute tolerance.   Absolute tolerance for this solver (see Specifying Variable-Step Solver Error Tolerances).

Maximum order.   This option appears only if you select the ode15s solver, which is based on NDF formulas of orders one through five. 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.

Solver reset method.   This option appears only if you select one of the following solvers:

Its setting controls the solver behavior at solver reset (e.g., after detecting a zero crossing) as follows:

Setting
Reset Behavior
Robust
The solver recomputes the Jacobian matrix needed by the integration step at every solver reset.
Fast
The solver does not recompute the Jacobian matrix at a solver reset.

The fast setting speeds 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.

Fixed-Step Solver Options

The following options appear when you choose one of the Simulink fixed-step solvers.

Periodic sample time constraint.   Allows you to specify constraints on the sample times defined by this model. During simulation, Simulink checks to ensure that the model satisfies the constraints. If the model does not satisfy the specified constraint, Simulink displays an error message. The contents of the Solver options group changes depending on the options selected. The options are

Fixed step size (fundamental sample time).   Specifies the step size used by the selected fixed-step solver. Entering auto (the default) in this field causes Simulink to choose the step size. If the model specifies one or more periodic sample times, Simulink 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 chooses a step size that divides the total simulation time into 50 equal steps.

Sample time properties.   Specifies and assigns priorities to the sample times that this model implements. Enter an Nx3 matrix in this field whose rows specify the sample times specified by this model in order from fastest rate to slowest rate.

The row for each sample time should have the form

where period is the sample time's period of a sample time, offset is the sample time's offset, and priority is the execution priority of the real-time task associated with the sample rate, with faster rates receiving higher priorities. For example, the following entry

declares that this model should specify three sample times, whose fundamental sample time is 0.1 second, and assigns priorities of 10, 11, and 12 to the sample times. This example assumes that for this model, higher priority values indicate lower priorities, i.e., the Higher priority value indicates higher task priority option is not selected (see Higher priority value indicates higher task priority).

When updating a model, Simulink checks the sample times defined by the model against this field. If the model defines more or fewer sample times than this field specifies, Simulink displays an error message.

Tasking mode for periodic sample times.   Specifies one of the following options:

Higher priority value indicates higher task priority.   If checked, this option indicates that the real-time system targeted by this model assigns a higher priority to tasks with higher priority values. This in turn causes Simulink Rate Transition blocks to treat asynchronous transitions between rates with lower priority values to rates with higher priority values as low-to-high rate transitions. If unchecked (the default), this option indicates that the real-time system targeted by this model assigns a higher priority to tasks with lower priority values. This in turn causes Simulink Rate Transition blocks to treat asynchronous transitions between rates with lower priority values to rates with higher priority values as high-to-low rate transitions. See the Real-Time Workshop documentation for more information on this option.

Automatically handle data transfers between tasks.   If checked, this option causes Simulink to insert hidden Rate Transition blocks where rate transitions occur between blocks.

The next two options appear only if you select the ode14x solver (see Implicit Fixed-Step Continuous Solvers).

Extrapolation Order.   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. The higher the order, the more accurate but the more computationally intensive is the solution per step size.

Number Newton's iterations.   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. The more iterations, the more accurate but the more computationally intensive is the solution per step size.


Previous page  The Configuration Parameters Dialog Box Data Import/Export Pane Next page

© 1994-2005 The MathWorks, Inc.