Accelerating the pace of engineering and science

# Physical Modeling of Mechanical Friction in Simulink

By Stephen Lunzman, Caterpillar, Dallas Kennedy, MathWorks, and Steve Miller, MathWorks

While sometimes an obstacle, friction makes possible much that we take for granted—hence, its importance in mechanical engineering and control design. In automotive engineering, for example, friction is undesirable in pistons and cylinders, but essential in clutches and in tire-road contact.

Two approaches are available for modeling mechanical friction: continuous and locking. The method you select depends on the system being modeled and on your simulation goals. This article describes methods for modeling and simulating continuous and hybrid continuous-locking mechanical friction using Simulink, Simscape, SimDriveline, and SimMechanics. Topics covered include:

The sample models are available for download. Each model’s DOC block explains model details.

### Numerical Simulation of Friction

The numerical simulation of a dynamical system requires calculating solutions at discrete time intervals within a fixed simulation period. Because the system changes in continuous time, this discretization introduces a solution error. To control this error we must control either the integration error or the time step size. More accurate results require smaller step size and more computational effort. Less computational cost allows for a larger step size but reduces the accuracy of the solution. The methods used to simulate friction can significantly increase computational cost by altering this tradeoff. These sections explain how to make these choices and how they affect important applications, such as control design and real-time simulation.

#### Continuous Versus Locking Friction — Choice of Solvers

Solver choice is a key decision in friction simulation. Your choice of solver depends on whether you are modeling continuous or a hybrid of continuous and locking friction.

Ordinary differential equation (ODE) integration methods or solvers are divided into two classes based on whether they control step size or solution error:

Fixed-step (FS) solvers specify time step size and let the dynamics and available computational precision determine the solution error. Such solvers map a given length of simulated time to a given length of real or clock time. When clock time is the decisive constraint, the simulation is called real-time.

Variable-step (VS) solvers specify an upper bound on solution error but must adapt the step size to prevent the error from getting too large. The simulated time interval is a given, but the real or clock time is a function of the dynamics and available computational speed.

Solver type is also classified by the order of the interpolation method that approximates the dynamics from one time step to the next. With locking friction, it is crucial not to relax the solver restrictions with a too-large error tolerance in the VS case or with a too-large time step size in the FS case. Otherwise, the solver will neither resolve locking-unlocking transitions nor converge to the correct solution.

Friction affects different DoFs in different ways over different time scales. When some forces are stronger than others or some DoFs vary much more quickly than others, the system is technically stiff, and a stiff ODE solver is optimal. In simulating stiff systems, nonstiff ODE solvers have difficulty either finding the correct time step or limiting the solution error.

Stiff system with stiff solverStiff system with nonstiff solver
AdvantagesLarger and fewer time steps, faster convergenceLow cost per time step
DisadvantagesHigher cost per time stepSmaller and many more time steps, slower convergence, higher order preferred

### What is Friction?

Mechanical friction results from sliding contact, usually dry or lubricated, between two surfaces. Friction opposes organized motion and dissipates mechanical work irreversibly into heat. Dissipation includes work-to-heat conversions of many types, such as hydrodynamic viscosity, electrical resistance, and magnetic hysteresis.

Friction between dry surfaces in contact is discontinuous in both nature and effect. These forces are proportional to the normal force acting on the surfaces and, in some cases, vary with contact area A.

`Friction = -μ(v, A)·Fnormal`

The coefficient of friction μ generally depends only weakly on slip or relative velocity v, but causes a dynamical discontinuity when the slip and consequently the friction change sign. At very low slip, dry kinetic friction changes to static friction and locks the surfaces together, causing a kinematic discontinuity that removes a degree of freedom (DoF) from the system. Together, static and kinetic friction are often referred to as stiction.

Static friction is a force of constraint and does no work on the bodies in contact, an exception to the generally dissipative nature of friction. Dry kinetic and static friction transform into one another and must be treated as a single dynamic constraint. This transformation is practically instantaneous, occurring over very small velocity and time scales relative to the overall motion.

In lubricated sliding friction, a mediating liquid modifies the surface contact. This type of continuous friction reflects the viscous character of fluids, and the coefficient μ is proportional to a positive power of the slip and vanishes in the limit of zero slip.

### Quasi-Locking and True-Locking Friction as Approximations

Most cases of stiffness in friction modeling are associated with static friction. Locking and unlocking events take place over very short times. To simulate these changes numerically, you can choose either quasi-locking or true-locking friction.

#### Quasi-Locking Friction

Quasi-locking friction, which approximates the locking near zero slip by a large viscosity and with no actual locking, is easy to implement and is robust to conflicts among DoFs and constraints. Such a force, being much larger than the others, is necessarily very stiff.

With quasi-locking friction, the quasi-locked DoF as modeled undergoes small changes during the simulation and is not truly locked. This fact might pose a problem for fidelity, depending on the purpose of the model. If the model simulates the dynamics of a machine apart from the locking component, which is treated as a black box with irrelevant internal dynamics, this solution is effective and reasonable. The smoother (more differentiable) the quasi-locking friction as a function of slip, the more favorable is the tradeoff between simulation speed and accuracy.

Quasi-locking generally fails in the following situations:

• The goal is to simulate the locking DoF itself (in particular, constraint forces related to this DoF).
• Large external forces such as gravity act continually on the locking DoF, so the quasi-locking DoF would drift continuously.

#### True-Locking Friction

By imposing an additional constraint, true-locking static friction eliminates the locked DoF from the system as long as the locking conditions hold. These conditions must be repeatedly tested to ensure that they continue to hold. The key locking condition applies to the relative motion of the surfaces sliding past one another. If the slip becomes small enough (defining a locking velocity range near zero), the surfaces stick together. The surfaces themselves supply whatever static friction is necessary to keep them from unsticking. This locking is typically undone only if an external force strong enough to overcome the static friction is applied along the contact surface between the bodies. These two key numbers—locking velocity threshold and static friction limit—characterize the transition from kinetic to static friction, and static to kinetic, respectively, typical of dry surfaces in contact.

The drawback is specifying the locking conditions and testing the motion and forces repeatedly for their validity, interrupting the simulation and removing or restoring the DoF, as required. The simulation applies an iterative algebraic test, a type of zero-crossing detection (ZCD), and creates an algebraic loop. ZCD frequently makes friction simulation costly, as well as hard to tune correctly and combine with other constraints.

These non-time-increment simulation steps (applying algebraic tests at one simulated time) are possible with an FS solver, but an FS solver cannot refine its detection of lockings and unlockings or its estimation of their true times of occurrence. FS solvers map simulation time to real time in a fixed way; the simulated time flow cannot be suspended while the locking conditions are adaptively checked. Instead, the locking conditions can be checked at successive, fixed simulated times, but this approach further reduces the simulation accuracy. True dynamic constraint testing requires a VS solver, one that can adapt its step size to better approximate the instantaneous transition and that is free to take as much clock time as it needs to achieve a given solution accuracy.

### Control Design with Friction — Trimming and Linearization

A critical complication in system and control design with friction arises when you attempt to linearize a simulation model by searching for a system’s steady states (trimming) and deriving its response to small changes (linearization). The trimming problem includes searching through discrete combinations of locked and unlocked DoFs while simultaneously searching over nonlocking DoFs by continuous variation.

In practice, trimming must be carried out in two stages: search first for discrete locked or unlocked states and then for continuous states. Each stage can require multiple iterations. Trimming methods that can only vary the states continuously do not work in the presence of locking or unlocking. The pattern of locked and unlocked DoFs must remain fixed. With a stiff solver, the quasi-locking approximation to stiction has a great advantage over locking/unlocking methods to trim the states of a frictional system.

### Real-Time Applications and Friction — Fixed-Step Solvers

Real-time simulation generally implies fixed-step (FS) solvers; simulation must be completed in a given clock time. When you add static friction to the simulation, this requirement implies these mutually exclusive solutions:

• Use an FS solver with locking friction and accept reduced accuracy for instantaneous locking and unlocking transitions artificially spread out over multiple simulated time steps. This is usually the better option for real-time simulation, if the step size is kept small enough.
• Model static friction with a highly stiff viscous force near zero slip; if necessary, choose a stiff FS solver or a nonstiff FS solver with small time step. Because fixed time steps generally miss the exact instants of locking and unlocking anyway, a stiff FS solver is often unnecessary for simulating locking friction.

Locking friction, despite its greater computational cost and complexity, suits some situations. Locking and unlocking creates greater realism, allows correct modeling of constraints, and enables a wider range of physical situations to be represented, including the presence of gravity and other external forces.

SimDriveline and SimMechanics contain several blocks for simulating locking friction. These include the Joint Stiction Actuator (JSA) in SimMechanics and the Controllable Friction and Fundamental Friction Clutches (CFC and FFC) in SimDriveline. SimMechanics also contains the `mech_friction` example library of simplified friction models based on the JSA. These blocks use hidden ZCD to model locking and unlocking. Nonstiff solvers can be used if there are no stiff continuous forces present in addition to the locking friction and if the tolerance or step size is kept small. Specialized friction blocks are also available in Simscape, and Stateflow event-based modeling software provides an alternative for modeling transitions between locked and unlocked states.

### Friction Modeling Examples

These friction examples and their Simulink models illustrate the two modeling methods and the modeling choices required for both.

#### Piston and Cylinder — One Degree of Freedom, Continuous or Locking

The two `Piston` models illustrate how to model the same physical situation with quasi-locking and true-locking approximations to vertically-acting contact stiction (Figure 1). The vertical motion is modeled in both in SimMechanics with a medium-order stiff VS solver. When it is vertically actuated by the oscillating excitation force, the piston sticks and unsticks to the cylinder’s inner wall. It alternates between static and kinetic friction, which are proportional to the horizontal normal contact force between piston and cylinder. Gravity is turned off.

Simulating kinetic friction poses no special difficulties, except for stiffness and force discontinuities. For prototyping and general purposes, a VS solver provides adequate accuracy and efficiency. FS solvers are best reserved for real-time applications or cases where VS solvers fail. In either case, examine the evolution and relative sizes of system forces for stiffness and discontinuities and switch to a stiff solver if needed.

Figure 1. Piston model.

In the continuous case, the friction is modeled in Simulink only and varies with slip (Figure 2). After opening the model, run the `plotFrictionCurve` M-script to graph the friction coefficient function.

In the locking case, the Coulomb Stiction subsystem applies stiction to the piston’s vertical motion with the JSA block, adjusted to cause neither too much nor too little sticking. The simulation invokes an algebraic loop to solve the locking and unlocking.

The Scopes in the locking model show the dynamical (force) and kinematic (locking) discontinuities as the piston sticks and unsticks, along with the effect of the kinetic friction during sliding and the vertical reaction force between piston and cylinder. During sticking, this reaction is the force of static constraint.

#### Automotive Clutch — One Continuous Degree of Freedom

The three `continuousClutch` example models simulate the same components subject to different friction approximations, all in Simulink. The first illustrates an unrealistic kinetic friction with a sign-change discontinuity at zero slip and no locking, simulated with a nonstiff FS solver. By missing the discontinuities, such a solver effectively sees a continuous dynamics. The second model modifies the friction with a quasi-locking approximation to a locking clutch. As a function of slip, the friction is constant, except close to zero slip, where it transitions smoothly but steeply in sign. Such a stiff force requires either a stiff, medium-order VS or an FS solver with small step size. The large stiffness keeps the slip tiny during periods of quasi-locking. The third model is physically the same as the second, but with the driveshaft and all connected mechanical components represented by SimDriveline blocks. Stiff solvers are again strongly preferred.

Figure 2. Continuous Friction model.

Trimming and linearization are straightforward for continuous systems such as this clutch. But take care to distinguish the effect of stiff forces approximating static friction from others. For example, trimming and linearization of a quasi-locking model in the quasi-locked state might produce an unphysical, highly damped DoF that should be removed.

#### Automotive Transmission — Many Locking Degrees of Freedom

The `multiClutch` model, based on SimDriveline, contains six clutches, five bundled into the 4-Speed Transmission and one Brake Clutch. The transmission transfers motion, torque, and power from the input to the output driveshafts, if exactly two of the transmission’s four forward clutches are locked. If more than two are locked, the DoFs conflict; any fewer, and the transmission transfers nothing. Each clutch is represented by a CFC block. The motion is simulated by a high-order, nonstiff VS solver, an efficient and accurate method, if controlled by a reasonably tight tolerance.

Simulating with multiple locking DoFs is an important engineering application and is required for automotive modeling. The issues that arise while simulating a single locking DoF apply here and are multiplied. In addition, it is important to avoid conflicts of simultaneously locked DoFs. You must maintain the right locked DoFs to transmit motion, force, and power as required by the system design, and avoid configurations with multiple DoFs in conflict.

The authors wish to thank Valery Tchkalov and Jeff Wendlandt of The MathWorks for help with continuous clutches and for comments on friction modeling.

Published 2008 - 91574v00

### References

• B. Armstrong and C. C. de Wit, in W. S. Levine, ed., The Control Handbook, Boca Raton: CRC Press and IEEE Press, 1996, sec. 77.1.
• G. Hähner and N. Spencer, Physics Today, 51(9), September 1998, 22-27.
• J. G. de Jalon and E. Bayo, Kinematic and Dynamic Simulation of Multibody Systems: The Real-Time Challenge, New York: Springer, 1993.
• C. Moler, Numerical Computing with MATLAB, Philadelphia: SIAM, 2004, chapter 7.
• G. D. Wood and D. C. Kennedy, “Simulating Mechanical Systems in Simulink with SimMechanics,” MATLAB Central, white paper 2871, December 2002.