# TOMLAB  
# REGISTER (TOMLAB)
# LOGIN  
# myTOMLAB
TOMLAB LOGO

« Previous « Start » Next »

76  One Dimensional Rocket Ascent

User’s Guide for DIRCOL

Problem 2.3 One-dimensional ascent of a rocket

76.1  Problem Formulation

Find tCut over t in [0; t_F ] to minimize

J = tCut 


subject to:

dx1
dt
 = x
dx2
dt
 = ag  (0<t<tCut)
dx2
dt
 = −g  (tCut<t<tF)
[x1  x2] = 0 
g = 1 
a = 2 
x1(tf) = 100 


Reference: [33]

76.2  Problem setup

toms t
toms tCut tp2
p1 = tomPhase('p1', t, 0, tCut, 20);
p2 = tomPhase('p2', t, tCut, tp2, 20);

t_f = tCut+tp2;

x1p1 = tomState(p1,'x1p1');
x2p1 = tomState(p1,'x2p1');
x1p2 = tomState(p2,'x1p2');
x2p2 = tomState(p2,'x2p2');

% Initial guess
x0 = {tCut==10
    t_f==15
    icollocate(p1,{x1p1 == 50*tCut/10;x2p1 == 0;})
    icollocate(p2,{x1p2 == 50+50*t/100;x2p2 == 0;})};

% Box constraints
cbox = {
    1  <= tCut <= t_f-0.00001
    t_f <= 100
    0  <= icollocate(p1,x1p1)
    0  <= icollocate(p1,x2p1)
    0  <= icollocate(p2,x1p2)
    0  <= icollocate(p2,x2p2)};

% Boundary constraints
cbnd = {initial(p1,{x1p1 == 0;x2p1 == 0;})
    final(p2,x1p2 == 100)};

% ODEs and path constraints
a = 2; g = 1;
ceq = {collocate(p1,{
    dot(p1,x1p1) == x2p1
    dot(p1,x2p1) == a-g})
    collocate(p2,{
    dot(p2,x1p2) == x2p2
    dot(p2,x2p2) == -g})};

% Objective
objective = tCut;

% Link phase
link = {final(p1,x1p1) == initial(p2,x1p2)
    final(p1,x2p1) == initial(p2,x2p2)};

76.3  Solve the problem

options = struct;
options.name = 'One Dim Rocket';
constr = {cbox, cbnd, ceq, link};
solution = ezsolve(objective, constr, x0, options);
Problem type appears to be: lpcon
Starting numeric solver
===== * * * =================================================================== * * *
TOMLAB - Tomlab Optimization Inc. Development license  999001. Valid to 2011-02-05
=====================================================================================
Problem: ---  1: One Dim Rocket                 f_k       9.999998166162907200
                                       sum(|constr|)      0.000733735151552596
                              f(x_k) + sum(|constr|)     10.000731901314460000
                                              f(x_0)     10.000000000000000000

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

FuncEv    1 ConstrEv   10 ConJacEv   10 Iter    8 MinorIter   91
CPU time: 0.046875 sec. Elapsed time: 0.047000 sec.

76.4  Plot result

t = [subs(collocate(p1,t),solution);subs(collocate(p2,t),solution)];
x1 = subs(collocate(p1,x1p1),solution);
x1 = [x1;subs(collocate(p2,x1p2),solution)];
x2 = subs(collocate(p1,x2p1),solution);
x2 = [x2;subs(collocate(p2,x2p2),solution)];

figure(1)
plot(t,x1,'*-',t,x2,'*-');
legend('x1','x2');
title('One Dim Rocket state variables');

pngs/onedimRocket_01.png

« Previous « Start » Next »