Parallel Reactions in Tubular Reactor

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.

Contents

Problem description

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

$$ J = x_2(t_f) $$

subject to:

$$ \frac{dx_1}{dt} = -(u+0.5*u^2)*x_1 $$

$$ \frac{dx_2}{dt} = u*x_1 $$

where

$$ x(0) = [1 \ 0] $$

$$ 0 <= u <= 5 $$

% 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
===== * * * =================================================================== * * *
TOMLAB - Tomlab Optimization Inc. Development license  999001. Valid to 2010-02-05
=====================================================================================
Problem: ---  1: Parallel Reactions             f_k      -0.573540787113989150
                                       sum(|constr|)      0.000000228705850258
                              f(x_k) + sum(|constr|)     -0.573540558408138890
                                              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  100
CPU time: 0.109375 sec. Elapsed time: 0.109000 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');