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:

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

  2. Configure the local solver for a Partitioning solver simulation.

  3. 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.

Resolve Initial Condition Errors and Warnings

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.

  1. 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.

  2. To examine the Simscape local solver configuration, open the Solver Configuration block settings.

     See Code

    The model is configured to simulate using the Simulink global solver because the Use local solver check box is cleared.

  3. Simulate the model and then, to examine the baseline results from the variable-step simulation, open the Scope block.

     See Code

  4. Configure the model for a Partitioning solver simulation. In the Solver Configuration block settings, select the Use local solver check box.

     See Code

    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::

    1. Solver typePartitioning

    2. Sample time0.05

    3. Partition methodRobust simulation

    4. Partition storage methodExhaustive

    5. Use fixed-cost runtime consistency iterations — Selected

    6. Nonlinear iterations3

  5. Simulate the model.

     See Code

    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 
    
  6. 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.

     See Code

    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).

  7. 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.

  8. 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.

     See Code

    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.

  9. 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.

     See Code

    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.

Reduce Chatter Due to Friction

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.

  1. 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.

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

    1. Open the model Configuration Parameters. On the Modeling tab, click Model Settings > Model Settings.

    2. In the left pane, select Simscape.

    3. Set Log simulation data to Use Local Settings.

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

    5. Select the Open viewer after simulation check box.

    6. To apply the changes to the Configuration Parameters, click OK.

    7. Click the Capstan block.

    8. 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.

    9. In the Logging settings, select the Log simulation data check box.

     See Code

  3. Simulate the model and then, to examine the results for the Capstan block B-node force, in the Simulation Data Inspector:

    1. Expand the Capstan node.

    2. Select the fB check box.

     See Code

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

  4. Close the Simulation Data Inspector.

     See Code

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

    1. Select the Use local solver check box.

    2. Set Solver type to Partitioning.

    3. Set Partition method to Robust simulation.

    4. Set Solver type to Partitioning.

    5. Set Partition storage method to Exhaustive.

     See Code

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

     See Code

    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.

     See Code

    According to the documentation, Vrel is the relative velocity between the belt and pulley periphery. The idealization of the discontinuity at Vrel = 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

    μ=ftanh(4VrelVthr),

    where:

    • μ is the instantaneous value of the friction coefficient.

    • f is the steady-state value of the friction coefficient.

    • Vthr is the friction velocity threshold.

    Therefore, for small values of Vthr, the friction force stiffness near Vrel increases significantly.

  7. To resolve this issue, increase the Vthr value in the Capstan block settings. In the Contact settings, increase Velocity threshold from 0.001 to 0.1.

     See Code

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

     See Code

    The Capstan block B-node force no longer shows significant chatter.

  9. Compare the data from the variable-step simulation to the new data from the fixed-step solver simulation.

    1. In the Simulation Data Inspector, select Compare.

    2. To configure the comparison, in the top, right pane:

      1. 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).

      2. 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).

      3. Click Compare.

    3. 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.

     See Code

    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.

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.

  1. 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.

  2. 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.

    1. 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.

      1. Open the Scopes subsystem.

      2. 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.

       See Code

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

      1. Open the Transmission Controller subsystem.

      2. Open the Shift state subsystem.

      3. 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.

       See Code

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

    1. Run the simulation. In the Simulink toolstrip, on the Simulation tab, in the Simulate section, click Run.

       See Code

    2. 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.

       See Code

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

    1. In the model, open the Solver Configuration block settings.

    2. Select the Use local solver check box.

     See Code

  5. Simulate using the Partitioning solver.

     See Code

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

    1. Open the Simulation Data Inspector.

    2. In the top, left pane, select Compare.

    3. Configure the comparison. In the top, right pane:

      1. On the right side of the Baseline setting, click the down arrow and select Run 1: sdl_vehicle_clutch.

      2. On the right side of the Compare to setting, click the down arrow and select Run 2: sdl_vehicle_clutch.

      3. Click Compare.

    4. 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.

     See Code

    The results from the Partitioning solver simulation contain significant chatter.

  7. 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:

    1. Open the Vehicle subsystem.

    2. Open the Tire LF block settings.

    3. In the Dynamics settings, set Inertia to No Inertia.

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

     See Code

  8. 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:

    1. Open the Dual Clutch Transmission subsystem.

    2. Open the Gears subsystem.

    3. Open the Dog Clutch 1 block settings. In the Initial Conditions settings, set Clutch initial state to Unlocked.

     See Code

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

    1. Run the simulation.

       See Code

    2. 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:

      1. On the right side of the Baseline setting, click the down arrow and select Run 1: sdl_vehicle_clutch.

      2. On the right side of the Compare to setting, click the down arrow and select Run 3: sdl_vehicle_clutch.

      3. Click Compare.

     See Code

    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

More About