How Simscape™ Simulation Works

Simscape™ Simulation Phases

Simscape™ software gives you multiple ways to simulate and analyze physical systems in the Simulink® environment. Running a physical model simulation is similar to running a simulation of any other Simulink model. It entails setting various simulation options, starting the simulation, and viewing the simulation results. See the Using Simulink documentation for a general discussion of these topics. This chapter focuses on aspects of simulation specific to Simscape and SimHydraulics® models. Refer to the SimMechanics™ and SimDriveline™ documentation for specifics of simulating and analyzing SimMechanics and SimDriveline models.

You might find this brief overview helpful for constructing models and understanding errors.

Simscape simulation sequence is shown in the following flow chart.

It consists of the following major phases:

  1. Model Validation

  2. Network Construction

  3. Equation Construction

  4. Computing Initial Conditions

  5. Performing Transient Initialization

  6. Transient Solve

Model Validation

Simscape solver first validates the model configuration and checks your data entries from the block dialogs. In particular:

Network Construction

After validating the model, Simscape solver constructs the physical network based on the following principles:

Equation Construction

Based on the network configuration, the parameter values provided in the block dialogs, and the global parameters defined by the fluid properties, if applicable, Simscape solver constructs the system of equations for the model.

These equations contain variables of the following types:

Computing Initial Conditions

Simscape solver computes the initial conditions only once, in the beginning of simulation (t=0).

Initial conditions are computed by setting all dynamic variables to 0, except those corresponding to blocks that have an initial condition field in their block dialogs, and solving for all the system variables. The blocks with initial conditions have their dynamic variables set according to the user-provided value in the block dialog. Initial conditions can only be set on dynamic variables, because these are the independent states for simulation. For example, the Translational Spring block has the Initial deformation parameter, so the corresponding spring position state is set to the initial offset specified in the block dialog. Refer to the block reference documentation to find which blocks have initial conditions specified through their dialogs.

It is required that the initial conditions for dependent dynamic states be set consistently. For example, the initial voltages on two parallel capacitors must be equal. When the solver detects dependent dynamic variables, it performs a check and issues an error if the initial conditions on dynamic states are not set consistently.

This concludes the initial conditions computation when the Start simulation from steady state check box in the Solver block dialog box is not selected (this is the default).

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, described previously. Although the solver tries to find the particular steady state resulting from the given initial conditions, it is not guaranteed to do so. All that is guaranteed is that if the steady-state solve succeeds, the state found is a steady state (within tolerance). Steady state means that the system variables are no longer changing with time. Simulation then starts from this steady state.

Performing Transient Initialization

After computing the initial conditions, or after a subsequent event (such as a discontinuity resulting, for example, from a valve opening, or a hard stop hitting the stop), Simscape solver performs transient initialization. This is done by fixing all dynamic variables and solving for algebraic variables and derivatives of dynamic variables. The goal of transient initialization is to provide a consistent set of initial conditions for the next transient solve phase.

Transient Solve

Finally, Simscape solver performs transient solve of the system of equations. In transient solve, continuous differential equations are integrated in time to compute all the variables as a function of time.

Simscape solver continues to perform the simulation according to the results of the transient solve until it encounters an event, such as a zero crossing or discontinuity. The event may be within the physical network or elsewhere in the Simulink model. If an event is encountered, Simscape solver returns to the phase of transient initialization, and then back to transient solve. This cycle continues until the end of simulation.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS