Physical Networks environment and solver configuration

Utilities

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.

The block has one conserving port. You can add this block anywhere on a physical network circuit by creating a branching point and connecting it to the only port of the Solver Configuration block.

**Start simulation from steady state**When this box is selected, 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, starting from the initial state obtained from the initial conditions computation. 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.**Consistency tolerance**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

`1e-9`

, which is applicable to most cases.**Use local solver**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.

**Solver type**Select the solver type used for updating the states:

`Backward Euler`

,`Trapezoidal Rule`

, or`Partitioning`

. The**Use local solver**check box must be selected. The default is`Backward Euler`

.**Sample time**Specify the sample time for the local solver. The

**Use local solver**check box must be selected. The sample time must be positive. The default is`.001`

s.**Partition method**Select whether to prioritize speed or robustness when using Partitioning local solver:

`Robust simulation`

— Increase simulation robustness.`Fast simulation`

— Improve simulation performance.

The

**Use local solver**check box must be selected and the**Solver type**must be set to`Partitioning`

. The default is`Robust simulation`

.**Partition storage method**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 parameter**Partition memory budget [kB]**to specify the maximum allowed memory budget for storing the data.

The

**Use local solver**check box must be selected and the**Solver type**must be set to`Partitioning`

. The default is`As needed`

.**Partition memory budget [kB]**Specify the maximum memory budget, in kB, allowed for storing cached partition data. The

**Partition storage method**method must be set to`Exhaustive`

. The default is`1024`

kB. If this budget is exceeded, simulation errors out. You can adjust this 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.**Use fixed-cost runtime consistency iterations**Lets you perform transient initialization at a fixed computational cost.

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.

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

**Use fixed-cost runtime consistency iterations**check box must be selected. The default number is`3`

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

**Use fixed-cost runtime consistency iterations**check box must be selected. The default number is`2`

.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.**Compute impulses**Lets you manage computational cost of impulse detection during transient initialization, both for global and local solvers. This check box becomes available when the

**Use fixed-cost runtime consistency iterations**check box is selected.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.

**Impulse iterations**Specify the number of impulse iterations at the time of transient initialization. The

**Compute impulses**check box must be selected. The default number is`2`

.**Linear Algebra**Specifies how the solver treats matrices. The parameter can have one of three values:

`auto`

,`Sparse`

, or`Full`

. The default value of the parameter is`auto`

. With this setting, the solver automatically selects the appropriate option, either sparse or full, for treating the matrices.Your choice of this parameter value is implemented in both model simulation and code generated from your model.

**Equation formulation**Specifies how the solver treats sinusoidal variables. The parameter can have one of two values:

`Time`

or`Frequency and time`

. The default value of the parameter is`Time`

.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.**Delay memory budget [kB]**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. The default number is`1024`

kB.**Apply filtering at 1-D/3-D connections when needed**This option is applicable only for models that connect blocks from Simscape Multibody™ Second Generation 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.

**Filtering time constant**This parameter specifies the filtering time constant for when the

**Apply filtering at 1-D/3-D connections when needed**check box is selected. The parameter value applies globally to all connections belonging to the network that includes this Solver Configuration block. The default value is`0.001`

s.