PROPT Parallel Reactions in Tubular Reactor: Difference between revisions

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


<math> J = x_2(t_f) </math>
<math> J = x_2(t_f) </math>


subject to:
subject to:


<math> \frac{dx_1}{dt} = -(u+0.5*u^2)*x_1 </math>
<math> \frac{dx_1}{dt} = -(u+0.5*u^2)*x_1 </math>
<math> \frac{dx_2}{dt} = u*x_1 </math>
<math> \frac{dx_2}{dt} = u*x_1 </math>


where
where


<math> x(0) = [1 \ 0] </math>
<math> x(0) = [1 \ 0] </math>
<math> 0 <= u <= 5 </math>
<math> 0 <= u <= 5 </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.

Problem 4: DYNOPT User's Guide version 4.1.0

Batch reactor with reactions: A -> B and A -> C.

M. Cizniar, M. Fikar, M. A. Latifi, MATLAB Dynamic Optimisation Code DYNOPT. User's Guide, Technical Report, KIRP FCHPT STU Bratislava, Slovak Republic, 2006.

Problem description

Find T over t in [0; 1 ] to maximize


subject to:


where


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

Problem setup

toms t
p = tomPhase('p', t, 0, 1, 30);
setPhase(p);

tomStates x1 x2
tomControls u

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

% Box constraints
cbox = {0 <= collocate(u) <= 5};

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

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

% Objective
objective = -final(x2);

Solve the problem

options = struct;
options.name = 'Parallel Reactions';
solution = ezsolve(objective, {cbox, cbnd, ceq}, x0, options);
t  = subs(collocate(t),solution);
x1 = subs(collocate(x1),solution);
x2 = subs(collocate(x2),solution);
u  = subs(collocate(u),solution);
Problem type appears to be: lpcon
Time for symbolic processing: 0.087774 seconds
Starting numeric solver
===== * * * =================================================================== * * *
TOMLAB - TOMLAB Development license  999007. Valid to 2011-12-31
=====================================================================================
Problem: ---  1: Parallel Reactions             f_k      -0.573540787113988930
                                       sum(|constr|)      0.000000228705850230
                              f(x_k) + sum(|constr|)     -0.573540558408138670
                                              f(x_0)      0.000000000000000000

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

FuncEv    1 ConstrEv   35 ConJacEv   35 Iter   34 MinorIter  118
CPU time: 0.046800 sec. Elapsed time: 0.042000 sec. 

Plot result

subplot(2,1,1)
plot(t,x1,'*-',t,x2,'*-');
legend('x1','x2');
title('Parallel Reactions state variables');

subplot(2,1,2)
plot(t,u,'+-');
legend('u');
title('Parallel Reactions control');

ParallelReactions 01.png