Time Delay 1

ITERATIVE DYNAMIC PROGRAMMING, REIN LUUS

8.3.1 Example 1

CHAPMAN & HALL/CRC Monographs and Surveys in Pure and Applied Mathematics

Linear time-delay system used for optimal control studies by Chan and Perkins

Contents

Problem Formulation

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

$$ J = x_3(t_F) $$

subject to:

$$ \frac{dx_1}{dt} = x_2 $$

$$ \frac{dx_2}{dt} = -10*x_1-5*x_2-2*x_1(t-tau)-x_2(t-tau)+u $$

$$ \frac{dx_3}{dt} = 0.5*(10*x_1^2+x_2^2+u^2) $$

$$ tau = 0.25 $$

The initial condition are:

$$ x(t<=0) = [1 \ 1 \ 0] $$

$$ -inf <= u <= inf $$

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

Problem setup

toms t
p1 = tomPhase('p1', t, 0, 5, 50);
setPhase(p1);

tomStates x1 x2 x3
tomControls u

% Initial guess
x0 = {icollocate({x1 == 1
    x2 == 1; x3 == 0})
    collocate(u == 0)};

% Boundary constraints
cbnd = initial({x1 == 1; x2 == 1; x3 == 0});

% Expressions for x1(t-tau) and x2(t-tau)
tau = 0.25;
x1delayed = ifThenElse(t<tau, 1, subs(x1,t,t-tau));
x2delayed = ifThenElse(t<tau, 1, subs(x2,t,t-tau));

% ODEs and path constraints
ceq = collocate({dot(x1) == x2
    dot(x2) == -10*x1 - 5*x2 - 2*x1delayed - x2delayed + u
    dot(x3) == 0.5*(10*x1.^2+x2.^2+u.^2)});

% Objective
objective = final(x3);

Solve the problem

options = struct;
options.name = 'Time Delay 1';
solution = ezsolve(objective, {cbnd, ceq}, x0, options);
t  = subs(collocate(t),solution);
u  = subs(collocate(u),solution);
Problem type appears to be: lpcon
===== * * * =================================================================== * * *
TOMLAB - Tomlab Optimization Inc. Development license  999001. Valid to 2010-02-05
=====================================================================================
Problem: ---  1: Time Delay 1                   f_k       2.525970855999299000
                                       sum(|constr|)      0.000000181522724643
                              f(x_k) + sum(|constr|)      2.525971037522023900
                                              f(x_0)      0.000000000000000000

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

FuncEv    1 ConstrEv 2079 ConJacEv 2079 Iter  555 MinorIter  736
CPU time: 26.968750 sec. Elapsed time: 27.016000 sec. 

Plot result

figure(1)
plot(t,u,'+-');
legend('u');
title('Time Delay 1 control');