Gradient Technique and Lagrange Multiplier -
E . STANLEY LEE Kansas State University, Manhattan, Kansas, U.S.A.
The gradient technique combined with Lagrange multiplier is used to find the optimum of a complex heterogeneous process with two reeyele streams. Both the reaction stages and the separation stages for the separation of a six component mixture are considered. In spite of the complexity of the process, only two minutes computation (IBM 7094) is needed to obtain the solution. Techniques for handling inequality constraints on the control and state variables are also discussed.
Th
ere are various difficulties in using the multistage optimization techniques such as dynamic programming and maximum principle to optimize a large heterogeneous complex process (6). The most severe difficulties are the dimensionality difficulty in dynamic programming and the boundary value difficulty in maximum principle. Owing to these difficulties, the multistage techniques even with the recent modifications for complex processes still cannot be used effectively for solving complex processes. Furthermore, due to the presence of a large number of variables and the highly nonlinear nature of the process, singlc-stage techniques such as linear and nonlinear programming also cannot be used. Since the computational effort depcnds exponentially on the number of variables, the multi-variable search techniques (9) such as Powell’s conjugate gradient method @), the pattern search technique ( I ) , and the cannot be used effectively due to the simplex search presence of a large number of variables and constraints. A second difficulty in optimizing a large complex chemical process arises from the lack of experimental data. Even if effective optimization techniques were available, the true optimum still cannot be obtained due to incomplete representation of the process. Another difficulty arises from the fact that due to the complexity of the process, several relative optima may be present. There exists no technique to obtain the true optimum for such a large complex system within a reasonable amount of computation time. Since in general the true optimum cannot be obtained for a large complex chemical process due to both the computational difficulties and the lack of experimental data, it is natural to seek a technique which will improve the profit of the process continuously and monotonically. T h e gradient technique which possesses the monotone convergence property seems to be such a technique (*I. However, it is not a simple matter to obtain the gradient direction for a complex process with a large number of variables and a large number of constraints. In this paper, the gradient vector is obtained with the help of the Lagrange multipliers. This combined gradient technique and Lagrange multiplier have been used to solve complex pro~
8
~
)
On a utilisk la methode du gradient conjointement avec le multiplicateur de Lagrange pour trouver le point optimal d’un procedi h6tGrogCme et complexe comportant deux circuits de recyclage. On a considhe B la fois les phases de reaction et de separation pour la separation d’un melange B six composants. En depit de la complexiti du proctkId6, on a pu trouver la solution en deux minutes grice au calculateur IBM-7094. On discute les methodes pour faire face i I’action des contraintes d’inigalith sur les variables du contr6le et du rigime.
cesses in an earlier paper (6). T h e purpose of this paper is to show the effectiveness of this combined technique to obtain the local optimum of a large complex chemical process with various recycle streams. It should be noted that the various simplifications in the formulation of the complex process are based on practical situations. T o simplify the discussions for the complex process with two recycles, a simple heterogeneous process is first solved, Then, a complex process in which six different components are separated is solved by the combined technique.
A Simple Example The simple heterogeneous process shown in Figure 1 is solved by this combined technique. As has been discussed in an earlier paper @), a heterogeneous process is a process in which the process equations, the state variables, or the control variables are not the same for all the stages involved. There are two sections in Figure 1. T h e first section constitutes N continuous flow stirred tank reactors in which the following reactions take place k. ks A--+B--+C . . . . . . . . . . . . . . . . . . (1) The product B is the most valuable one and C i s a waste product. Both reactions are first order and are irreversible. The reaction rate equations can be obtained by a material balance around the reactors: x.-1 = x. t. k,, x., n = 1, . . ., N . . . . . . . . (2) yI-l = yn t. 4 . y. - t. k.. x., n = 1, . . ., N . . . (3)
+
+
,
where the x’s and y’s represent the concentrations in moles per liter of A and B, respectively; the t’s represent the holding time of the reaction mixture in the reactors; and k, and kb are the rate constants k,. = G, e r p ( -
The Canadian Journal of Chemical Engineering, Vol. 47, Augurt, 1969
AR T. ),kss =
cb exp(-
&),n
=
1,
..., N
. . . . . . . , . . (4) ’
431
Our problem is to find the control variables, T. and w,,,, so that the following quantity is maximized
Figure 1-A
simple heterogenous process.
where thc variable T. is the temperature of the reaction mixture in rewtor 17, E, and ?fb are activation energies of reactions, and K is the gas constant. Stages (,V+2) to .if are cross-current extractors. W e have assumed that the waste product C can be separated easily from thc reaction mixture and thus no consideration for optimization is needed for this separation. One possible situation would be that the waste product C' has a much lower boiling point than the other componcnts. Thc cornponcnt C is separated completely in stage (N+I ) . Stage (A+ I ) also scrves as a fictitious stagc. Notice that therc is a change in the units of the statc variables used between stages iV and ( N + 2 ) . T h e variable y is not considered as a state variable in stages N+2 to ,\1 but it is a state variable in stages 1 to N . The mixture containing A and B is being extracted by a miscible solvent w. The concentrations of A and R in the extract streams are represented by .YE and Y E , respectively. The flow rates of the original mixture and the raftinate streanis are represented by q. Thc extract stremi has an inlet flow ratc, w, of pure solvent and an outlet rate I [ . The stream q and w are expressed in total weight and all concentrations are in weight fractions. If we assunie the volumetric feed rate to stage 1 is one liter per hour, then thc flow rate q N + I in weight unit based cn one liter of original feed is =
qN+l
XN
Mz
+
where a is the value of component x based on the assumption that the value of component y is unity and 7 is thc cost of thc extracting solvent per unit value of the desired product y. In order to solve the above optimization problem anothcr set of equations will be cstablished. Introduce the 1,3grangc multiplicrs, Xi, pi, and Om, where i = 0, I , . . . . ,if, and m = N + 2 , . . . . ;\I and consider the equation M
4
= ([At YM N
(x.
+ a Z: + t. k .
M
(Y. 4- t.
kb.
3~.
- xS-11
Y.
- t , k Zx,~ - 3'S-i)
- XN n f r )
h t l (QNtl X N t l
PNt? ( q N t ?
21 Pm(qrn
Nt3
+
yNt2
M
+ urn
ym
-
X E ~-
N Pn
7 Z:
14,
Nt2
Nt2
-
- XN
- P N t I (qN+I
P N t ? YE(Nt?)
YEm
W,
- %-I
-
%-I)
YN
z Om(qm + urn -
+
Y N dfy)
--
MY)-
-
M
N+ 2
iM,
qm-l
- wm).. . . . . . . . . . .(17)
Notice that the number of Lagrangc multipliers is equal to the number of state variables in each stage. Next consider thc differential ehangcs of 4 due to differential changes in the control variables
. ,(5)
YN M y
where M, and My are the molecular weights of A and B, respectively. T h e equation for the state variable X N + ~is =
XN+I
X N Mx/QN+i
,
. (6)
The equations for thc extractors can bc obtained by mass balances on the total flow rate and the components x and y (/,,,-I
+ u:.
+
?,,,-I
&-I
=
?,,,-I
ym-1
= r/, ym
= qm
4,
X,
+
U,,,X E , , 14,
#
=
( N + 3 ) . . . . . AT. . (8)
m
=
( N + 3 ) , . . . . M . . (9)
- X.
m = ( N + 3 ) , . . . . A T . , (7)
Zlm,
+
After the differentiations are carried out, Equation (1 8) becomes a very complex expression. In order to save space, we have written Equation (IS) in an abstract form. Choose the Lagrange multipliers in Hquation (18) so that the coefficients of dx,, iiy., dq,, and did, vanish:
YEmi
There are only two state variables X N + ~ and ~ N + I in the feed stream to stage (,V+2). The equations for this stage are (lNfl
+
wN+? = qNt2
q N t 1 xN+I Y N Jlfy
q N t 2 xN+2
=
qN+2 y N t 2
+
+
+
uN+2..
- h, t , k o .
- AN - AN t~
knN
XstI
+
+ PN t~ - XN+1
. . . . . . . . . '(10)
U N f Z xE(N+2)
+
k,, = 0 , n
ts
koN
+
=
1, . . ., ( N - 1)(19)
XNfl MX/qN+i
+ P N + I h.i =
.........................
+
X N + 2 qN+1 =
(1
(20)
0 . . . . . . . . . . . . . .(21)
. . . . . . . .( 1 1 )
uN+2 Y E ( N t 2 ) . .
. . . . . . . (12)
There are six unltnowns q, 11, x, y, x E , and Y E in Equations (7) to ( I 2 ) . In addition to these three equations, three more equations can be obtaincd from thc liquid-liquid equilibrium relationship. Following the treatment in an earlier paper the following equilibrium relationship can be obtained
+ A Z X + A,*.*. . . . . . . . . . . ( 1 3 ) = Ad + + A & . . . . . . . . . . .(14) = A, + + + . . . . .(Is)
y =JI(x) YE XE
=
A1
AgX
=f2(~)
=f3(X)
(6),
AaX
AyXZ
AioX3..
Thus, only x, q, and zi are considered as state variables. The other three variables, y, xg, and Y E are considered as functions of x through Equations ( 1 3) to ( 1 5).
432
a
XEm
- Xm
XE,
- P,
YE", - 0, = 0, m = N+2, . . . . M-1
and at the last stage M :
The Canadian Journal
of
Chemical Engineering, Vol. 47, Augurt, 1969
12
6
E
I-'
B 4
2
0
STAGE NUMBER, n or rn
Figure 2-Convergence
rate of :he simple example.
wherc A+ is the required improvement. Thus, this optimization problcm can be solved by the use of thc following procedure 1. Assume a reasonable set of values for the control variables
7' and w . 2 . Obtain the state variables by solving IGqiiations (2) to ( I 5) in a forward recursive fashion starting from stage I . 3 . Obtain the Lagrange multipliers by solving Equations ( I Y ) to (30) in a backward recursive fashion starting from the last stage M. 4. Obtain improved values for the control variables T and w bv the use of Fauations (32) to (37) ~, N (a+)"
;,("")'
and Equation ( I 8) is reduced to:
5 . Repcat steps 2 to 4 until Z
-
1
+2
awi
becomes
so small that further improvement is not significant. where ..
a+ a+ a ~ . arm
This problem has been solved for the following numerical values a = 0.1 E. = 18,000 7] = 0.01 Eb = 30,000 xo = 0.95 N = 5 yo = 0.05 M = 9 In = 6 , n = 1 , .... 5 M, = 33.5
respect to the control variables T and w . The optimality con-
a4
The constants in Equations (1 3) to ( I 5 ) are
a4
A!
dition is obtained when - = 0 and - = 0, as no more a7: aWm improveincnt would bc possihle. T h c bcst direction of iniprovewill occur if the improved control variables arc ment in obtained by
+ 6T.t
TZ =
1,
.... N . . . . . . . . . (31)
=
which is the samc equilibrium relationship as that used in an carlier paper ( 5 ) . T h e initially assumed values for the control variables for step 1 are T"
=
335,
w, = 7,
a+
6Tn :___________-
A+, n
=
1,
.... N.(36)
=
A?
As = -1.2203 Aa = 0.009 . - I b = -0.1156
wherc
a T..
2.6013 =o.nis '48 = 4.1882.. . . . (38) A s = -11.23 A10 = 8.481 Ag
0.9865
'-1% = -0.8295
+
T,,,ncw = Tn,old
My = 31.5 R = 2
G. = 0.535 X 10" Gb = 0.461 x 10"
T h e sequences -and - are the gradient of 4 with
n
=
1, . . . . 5
m
=
7, 8, 9
. . . . . . . . . . . . , (39)
Thc convergence rate for the control variable is shown in Figurc 2 . T h c optimal profile was obtained in 140 iterations with less than half a minute computation time on the IBM 7094 computer. ?'he values of A 4 used were: A+ = 0.1 for the first 85 iterations and A+ = 0.01 for the remining iterations. T h e optimal results are summarized in Table 1. T h e maxiniuni value of # obtained is 22.605. To solve Equations ( 7 ) to ( I 2) in step 2, Newton-Raphson iteration was used. In order to insure convergence, direction iteration was also used to complinicnt the Newton-Raphson
The Canadian Journal of Chemical Engineering, Vol. 47, August, 1969
433
TABLE1 O P r I M U M C o N D I T l O N S F O R THIS S I M P L l C
State Variables
Control \';triable Torw
Stage
__
x
___
_-__
331 . A
2 3 4 5 6
329.7 328.7 .128 0 327.6
0 0 0 0 0 0 0
10 68
7
1.17 0.93
8 9
0 0 0 0 0 0
307 221 160 193 070 057 048
0 0
0 0
___
05 351 520 621 681 715 807 922 93.5 944
21 0 24.2 1.51 23.6
=
7, 8, 9
whcre the sripcrscript k represents thc iteration number. lnstcad of the initial values given by i;,quation (39), the following three differential sets of initial approximations havc also bccii used ( I ) r,, = 335, W," = 3 ( 2 ) T,, = 32.5, W , = 7 (3) T, = 325, ?[In, = 3 for I I = I , . . , 5 arid vi = 7, 8, 9. , i l l three sets converge t o the sanic optimal results listed in l'ablc 1.
A Complex Process with Two Recycles
.4 complex process with two rccyclc strcaiiis is shown in Figurc 3 . This process has seven sections. Since the statc variables arc different for different sections, fictitious stages are used to adjust the state variables (6). T h e first section constitiitcs three continuous flow stirred tank rcactors in which the following reactions take place
+ (H)
+
B
-t
=
X,
+ 6D + c E . . . . . . . . . .(40)
+ t. k,. s., n I , 2, 3 . . . . . . . . . . . . . . . .(41) + t. kbn y. - t,, k,,, s,, I , 2, 3 . . . . . . . . (42) =
~t=
where the rcaction rate constants k,znand ka. are functions of the temperature T. and are given by Equation (4). Since the concentrations of the other components can be obtained by material balance, x and y are the only two state variables in stages 1, 2, and 3 . We have assumed that the volume change in the reaction mixture is negligible.
434
0.008 0.005 - 0.0010
0 0 0
+B
20
( U I I YEII
0.010 0 010
0.010
Y E ~ ) / MVy.. , . . . . . . . . . .(4.3)
W.
18
where ,\Il and i\Z, are the molecular weights of ,4 and /{, respectively, and V , and V , are moles per unit volume of '4 and H , respectively. Variables with subscript E represent thc extract stream. q, N, and w represent the flow rates of the raffinate stream, the extract stream outlet, and the extract streaiii fccd, respectively. T h e second and third terms in Equation (43) rcpresent the volumetric recycle rates of A and H , rcspeetivcly. Assuming a negligible change in the volume of the reaction mixture, Equation (43) is also the volumetric outlct rate from stage 3 . Thus, the flow rate q 4 in weight units is 474
y.-i = y.
30 0
1
2 4 0100 989 989 989
In stages 1 to 3, all concentrations arc in moles per liter. However, in all the other stages the concentrations are in weight fractions and the streams are in total weight. To obtain the process equations for stage 4, we must consider the t w o recycle streams. If we assume the volumetric feed rate to stagc 0 is one liter of the mixture A , B, and H per hour, then the total volumetric feed rate to stage 1 is
CLC
coniponent H is the most valuable product. Components C: and D also have certain value. However, coinponcnt E is a waste product. Component H is certain inert material which is necessary to carry nut the reaction. For example, thc rcaction niay be carried out in an inert solvent H . All the other sections are purification sections in which the conipncnts A , H , B, c, I), and E are separated. For illustrative purposes arid also for simplifications in calculations, we have assumed that cross-current extraction is used in these purification sections. (:learly, the prcscnt approach can also be used to solve problems with other types of purification equipments such as distillation. W e have also assumed that the solvents used for extraction can be separated easily from the mixture and thus no consideration for optimization is needed. Different solvents arc uscd in different sections. lxt .r, y, 2 , ti, e, and h represent the concentrations of A, H , C', I), I:, and H , rcspcctivcly, and variables with subscript 11 denote the outlct from the nth stage, the reaction rate equations for thc rcactors arc ~.-i
0.23
2 8
~-
- x,,,)+I/ 5 0.1 X l W 4 , m
A
25 26 28 29
22.5 21 . 0 18.4 14.5 8.75
method. In other words, if no convergence was obtaincd in ten iterations, the program automatically switches to the direction iteration method. T h e accuracy rcquired in these iterations is (.u,k
P
-I
0 9.5 0 627 0 4.13
0 1
EXAMPLE
(X3
= (xz
M,
+
+
+
+
MZ 3'3 Myf 23 M S da A'fd e3 Ma) V h/ Mh = y3 My [M.U Mdb M J ][ X o f YO - XI - YY~)U
+
+
+
+
+
(44)
where ,M,,M d , ,We, and Mh are the molecular weights of C, 11, E, and H , respectively. b, is the concentration of H in the fced to stage O based on one liter feed. Variables with the subscript 0 denote the outlet from stage 0. T h e other state variablc equations for stage 4 are x4 =
x3
y4 = y3 24
=
da = e4
=
M,v/q4 . . . . . . . . . . . . . . . . . . . . . . . . .
M y v/q4
Ms a v(x0 hfd
b
M, c
+ yu - ya - x3)/q1. . . . . . . . . (47) yo
V(Xo
v(x0
, (45) . . . (46)
- 3'3
- ~ z ) / q i . . . . . . . . .(48)
+ yo - yI - xa)/y4.. . . . . . . . . (49)
Stages S to 7 are used to separate H from the mixture. A solvent WI which is immiscible with the original solvent If is used for this separation. We have assumed that cornponents R, C, I), and B have an infinite solubility in WI and thus there is no B, C, U , and E in the raffiriate stream of stagc 5. Material balance on component A gives q4 x4 = q 5 x 5
+ u 6 xEb... . . . . . . . . . . .(so)
where X E b can be eliminated from Lquation (SO) by the liquidliquid equilibrium relationship XE
-
.4i
+ .4ax +
4435'
+ ;lax3 +
.45y4
+ Aex6..
, (51)
The Canadian Journal of Chemical Engineering, Vol. 47, August, 1969
The other state variable equations for stage 5 are q5
=
Ub
= X'5
+
q d y4 = u 44
+ q4(1 . . . . .
q 5 x5
q4(yc
f
f
24
24
d4
+ + d4
e4).
e4).
. . . .(52)
. . . . . . (53)
= u5eE6..
. . . . . ., ..,.................
, ,
yS(l-zS) q8
+
= qQ
{ Q
+
f
UP { E O . .
249.
qI7
ZE
=
f
u5(yES ~5
+
ZE5
....... .
Z E ~ / ~ S . .
,
, ,
XE6
w7 Y E T . .
. . (62)
qio = q o { s . . . . . . . . . . . . . . . . . . . . . . . . . . . qs
=
+
~
410 xi0
i
=
+ XI^ +
~ i i
Yio(1 -XIO) =
$711
2411 YEl'ell.
qn-l
+
W"
= (1.
The Canadian Journal
+ u., of
u5
= (1.
d.-l
q* = qn d.
=
217
= q16
U Q{ E Y ,
. . . . . . . . . (74)
. . . . . . . . . . . . . . . .(75)
U Q{ E D / q l l . .
. . . . . . . . . . . . . . . . . (76)
216/(117.
ln + w,
lEnl
n
18, 19, 2 0 . . . . . . (77)
=
+ I: u,,( d ~ "+ Z E J .. . . . . . . (78)
eES
=
I; U n d E n / Q u . .
d.
+ u,
. . . . . . . . . . . . . .(79)
n
=
22, 23, 2 4 . . . . . . (80)
n
=
22, 23, 2 4 . . . . . . (81)
n = 22, 23, 2 4 . . . . . . (82)
f W,,
The concentration d E can be eliminated using the equilibrium relationship, Equation ( 5 1 ) . Let XI and y~ represent the concentrations in moles per liter in the feed to stage 0, the outlet concentrations from stage 0 based on one liter of feed are x/
+
20
(UIl XEll
f
Wn X E n ) / M >
. . . . . . . . .(83)
=
. . . . . . . . . . (67)
V
. . . . . . . . . . (68)
n = 14, 15, 1 6 . . , . , .(69)
dEn
+ q21 (1 - d n J ,
24% = U. d E n
(64)
where qll is the product for component B and uII recycles back to the feed stage. Again, the concentrations yll, ~ I I and , X E can be eliminated using the equilibrium relationships Equations (13) to ( 1 5 ) . Stages 14 to 16 are used ro separate C and the remaining small amounts of A and R from coniponents D and E using a miscible solvent W4. (:omponent E has an infinite solubility in Wq. Furthermore, the presence of E does not influence the solubility of D in W,. Thus, component E is not considered in the material balance of these stages. We shall also assume that the remaining small amounts of A and B are completely insoluble in W',. Neglecting .4 and B, the material balances for these stages are Q.-I
{I7
+
216)
I4
X"
+
di3
lfi
. . . . . . . . . . . . . . . . . (66)
YII
f
ql((dl6
dzi
~ 1 1 .
~ 1 ~1 ~ 1 1 . .. ..
1 -
14
XQ/Yl0
=i q11
=
= (117
~ S = I
where wc have neglected the amount of z in the outlet of stage 10. For stage 1 1, the following material balances can be obtained 410
=
lfi
. , , . . . . . . . . . . . . . . . .(63)
Notice that components D and E are not included in q 8 . The symbol { rcpresents the total concentration A and R. The variables ZEQ, {9 and C E O can be eliminated using equilibrium relationships Equations (1 3) to (1 s). A miscible solvent Wa is used to scparate components A from B in stage 1 1. T h e state variable equations for stage 10 are
XlO
. . . . . . . . . . . . . . . . . . . (73)
where { E l is a function of {,, through the equilibrium relationship, lquation (51). The stream q 2 0 is the product for C and the extract streams recycle back to the feed stage. W e have assumed, again, that components A and R have approximately the same solubility in W5 and thus they are considered as one component. Stages 22 to 24 separate component 11 from E using an immiscible solvent We.The Equations for stages 21 to 24 are
...
f
{,,-I
a 7
. . . . . . . . . . . . . . . . (61)
+ w6
XES)
= U Sd e s / Y i 3 .
. . . . . . . . . . . . . (72)
Assuming constant raffinate flow rate, material balances on { for stages 18 to 20 give
where q~ and z 8 are the state variables for state 8 and are given by the relationships qS =
d13
dEs.
The concentrations z, ZE, and d~ can be expressed as functions of d by the equilibrium relationships Equations (1 3 ) to ( 1 5). The remaining small amounts of A and B are separated from Cin stage 18 to 20 with an immiscible solvent SV,. The equations for stage 17 are
f ug Z E Q . . . . . . . . . . . . . . . .(59)
= qQ
Wg
= U QZ E Y f Ub
213
The equilibrium relationship, Equation (51), can be used to eliminate .I-*,. Stage 9 is used to separate components A and B from the mixture. .A solvent W:!which is miscible with the raffinate stream is used for this separation. Solubility study has indicated that components A and B have approximately the same solubility in solvent lf'2, components D and E have an infinite solubility in Wp, and the presence of I) and E does not influence the solubility of A and B in W p . Thus, D and E need not be considered in this extraction and A and B are considered as one component in stage 9 . Material balances give ZD
(113
. , (57)
+
= qQ
n = 14, 15, 16. . . . . .(71)
with
Since U', is an immiscible solvent, the flow rate q is assumed constant in stages 6 and 7. Thus, there is only one state in these stages gs X.-I = ~5 X" W. XE", n = 6, 7 . . . . . . . . . (58)
q 8 28
= qs z,, f U. ZE,,,
~ " - 1
The state variable equations for stage 1 3 are
. . . . . . . . . . . . . . . . . (56)
.......
qn-l
,
..............................
~ 6 . . ..
= q. d. f u,
. (54) , . (55)
..............................
21 = U 5 Z g 5 .
q4er
y4
U6 X E ~
Y E5.
qc dc = U Sd
x4
dE., n = 14, 15, 1 6 . . . . . .(70)
yn-l d"-.l
yf
yo ~
+
+2 20
b l l YE11
wn
18
V
~
YE>,)/My . . . . . . . . . (84)
=
wherc xtn and ,ybn can bc expressed as fiinctions of {
.......................... 2 ( 5 Y E S u9 ( E Y
=
lEn q8(1-Z.S)q17
,n
=
(85)
18, 19, 2 0 . . . . . . . (86)
{17
The problem is to find the control variables T and w in each stage so that the following net profit is maximized
Chemical Engineering, Vol. 47, August, 1969
435
0, the values of these Lagrangc multipliers must be assumed and
16
some iterative scheme must be used to obtain the true valuc. It was found that the Lagrange multipliers XI, p4, P4, y4, and O 4 always appear in the following form in tliese later stages.
1
( 6,
~ ( 1 1( . Y ~ I I
+
Y ~ I I )-
BIUS
.. ..
~ l {nl i t , .
IS
l.1
. (87)
$,
~
.-
2
I I,
1
./ ( I )
LO
2
p,,j,,IXJ .- y
I
4
0
x8 [ j
n . /"2J PI
fin/,81:lJ
18
4
13
where for simplicity the function's f have l)ccn introduced. f,(,i, , . ., / n ( s ~ rcprcscnt the corresponding statc variable cqtlatioiis F)r the statc variables x, .y, s, d, e, {, q, 11. The subscript I / in f. is the stage niiml)cr. I;or cxamplc
/.(I),
jl'" = jJ7'
=
j&aJ = fJ3,
XI
+
yp
lY + 2ly
'19
tl
k,, s, -
+ up +
= qpzs
0
- (/"(I --za)
(18 -
ugzliy
=
X(l
-
U'y =
=
0
0
c/azw = 0
'l'hc 1,agrangc multiplier equations and the gradients of with respect the control variables can now be obtained from Equation (8X). T h e procedure is the same as that used to obtain Equations (19) to (3 3) from Equation (1 7). Since we have 61 statc variable equations which are Lquations (+I), (42), (44) to (50). and ( 5 2 ) to (84), 61 Lagrange multiplier cquations arc obtaincd for the 61 unknown 1,agraiige niiiltiplicrs. ~l'hcsc equations can, again, bc solvcd in a backward recursive cashion starting froin the last stagc 24. Howcvcr, due to the presence of the two recycle streams, the I .agrange multipliers Ao, po, X4, p4, @., 74, 6 , and 0 4 appear in the 1,agrangc multiplier equations for stages 5 , X tn 1 I , and I 7 to 2 0 . Since the values of thesc 1,agrangc multipliers arc not calculated until stages 4 and
0 ,00009
0,9740 0 0865 0.9887 0 00826 0.00369
436
I
+
y3
12fv
x 4 Y3 A f x
+ ( I I ~ +~ U + A ~ , c ) ( s o + YO Afdb
+
p 4
y3 121,
+
(134
M'a
+
+ 64 h f e ( . ) ( ~+o yo -- xg - y:i). . . . . . .
(80)
I . ,4ssunic a reasonable set of values for the control variables 7' and w 2 . Assume reasonable values for xu, y o , and Y 3. (:alculate the state variables starting from stage 1 in a forward rccursivc fashion using thc state variable equations, hpations (41) to (82) 4. (:aleidate improved values for x() and yo using I:,quations (83) and (84), and the newly calculated value of Y 5 . Repcat steps 3 and 4 until thc dcsircd accuracy on YO and y o is obtained 6. Assunic reasonable values for Xu, po, and ( 7. (:alculate the Lagrange multipliers starting from stagc 24 in a backward recursive fiashioii until stagc 4, using tlic 1,agrarigc multiplier equations olmined from I:+iiation (HX) 8 . Calculate an improved valuc for ( using l i p t i o n (89) Y. Repeat steps 7 and 8 until the desired accuracy o n 4 is obtained 10. Obtain the Lagrange inultiplicrs for stages 1 to 3 1 1 . Obtain improved values for Xu and pa using the 1,agrangc multiplier equations for stage 0 12. Repeat steps 7 to 1 1 until the dcsircd accuracy on Xu arid po arc obtained 1 3 . Obtained improved values for the control variables by using the gradients and equations similar to Equations (31) to (37) 14. Repeat steps 3 to 5 and 7 to 1 3 until the sum of thc squarcs of the gradient is so small that further improvement is n o t significant. Notice that steps 1, 2, and 6 are not used in later itcrations. The values of the previous iteration are used instead of the assumed values for 7', w, yo, xo, v , XO, PO,and E. In solving the statc variahle equations in step 3, the Newton-Raphson method is uscd alternatively with the simple iteration scheme, which has been discusscd in thc numerical solution of the simple example in thc previous section. This problem has been solved on an IBM 7094 computer. l h e liquid-liquid cquilibrium relationships uscd are first correlated into equations. Fquations (13) to (IS) are uscd for
-
- - - ~ y , , J , , <-;?:y,,f',,[lJ ll -
.- fi17/L7(JJ
- I)%
+
l'hus, instead of assuming the values for the Lagrangc niultipliers, the value of E is assumed. Since the process equations arc solvcd in a forward rectirsivc fashion, the variables in Equation (43) are unknown values when Equations (41) to (49) arc solved. Furtherniore, the variables for stages 11 and 18 to 20 are also unknown variables in Equations (83) and (84). Instead of assuming a value for each of these unknown variables, values for xo, yo, and Y are assumed. Thus, this optimization problem is solved by the following procedure:
6
-
A)l,f,,(lJ
1'
O , [ S ~Afz
Afdb
wlicre NI and H , are thc nornializcd unit values of products C' and I ) assuming the valuc of product H is one. H a to Bs are the costs of the extracting solvents per unit value of product B, and By and Blo are the recycle costs. In establishing kcpation ( 8 7 ) , we have neglected all the other operating costs. Clearly, the basic procedure can also be applied to objective functions including these other operating costs. To obtain the gradient of the objective function with respect to the control variatlles, let 11s introduce the Lagrange multipliers A, p, fi, 7,6, 11, 0, and a, and consider the equation
4
=
zo
1 7971
-0 --0 --0 4
7707 8295 9646
.12.1
,< . 564
--0.7771 - 1 ,2203 - 0 09306 -1.3 --
-0
1156
,363
1 I 097
-21
209
2.6043 o.oisn 0.1578 0.01366 8 013 7.695
4.3882 2.602
The Canadian Journal of Chemical Engineering, YO~.47, Augurt, 1969
miscible solvents and IGquation (51) is used for immiscible solvents. 'I'he coefficients for these equilibrium data are givcn in Table 2. The other numerical values used are:
M,
= 0.95 = 0.05 = 80
My
=
X,
y,
B, Bz Bt Bc Ba Be B, B*
OPTIMAL CONTROLS FOR
x
v, v,
=
T,,
=
n = 1, 2, 3 n = 5, 6, 7, 9, 11 n = 14, 15, 16, 18, 19, 20, 22, 23, 24
335,
the optimal values for the control variables listed in Table 3 are obtained in approximately two minutes. The rnaximuni value of obtained is 54.73. T o start the recycle iterations, the following values were assumed
+
Xo = 25 po = 25
= 0.95 yo = 0.05 v = 1 ~0
E
=
100
The accuracs required for thcse variables are ~ p h- p + l l
lp
-
p + l l
I 10-5 I1 0 - 4
7w
5 c
where c is any given value. ki'henevcr the calculated value for this control variable is larger than c, we simply let w = c
The same technique can be used to handle inequality constraints of the following type
335 .0 333.3 332.4 116.9 164.6 165.8 38 1
7
.?i. 7 2.37 1.78 1.66 4.76 3 66 3.33 1.42 1.39 1.22
20
22 23 24
constraint is violated or when the calculated value for g ( x ) is larger than c, the additional objective function, (91), must also be considered. T h e purpose is to reduce Equation (91) to zero subjects to all the constraints of the state variable equations. Thus, the gradient vector for Equation (9 I ) with respect to the control variables can be obtained in the same way as that used to obtain the gradient vector for rhe original objective function such as Ikpation (1 6). Since thc objective is to reduce Equation (91) to zero, the step size AS for Equation (91) is a known quantity. Notice that the optimum of the original objective function is unknown. Consequently, A#J is also unknown and must be assumed. Thus, we can optimize the original objective function and reduce Iquation (9 I ) to zero simultaneously by using their respective gradient vectors. One way to do this is to solve the following siniultancous cquations for I<, and K 2
where p = so, yo, Xo, and po. The superscript k represents the recycle iteration number. The recycle iterations converge very fast. In general, the above required accuracy can be obtained in only two to four iterations.
Inequality Constraints The combined scheme can handle inequality constraints on the control variables easily. I:or exaniplc, suppose that the control variat)le w is subject t o the following inequality constraint
Torw
9 11 14 1.5 16 18 19
Starting with the following valucs for the control variables for step 1 w. = 10, w. = 2,
I
Stage
= 0.5
0.5 = 0.005 = 0.001 = 0.05 = 0.08 = 0.02 = 0.005 By = 0.1 HI,, = 0.1 n = 1 b = 1 c = 1 1, = 6, n = 1, 2, 3
78 M. = 46 iw,j = 28 M. = 4 h,Alh = 750 (;* = 0.53.5 x 10" c;b = 0.461 X 10" E. = 0.18 X 10' E, = 0.3 105 K = 2 = 1 = 1
TABLE 3 PROCESS W I T H Two RECYCLES
THE
A+ A.7
=
=
[Z (Z
(%)*I
a+ a.7 +( u', -) awn K:, . .(92)
I\'~
,
-)
a+ as azl. awn K~ + [Z
-
(g)']
K.. . . . (93)
where A#J is the step size or the required improvement and AS is thc minus of the quantity that exceeds the constraint, 1;quation (90). The sunlmation sign indicates the summation over all the control variables. For example, if the sitnple example discussed previously has the inequality constraint, lkpation (90), the summation sign would niean the suiii of all the N partial derivatives with respect to 7' and all the (.tl - (iVf1)) partial derivatives with respect to w . which obey the constraint, The new control variable, LGquation (90), and also makes the required improvement A+ is wnew=
Wola
+ 6w
. . . . . . . . . . . . . . . .(94)
h(w, w) I c ,
where h is a given function of the state variable x and the control variable w. However, inequality constraints involving state variables onlv are much more diHicult to handle. The statc variable inequality constraints can be handled in the following manner. Suppose that the variable x is subject to the following inequality constraint
(95)
.Again, if Equation (90) is an inequality constraint for the simple example discussed previously, 1;quations (36) and (37) would become a.s 84 6Tn = h-1- Kr - n = 1, . . ., N . . . . .,.(96) a Tn a T"'
+
g(r) Ic . . . . . . . . . . . . .
where c is a givcn value and g is a given function. In addition to the original objective function, we can consider the following as an additional objective function
.S =
g ( ~ )- c . . . . . . . . . . . . . . . . . . . (91)
whenever the calculated value for the function g(+) is less than c, Equation (91) need not be considered. However, when the
with other cquations remain unchanged. It should be emphasized again that I;quations (91) to (97) are used only for those iterations where the constraint, Fquation (90), is violated. If for any iteration, the constraint is not violated, the problem should be solved as if there were no inequality constraints.
The Canadian Jaurnal of Chemical Engineering, Vol. 47, August, 1969
437
Diecussion The gradient technique appears to be a powerful tool for solving large nonlinear optiniizatiori problems. Furthermore, thc use of the Lagrange multiplier to obtain the gradient vector for complex processes with a large number of equality constraints is an effective scheme for handling complex interconnections betwceri stagcs. The convergence rate of the recycle iterations is very cast. Other complex structures(6)such as branching stages, combining stages, feedforward loop or by-passing can be solved without any additional effort. le can be considcrcd as a feedback complication or feedback loop which makes the process equations depend on the values of the state variables of latter stagcs. Since the process equations or the state variable cquations arc solved by starting frorii the first stage in a forward recursive fashion, the values of thc state variables of latter stages are always unltnowri. Thus, the unknown variables of latter stagcs must be assumed and iterations caii bc uscd to hid these assunicd values. Thc fccdforward coiiiplications iiiakc thc process equations dcpcnd o n the variables of thc earlier stages. Since the values of the state variables are known for the earlier stagcs, no additional compurational effort is needed to handle feedforward coiiiplications. Sonic of thc feedforward complications are bypassing, fccdforwwd loop, and the presence of inactive state variables. Frequcntly, the operations in a stage do not influence all the input state variatks. Some of thc state variables pass through a stage without any change. For simplicity in computation, these inactive state variables are frcqueritly neglected. One cxainple would he the concentration of components I ) and E in stage 9 in Figure 3 . These concentrations were not considered in the calculations.
There are two extremes in the structures of a multistage process. T h e simplest multistage process is the simple honiogeneous serial process in which the output of the previous stage becomes the feed to the next stage. T h e process equations for this serial process involve only the variables of the current and the previous stages. As more feedforward and fecdback complications are added, the process equations become functions of the variables of more stages. Finally, the process beconics so complex that the distinctions between stages completely disappear and the process becomes a onc stage process. ‘I’he complex processes discussed in this paper are between these two ex t renies.
Acknowledgment This work was partly supported by the Office of Water Resources Research US. Department of the Interior Grant No. 14-01-0001-1962. Part of this work was done while the author was with Phillips Petroleum Company.
sferences Box, M. J., Computer Journal, 9, 67 (1966). Courant R Bull. Am. Math. Soc 49, 1 (1943). Hadley, ’ G.: Nonlinear and D y n a h c Programming, Addison-Wesley Publishing Company (1964). Hooke, R. and Jeeves, T. A., Assoc. Comp. Mach. J., 8, 212 (1961). Lee, E. S., I. E. C. Fundamentals, 3, 373 (1964). Lee, E. S., “Optimization of Complex Chemical Plants by a Gradient Technique”, presented at AIChE St. Louis Meeting, 1968, also to appear in AIChE Journal. Nelder, J. A. and Mead, R., Computer Journal, 7. 308 (1965). Powell, M. J. D., Computer Journal, 7, 155 (1964). Wilde, D. J. and Beightler, C. S., Foundations of Optimization, Prentice-Hall (1967).
Manuscript received November 5, 1968; accepted May 1. 1969.
* * *
NOTE TO THE EDITOR
Geometric Parameters for Open Circular Channels CARLOS TlU and WILLIAM KOZlCKl Department of Chemical Engineering, University of Ottawa, Ottawa, Ontario
In
’ oils papcrs ( I . * ) , a method was proposed to predict the non-Ncwtonian prt\i flow through closed and open channels of arbitrary cross section utilizing the knowledge of two geometric parameters and a fluid model equation. The general relationship between the average vclocity ( I / ) and the pressure drop or the average wall shear mess i, was found to bc given by
2 ( ( 4 - Tr,) rti
- __
1: f
dr. . .
’
..
. . . (1)
\vhcre R, is the average cffcctivc velocity at the wall, rff is the
438
hydraulic radius, E is the aspect factor defined by E = b/tr, a and b arc the geometric parameters characterizing the flow cross section, T,, is the yield stress of the fluid, and q is the nonNewtonian viscosity determined by the fluid model equation. Recently, Buffhamc3) obtained a solution to predict the velocity profile and flow rate of Newtonian fluids in operi circular shallow channels of different depth to half-width ratios. The purpose of this paper is to provide the geometric parameters for shallow circular channels evaluated from the solutiori of Buffham. This information enables one to predict non-Newton-
The Canadian Journal
of
Chemical Engineering, Vol. 47, Aupurt, 1969