Resolve Partitioning Solver Simulation Issues for Simscape Driveline Models
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.
Resolving Issues for Blocks with Stiffness or Friction
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.
Using the Partitioning Solver
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, Choose Step Size and Number of Iterations, and Reduce Fast Dynamics.
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.
Diagnose Unexpected Simulation Behavior Due to Nonlinearities
This example uses a model of a helicopter taking off to show how to diagnose a numerical issue caused by a nonlinearity. The model uses a Translational Hard Stop block to represent the interaction of the helicopter chassis with the ground. When the helicopter takes off, the block implements smoothing to transition away from a position of zero. The partitioning solver produces unexpected results because of this smoothed transition.
Open the model. At the MATLAB® command prompt, enter:
Note that the automatic solver selection is
ode23t
. This is a variable-step solver.Inspect the Solver Configuration block settings
Note that Use local solver is off. This means that the simulation uses a global solver.
Generate baseline results from the variable-step, global solver and open the Scope block.
Configure the model to use the partitioning solver. In the Solver Configuration block settings, select Use local solver.
When you select Use local solver, the block enables related parameters. The default parameter settings are:
Solver type —
Partitioning
Sample time —
0.05
Partition method —
Robust simulation
Partition storage method —
Exhaustive
Use fixed-cost runtime consistency iterations — on
Nonlinear iterations —
3
Simulate the model.
The simulation runs to completion, but it generates unexpected results.
To diagnose this behavior, reduce the simulation sample time. Set Sample time to
0.01
and run the simulation.The partitioning solver results now reflect the baseline results. This confirms that the model is valid and is generated unexpected results for numerical reasons.
To diagnose the numerical issue, examine the results in the Simscape Results Explorer. Compare Chassis.f and Translational_Hard_Stop.f to observe the fast dynamics that affect the system.
The force variables both show excessive noise at the beginning of the simulation, when the helicopter takes off. You can use the Statistics Viewer tool to learn more about the nature of the problem. The figure shows Translational_Hard_Stop.f is in a partition by itself.
Translational_Hard_Stop.x is in a different partition because the force and position relationship is nonlinear in the current configuration of the Translational Hard Stop block. The dependency on Translational_Hard_Stop.x causes Chassis.f to also behave unexpectedly.
To generate accurate results using a
0.05
time step, you must remove the nonlinearity. Because the Translational Hard Stop block in the model uses theStiffness and damping applied smoothly through transition region, damped rebound
setting by default, the block implements smoothing near zero, when the helicopter takes off. This smoothing introduces a nonlinearity that the partitioning solver resolves by splitting the force variables and position variables into different partitions.Choose a setting that avoids nonlinearities. Set Hard stop model to
Full stiffness and damping applied at bounds, damped rebound
and reset the solver sample time to its original value. Finally, run the simulation again and open the Scope block to view the results.Removing the smoothing from the Translational Hard Stop block causes the simulation to generate the correct results using the original sample time.
Confirm that these actions remove the noise in the system. Open the Simscape Results Explorer and compare Chassis.f and Translational_Hard_Stop.f again.
Noise is not present in the updated solver configuration for both Chassis.f and Translational_Hard_Stop.f.
Resolve Chatter Due to Stiffness
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:
openExample('sdl/VehicleWithDualClutchTransmissionExample') model = 'VehicleWithDualClutchTransmission';
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.
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.
See Also
Related Examples
- Increase Simulation Speed Using the Partitioning Solver
- Reduce Numerical Stiffness
- Reduce Fast Dynamics
- Reduce Zero Crossings