# Coloumb Friction 2

Minimum-Time Control of Systems With Coloumb Friction: Near Global Optima Via Mixed Integer Linear Programming, Brian J. Driessen, Structural Dynamics Department, Sandia National Labs.

4. Numerical Examples

## Problem Formulation

Find u over t in [0; tF ] to minimize

subject to:

% Copyright (c) 2007-2008 by Tomlab Optimization Inc.


## Problem setup

toms t
toms tf

p = tomPhase('p', t, 0, tf, 40, [], 'gauss');
setPhase(p);

tomStates q1 q1dot q2 q2dot
tomControls u1 u2

% Initial guess
x0 = {tf == 1};

% Box constraints
cbox = {1.8 <= tf <= 4
-4  <= collocate(u1) <= 4
-4  <= collocate(u2) <= 4};

% Boundary constraints
cbnd = {initial({q1 == 0; q1dot == -1
q2 == 0; q2dot == -2})
final({q1 == 1; q1dot == 0
q2 == 2; q2dot == 0})};

k1 = 0.95; k2 = 0.85;
m1 = 1.1;  m2 = 1.2;
mu = 1;

% ODEs and path constraints
ceq = collocate({dot(q1) == q1dot
m1*dot(q1dot) == (-k1-k2)*q1+k2*q2-mu*sign(q1dot)+u1
dot(q2)       == q2dot
m2*dot(q2dot) == k2*q1-k2*q2-mu*sign(q2dot)+u2});

% Objective
objective = tf;


## Solve the problem

options = struct;
options.name = 'Coloumb Friction 2';
solution = ezsolve(objective, {cbox, cbnd, ceq}, x0, options);
t     = subs(collocate(t),solution);
q1    = subs(collocate(q1),solution);
q2    = subs(collocate(q2),solution);
q1dot = subs(collocate(q1dot),solution);
q2dot = subs(collocate(q2dot),solution);
u1    = subs(collocate(u1),solution);
u2    = subs(collocate(u2),solution);
q1dot_f = q1dot(end);
q2dot_f = q2dot(end);

Problem type appears to be: lpcon
===== * * * =================================================================== * * *
TOMLAB - Tomlab Optimization Inc. Development license  999001. Valid to 2010-02-05
=====================================================================================
Problem: ---  1: Coloumb Friction 2             f_k       2.125397797774969600
sum(|constr|)      0.000000000012176456
f(x_k) + sum(|constr|)      2.125397797787146100
f(x_0)      1.800000000000000000

Solver: snopt.  EXIT=0.  INFORM=1.
SNOPT 7.2-5 NLP code
Optimality conditions satisfied

FuncEv    1 ConstrEv   31 ConJacEv   31 Iter   27 MinorIter  389
CPU time: 0.484375 sec. Elapsed time: 0.485000 sec.


## Plot result

subplot(2,1,1)
plot(t,q1,'*-',t,q2,'*-');
legend('q1','q2');
title(sprintf('Coloumb Friction 2, q1dot_f = %g, q2dot_f = %g',q1dot_f,q2dot_f));

subplot(2,1,2)
plot(t,u1,'+-',t,u2,'+-');
legend('u1','u2');
title('Coloumb Friction 2 controls');