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.
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 generates a warning. The results agree with the baseline results in terms of the significant characteristics for the model (such as the slopes, magnitudes, and inflection points).
The warning is caused by initial condition issues. Investigate the issues by examining the variables in the model. To open the Variable Viewer, in the model window, on the Debug tab, click Diagnostics > 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.
Eliminate the warning by unlocking the initial state of the clutch. Open the
Unidirectional Clutch block and set the
Initial state parameter to
Unlocked
. Then simulate the model, examine the
variables, and view the results.
The initial condition warning is not generated and the Variable Viewer reports that all targets are satisfied. The results agree with the baseline results in terms of the significant characteristics for the model.
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.
Chatter in the front tire slip is due to the parameters specified for the Tire (Magic Formula) block. 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.
To better understand the cause of the warning, examine 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.
The Variable Viewer shows that several high priority variable targets are not satisfied. For some driveline models with clutches, this issue is resolved by unlocking any clutches that are initially locked. For a clutch, a locked initial state is more numerically constraining. For more information, see Fundamental Friction Clutch.
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.