PROPT One Dimensional Rocket Ascent: Difference between revisions

From TomWiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 10: Line 10:


<math> J = tCut </math>
<math> J = tCut </math>


subject to:
subject to:


<math> \frac{dx_1}{dt} = x2 </math>
<math> \frac{dx_1}{dt} = x2 </math>
<math> \frac{dx_2}{dt} = a-g \ (0<t<tCut)</math>
<math> \frac{dx_2}{dt} = a-g \ (0<t<tCut)</math>
<math> \frac{dx_2}{dt} = -g \ (tCut<t<t_F)</math>
<math> \frac{dx_2}{dt} = -g \ (tCut<t<t_F)</math>
<math> [x_1 \ x_2] = 0 </math>
<math> [x_1 \ x_2] = 0 </math>
<math> g = 1 </math>
<math> g = 1 </math>
<math> a = 2 </math>
<math> a = 2 </math>
<math> x_1(t_f) = 100 </math>
<math> x_1(t_f) = 100 </math>


<source lang="matlab">
<source lang="matlab">

Revision as of 08:10, 9 November 2011

Notice.png

This page is part of the PROPT Manual. See PROPT Manual.

User's Guide for DIRCOL

Problem 2.3 One-dimensional ascent of a rocket

Problem Formulation

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


subject to:


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

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)};

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
Time for symbolic processing: 0.11449 seconds
Starting numeric solver
===== * * * =================================================================== * * *
TOMLAB - TOMLAB Development license  999007. Valid to 2011-12-31
=====================================================================================
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.015600 sec. Elapsed time: 0.015000 sec. 

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');

OnedimRocket 01.png