PROPT Bridge Crane System: Difference between revisions
From TomWiki
Jump to navigationJump to search
(Created page with " ITERATIVE DYNAMIC PROGRAMMING, REIN LUUS 12.4.1 Example 1: Bridge crane system CHAPMAN & HALL/CRC Monographs and Surveys in Pure and Applied Mathematics ==Problem description...") |
No edit summary |
||
Line 1: | Line 1: | ||
{{Part Of Manual|title=the PROPT Manual|link=[[PROPT |PROPT Manual]]}} | |||
ITERATIVE DYNAMIC PROGRAMMING, REIN LUUS | ITERATIVE DYNAMIC PROGRAMMING, REIN LUUS | ||
Line 25: | Line 26: | ||
<math> -1 <= u <= 1 </math> | <math> -1 <= u <= 1 </math> | ||
< | <source lang="matlab"> | ||
% Copyright (c) 2007-2008 by Tomlab Optimization Inc. | % Copyright (c) 2007-2008 by Tomlab Optimization Inc. | ||
</ | </source> | ||
==Problem setup== | ==Problem setup== | ||
< | <source lang="matlab"> | ||
toms t | toms t | ||
toms t_f | toms t_f | ||
Line 65: | Line 66: | ||
% Objective | % Objective | ||
objective = t_f; | objective = t_f; | ||
</ | </source> | ||
==Solve the problem== | ==Solve the problem== | ||
< | <source lang="matlab"> | ||
options = struct; | options = struct; | ||
options.name = 'Bridge Crane System'; | options.name = 'Bridge Crane System'; | ||
Line 79: | Line 80: | ||
x4 = subs(collocate(x4),solution); | x4 = subs(collocate(x4),solution); | ||
u = subs(collocate(u),solution); | u = subs(collocate(u),solution); | ||
</ | </source> | ||
<pre> | <pre> | ||
Line 104: | Line 105: | ||
==Plot result== | ==Plot result== | ||
< | <source lang="matlab"> | ||
subplot(2,1,1) | subplot(2,1,1) | ||
plot(t,x1,'*-',t,x2,'*-',t,x3,'*-',t,x4,'*-'); | plot(t,x1,'*-',t,x2,'*-',t,x3,'*-',t,x4,'*-'); | ||
Line 114: | Line 115: | ||
legend('u'); | legend('u'); | ||
title('Bridge Crane System control'); | title('Bridge Crane System control'); | ||
</ | </source> |
Revision as of 10:54, 2 November 2011
This page is part of the PROPT Manual. See PROPT Manual. |
ITERATIVE DYNAMIC PROGRAMMING, REIN LUUS
12.4.1 Example 1: Bridge crane system
CHAPMAN & HALL/CRC Monographs and Surveys in Pure and Applied Mathematics
Problem description
Find u over t in [0; t_F ] to minimize
subject to:
The initial condition are:
% Copyright (c) 2007-2008 by Tomlab Optimization Inc.
Problem setup
toms t
toms t_f
p = tomPhase('p', t, 0, t_f, 50);
setPhase(p);
tomStates x1 x2 x3 x4
tomControls u
% Initial guess
% Note: The guess for t_f must appear in the list before expression involving t.
x0 = {t_f == 8, ...
collocate(u==1-2*t/t_f)};
% Box constraints
cbox = {0.1 <= t_f <= 100
-1 <= collocate(u) <= 1};
% Boundary constraints
cbnd = {initial({x1 == 0; x2 == 0
x3 == 0; x4 == 0})
final({x1 == 15; x2 == 0
x3 == 0; x4 == 0})};
% ODEs and path constraints
ceq = collocate({
dot(x1) == x2
dot(x2) == u
dot(x3) == x4
dot(x4) == -0.98*x3+0.1*u});
% Objective
objective = t_f;
Solve the problem
options = struct;
options.name = 'Bridge Crane System';
solution = ezsolve(objective, {cbox, cbnd, ceq}, x0, options);
t = subs(collocate(t),solution);
x1 = subs(collocate(x1),solution);
x2 = subs(collocate(x2),solution);
x3 = subs(collocate(x3),solution);
x4 = subs(collocate(x4),solution);
u = subs(collocate(u),solution);
Problem type appears to be: lpcon Time for symbolic processing: 0.14777 seconds Starting numeric solver ===== * * * =================================================================== * * * TOMLAB - TOMLAB Development license 999007. Valid to 2011-12-31 ===================================================================================== Problem: --- 1: Bridge Crane System f_k 8.578933610367172900 sum(|constr|) 0.000000187956526363 f(x_k) + sum(|constr|) 8.578933798323699700 f(x_0) 8.000000000000000000 Solver: snopt. EXIT=0. INFORM=1. SNOPT 7.2-5 NLP code Optimality conditions satisfied FuncEv 1 ConstrEv 37 ConJacEv 37 Iter 19 MinorIter 501 CPU time: 0.171601 sec. Elapsed time: 0.176000 sec.
Plot result
subplot(2,1,1)
plot(t,x1,'*-',t,x2,'*-',t,x3,'*-',t,x4,'*-');
legend('x1','x2','x3','x4');
title('Bridge Crane System state variables');
subplot(2,1,2)
plot(t,u,'+-');
legend('u');
title('Bridge Crane System control');