TSi ProPac: Backlash & Friction

Harry G. Kwatny

Department of Mechanical Engineering & Mechanics
Drexel University
Philadelphia, PA 19104

Introduction

ProPac contains version 3.0 of Dynamics. It includes functions for dealing with nondifferentiable nonlinearities including backlash and coulomb, and static friction with Stribeck effect. The primary functions are:
BacklashPotential
JointFrictionPotential  
In addition, simplification rules/functions have been implemented including
SimplifyDiracDelta1
UnitStep2Sign
Also modifications have been made to several TSiDynamics functions including
CreateModel
CreateModelSpecial
to facilitate working with nondifferentiable nonlinearities. This notebook illustrates the use of these functions.
First we load the package.

<< "ProPac`"

Dynamics

?BacklashPotential

?JointFrictionPotential

Backlash

Two Masses & Spring With Backlash

r1 = {1}; H1 = Transpose[{{0, 0, 0, 1, 0, 0}}];
q1 = {x1}; p1 = {v1};
r2 = {1}; H2 = Transpose[{{0, 0, 0, 1, 0, 0}}];
q2 = {x2}; p2 = {v2};
JointLst = {{r1, H1, q1, p1}, {r2, H2, q2, p2}};
{JV, JX, JH} = Joints[JointLst];

com1 = {0, 0, 0}; mass1 = m1; out1 = {2, {0, 0, 0}};
Inertia1 = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
com2 = {0, 0, 0}; mass2 = m2; out2 = {3, {0, 0, 0}};
Inertia2 = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
BodyLst = {{com1, {out1}, mass1, Inertia1}, {com2, {out2}, mass2, 
          Inertia2}}
TreeLst = {{{1, 1}, {2, 2}}};

PEBack[x_] := (k1*x^2)/2;
PE1 = BacklashPotential[PEBack, e, (x1 - x2)]
PE2 = (1/2)*k2*x2^2;
PE = PE1 + PE2;
Q = {F1, F2};
CreateModel[JointLst, BodyLst, TreeLst, -g, PE, Q, JV, JX, 
      JH]

CreateModel[JointLst, BodyLst, TreeLst, -g, PE, Q]

Double Pendulum With Backlash Constrained Upper Joint

r1 = {1}; H1 = {{1}, {0}, {0}, {0}, {0}, {0}};
q1 = {a1x}; p1 = {w1x};
r2 = {1}; H2 = {{1}, {0}, {0}, {0}, {0}, {0}};
q2 = {a2x}; p2 = {w2x};
JointLst = {{r1, H1, q1, p1}, {r2, H2, q2, p2}};

{JV, JX, JH} = Joints[JointLst];

Define Body Data

com1 = {0, 0, -l1}; mass1 = m1; 
    out1 = {2, {0, 0, -l1}};
Inertia1 = DiagonalMatrix[{0, 0, 0}];
com2 = {0, 0, -l2}; mass2 = m2; 
    out2 = {3, {0, 0, -l2}};
Inertia2 = DiagonalMatrix[{0, 0, 0}];
BodyLst = {{com1, {out1}, mass1, Inertia1}, {com2, {out2}, mass2, 
            Inertia2}};

Define Interconnection Structure

TreeLst = {{{1, 1}, {2, 2}}};

Define Potential Energy
In this case only gravity contributes to the potential energy. The only generalized forces are external torques acting at the two joints.

g = gc; PE = 0; Q = {T1, T2};

{V, X, H, M, Cp, Fp, p, q} = 
        CreateModel[JointLst, BodyLst, TreeLst, g, PE, Q];

PEBack[x_] := (k1*x^2)/2;
PE1 = BacklashPotential[PEBack, e, (a1x)]
PE2 = (1/2)*k2*a2x^2;
PE = PE1 + P2;

{JV, JX, JH, MM, Cp, Fp, pp, qq} = 
        CreateModel[JointLst, BodyLst, TreeLst, g, PE, Q, JV, JX, 
          JH];

Fp

Simulation: Numerical Solution

We can easily construct a simulation within Mathematica. First assemble the system parameter matrices computed above into a system of ordinary differential equations using the TSi Dynamics function MakeODEs.

Equations = MakeODEs[p, q, V, M, Cp, Fp, t]

Now, replace parameter symbols by numbers and set up initial conditions.

DataReplacements = {m1 -> 1, l1 -> 2, m2 -> 1, 
        l2 -> 1, gc -> 1, T1 -> 0, T2 -> 0, k1 -> 1000, 
        e ->  .1, k2 -> 0}

Equations1 = Equations /. DataReplacements

vars = Join[p, q]

InitialConditions = 
      Table[ToExpression[
          ToString[
              vars[[
                i]]] <> "[0]==0"], {i, 
          Length[vars]}]

InitialConditions = {w1x[0] == 0, w2x[0] == 0, a1x[0] ==  .1, 
        a2x[0] ==  .2}

Equations2 = Join[Equations1, InitialConditions]

Finally, integrate the equations using the Mathematica function NDSolve and plot the results.

sols = 
      NDSolve[Equations2, vars, {t, 0, 19}, PrecisionGoal -> 10]

Plot[Evaluate[a1x[t] /. sols], {t, 0, 19}]

Plot[Evaluate[a2x[t] /. sols], {t, 0, 19}]

Friction

Two Masses With Backlash & Friction

r1 = {1}; H1 = Transpose[{{0, 0, 0, 1, 0, 0}}];
q1 = {x1}; p1 = {v1};
r2 = {1}; H2 = Transpose[{{0, 0, 0, 1, 0, 0}}];
q2 = {x2}; p2 = {v2};
JointLst = {{r1, H1, q1, p1}, {r2, H2, q2, p2}};
{JV, JX, JH} = Joints[JointLst];

com1 = {0, 0, 0}; mass1 = m1; out1 = {2, {0, 0, 0}};
Inertia1 = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
com2 = {0, 0, 0}; mass2 = m2; out2 = {3, {0, 0, 0}};
Inertia2 = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
BodyLst = {{com1, {out1}, mass1, Inertia1}, {com2, {out2}, mass2, 
            Inertia2}};
TreeLst = {{{1, 1}, {2, 2}}};

PEBack[x_] := (k1*x^2)/2;
PE1 = BacklashPotential[PEBack, e, x2]
PE2 = (1/2)*k2*(x1 + x2)^2;
PE = PE1 + PE2;
Q = {FF1, FF2};
DissPot1 = JointFrictionPotential[v1, cv, cc, cs, vs]
\(\({JV, JX, JH, MM, Cp, Fp, pp, qq} = 
        CreateModel[JointLst, BodyLst, TreeLst, \(-g\), PE, DissPot1, Q, JV, 
          JX, JH];\)
\)

Fp

UnitStep2Sign[Fp]