# Documentation

## Driveline Simulation Performance

Driveline simulation involves the tradeoff between accuracy and speed inherent in all numerical simulation. Accuracy bundles two distinct issues, the accuracy or fidelity of the model, versus of the accuracy of the simulation methods. This section describes the inherent complexity of driveline models, as distinct from general simulation issues.

About solvers and simulation methods, see Setting Up Solvers for Physical Models and Making Optimal Solver Choices for Physical Simulation.

Improving the fidelity of driveline models involves making blocks that are more accurate representations of the actual physical components. For example, you can make the internal dynamics of the components represented by blocks more or less accurate and realistic by:

• Turning physical effects on and off, such as nonideal gear meshing losses (gear efficiency)

• Including or omitting compliance (including damped spring reactions), hard stops, and time lags

• Including or omitting Coulomb friction from clutches and clutch-like elements

• Steepening or softening sharp gradients in physical thresholds, such as velocity thresholds in clutches and nonideal gears

Modeling these physical effects requires additional dynamics and algebraic constraints, generates computationally more intensive simulations, and can reduce simulation speed, often considerably.

#### Model Fidelity in Ordinary Desktop Simulation

• Very small velocity threshold values and short time lags can degrade numerical convergence or simulation performance. Consider whether you can make these values larger in your simulation.

• If your model includes gears with efficiency loss, select adaptive zero-crossing in the Model Configuration Parameters menu.

#### Model Fidelity in Fixed-Step, Real-Time, and Hardware-in-the-Loop Simulation

Apart from clutches, MathWorks® does not recommend including these fidelity enhancements in simulation with fixed-step solvers, particularly real-time or hardware-in-the-loop simulation.

If you do need to model compliance or efficiencies, consider reducing the number of such elements by:

• Deleting unnecessary lossy elements

• Combining lossy elements into as few elements as possible

If you simulate with a fixed-step solver, avoid:

• Very small velocity thresholds.

• Time lags that are short compared to the fixed time step.

### Optimize Simulation of Stiff Drivelines

When modeling a driveline, you might not need to model all compliances, depending on the purpose of your model. If there are specific compliances that are more dominant than others, then you might need to model only these compliances.

The coupling of drivelines to external loads — for an automobile, the wheel-tire-road load — is often stiff. Driving and road conditions typically change over seconds or tens of seconds. However, the internal changes of an automobile's drive system can change over fractions of a second, especially if clutch changes and braking are at work. In addition, clutch locking and unlocking events create dynamic discontinuities.

For example, a tire is "stiff" in responding slowly to imposed forces and experiencing slip. A tire also has a broad range of frequency responses. You might model tire compliance only when you model the automobile accelerating from rest.

### Optimize Simulation of Clutches

Clutch locking and unlocking events generate discontinuous changes in driveline dynamics and can cause major inaccuracies, particularly if you are simulating with a large variable-step solver tolerance or a large fixed time step.

• Clutch discontinuities change the number and nature of the degrees of freedom of the driveline during the simulation.

• Because clutch discontinuities are idealized events, they cause the driveline torques to change abruptly, as the clutch switches abruptly between static and kinetic friction.

#### Smoothing and Offsetting Clutch Control Signals

You exert dynamic control on the locking and unlocking of clutches through their input pressure or other locking signals.

The simplest way to force a locking is to abruptly change a clutch pressure from zero to some predetermined value. You can then force an unlocking by abruptly changing the clutch pressure back to zero. Such abrupt clutch pressure changes are not realistic. The best solution is to model full clutch actuation. However, you can use simplified models to reduce model complexity.

You can improve your clutch modeling and make it more realistic by ensuring that the clutch pressure signals rise and fall smoothly, not suddenly. The Simulink® Sources library provides many ways to create such signals. You can also reshape existing signals using blocks such as State-Space and Transfer Fcn.

These example models illustrate smoothed clutch pressure signals:

• sdl_simple_clutch ramps up and down the input clutch pressure.

• sdl_vehicle uses Transfer Fcn blocks to reshape and smooth sharp clutch pressure signals.

You can adjust internal parameters within each clutch block to control when and how the clutch locks and unlocks.

Changing Pressure or Force Threshold.  The locking signal coming into a clutch is physical, with units of force or pressure. With some clutches, you can specify a force or pressure threshold Fth or Pth. This threshold imposes a cutoff on the clutch pressure such that the effective controlling pressure is PPth rather than P. If P < Pth, no pressure at all is applied. (Normal force between clutch surfaces can substitute for pressure.) Raising the pressure or force threshold of a clutch that has an adjustable threshold makes it harder for the clutch to engage.

 Tip   If a clutch in your simulation engages too easily, consider raising its pressure or force threshold. If the clutch has difficulty engaging, consider lowering this threshold.

Changing Velocity Tolerance.  Most clutch blocks have a velocity tolerance parameter ωTol that controls when the clutch locks or unlocks.

• A clutch can lock only if the relative shaft velocity ω lies in the range –ωTol < ω < +ωTol.

• A clutch unlocks if the torque across the clutch exceeds the static friction limit, which depends in turn on the normal force across the clutch.

You specify ωTol values through each clutch block.

 Tip   If a clutch switches between locked and unlocked too easily during simulation, consider increasing its velocity tolerance.

#### Adjusting Solvers for Clutch Discontinuities

If you use a solver tolerance or step size that is too large, clutch discontinuities can cause major inaccuracies.

• If the variable-step tolerances are too large, the solver finds it difficult or impossible to accurately track the dynamic change associated with the change of friction torques acting on the driveline.

• If the fixed step size is too large, the solver cannot accurately resolve abrupt changes such as clutch locking and unlocking events. A fixed-step solver cannot adaptively reduce its step size to compensate.

 Tip   If you encounter convergence failures or abrupt driveline state (velocity) changes at or around the instant of clutch state changes, consider reducing the solver tolerances (for a variable-step solver) or the step size (for a fixed-step solver). Set the variable-step solver tolerance or the fixed-step solver step size to the smallest value possible that produces an acceptable simulation speed (not too slow).
AdjustmentSolver Type and SettingEffect on AccuracyEffect on SpeedEffect on Clutch Simulation
ReduceVariable-step: tolerancesIncreasesReducesImproves resolution and simulation of abrupt locking and unlocking
Fixed-step: step size
IncreaseVariable-step: tolerancesReducesIncreasesDegrades resolution and simulation of abrupt locking and unlocking
Fixed-step: step size