The Partitioning solver is a Simscape™ fixed-step, local solver that improves performance for certain models. However, when using the Partitioning solver, some Simscape Driveline™ models generate warnings, stop and generate errors, fail to initialize, or yield signal chatter due to numerical difficulties. These examples show how to eliminate errors, mitigate warnings, and reduce chatter by resolving numerical difficulties.

Numerical difficulties that prevent models from simulating to completion, yield warnings, or introduce chatter are typically related to blocks that have high stiffness or friction. Simscape Driveline blocks with high stiffness or friction include clutches, belt pulleys, tires, and flexible shafts.

To resolve numerical difficulties in models that contain these blocks, use one or more of the methods:

Adjust the solver settings.

Remove high-priority variable redundancies.

Unlock clutch initial conditions.

Loosen friction-related tolerances.

Eliminate high-stiffness blocks.

Eliminate degrees of freedom.

When simulating models using the Partitioning solver:

Simulate the model by using a global variable-step solver to capture baseline results that agree with your mathematical model or empirical data.

Configure the local solver for a Partitioning solver simulation.

Run the Partitioning solver simulation. If the simulation:

Runs to completion — Compare the Partitioning solver simulation results to the baseline results. If the results do not agree, adjust the solver settings or model components and simulate again. For example, decrease the step size or simplify model dynamics. For more information, see Reduce Numerical Stiffness (Simscape), Choose Step Size and Number of Iterations (Simscape), and Reduce Fast Dynamics (Simscape).

Repeat until the simulation returns results that agree with the baseline results.

Fails to simulate to completion due to numerical issues — Resolve the issues by applying one or more of the methods listed in Resolving Issues for Blocks with Stiffness or Friction. Rerun the simulation. Repeat until the simulation runs to completion, then compare the results to the baseline results. If the results do not agree, adjust the solver settings or model components and rerun the simulation. Repeat until the Partitioning solver simulation returns results that agree with the baseline results.

This example shows how to resolve numerical difficulties that generate initial condition
errors and warnings. When an initial condition issue prevents a simulation from initiating
or running to completion, MATLAB^{®} stops the simulation and generates an error. When a simulation is unable to
satisfy high-priority targets, the simulation continues to run, but MATLAB generates a warning.

Open the model. At the MATLAB command prompt, enter:

%% Open the Model model = 'sdl_transmission_helicopter_base'; open_system(model)

The model window indicates that the Simulink

^{®}global solver is a variable-step solver.To examine the Simscape local solver configuration, open the Solver Configuration block settings.

The model is configured to simulate using the Simulink global solver because the

**Use local solver**check box is cleared.Simulate the model and then, to examine the baseline results from the variable-step simulation, open the Scope block.

Configure the model for a Partitioning solver simulation. In the Solver Configuration block settings, select the

**Use local solver**check box.When you select the

**Use local solver**check box, related parameters are enabled. By default, the parameters in the Solver Configuration block are set to::**Solver type**—`Partitioning`

**Sample time**—`0.05`

**Partition method**—`Robust simulation`

**Partition storage method**—`Exhaustive`

**Use fixed-cost runtime consistency iterations**— Selected**Nonlinear iterations**—`3`

Simulate the model.

The simulation generates two warnings and one error. The error prevents compilation because it stops the simulation.

Warning: Initial conditions for eliminated differential variables not supported by partitioning solver. The following states may deviate from requested initial conditions: ['sdl_transmission_helicopter_base/Inertia Main Rotor'] Inertia_Main_Rotor.w ['sdl_transmission_helicopter_base/Inertia Tail Rotor'] Inertia_Tail_Rotor.w Warning: Simscape succeeded in finding consistent states with which to start the simulation, but the states found may deviate from requested initial conditions. Error: ['sdl_transmission_helicopter_base/Solver Configuration']: At time 0.050000, one or more assertions are triggered. See causes for specific information. Caused by: Argument of sqrt must be nonnegative. The assertion comes from: Block path: sdl_transmission_helicopter_base/Lift and Drag Main Rotor/L^.5 Assert location: In between line: 48, column: 19 and line: 48, column: 20 in file: Dir:\Program\Files\MATLAB\R20XXx\toolbox\physmod\simscape\library\m\ physical_signal_legacy\+foundation\+physical_signal\+functions\math_function.ssc

The error message indicates that the solver returned a negative value for a square-root computation. If a variable-step simulation runs to completion, but a fixed-step simulation generates this type of error for the same model, typically, the local solver sample time is too large or the local solver number of nonlinear iterations is too small. Increase the number of nonlinear iterations for the local solver. In the Solver Configuration block settings, set

**Nonlinear iterations**to`9`

. Then simulate the model and view the results in the Scope block.Warning: Initial conditions for eliminated differential variables not supported by partitioning solver. The following states may deviate from requested initial conditions: ['sdl_transmission_helicopter_base/Inertia Main Rotor'] Inertia_Main_Rotor.w ['sdl_transmission_helicopter_base/Inertia Tail Rotor'] Inertia_Tail_Rotor.w Warning: Simscape succeeded in finding consistent states with which to start the simulation, but the states found may deviate from requested initial conditions.

The simulation runs to completion, but it still generates two warnings. The results agree with the baseline results in terms of the significant characteristics for the model (such as the slopes, magnitudes, and inflection points).

Both warnings are caused by initial condition issues. Investigate the warnings by examining the variables in the model. To open the Variable Viewer, on the

**Apps**tab, in the**Physical Modeling**category, click**Simscape Variable Viewer**. To filter for variables that have targets that the simulation is unable to satisfy, click the arrow to the right of the**Status**column header, and in the drop-down list, clear the**OK**check box.There are several variables that have

`High`

priority targets that the simulation is unable to satisfy.The two inertia blocks that are mentioned in the first warning are among the blocks that have problematic high-priority targets. The Partitioning solver has converted these variables to nondifferential variables, which are algebraically related to remaining differential variables. Initial conditions for nondifferential variables are not supported by the Partitioning solver.

The Inertia Tail Rotor initial rotational velocity, -400 (rpm), is algebraically constrained to match the rotational velocity specified in the Flexible Shaft block. Likewise, the Inertia Main Rotor initial rotational velocity of -80 (rpm) is algebraically constrained to match the rotational velocity of the

**R**node of Planetary Main Rotor block.Eliminate the first warning by removing the priority for the problematic initial condition targets. Open both the Inertia Main Rotor block and the Inertia Tail Rotor block, and, in the

**Variables**settings, set the priority for the**Rotational velocity**variable to`None`

. Then simulate the model, examine the variables, and view the results.Warning: Simscape succeeded in finding consistent states with which to start the simulation, but the states found may deviate from requested initial conditions.

The inertia initial condition warning is not generated and the Variable Viewer no longer shows the velocity for the inertia among the failed targets. The results agree with the baseline results in terms of the significant characteristics for the model.

Examine the Variable Viewer data. The remaining warning is issued because there is a large difference between the

**Target**and**Start**values for several high priority targets. To reduce the difference, decrease the sample time for the local solver. In the Solver Configuration block settings, set**Sample time**to`0.01`

. Then simulate the model and view the results.Warning: Simscape succeeded in finding consistent states with which to start the simulation, but the states found may deviate from requested initial conditions.

There is still a warning for several high-priority targets, but the difference between the

**Target**and**Start**values is smaller. The results match the baseline results in terms of the significant characteristics for the model and, due to the decrease in sample time, the**Main**signal is smoother.

This example shows how to reduce chatter, a type of signal noise. Chatter can occur when you use the Partitioning solver to simulate a model that includes a block that models friction. Certain Simscape Driveline brake, clutch, drive, gear, and tire blocks can model friction.

Open the model. At the MATLAB command prompt, enter:

%% Open the Model model = 'sdl_capstan'; open_system(model) % Expand the Model Window to Accomodate the Property Inspector modelLocation = get_param(model,'location'); modelLocationAdjustment = [0 0 400 100]; modelLocationAdjusted = modelLocation + modelLocationAdjustment; set_param(model,'location',modelLocationAdjusted)

The model is configured for variable-step simulation.

The capstan is represented by a Belt Pulley block, a drive block that models friction.

Enable Simscape local data logging for the model and for the Capstan block.

Open the model Configuration Parameters. On the

**Modeling**tab, click**Model Settings**>**Model Settings**.In the left pane, select

**Simscape**.Set

**Log simulation data**to`Use Local Settings`

.Select the

**Record data in Simulation Data Inspector**check box.Select the

**Open viewer after simulation**check box.To apply the changes to the

**Configuration Parameters**, click**OK**.Click the Capstan block.

Open the Property Inspector. On the

**Modeling**tab, click the arrow on the right side of the**Design**section. In the**Data Management**category, select**Property Inspector**.In the

**Logging**settings, select the**Log simulation data**check box.

Simulate the model and then, to examine the results for the Capstan block

**B**-node force, in the Simulation Data Inspector:Expand the

**Capstan**node.Select the

**fB**check box.

The results show that the load force causes slip when it exceeds the capstan force limit.

Close the Simulation Data Inspector.

Configure the model for a Partitioning solver simulation. Click the Solver Configuration and in the Solver Configuration block settings:

Select the

**Use local solver**check box.Set

**Solver type**to`Partitioning`

.Set

**Partition method**to`Robust simulation`

.Set

**Solver type**to`Partitioning`

.Set

**Partition storage method**to`Exhaustive`

.

Simulate the model and examine the results in the Simulation Data Inspector.

The Capstan block

**B**-node force shows significant chatter during the Partitioning solver simulation. Refer to the documentation for the Belt Pulley block for sources of stiffness or discontinuities.According to the documentation,

*V*is the relative velocity between the belt and pulley periphery. The idealization of the discontinuity at_{rel}*V*= 0 is both difficult for the solver to resolve and not physically accurate. To alleviate this issue, the friction coefficient is assumed to change its value as a function of the relative velocity such that_{rel}$$\mu =-f\ast \mathrm{tanh}\left(4\ast \raisebox{1ex}{${V}_{rel}$}\!\left/ \!\raisebox{-1ex}{${V}_{thr}$}\right.\right),$$

where:

*μ*is the instantaneous value of the friction coefficient.*f*is the steady-state value of the friction coefficient.*V*is the friction velocity threshold._{thr}

Therefore, for small values of

*V*, the friction force stiffness near_{thr}*V*increases significantly._{rel}To resolve this issue, increase the

*V*value in the Capstan block settings. In the_{thr}**Contact**settings, increase**Velocity threshold**from`0.001`

to`0.1`

.Simulate the model and examine the results in the Simulation Data Inspector.

The Capstan block

**B**-node force no longer shows significant chatter.Compare the data from the variable-step simulation to the new data from the fixed-step solver simulation.

In the Simulation Data Inspector, select

**Compare**.To configure the comparison, in the top, right pane:

Click the arrow on the right side of the

**Baseline**setting. At the bottom of the list, click**Signals**and then select`sdl_capstan.Capstan.fB (Run 1: sdl_capstan)`

.Click the arrow on the right side of the

**Compare to**setting. At the bottom of the list, click**Signals**and then select`sdl_capstan.Capstan.fB (Run 3: sdl_capstan)`

.Click

**Compare**.

To change the Partitioning solver results line color, in the

**Properties**pane, in the**Compare to**column, click the colored**Line**, select a different color and style, such as yellow and dash-dot, and then click**Set**.

The Capstan block

**B**-node force no longer shows significant chatter. The Partitioning solver and Variable-step solver simulation results agree for much of the simulation. The difference in the results is the expected difference for a comparison of variable-step and fixed-step solver results.

The figure shows a time-scaled view of the difference between the results of the variable-step simulation and the results of the Partitioning solver fixed-step simulation.

By decreasing the step size during a simulation, the variable-step solver is able to
capture fast dynamics that occur at simulation time, *t* = 3 s. The
Partitioning solver steps over the fast dynamics because the fixed-step size is too large.
You could reduce or resolve the difference by decreasing the step size for the Partitioning
solver, but doing so increases simulation duration time and can result in a real-time
simulation overrun.

The overshoot of the fixed step solver at simulation time *t* = 3.014 s
is also a characteristic of fixed-step solvers. Reducing the step size for the Partitioning
solver can minimize the overshoot but can also result in a real-time simulation
overrun.

This example also shows how to resolve numerical difficulties that yield chatter in Simscape Driveline simulations that use the Partitioning solver. In this case, the chatter is caused by stiffness. A stiff model is one that contains both fast and slow dynamics.

Open the model with block. At the MATLAB command prompt, enter:

%% Open the Model model = 'sdl_vehicle_dual_clutch'; open_system(model)

The model is configured for a variable-step simulation that uses the global solver. Data logging is enabled only for the signal that contains the gear state data.

Configure the model for data logging. For this example, tire slip is the data of interest and logging additional data increases the computational cost of simulation. Enable data logging for tire slip and disable data logging for the gear state.

In the Vehicle subsystem, the Tire LF Tire (Magic Formula) block represents the left-front tire of the vehicle. The Tire LF

**S**port, which transmits the tire slip data, is a physical signal port. You can log physical signal data using Simulink data logging. The destination for the signal is the Tire slip Scope block, which is in the Scopes subsystem.Open the Scopes subsystem.

The tire slip data is in the signal that the FrontSlip From block transmits to the Tire slip Scope block. Select the signal, and in the Simulink toolstrip, on the

**Signal**tab, click the arrow on the right side of the**Monitor**section. In the**Signal Monitoring**category, click**Log Signals**.

In the Transmission Controller subsystem, in the Shift state subsystem, the z3 Unit Delay block transmits the gear state.

Open the Transmission Controller subsystem.

Open the Shift state subsystem.

The Gear state G subsystem transmits the gear state to a Unit Delay block, which, in turn, transmits the data to the Gear state Outport block. The signal that connects the Unit Delay block to the Gear state Outport block is marked for data logging. Select the signal, and in the Simulink toolstrip, on the

**Signal**tab, click the arrow on the right side of the**Monitor**section. In the**Signal Monitoring**category, click**Log Signals**.

Obtain and examine the baseline results. Simulate using the global variable-step solver and review the results in the Simulation Data Inspector.

Run the simulation. In the Simulink toolstrip, on the

**Simulation**tab, in the**Simulate**section, click**Run**.Open the Simulation Data Inspector. In the Simulink toolstrip, on the

**Simulation**tab, click the arrow on the right side of the**Review Results**section, and, in the**Signal Logging Results**category, click Signal Logging Results.To inspect the tire slip data, select the**From8:1**check box.

Configure the local solver for fixed-step simulation using the Partitioning solver.

In the model, open the Solver Configuration block settings.

Select the

**Use local solver**check box.

Simulate using the Partitioning solver.

Compare the baseline and Partitioning solver results in the Simulation Data Inspector.

Open the Simulation Data Inspector.

In the top, left pane, select

**Compare**.Configure the comparison. In the top, right pane:

On the right side of the

**Baseline**setting, click the down arrow and select`Run 1: sdl_vehicle_clutch`

.On the right side of the

**Compare to**setting, click the down arrow and select`Run 2: sdl_vehicle_clutch`

.Click

**Compare**.

To change the Partitioning solver results line color, in the

**Properties**pane, in the**Compare to**column, click the colored**Line**, select a different color, such as yellow, and then click**Set**.

The results from the Partitioning solver simulation contain significant chatter.

The signal chatter is due to stiffness that is related to inertia in the Tire (Magic Formula) blocks. The inertia is also the cause of the first initial condition warning. To resolve the signal chatter and the initial condition warning, simplify the tire dynamics:

Open the Vehicle subsystem.

Open the Tire LF block settings.

In the

**Dynamics**settings, set**Inertia**to`No Inertia`

.Using the same process, omit the inertia for the Tire RF, Tire LR, and Tire RR blocks.

The second initial condition warning is due to the locked state of the Dog Clutch 1 block at the beginning of the simulation. The Partitioning solver cannot solve the dynamics for the initial torque that the locked clutch transmits between the ring and the hub. To resolve the warning:

Open the Dual Clutch Transmission subsystem.

Open the Gears subsystem.

Open the Dog Clutch 1 block settings. In the

**Initial Conditions**settings, set**Clutch initial state**to`Unlocked`

.

Simulate and then examine and compare the results in the Simulation Data Inspector.

Run the simulation.

Open the Simulation Data Inspector and compare the results from the Partitioning solver fixed-step simulation to the baseline results from the variable-step simulation. To configure the comparison, in the top, right pane:

On the right side of the

**Baseline**setting, click the down arrow and select`Run 1: sdl_vehicle_clutch`

.On the right side of the

**Compare to**setting, click the down arrow and select`Run 3: sdl_vehicle_clutch`

.Click

**Compare**.

The results from the Partitioning solver simulation no longer contain significant chatter and are much more similar to the baseline results.

- Increase Simulation Speed Using the Partitioning Solver (Simscape)
- Reduce Numerical Stiffness (Simscape)
- Reduce Fast Dynamics (Simscape)
- Reduce Zero Crossings (Simscape)

- Variable Viewer (Simscape)
- Model Statistics Available when Using the Partitioning Solver (Simscape)