PROPT Temperature Control: Difference between revisions
(Created page with "{{Part Of Manual|title=the PROPT Manual|link=PROPT Manual}} Optimal Control CY3H2, Lecture notes by Victor M. Becerra, School of Systems Engineering, University of Rea...") |
No edit summary |
||
| Line 10: | Line 10: | ||
<math> J = \frac{1}{2} \int_0^{1} u^2 \mathrm{d}t </math> | <math> J = \frac{1}{2} \int_0^{1} u^2 \mathrm{d}t </math> | ||
subject to: | subject to: | ||
<math> \frac{dx}{dt} = -2*x + u </math> | <math> \frac{dx}{dt} = -2*x + u </math> | ||
<math> x(0) = 0, </math> | <math> x(0) = 0, </math> | ||
<math> x(1) = 10 </math> | <math> x(1) = 10 </math> | ||
<source lang="matlab"> | <source lang="matlab"> | ||
Revision as of 08:12, 9 November 2011
|
This page is part of the PROPT Manual. See PROPT Manual. |
Optimal Control CY3H2, Lecture notes by Victor M. Becerra, School of Systems Engineering, University of Reading
Heating a room using the least possible energy.
Problem Description
Find u over t in [0; 1] to minimize:
Failed to parse (SVG with PNG fallback (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle J = \frac{1}{2} \int_0^{1} u^2 \mathrm{d}t }
subject to:
Failed to parse (SVG with PNG fallback (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \frac{dx}{dt} = -2*x + u }
Failed to parse (SVG with PNG fallback (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle x(0) = 0, }
Failed to parse (SVG with PNG fallback (MathML can be enabled via browser plugin): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle x(1) = 10 }
% Copyright (c) 2009-2009 by Tomlab Optimization Inc.Problem setup
toms t
p = tomPhase('p', t, 0, 1, 20);
setPhase(p);
tomStates x
tomControls u
% Initial guess
x0 = {icollocate(x == 10*t)
collocate(u == 1)};
% Box constraints
cbox = collocate(0 <= u);
% Boundary constraints
cbnd = {initial(x == 0)
final(x == 10)};
% ODEs and path constraints
ceq = collocate(dot(x) == -2*x+u);
% Objective
objective = 0.5*integrate(u^2);Solve the problem
options = struct;
options.name = 'Temperature Control';
solution = ezsolve(objective, {cbox, cbnd, ceq}, x0, options);
t = subs(collocate(t),solution);
x = subs(collocate(x),solution);
u = subs(collocate(u),solution);Problem type appears to be: qp
Time for symbolic processing: 0.030845 seconds
Starting numeric solver
===== * * * =================================================================== * * *
TOMLAB - TOMLAB Development license 999007. Valid to 2011-12-31
=====================================================================================
Problem: 1: Temperature Control f_k 203.731472072683000000
sum(|constr|) 0.000000000059135659
f(x_k) + sum(|constr|) 203.731472072742150000
f(x_0) 0.000000000000000000
Solver: CPLEX. EXIT=0. INFORM=1.
CPLEX Barrier QP solver
Optimal solution found
FuncEv 9 GradEv 9 ConstrEv 9 Iter 9
Elapsed time: 0.003000 sec.
Plot result
figure(1);
subplot(2,1,1)
plot(t,x,'*-');
legend('Temperature');
subplot(2,1,2)
plot(t,u,'*-');
legend('Energy');