/[ascend]/trunk/models/abc_flowsheet.a4l
ViewVC logotype

Contents of /trunk/models/abc_flowsheet.a4l

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2651 - (show annotations) (download) (as text)
Thu Dec 13 07:29:48 2012 UTC (11 years, 6 months ago) by jpye
File MIME type: text/x-ascend
File size: 13570 byte(s)
Fixing GPL header, removing postal address (rpmlint incorrect-fsf-address)
1 REQUIRE "collocation.a4l";
2 REQUIRE "ben/bencolumn.a4l";
3 (* => ben/bencolumn.a4l, ben/benflash.a4l, ben/benstream.a4l,
4 * ben/benHGthermo.a4l, ben/benpropertyoptions.a4l,
5 * ben/bencomponents.a4l, atoms.a4l, measures.a4l, system.a4l,
6 * basemodel.a4l *)
7 REQUIRE "KenPendings.a4l";
8 (* => KenPendings.a4l, ben/benstream.a4l, ben/benHGthermo.a4l,
9 * ben/benpropertyoptions.a4l, ben/bencomponents.a4l, atoms.a4l,
10 * measures.a4l, system.a4l, basemodel.a4l *)
11 PROVIDE "abc_flowsheet.a4l";
12
13 (*
14 * abc_flowsheet.a4l
15 * by Kenneth H. Tyner
16 * Part of the ASCEND Library
17 * $Date: 1998/06/17 19:49:24 $
18 * $Revision: 1.4 $
19 * $Author: mthomas $
20 * $Source: /afs/cs.cmu.edu/project/ascend/Repository/models/abc_flowsheet.a4l,v $
21 *
22 * This file is part of the ASCEND Modeling Library.
23 *
24 * Copyright (C) 1997, 1998 Carnegie Mellon University
25 *
26 * The ASCEND Modeling Library is free software; you can redistribute
27 * it and/or modify it under the terms of the GNU General Public
28 * License as published by the Free Software Foundation; either
29 * version 2 of the License, or (at your option) any later version.
30 *
31 * The ASCEND Modeling Library is distributed in hope that it
32 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
33 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
34 * See the GNU General Public License for more details.
35 *
36 * You should have received a copy of the GNU General Public License
37 * along with this program. If not, see <http://www.gnu.org/licenses/>.
38 *)
39
40 (*
41 * Distillation flowsheet demos (using aceton-benzene-chloroform.
42 *)
43 MODEL demo_flowsheet(
44 n_columns IS_A integer_constant;
45 components IS_A set OF symbol_constant;
46 reference IS_A symbol_constant;
47 n_trays[1..n_columns] IS_A integer_constant;
48 vapor_options WILL_BE vapor_phase_options;
49 liquid_options WILL_BE liquid_phase_options;
50 ) WHERE (
51 reference IN components == TRUE;
52 );
53
54 feed_P[1..n_columns] IS_A pressure;
55 feed_T[1..n_columns] IS_A temperature;
56 FOR i IN [1..n_columns] CREATE
57 feed_vapor_state[i] IS_A vapor_mixture(
58 feed_P[i],
59 feed_T[i],
60 vapor_options
61 );
62 feed_liquid_state[i] IS_A liquid_mixture(
63 feed_P[i],
64 feed_T[i],
65 liquid_options
66 );
67 END FOR;
68
69 Equilibrated[1..n_columns] IS_A boolean;
70 FOR i IN [1..n_columns] CREATE
71 feed_state[i] IS_A td_VLE_mixture(
72 feed_P[i],
73 feed_T[i],
74 feed_vapor_state[i],
75 feed_liquid_state[i],
76 Equilibrated[i]
77 );
78 END FOR;
79 FOR i IN [1..n_columns] CREATE
80 Feed[i] IS_A vapor_liquid_stream(feed_state[i]);
81 END FOR;
82
83
84 distillate_P[1..n_columns] IS_A pressure;
85 distillate_T[1..n_columns] IS_A temperature;
86 FOR i IN [1..n_columns] CREATE
87 distillate_state[i] IS_A liquid_mixture(
88 distillate_P[i],
89 distillate_T[i],
90 liquid_options
91 );
92 END FOR;
93 FOR i IN [1..n_columns] CREATE
94 Distillate[i] IS_A liquid_stream(distillate_state[i]);
95 END FOR;
96
97 bottoms_P[1..n_columns] IS_A pressure;
98 bottoms_T[1..n_columns] IS_A temperature;
99 FOR i IN [1..n_columns] CREATE
100 bottoms_state[i] IS_A liquid_mixture(
101 bottoms_P[i],
102 bottoms_T[i],
103 liquid_options
104 );
105 END FOR;
106 FOR i IN [1..n_columns] CREATE
107 Bottoms[i] IS_A liquid_stream(bottoms_state[i]);
108 END FOR;
109
110 reduce[1..n_columns] IS_A fraction;
111 z_on[1..n_columns] IS_A boolean;
112 hat_on[1..n_columns] IS_A boolean;
113 hb_on[1..n_columns] IS_A boolean;
114
115 z_on[1..n_columns] := FALSE;
116 hat_on[1..n_columns] := FALSE;
117 hb_on[1..n_columns] := FALSE;
118 Equilibrated[1..n_columns] := FALSE;
119
120 FOR i IN [1..n_columns] CREATE
121 Column[i] IS_A simple_coll_column(
122 n_trays[i],
123 Distillate[i],
124 Feed[i],
125 Bottoms[i],
126 Equilibrated[i],
127 reduce[i],
128 z_on[i],
129 hat_on[i],
130 hb_on[i]
131 );
132 END FOR;
133
134 (* hooking it all up *)
135 n_sheet_feeds IS_A integer_constant;
136 n_sheet_feeds :== 1;
137
138 outputs IS_A set OF symbol_constant;
139 outputs :== [components,'waste'];
140
141 product_P[outputs] IS_A pressure;
142 product_T[outputs] IS_A temperature;
143 sheet_feed_P[n_sheet_feeds] IS_A pressure;
144 sheet_feed_T[n_sheet_feeds] IS_A temperature;
145 FOR i IN [outputs] CREATE
146 product_state[i] IS_A liquid_mixture(
147 product_P[i],
148 product_T[i],
149 liquid_options
150 );
151 END FOR;
152 FOR i IN [n_sheet_feeds] CREATE
153 sheet_feed_state[i] IS_A liquid_mixture(
154 sheet_feed_P[i],
155 sheet_feed_T[i],
156 liquid_options
157 );
158 END FOR;
159
160 FOR i IN [outputs] CREATE
161 product[i] IS_A liquid_stream(product_state[i]);
162 END FOR;
163 Product[n] ALIASES
164 (product[outputs])
165 WHERE n IS_A set OF integer_constant
166 WITH_VALUE (1..CARD[components]+1);
167
168 FOR i IN [1..n_sheet_feeds] CREATE
169 Sheet_Feed[i] IS_A liquid_stream(sheet_feed_state[i]);
170 END FOR;
171
172 sources IS_A set OF integer_constant;
173 sinks IS_A set OF integer_constant;
174
175 sources :== [1..(n_columns*2 + n_sheet_feeds)];
176 sinks :== [1..(n_columns+CARD[components]+1)];
177 (*
178 link_T[sources][sinks] IS_A temperature;
179 link_P[sources][sinks] IS_A pressure;
180 FOR i IN sources CREATE
181 FOR j IN sinks CREATE
182 link_state[i][j] IS_A liquid_mixture(
183 link_P[i][j],
184 link_T[i][j],
185 liquid_options
186 );
187 END FOR;
188 END FOR;*)
189 FOR i IN sources CREATE
190 FOR j IN sinks CREATE
191 (* Source_Link[i][j] IS_A liquid_stream(link_state[i][j]);*)
192 Source_Link[i][j] IS_A mass_stream(components);
193 END FOR;
194 END FOR;
195 FOR i IN sinks CREATE
196 FOR j IN sources CREATE
197 Sink_Link[i][j] ALIASES Source_Link[j][i];
198 END FOR;
199 END FOR;
200
201 mb_reduce[1..n_columns] IS_A factor;
202 prod_reduce[1..CARD[components]+1] IS_A factor;
203
204 FOR i IN [1..n_columns] CREATE
205 mixer[i] IS_A mass_balance_homotopy_mixer_single_output_int(
206 sources,
207 Sink_Link[i],
208 Feed[i],
209 mb_reduce[i]
210 );
211 dist_split[i] IS_A liquid_stream_splitter_int(
212 Distillate[i],
213 sinks,
214 Source_Link[i]
215 );
216 bot_split[i] IS_A liquid_stream_splitter_int(
217 Bottoms[i],
218 sinks,
219 Source_Link[n_columns + i]
220 );
221 END FOR;
222 FOR i IN [1..n_sheet_feeds] CREATE
223 feed_split[i] IS_A liquid_stream_splitter_int(
224 Sheet_Feed[i],
225 sinks,
226 Source_Link[n_columns*2 + i]
227 );
228 END FOR;
229 FOR i IN [1..CARD[components]+1] CREATE
230 prod_mix[i] IS_A mass_balance_homotopy_mixer_single_output_int2(
231 sources,
232 Sink_Link[n_columns + i],
233 Product[i],
234 prod_reduce[i]
235 );
236 END FOR;
237
238 (* conditionals *)
239 (* could just use mass streams *)
240 stream_exists[sources][sinks] IS_A boolean;
241 stream_exists[sources][sinks] := FALSE;
242 (* FOR i IN sources CREATE
243 FOR j IN sinks CREATE
244 WHEN (stream_exists[i][j])
245 CASE TRUE:
246 USE Source_Link[i][j].state;
247 USE Source_Link[i][j].Htot_def;
248 USE Source_Link[i][j].bubble_point;
249 END FOR;
250 END FOR;
251 END FOR;
252 *)
253 METHODS
254 METHOD scale;
255 RUN Column[1..n_columns].scale;
256 END scale;
257 METHOD set_connections;
258 FIX dist_split[1..n_columns].split[sinks];
259 FIX bot_split[1..n_columns].split[sinks];
260 FIX feed_split[1..n_sheet_feeds].split[sinks];
261
262 FOR i IN [1..n_columns] DO
263 FOR j IN sinks DO
264 IF (stream_exists[i][j] == FALSE) THEN
265 dist_split[i].split[j] := 0;
266 END IF;
267 END FOR;
268 END FOR;
269 FOR i IN [n_columns+1..n_columns*2] DO
270 FOR j IN sinks DO
271 IF (stream_exists[i][j] == FALSE) THEN
272 bot_split[i-n_columns].split[j] := 0;
273 END IF;
274 END FOR;
275 END FOR;
276 FOR i IN [n_columns*2+1..n_columns*2+n_sheet_feeds] DO
277 FOR j IN sinks DO
278 IF (stream_exists[i][j] == FALSE) THEN
279 feed_split[i-n_columns*2].split[j] := 0;
280 END IF;
281 END FOR;
282 END FOR;
283 (*
284 FOR i IN sources DO
285 FOR j IN sinks DO
286 IF (stream_exists[i][j] == FALSE) THEN
287 Source_Link[i][j].f_def[components].included
288 := FALSE;
289 ELSE
290 Source_Link[i][j].f_def[components].included
291 := TRUE;
292 END FOR;
293 END IF;
294 END FOR;
295 *)
296 END set_connections;
297 METHOD remove_connections;
298 FOR i IN sources DO
299 FOR j IN sinks DO
300 stream_exists[i][j] := FALSE;
301 END FOR;
302 END FOR;
303 END remove_connections;
304 METHOD fix_splits;
305 FOR i IN [1..n_columns] DO
306 FIX dist_split[i].split[sinks];
307 FIX bot_split[i].split[sinks];
308 END FOR;
309 FOR i IN [1..n_sheet_feeds] DO
310 FIX feed_split[i].split[sinks];
311 END FOR;
312 END fix_splits;
313
314 METHOD calc_multipliers;
315 RUN mixer[1..n_columns].calc_multipliers;
316 END calc_multipliers;
317
318 METHOD calc_outputs;
319 RUN mixer[1..n_columns].calc_outputs;
320 END calc_outputs;
321
322 METHOD reduce_mix_diff;
323 RUN mixer[1..n_columns].reduce_mix_diff;
324 END reduce_mix_diff;
325
326 METHOD clear;
327 RUN Sheet_Feed[1..n_sheet_feeds].clear;
328 RUN Column[1..n_columns].clear;
329 RUN Source_Link[sources][sinks].clear;
330 RUN mixer[1..n_columns].clear;
331 RUN dist_split[1..n_columns].clear;
332 RUN bot_split[1..n_columns].clear;
333 RUN feed_split[1..n_sheet_feeds].clear;
334 RUN prod_mix[1..CARD[components]+1].clear;
335 END clear;
336
337 METHOD reset;
338 RUN clear;
339
340 RUN dist_split[1..n_columns].seqmod;
341 RUN bot_split[1..n_columns].seqmod;
342 RUN feed_split[1..n_sheet_feeds].seqmod;
343
344 RUN Column[1..n_columns].reset;
345 RUN mixer[1..n_columns].seqmod;
346 RUN prod_mix[1..CARD[components]+1].seqmod;
347
348 RUN Sheet_Feed[1..n_sheet_feeds].specify;
349 END reset;
350
351 END demo_flowsheet;
352
353 MODEL abc_demo_sheet;
354 components IS_A set OF symbol_constant;
355 reference IS_A symbol_constant;
356 n_columns IS_A integer_constant;
357 n_trays[1..n_columns] IS_A integer_constant;
358
359 n_columns :== 3;
360 components :== ['acetone','benzene','chloroform'];
361 reference :== 'chloroform';
362 n_trays[1] :== 4;
363 n_trays[2] :== 2;
364 n_trays[3] :== 2;
365
366
367
368 ds IS_A
369 td_component_data_set(components,reference);
370 vapor_options IS_A vapor_phase_options(ds,'Pitzer','Pitzer');
371 (* liquid_options IS_A liquid_phase_options(ds,'Rackett','UNIFAC');*)
372 liquid_options IS_A liquid_phase_options(ds,'Rackett','Wilson');
373
374 abc_sheet IS_A demo_flowsheet(n_columns,
375 components,reference,n_trays,
376 vapor_options,liquid_options);
377
378 (* PLOTING SECTION *)
379
380 FOR i IN [1..n_columns] CREATE
381 liq_eq_plot[i] IS_A ternary_plot_equilateral(
382 'abc liquid comp',
383 components,
384 'acetone',
385 'chloroform',
386 abc_sheet.Column[i].n_plt_points_x,
387 abc_sheet.Column[i].x_plot
388 );
389 END FOR;
390
391 curves IS_A set OF symbol_constant;
392 curves :== ['Column_1','Column_2','Column_3'];
393 curve[c] ALIASES
394 (liq_eq_plot[1..n_columns].curve)
395 WHERE c IS_A set OF symbol_constant
396 WITH_VALUE ([curves]);
397
398 eq_plot IS_A ternary_plot_equilateral2(
399 'Acetone-Benzene-Chloroform Liquid Comps',
400 components,
401 'acetone',
402 'chloroform',
403 curves,
404 curve
405 );
406
407
408
409
410 (*
411 r_plot IS_A ternary_plot_right(
412 'abc liquid comp',
413 abc_column.components,
414 'acetone',
415 'chloroform',
416 abc_column.Column.n_plt_points_x,
417 abc_column.Column.x_plot
418 );
419 *)
420
421 METHODS
422 METHOD values;
423 abc_sheet.Column[1].feed_tray_state.alpha['acetone'] := 1.73;
424 abc_sheet.Column[1].feed_tray_state.alpha['benzene'] := 0.97;
425 abc_sheet.Column[1].feed_tray_state.alpha['chloroform'] := 1.19;
426 abc_sheet.Feed[1].f['acetone'] := 3.5{mole/s};
427 abc_sheet.Feed[1].f['chloroform'] := 2.5{mole/s};
428 abc_sheet.Feed[1].f['benzene'] := 4.0{mole/s};
429 abc_sheet.Distillate[1].Ftot := 3.5{mole/s};
430 abc_sheet.Column[1].rectifying_section.stot := 10;
431 abc_sheet.Column[1].stripping_section.stot := 10;
432 abc_sheet.feed_state[1].phi['vapor'] := 0;
433 abc_sheet.Column[1].condenser.reflux_ratio := 4.0;
434 abc_sheet.Column[1].s_stack[1] := 20.0;
435 abc_sheet.Column[1].s_stack[2] := 15.0;
436 abc_sheet.feed_T[1] := 298 {K};
437 abc_sheet.feed_P[1] := 1{atm};
438 RUN abc_sheet.Column[1].propagate_feed;
439
440 abc_sheet.Column[2].feed_tray_state.alpha['acetone'] := 1.76;
441 abc_sheet.Column[2].feed_tray_state.alpha['benzene'] := 0.79;
442 abc_sheet.Column[2].feed_tray_state.alpha['chloroform'] := 1.22;
443 abc_sheet.Feed[2].f['acetone'] := 0.2{mole/s};
444 abc_sheet.Feed[2].f['chloroform'] := 2.5{mole/s};
445 abc_sheet.Feed[2].f['benzene'] := 4.0{mole/s};
446 abc_sheet.Distillate[2].Ftot := 2.675{mole/s};
447 abc_sheet.Column[2].rectifying_section.stot := 10;
448 abc_sheet.Column[2].stripping_section.stot := 7;
449 abc_sheet.feed_state[2].phi['vapor'] := 0;
450 abc_sheet.Column[2].condenser.reflux_ratio := 4.25;
451 abc_sheet.feed_T[2] := 298 {K};
452 abc_sheet.feed_P[2] := 1{atm};
453 RUN abc_sheet.Column[2].propagate_feed;
454
455 abc_sheet.Column[3].feed_tray_state.alpha['acetone'] := 1.0;
456 abc_sheet.Column[3].feed_tray_state.alpha['benzene'] := 0.6;
457 abc_sheet.Column[3].feed_tray_state.alpha['chloroform'] := 1.11;
458 abc_sheet.Feed[3].f['acetone'] := 0.3{mole/s};
459 abc_sheet.Feed[3].f['chloroform'] := 2.5{mole/s};
460 abc_sheet.Feed[3].f['benzene'] := 0.1{mole/s};
461 abc_sheet.Distillate[3].Ftot := 2.2{mole/s};
462 abc_sheet.Column[3].rectifying_section.stot := 10;
463 abc_sheet.Column[3].stripping_section.stot := 5;
464 abc_sheet.feed_state[3].phi['vapor'] := 0;
465 abc_sheet.Column[3].condenser.reflux_ratio := 4.0;
466 abc_sheet.feed_T[3] := 298 {K};
467 abc_sheet.feed_P[3] := 1{atm};
468 RUN abc_sheet.Column[3].propagate_feed;
469
470 abc_sheet.Sheet_Feed[1].f['acetone'] := 3.5{mole/s};
471 abc_sheet.Sheet_Feed[1].f['chloroform'] := 2.5{mole/s};
472 abc_sheet.Sheet_Feed[1].f['benzene'] := 4.0{mole/s};
473 abc_sheet.sheet_feed_T[1] := 298 {K};
474 abc_sheet.sheet_feed_P[1] := 1{atm};
475
476 abc_sheet.z_on[1..n_columns] := FALSE;
477 abc_sheet.hat_on[1..n_columns] := FALSE;
478 abc_sheet.hb_on[1..n_columns] := FALSE;
479 abc_sheet.Equilibrated[1..n_columns] := FALSE;
480
481 abc_sheet.Distillate[1..n_columns].saturated := FALSE;
482 abc_sheet.Bottoms[1..n_columns].saturated := FALSE;
483 abc_sheet.Product[1..CARD[components]+1].saturated := FALSE;
484 abc_sheet.Sheet_Feed[1..abc_sheet.n_sheet_feeds].saturated := FALSE;
485 (* abc_sheet.Source_Link[abc_sheet.sources][abc_sheet.sinks].saturated
486 := FALSE;*)
487
488 END values;
489
490 END abc_demo_sheet;

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