Main Content

Understanding How the Partitioning Solver Works

Learn how the Partitioning Solver works with the Nonlinear Electromechanical Circuit with Partitioning Solver example. The solver creates partitions of the model and selects the best solver for the given partition. You can use the Statistics Viewer tool to analyze how the Partitioning Solver partitions the model. The tool gives details about the each partition including the solver type and equation type.

  1. To open the example model, enter ssc_nonlinear_electromechanical_circuit in the MATLAB® Command Window.

    Block diagram of the model

  2. To view model statistics, in the model window, on the Debug tab, click Simscape > Statistics Viewer. Click the Update Model button to populate the viewer with data.

  3. Select Partitions under 1-D Physical System. The solver divides the system into three partitions. One partition uses the Forward Euler solver, and the other two use Backward Euler.

    Statistics Viewer showing the Partitioning details

  4. To view additional details for a partition, select the row for that partition. The Variables tab shows the variable path and label for each variable in the partition. The Equations tab shows the block and component for the partition.

    Statistics Viewer showing the variable name for the first partition

  5. To navigate to a block in the partition, select the row for that block under either the Variables or Equations tab, and click the Highlight Block button. You can also navigate to the source code, where available, that generates a certain equation.

    Select Inertia.w under the Variables tab, and click Source Code.

    Statistics Viewer showing the equation link for the first partition

    t == inertia * w.der;

    Similarly, you can see the equations for other partitions.

The Partitioning Solver assembles all these equations into the system of equations required to simulate the model:

System of equations

Here, Sensor.phi is the abbreviation of the Sensing.Ideal Rotational Motion Sensor.phi variable. m0 is the boolean originating from the equation in the Diode block, where Diode.v is compared with the Forward voltage parameter:

    if v > Vf
      i == (v - Vf*(1-Ron*Goff))/Ron;
      i == v*Goff;

Comparing this system of equations with the Statistics Viewer tool data, you can see that the first row of the system is in Partition 3, because Partition 3 owns the Inertia.t state variable. Similarly, the second and third rows are in Partition 2, and the fourth row is in Partition 1.

The equation type of a partition depends only on the terms involving owned states and is not affected by the connection function. For example, Partition 3 lists its Equation Type as Linear time-invariant, despite having nonlinearities in the connection function term, because it is linear time-invariant with respect to its owned states.

During simulation, the Partitioning Solver solves the partitions in the order listed in the Statistics Viewer tool. The solver uses the updated state values, obtained after solving each partition, to perform state update for upstream partitions.

Related Topics