« Previous « Start » Next »
12 Batch Production
Dynamic optimization of bioprocesses: efficient and robust numerical strategies 2003, Julio R. Banga, Eva Balsa-Cantro, Carmen G. Moles and Antonio A. Alonso
Case Study II: Optimal Control of a Fed-Batch Reactor for Ethanol Production
12.1 Problem description
This case study considers a fed-batch reactor for the production of ethanol, as studied by Chen and Hwang (1990a) and others (Bojkov & Luus 1996, Banga et al. 1997). The (free terminal time) optimal control problem is to maximize the yield of ethanol using the feed rate as the control variable. As in the previous case, this problem has been solved using CVP and gradient based methods, but convergence problems have been frequently reported, something which has been confirmed by our own experience. The mathematical statement of the free terminal time problem is:
Find the feed flow rate u(t) and the final time t_f over t in [t0; t_f ] to maximize
subject to:
where x1, x2 and x3 are the cell mass, substrate and product concentrations (g/L), and x4 is the volume (L). The initial conditions are:
The constraints (upper and lower bounds) on the control variable (feed rate, L/h) are:
and there is an end-point constraint on the volume:
Reference: [3]
12.2 Problem setup
toms t
toms tfs
t_f = 100*tfs;
% initial guesses
tfg = 60;
x1g = 10;
x2g = 150-150*t/t_f;
x3g = 70;
x4g = 200*t/t_f;
ug = 3;
n = [ 20 60 60 60];
e = [0.01 0.002 1e-4 0];
for i = 1:3
p = tomPhase('p', t, 0, t_f, n(i));
setPhase(p);
tomStates x1s x2s x3s x4s
if e(i)
tomStates u
else
tomControls u
end
%tomControls g1 g2
% Create scaled states, to make the numeric solver work better.
x1 = 10*x1s;
x2 = 1*x2s;
x3 = 100*x3s;
x4 = 100*x4s;
% Initial guess
% Note: The guess for t_f must appear in the list before expression involving t.
x0 = {t_f == tfg
icollocate({
x1 == x1g
x2 == x2g
x3 == x3g
x4 == x4g
})
collocate({u==ug})};
% Box constraints
cbox = {
0.1 <= t_f <= 100
mcollocate({
0 <= x1
0 <= x2
0 <= x3
1e-8 <= x4 % Avoid division by zero.
})
0 <= collocate(u) <= 12};
% Boundary constraints
cbnd = {initial({
x1 == 1;
x2 == 150
x3 == 0;
x4 == 10})
final(0 <= x4 <= 200)};
% Various constants and expressions
g1 = (0.408/(1+x3/16))*(x2/(x2+0.22));
g2 = (1/(1+x3/71.5))*(x2/(0.44+x2));
% ODEs and path constraints
ceq = collocate({
dot(x1) == g1*x1 - u*x1/x4
dot(x2) == -10*g1*x1 + u*(150-x2)/x4
dot(x3) == g2*x1 - u*x3/x4
dot(x4) == u});
% Objective
J = final(x3*x4);
if e(i)
% Add cost on oscillating u.
objective = -J/4900 + e(i)*integrate(dot(u)^2);
else
objective = -J/4900;
end
12.3 Solve the problem
options = struct;
options.name = 'Batch Production';
solution = ezsolve(objective, {cbox, cbnd, ceq}, x0, options);
Problem type appears to be: con
Starting numeric solver
===== * * * =================================================================== * * *
TOMLAB - Tomlab Optimization Inc. Development license 999001. Valid to 2010-02-05
=====================================================================================
Problem: --- 1: Batch Production f_k -4.154069198671450600
sum(|constr|) 0.209165846708399110
f(x_k) + sum(|constr|) -3.944903351963051600
f(x_0) 1.259999999999963600
Solver: snopt. EXIT=1. INFORM=32.
SNOPT 7.2-5 NLP code
Major iteration limit reached
FuncEv 4854 GradEv 4852 ConstrEv 4852 ConJacEv 4852 Iter 1000 MinorIter 4192
CPU time: 21.671875 sec. Elapsed time: 22.266000 sec.
Warning: Major iteration limit reached
The returned solution may be incorrect.
Problem type appears to be: con
Starting numeric solver
===== * * * =================================================================== * * *
TOMLAB - Tomlab Optimization Inc. Development license 999001. Valid to 2010-02-05
=====================================================================================
Problem: --- 1: Batch Production f_k -4.222925119633551100
sum(|constr|) 0.000005285559072603
f(x_k) + sum(|constr|) -4.222919834074478900
f(x_0) -1.862766170193072700
Solver: snopt. EXIT=0. INFORM=1.
SNOPT 7.2-5 NLP code
Optimality conditions satisfied
FuncEv 472 GradEv 470 ConstrEv 470 ConJacEv 470 Iter 427 MinorIter 899
CPU time: 17.718750 sec. Elapsed time: 19.109000 sec.
Problem type appears to be: con
Starting numeric solver
===== * * * =================================================================== * * *
TOMLAB - Tomlab Optimization Inc. Development license 999001. Valid to 2010-02-05
=====================================================================================
Problem: --- 1: Batch Production f_k -4.248461966959419900
sum(|constr|) 0.000084501506317750
f(x_k) + sum(|constr|) -4.248377465453102400
f(x_0) -4.126181344050842800
Solver: snopt. EXIT=0. INFORM=1.
SNOPT 7.2-5 NLP code
Optimality conditions satisfied
FuncEv 323 GradEv 321 ConstrEv 321 ConJacEv 321 Iter 202 MinorIter 648
CPU time: 8.625000 sec. Elapsed time: 8.766000 sec.
12.4 Plot result
subplot(2,1,1)
ezplot([x1 x2 x3 x4]);
legend('x1','x2','x3','x4');
title(['Batch Production state variables. J = ' num2str(subs(J,solution))]);
subplot(2,1,2)
ezplot(u);
legend('u');
title('Batch Production control');
drawnow
% Copy inital guess for next iteration
tfg = subs(t_f,solution);
x1g = subs(x1,solution);
x2g = subs(x2,solution);
x3g = subs(x3,solution);
x4g = subs(x4,solution);


end
« Previous « Start » Next »