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

Contents of /trunk/models/linear_balance.a4c

Parent Directory Parent Directory | Revision Log Revision Log


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

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