Main Content

Solver Configuration

Physical network environment and solver configuration

  • Library:
  • Simscape / Utilities

  • Solver Configuration block

Description

Each physical network represented by a connected Simscape™ block diagram requires solver settings information for simulation. The Solver Configuration block specifies the solver parameters that your model needs before you can begin simulation.

Each topologically distinct Simscape block diagram requires exactly one Solver Configuration block to be connected to it.

Ports

Conserving

expand all

Conserving connection port. This port is untyped. You can connect it anywhere on a physical network circuit by creating a branching point on a connection line between conserving ports of any type. The block provides solver setting to the whole physical network, regardless of the connection type.

Parameters

expand all

By default, when this check box is cleared, simulation starts from the initial state obtained from the initial conditions computation.

When you select this check box, the solver attempts to find the steady state that would result if the inputs to the system were held constant for a sufficiently large time. For more information, see Initial Conditions Computation. Simulation then starts from this steady state.

For models compatible with frequency-and-time equation formulation, when you select this check box, the solver attempts to perform sinusoidal steady-state initialization. In other words, initialization is performed using frequency-time equations, and then the simulation proceeds using the actual equation formulation and other options selected in the Solver Configuration block. For more information, see Frequency and Time Simulation Mode.

Note

Using the Initial state option on the Data Import/Export pane of the Configuration Parameters dialog box overrides the Start simulation from steady state option.

This parameter affects the nonlinear solver used for computing initial conditions and for transient initialization. It determines how accurately the algebraic constraints are to be satisfied at the beginning of simulation and after every discrete event (for example, a discontinuity resulting from a valve opening, a hard stop, and so on). Decrease the parameter value (that is, tighten tolerance) to obtain a more reliable time simulation. Increase the parameter value (that is, relax the tolerance) if solving for initial conditions failed to converge, or to reduce the computation time.

The default value is applicable to most cases.

Lets you use a sample-based local solver with a sample time specified by the Sample time parameter. In sample-based simulation, all the physical network states, which are otherwise continuous, become represented to Simulink® as discrete states. The solver updates the states once per time step. This option is especially useful for generated code or hardware-in-the-loop (HIL) simulations.

Note

If you use a local solver, simultaneous use of Simulink or Simulink Control Design™ linearization tools is not recommended.

Select the solver type used for updating the states:

  • Backward Euler — Tends to damp out oscillations, but is more stable, especially if you increase the time step.

  • Trapezoidal Rule — Captures oscillations better than Backward Euler, but is less stable.

  • Partitioning — Lets you increase real-time simulation speed by partitioning the entire system of equations corresponding to a Simscape network into a cascade of smaller equation systems. Not all networks can be partitioned. However, when a system can be partitioned, this solver provides a significant increase in real-time simulation speed. For more information, see Understanding How the Partitioning Solver Works and Increase Simulation Speed Using the Partitioning Solver.

Regardless of which local solver you choose, the Backward Euler method is always applied:

  • Right at the start of simulation.

  • Right after an instantaneous change, when the corresponding block undergoes an internal discrete change. Such changes include clutches locking and unlocking, valve actuators opening and closing, and the switching of the PS Asynchronous Sample & Hold block.

Dependencies

To enable this parameter, select the Use local solver check box.

Specify the local solver sample time, in seconds. The solver updates the states once per time step.

Dependencies

To enable this parameter, select the Use local solver check box.

Select whether to prioritize speed or robustness when using Partitioning local solver:

  • Fast simulation — Improve simulation performance by solving most differential equations using the forward Euler scheme.

  • Robust simulation — Increase simulation robustness by solving more equations using the backward Euler scheme.

Dependencies

To enable this parameter, select the Use local solver check box and set Solver type to Partitioning.

When you use the Partitioning solver, it solves the small switched linear equations consecutively. You can choose to store the matrix inverses, to improve the simulation performance. Then, if the same configuration is detected in a subsequent time step, the partitioning solver uses the stored matrix inverses, instead of recomputing them. Select the method used for storing partitioning data:

  • As needed — Compute matrix inverses during simulation, as needed. This method does not require as much memory but can result in performance spikes.

  • Exhaustive — Compute and store matrix inverses before simulation. This method improves the simulation performance but requires more memory. Use the Partition memory budget [kB] parameter to specify the maximum allowed memory budget for storing the data.

Dependencies

To enable this parameter, select the Use local solver check box and set Solver type to Partitioning.

Specify the maximum memory budget, in kB, allowed for storing cached partition data. If this budget is exceeded, simulation errors out. You can adjust the default value based on your available memory resources and on the Total memory estimate data in the Statistics Viewer. For more information, see Model Statistics Available when Using the Partitioning Solver.

Dependencies

To enable this parameter, select the Use local solver check box. Set Solver type to Partitioning and Partition storage method to Exhaustive.

If you select this check box, you can specify the number of nonlinear and mode iterations for transient initialization. If the system does not converge once it performs the specified number of iterations, it ignores the failure and goes to the next step.

If you clear the check box, the system uses a more robust and time-consuming algorithm, performing as many iterations as necessary to reach convergence, and errors out if it fails to reach convergence at the time of transient initialization.

Selecting and clearing Use local solver automatically selects and clears the Use fixed-cost runtime consistency iterations check box as well, because these are the recommended settings for real-time and HIL simulations. However, you can select and clear the two check boxes independently of each other. For more information, see Fixed-Cost Simulation.

Specify the number of Newton iterations to be performed at the time of transient initialization.

Dependencies

To enable this parameter, select the Use fixed-cost runtime consistency iterations check box.

Specify the number of mode iterations to be performed at the time of transient initialization.

Dependencies

To enable this parameter, select the Use fixed-cost runtime consistency iterations check box and clear the Use local solver check box. Only one major mode update per step is performed when using local solvers, therefore this parameter is not available if the Use local solver check box is selected.

Lets you manage computational cost of impulse detection during transient initialization, both for global and local solvers.

Event-based methods of state reinitialization and impulse handling let you model physical phenomena, such as collisions and bouncing balls, and provide a significant boost in simulation speed for such models. However, impulse detection can add cost to transient initialization. This cost is proportional to the number of impulse iterations performed to reach convergence.

If you select the Compute impulses check box, you can specify the number of impulse iterations to perform during transient initialization. If the system does not converge upon reaching these numbers, it ignores the failure and goes to the next step.

If you clear the check box, the system computes impulses as many times as necessary to reach convergence.

Dependencies

To enable this check box, select the Use fixed-cost runtime consistency iterations check box.

Specify the number of impulse iterations to be performed at the time of transient initialization. If the system does not converge upon reaching these numbers, it ignores the failure and goes to the next step.

Dependencies

To enable this parameter, select the Compute impulses check box.

Specifies how the solver treats matrices:

  • Sparse — The solver treats matrices as sparse.

  • Full — The solver treats matrices as full.

  • auto — The solver automatically selects the appropriate option, either sparse or full, for treating the matrices.

Specifies how the solver treats sinusoidal variables.

Use the Frequency and time value to speed up simulation of systems with a single nominal frequency. For more information, see Frequency and Time Simulation Mode.

Specify the maximum memory budget, in kB, allowed for processing delays when simulating models that contain either blocks from the Delays library or custom blocks using the delay Simscape language construct. The purpose of this parameter is to protect against excessive memory swapping. If this budget is exceeded, simulation errors out. You can adjust this value based on your available memory resources.

This option is applicable only for models that connect blocks from Simscape Multibody library to Simscape blocks, or blocks from other add-on products. Use the Statistics Viewer to determine whether your model has 1-D/3-D connections. For more information, see 1-D/3-D Interface Statistics.

When a Simscape Multibody block is connected directly to a Simscape network, an additional derivative may be required for the network to be solved. When you select this check box, the solver automatically applies input filtering to the signal entering the Simulink-PS Converter block to obtain this additional derivative. The Filtering time constant parameter provides the time constant for the delay.

Note

This check box is selected by default. If you clear it, and the 1-D/3-D connection requires the additional derivative, the solver issues an error message.

This parameter specifies the filtering time constant, in seconds, for the automatic input filtering for 1-D/3-D connections. The parameter value applies globally to all connections belonging to the network that includes this Solver Configuration block.

Dependencies

To enable this parameter, select the Apply filtering at 1-D/3-D connections when needed check box.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Introduced in R2007a