/[ascend]/trunk/models/linear_balance.a4c
ViewVC logotype

Contents of /trunk/models/linear_balance.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 576 - (show annotations) (download) (as text)
Tue May 9 03:42:08 2006 UTC (18 years ago) by johnpye
File MIME type: text/x-ascend
File size: 8241 byte(s)
Changed all cases of *.fixed := {TRUE,FALSE} to 'FIX' and 'FREE' statements.
1 REQUIRE "atoms.a4l";
2 (* => atoms.a4l, measures.a4l, system.a4l, basemodel.a4l *)
3 PROVIDE "linear_balance.a4c";
4 (*
5 * This file is part of the ASCEND Modeling Library and is released
6 * under the GNU Public License as described at the end of this file.
7 *
8 * Use of this module is demonstrated by the associated script file
9 * linear_balance.a4s.
10 *)
11
12
13 (*
14 Ascend model of the linear mass balance example presented by Grossmann
15 and Turkay -- Solution of Algebraic Systems of Disjuctive Equations, Comp.
16 and Chem. Eng., Vol. 20, Suppl. Part A, s339-44, 1996 --. It represent a
17 problem which we can represent as a conditional model and solve with the
18 ascend conditional solver CMSlv. The problem consists of a six unit
19 operations flowsheet, each unit operation having three possible operation
20 modes.
21
22 This model requires:
23 "system.a4l"
24 "atoms.a4l"
25 *)
26
27 (* ************************************************* *)
28
29 MODEL unit_op1;
30
31 Fmain,Fsub1,Fsub2 IS_A molar_rate;
32 B[bounds] IS_A molar_rate;
33 disjunc IS_A set OF integer_constant;
34 bounds IS_A set OF integer_constant;
35 a[disjunc] IS_A factor_constant;
36 b[disjunc] IS_A factor_constant;
37 bol1,bol2 IS_A boolean_var;
38
39 disjunc :== [1..3];
40 bounds :== [1..2];
41
42 (* Boundaries *)
43
44 CONDITIONAL
45 cond1: Fmain <= B[1];
46 cond2: Fmain >= B[2];
47 END CONDITIONAL;
48
49 bol1 == SATISFIED(cond1,1e-08{lb_mole/hour});
50 bol2 == SATISFIED(cond2,1e-08{lb_mole/hour});
51
52 (* Variant Equations *)
53
54 eq1a: Fsub1 = a[1] * Fmain;
55 eq1b: Fsub2 = b[1] * Fmain;
56
57 eq2a: Fsub1 = a[2] * Fmain;
58 eq2b: Fsub2 = b[2] * Fmain;
59
60 eq3a: Fsub1 = a[3] * Fmain;
61 eq3b: Fsub2 = b[3] * Fmain;
62
63 (* Disjunctive Statements *)
64
65 WHEN (bol1,bol2)
66 CASE TRUE,FALSE:
67 USE eq1a;
68 USE eq1b;
69 CASE FALSE,FALSE:
70 USE eq2a;
71 USE eq2b;
72 CASE FALSE,TRUE:
73 USE eq3a;
74 USE eq3b;
75 END WHEN;
76
77 METHODS
78
79 METHOD default_self;
80 END default_self;
81
82 METHOD specify;
83 FOR i IN bounds DO
84 FIX B[i];
85 END FOR;
86 END specify;
87
88 METHOD values;
89 bol1 := SATISFIED(cond1,1e-08{lb_mole/hour});
90 bol2 := SATISFIED(cond2,1e-08{lb_mole/hour});
91 END values;
92
93 END unit_op1;
94
95
96 (* ************************************************* *)
97
98 MODEL unit_op2;
99
100 Fmain,Fsub1 IS_A molar_rate;
101 B[bounds] IS_A molar_rate;
102 disjunc IS_A set OF integer_constant;
103 bounds IS_A set OF integer_constant;
104 a[disjunc] IS_A factor_constant;
105 bol1,bol2 IS_A boolean_var;
106
107 disjunc :== [1..3];
108 bounds :== [1..2];
109
110 (* Boundaries *)
111
112 CONDITIONAL
113 cond1: Fmain <= B[1];
114 cond2: Fmain >= B[2];
115 END CONDITIONAL;
116
117 bol1 == SATISFIED(cond1,1e-08{lb_mole/hour});
118 bol2 == SATISFIED(cond2,1e-08{lb_mole/hour});
119
120
121 (* Variant Equations *)
122
123 eq1: Fsub1 = a[1] * Fmain;
124
125 eq2: Fsub1 = a[2] * Fmain;
126
127 eq3: Fsub1 = a[3] * Fmain;
128
129 (* Disjunctive Statements *)
130
131 WHEN (bol1,bol2)
132 CASE TRUE,FALSE:
133 USE eq1;
134 CASE FALSE,FALSE:
135 USE eq2;
136 CASE FALSE,TRUE:
137 USE eq3;
138 END WHEN;
139
140
141 METHODS
142
143 METHOD default_self;
144 END default_self;
145
146 METHOD specify;
147 FOR i IN bounds DO
148 FIX B[i];
149 END FOR;
150 END specify;
151
152 METHOD values;
153 bol1 := SATISFIED(cond1,1e-08{lb_mole/hour});
154 bol2 := SATISFIED(cond2,1e-08{lb_mole/hour});
155 END values;
156
157 END unit_op2;
158
159
160 (* ************************************************* *)
161
162 MODEL flowsheet;
163
164 U[num_units1] IS_A unit_op1;
165 U2[num_units2] IS_A unit_op2;
166 F[num_flow] IS_A molar_rate;
167 num_units1 IS_A set OF integer_constant;
168 num_units2 IS_A integer_constant;
169 num_flow IS_A set OF integer_constant;
170
171 (* wire up flowsheet *)
172
173 F[2],U[2].Fsub1 ARE_THE_SAME;
174 F[3],U[4].Fsub1 ARE_THE_SAME;
175 F[4],U[3].Fmain ARE_THE_SAME;
176 F[5],U2[6].Fmain ARE_THE_SAME;
177 F[6],U[1].Fsub1 ARE_THE_SAME;
178 F[7],U[1].Fmain,U[2].Fsub2 ARE_THE_SAME;
179 F[8],U[2].Fmain,U[3].Fsub1 ARE_THE_SAME;
180 F[9],U[3].Fsub2 ARE_THE_SAME;
181 F[10],U[1].Fsub2 ARE_THE_SAME;
182 F[11],U[5].Fsub1 ARE_THE_SAME;
183 F[12],U[4].Fsub2 ARE_THE_SAME;
184 F[13],U[4].Fmain,U[5].Fsub2 ARE_THE_SAME;
185 F[14],U[5].Fmain,U2[6].Fsub1 ARE_THE_SAME;
186
187
188 (* Set definitions *)
189
190 num_units1 :== [1..5];
191 num_units2 :== 6;
192 num_flow :== [1..14];
193
194 (* Invariant Equations *)
195
196 F[1] = F[6] + F[12];
197 F[9] = F[10] + F[11];
198
199 (* Constants *)
200
201 U[1].a[1] :== 1.1;
202 U[1].a[2] :== 1.15;
203 U[1].a[3] :== 1.2;
204 U[1].b[1] :== 0.05;
205 U[1].b[2] :== 0.1;
206 U[1].b[3] :== 0.2;
207
208 U[2].a[1] :== 0.5;
209 U[2].a[2] :== 0.47;
210 U[2].a[3] :== 0.45;
211 U[2].b[1] :== 0.8;
212 U[2].b[2] :== 0.75;
213 U[2].b[3] :== 0.7;
214
215 U[3].a[1] :== 1.7;
216 U[3].a[2] :== 1.8;
217 U[3].a[3] :== 1.87;
218 U[3].b[1] :== 0.67;
219 U[3].b[2] :== 0.7;
220 U[3].b[3] :== 0.75;
221
222 U[4].a[1] :== 1.18;
223 U[4].a[2] :== 1.15;
224 U[4].a[3] :== 1.10;
225 U[4].b[1] :== 0.23;
226 U[4].b[2] :== 0.25;
227 U[4].b[3] :== 0.3;
228
229 U[5].a[1] :== 0.37;
230 U[5].a[2] :== 0.35;
231 U[5].a[3] :== 0.3;
232 U[5].b[1] :== 1.2;
233 U[5].b[2] :== 1.25;
234 U[5].b[3] :== 1.3;
235
236 U2[6].a[1] :== 1.15;
237 U2[6].a[2] :== 1.10;
238 U2[6].a[3] :== 1.02;
239
240 METHODS
241
242 METHOD default_self;
243 END default_self;
244
245
246 METHOD specify;
247 FIX F[1];
248 FOR i IN num_units1 DO
249 RUN U[i].specify;
250 END FOR;
251 RUN U2[num_units2].specify;
252 END specify;
253
254 METHOD bound_all;
255 (* Unit 1 *)
256 U[1].Fmain.upper_bound := 150 {lb_mole/hour};
257
258 (* Unit 2 *)
259 U[2].Fmain.upper_bound := 150 {lb_mole/hour};
260
261 (* Unit 3 *)
262 U[3].Fmain.upper_bound := 180 {lb_mole/hour};
263
264 (* Unit 4 *)
265 U[4].Fmain.upper_bound := 140 {lb_mole/hour};
266
267 (* Unit 5 *)
268 U[5].Fmain.upper_bound := 130 {lb_mole/hour};
269
270 (* Unit 6 *)
271 U2[6].Fmain.upper_bound := 75 {lb_mole/hour};
272
273 END bound_all;
274
275 METHOD values;
276
277 RUN bound_all;
278
279 (* Fixed Values*)
280
281 F[1] := 47.5 {lb_mole/hour };
282
283 (* Unit 1 *)
284 U[1].B[1] := 50 {lb_mole/hour};
285 U[1].B[2] := 80 {lb_mole/hour};
286
287 (* Unit 2 *)
288 U[2].B[1] := 50 {lb_mole/hour};
289 U[2].B[2] := 100 {lb_mole/hour};
290
291 (* Unit 3 *)
292 U[3].B[1] := 50 {lb_mole/hour};
293 U[3].B[2] := 110 {lb_mole/hour};
294
295 (* Unit 4 *)
296 U[4].B[1] := 50 {lb_mole/hour};
297 U[4].B[2] := 90 {lb_mole/hour};
298
299 (* Unit 5 *)
300 U[5].B[1] := 40 {lb_mole/hour};
301 U[5].B[2] := 80 {lb_mole/hour};
302
303 (* Unit 6 *)
304 U2[6].B[1] := 20 {lb_mole/hour};
305 U2[6].B[2] := 45 {lb_mole/hour};
306
307
308 (* Initial Guess *)
309
310
311 (* Unit 1 *)
312 U[1].Fmain := 34 {lb_mole/hour};
313 U[1].Fsub1 := 37.5 {lb_mole/hour};
314 U[1].Fsub2 := 1.70 {lb_mole/hour};
315
316 (* Unit 2 *)
317
318 U[2].Fmain := 52.5 {lb_mole/hour};
319 U[2].Fsub1 := 21.25 {lb_mole/hour};
320 U[2].Fsub2 := 60 {lb_mole/hour};
321
322 (* Unit 3 *)
323 (* initial *)
324 U[3].Fmain := 25 {lb_mole/hour};
325 U[3].Fsub1 := 52.5 {lb_mole/hour};
326 U[3].Fsub2 := 16.75 {lb_mole/hour};
327
328 (* Unit 4 *)
329 (* initial *)
330 U[4].Fmain := 60.0 {lb_mole/hour};
331 U[4].Fsub1 := 69 {lb_mole/hour};
332 U[4].Fsub2 := 15 {lb_mole/hour};
333
334 (* Unit 5 *)
335 (* initial *)
336 U[5].Fmain := 48 {lb_mole/hour};
337 U[5].Fsub1 := 16.8 {lb_mole/hour};
338 U[5].Fsub2 := 110 {lb_mole/hour};
339
340 (* Unit 6 *)
341 (* initial *)
342 U2[6].Fmain := 50 {lb_mole/hour};
343 U2[6].Fsub1 := 48 {lb_mole/hour};
344
345 (* Same initial value as complementarity *)
346
347 U[2].Fmain := 42.5 {lb_mole/hour};
348 U[3].Fsub1 := 42.5 {lb_mole/hour};
349 U2[6].Fmain := 43 {lb_mole/hour};
350
351 (* Initialization of boolean variables *)
352 FOR i IN num_units1 DO
353 RUN U[i].values;
354 END FOR;
355 RUN U2[num_units2].values;
356
357 END values;
358
359 END flowsheet;
360
361
362 (*
363 * linear_balance.a4c
364 * by Vicente Rico-Ramirez
365 * April 10, 1998
366 * Part of the ASCEND Library
367 * $Date: 1998/06/17 19:11:17 $
368 * $Revision: 1.3 $
369 * $Author: mthomas $
370 * $Source: /afs/cs.cmu.edu/project/ascend/Repository/models/linear_balance.a4c,v $
371 *
372 * This file is part of the ASCEND Modeling Library.
373 *
374 * Copyright (C) 1998 Carnegie Mellon University
375 *
376 * The ASCEND Modeling Library is free software; you can redistribute
377 * it and/or modify it under the terms of the GNU General Public
378 * License as published by the Free Software Foundation; either
379 * version 2 of the License, or (at your option) any later version.
380 *
381 * The ASCEND Modeling Library is distributed in hope that it will be
382 * useful, but WITHOUT ANY WARRANTY; without even the implied
383 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
384 * See the GNU General Public License for more details.
385 *
386 * You should have received a copy of the GNU General Public License
387 * along with the program; if not, write to the Free Software
388 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check
389 * the file named COPYING.
390 *)

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22