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

Contents of /trunk/models/stream_holdup.a4l

Parent Directory Parent Directory | Revision Log Revision Log


Revision 576 - (show annotations) (download) (as text)
Tue May 9 03:42:08 2006 UTC (13 years, 7 months ago) by johnpye
File MIME type: text/x-ascend
File size: 21627 byte(s)
Changed all cases of *.fixed := {TRUE,FALSE} to 'FIX' and 'FREE' statements.
1 REQUIRE "thermodynamics.a4l";
2 (* => thermodynamics.a4l, components.a4l, phases.a4l, atoms.a4l, measures.a4l,
3 * system.a4l, basemodel.a4l *)
4 PROVIDE "stream_holdup.a4l";
5
6 (*
7 * stream_holdup.a4l
8 * by Arthur W. Westerberg and Benjamin A. Allan
9 * Part of the ASCEND Library
10 * $Date: 1998/06/17 19:31:17 $
11 * $Revision: 1.4 $
12 * $Author: mthomas $
13 * $Source: /afs/cs.cmu.edu/project/ascend/Repository/models/stream_holdup.a4l,v $
14 *
15 * This file is part of the ASCEND Modeling Library.
16 *
17 * Copyright (C) 1998 Carnegie Mellon University
18 *
19 * The ASCEND Modeling Library is free software; you can redistribute
20 * it and/or modify it under the terms of the GNU General Public
21 * License as published by the Free Software Foundation; either
22 * version 2 of the License, or (at your option) any later version.
23 *
24 * The ASCEND Modeling Library is distributed in hope that it
25 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
26 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
27 * See the GNU General Public License for more details.
28 *
29 * You should have received a copy of the GNU General Public License
30 * along with the program; if not, write to the Free Software
31 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check
32 * the file named COPYING.
33 *)
34
35 MODEL sh_base REFINES cmumodel;
36 (* This MODEL anchors the stream-holdup library models. This MODEL
37 * is supposed to be empty except for notes documenting the library.
38 *)
39 NOTES
40 'licensing' SELF {This library is subject to the GNU Public License v.2.0}
41 'new users' SELF {
42 The models "stream" and "holdup" provide easy-to-use (really!) interfaces
43 to stream and control volume calculations. "detailed_stream" and
44 "detailed_holdup" are for advanced modelers who wish to create very
45 efficient models.
46 }
47 'purpose' SELF {
48 Models for single and multiphase, multicomponent streams and holdups.
49 }
50 'created' SELF {November 9, 1997}
51 'author' SELF {
52 Written by Arthur W. Westerberg and Benjamin A. Allan
53 }
54 'design goals' SELF {
55 We structured these stream/holdup models to allow us to model a
56 flash unit by sharing the phase information for the vapor and
57 liquid product streams from a flash unit with the state of the
58 flash unit. See the flash model library. Streams and holdups are
59 treated equivalently in these models -- with the former being a set
60 of flows and a state and the later a set of amounts and a state.
61 }
62 'telephone support' SELF {
63 You must be kidding. CAPD consortium sponsors can contact the authors
64 further consultancy. Everyone else can submit questions, suggestions,
65 and bug reports via the World Wide Web.
66 }
67 'URL' SELF {http://www.cs.cmu.edu/~ascend}
68 'last revised' SELF {$Revision: 1.4 $}
69 END NOTES;
70 END sh_base;
71
72
73 MODEL detailed_stream(
74 state WILL_BE thermodynamics;
75 ) REFINES sh_base;
76
77 NOTES 'purpose' SELF {
78 A typical user will not use "detailed_stream". The
79 "stream" model given later in this set of models has a part
80 which is a detailed_stream. detailed_stream sets up the
81 extensive variables (quantity dependent) and their
82 relationships for a stream.
83 }
84 END NOTES;
85
86 components ALIASES state.cd.components;
87 phases ALIASES state.pd.phases;
88 P ALIASES state.P;
89 T ALIASES state.T;
90
91 flow "total stream flow rate" IS_A molar_rate;
92 f[components] IS_A molar_rate;
93 V_flow IS_A volume_rate;
94 H_flow IS_A energy_rate;
95
96 flowscale "variable (not solved for) used for scaling"
97 IS_A molar_rate_scale;
98 FOR i IN components CREATE
99 f_eqn[i]: f[i]/flowscale = state.y[i]*flow/flowscale;
100 END FOR;
101 (* Do not write "flow = sum(f[i])" because it is redundant with
102 * f_eqn and sum(y[i]) = 1.
103 *)
104
105 V_flowscale "variable (not solved for) used for scaling"
106 IS_A volume_rate_scale;
107 H_flowscale "variable (not solved for) used for scaling"
108 IS_A energy_rate_scale;
109 V_eqn: V_flow/V_flowscale = state.V*flow/V_flowscale;
110 H_eqn: H_flow/H_flowscale = state.H*flow/H_flowscale;
111
112 checkflow "temporary variable (not solved for) used in methods"
113 IS_A molar_rate_scale;
114 boundwidth IS_A bound_width;
115
116 METHODS
117 (* inherits ClearAll, reset *)
118
119 (* The methods assume something like plant scale flow rates,
120 * and not small equipment laboratory flow rates.
121 * For laboratory flow rates, you may need to replace
122 * these methods or add a new ones.
123 *)
124 METHOD check_all;
125 RUN state.check_all;
126 RUN check_self;
127 END check_all;
128
129 METHOD check_self;
130 checkflow := SUM[f[components]];
131 IF ( checkflow <= 0{mole/second} ) THEN
132 STOP {Stream flow <= 0{mole/second}!};
133 END IF;
134 IF (abs((flow - checkflow)/checkflow) > 1.0e-6) THEN
135 STOP {Stream flow not equal to sum of component flows!};
136 (* check must be relative to total, or roundoff gets us *)
137 END IF;
138 END check_self;
139
140 METHOD default_all;
141 RUN state.default_all;
142 boundwidth := 10;
143 RUN default_self;
144 END default_all;
145
146 METHOD default_self;
147 checkflow := SUM[f[components]];
148 flowscale := abs(checkflow);
149 H_flowscale := flowscale*state.H;
150 V_flowscale := flowscale*state.V;
151 (* Assuming for now that the ATOM defaults are sufficient.
152 * Probably not quite TRUE.
153 *)
154 END default_self;
155
156 METHOD scale_all;
157 RUN state.scale_all;
158 RUN scale_self;
159 END scale_all;
160
161 METHOD scale_self;
162 (* set equation scaling from current values. *)
163 flowscale := abs(SUM[f[components]]) * 1.0001 + 0.01{mole/second};
164 flow.nominal := flowscale;
165 FOR i IN components DO
166 IF (abs(f[i]) > 0.01{mole/second}) THEN
167 f[i].nominal := abs(f[i]) * 1.0001;
168 ELSE
169 f[i].nominal := 0.01{mole/second};
170 END IF;
171 END FOR;
172 V_flow.nominal := state.V.nominal * flowscale;
173 H_flow.nominal := state.H.nominal * flowscale;
174 END scale_self;
175
176 METHOD bound_self;
177 flowscale := abs(SUM[f[components]]) * 1.0001 + 0.01{mole/second};
178 flow.upper_bound := flow + abs(boundwidth*flowscale);
179 FOR i IN components DO
180 f[i].upper_bound := f[i] + boundwidth*f[i].nominal;
181 END FOR;
182 H_flow.lower_bound := H_flow - abs(boundwidth*H_flowscale);
183 H_flow.upper_bound := H_flow + abs(boundwidth*H_flowscale);
184 END bound_self;
185
186 METHOD bound_all;
187 state.boundwidth := boundwidth;
188 RUN state.bound_all;
189 RUN bound_self;
190 END bound_all;
191
192 METHOD seqmod;
193 RUN state.specify;
194 FREE state.y[components];
195 END seqmod;
196
197 METHOD specify;
198 RUN state.specify;
199 FREE state.y[components];
200 FIX f[components];
201 END specify;
202
203 END detailed_stream;
204
205 (* ****************************************************************** *)
206
207 MODEL detailed_holdup(
208 state WILL_BE thermodynamics;
209 ) REFINES sh_base;
210
211 NOTES 'purpose' SELF {
212 A typical user will not use this model. The holdup model given
213 later in this set of models has a part which is a
214 detailed_holdup. This model sets up the extensive variables
215 (quantity dependent) and their relationships for a holdup.
216 }
217 END NOTES;
218
219 components ALIASES state.cd.components;
220 phases ALIASES state.pd.phases;
221 P ALIASES state.P;
222 T ALIASES state.T;
223 holdup IS_A mole;
224 m[components] IS_A mole;
225 holdupscale "variable (not solved for) used for scaling" IS_A mole_scale;
226
227 FOR i IN components CREATE
228 species_holdup[i]: m[i]/holdupscale = state.y[i] * holdup/holdupscale;
229 END FOR;
230
231 V_holdup "holdup volume" IS_A volume;
232 H_holdup "holdup enthalpy (not as useful as U_holdup)" IS_A energy;
233 V_holdupscale "variable (not solved for) used for scaling"
234 IS_A volume_scale;
235 H_holdupscale "variable (not solved for) used for scaling"
236 IS_A energy_scale;
237 Volume_eqn: V_holdup/V_holdupscale = state.V * holdup/V_holdupscale;
238 Enthalpy_eqn: H_holdup/H_holdupscale = state.H * holdup/H_holdupscale;
239 checkholdup "variable (not solved for) used in methods"
240 IS_A mole_scale;
241 boundwidth IS_A bound_width;
242
243 METHODS
244
245 METHOD check_all;
246 RUN state.check_all;
247 RUN check_self;
248 END check_all;
249
250 METHOD check_self;
251 checkholdup := SUM[m[components]];
252 IF ( checkholdup < 0{mole} ) THEN
253 STOP {Holdup mass < 0{mole}!};
254 END IF;
255 IF (abs((holdup - checkholdup)/checkholdup) > 1.0e-6) THEN
256 STOP {holdup not equal to sum of component masses!};
257 (* check must be relative to total, or roundoff gets us *)
258 END IF;
259 END check_self;
260 METHOD default_all;
261 RUN state.default_all;
262 RUN default_self;
263 END default_all;
264
265 METHOD default_self;
266 boundwidth := 10;
267 checkholdup := SUM[m[components]];
268 holdupscale := abs(checkholdup);
269 H_holdupscale := holdupscale*state.H;
270 V_holdupscale := holdupscale*state.V;
271 (* Assuming for now that the ATOM defaults are sufficient.
272 * Probably not quite TRUE.
273 *)
274 END default_self;
275
276 METHOD bound_self;
277 holdupscale := abs(SUM[m[components]]) * 1.0001 + 0.01{mole};
278 FOR i IN components DO
279 m[i].upper_bound := m[i] + boundwidth*m[i].nominal;
280 END FOR;
281 holdup.upper_bound := holdup + abs(boundwidth*holdupscale);
282 H_holdup.lower_bound := H_holdup - abs(boundwidth*H_holdupscale);
283 H_holdup.upper_bound := H_holdup + abs(boundwidth*H_holdupscale);
284 END bound_self;
285
286 METHOD bound_all;
287 state.boundwidth := boundwidth;
288 RUN state.bound_all;
289 RUN bound_self;
290 END bound_all;
291
292 METHOD scale_all;
293 RUN state.scale_all;
294 RUN scale_self;
295 END scale_all;
296
297 METHOD scale_self;
298 (* set equation scaling from current values. *)
299 holdupscale := abs(SUM[m[components]]) * 1.0001 + 0.01{mole};
300 holdup.nominal := holdupscale;
301 FOR i IN components DO
302 IF (abs(m[i]) > 0.01{mole/second}) THEN
303 m[i].nominal := abs(m[i]) * 1.0001;
304 ELSE
305 m[i].nominal := 0.01{mole/second};
306 END IF;
307 END FOR;
308 V_holdup.nominal := state.V.nominal * holdupscale;
309 H_holdup.nominal := state.H.nominal * holdupscale;
310 END scale_self;
311
312
313 METHOD specify;
314 RUN state.specify;
315 FIX m[components];
316 FREE state.y[components];
317 END specify;
318
319 END detailed_holdup;
320
321 (* ****************************************************************** *)
322
323 MODEL select_mixture_type(
324 cd WILL_BE components_data;
325 type WILL_BE symbol_constant;
326 ) REFINES sh_base;
327
328 NOTES
329 'purpose' SELF {
330 This model sets up the appropriate model for a phase, based on the
331 type of the phase. This MODEL must be edited to accomodate new
332 mixture types.
333 }
334 END NOTES;
335 phase IS_A phase_partials(cd);
336
337 SELECT (type)
338 CASE 'ideal_vapor_mixture':
339 phase IS_REFINED_TO ideal_vapor_mixture(cd);
340 CASE 'Pitzer_vapor_mixture':
341 phase IS_REFINED_TO Pitzer_vapor_mixture(cd);
342 CASE 'UNIFAC_liquid_mixture':
343 phase IS_REFINED_TO UNIFAC_liquid_mixture(cd);
344 CASE 'Wilson_liquid_mixture':
345 phase IS_REFINED_TO Wilson_liquid_mixture(cd);
346 OTHERWISE:
347 END SELECT;
348 boundwidth IS_A bound_width;
349
350 METHODS
351
352 METHOD check_self;
353 RUN phase.check_self;
354 END check_self;
355
356 METHOD check_all;
357 RUN cd.check_all;
358 RUN check_self;
359 END check_all;
360
361 METHOD default_self;
362 RUN phase.default_self;
363 END default_self;
364
365 METHOD default_all;
366 RUN cd.default_all;
367 RUN default_self;
368 END default_all;
369
370 METHOD scale_self;
371 RUN phase.scale_self;
372 END scale_self;
373
374 METHOD scale_all;
375 RUN cd.scale_all;
376 RUN scale_self;
377 END scale_all;
378
379 METHOD bound_self;
380 phase.boundwidth := boundwidth;
381 RUN phase.bound_self;
382 END bound_self;
383
384 METHOD bound_all;
385 RUN cd.bound_all;
386 RUN bound_self;
387 END bound_all;
388
389 METHOD specify;
390 RUN phase.specify;
391 END specify;
392
393 END select_mixture_type;
394
395 (* ****************************************************************** *)
396
397 MODEL stream(
398 cd WILL_BE components_data;
399 pd WILL_BE phases_data;
400 equilibrated WILL_BE boolean;
401 ) REFINES sh_base;
402
403 NOTES
404 'purpose' SELF {
405 The stream model for flowsheet models in ASCEND. This is
406 the model that users should use when creating a stream. It
407 sets up the appropropriate phase_partials models for each
408 of the phases in the stream (by including a
409 select_mixture_type model for each phase). It also sets up
410 the extensive variables for the stream by including a
411 detailed_steam model as a part.
412 }
413 END NOTES;
414
415 components ALIASES cd.components;
416 phases ALIASES pd.phases;
417 FOR j IN phases CREATE
418 smt[j] IS_A select_mixture_type(cd, pd.phase_type[j]);
419 END FOR;
420
421 FOR j IN phases CREATE
422 phase[j] ALIASES smt[j].phase;
423 END FOR;
424
425 state IS_A thermodynamics(cd, pd, phase, equilibrated);
426 Details IS_A detailed_stream(state);
427
428 P ALIASES phase[pd.reference_phase].P;
429 T ALIASES phase[pd.reference_phase].T;
430 flow ALIASES Details.flow;
431 f ALIASES Details.f;
432 y ALIASES state.y;
433 V_flow ALIASES Details.V_flow;
434 H_flow ALIASES Details.H_flow;
435
436 (* put back in when rest is working
437 (* auxillary quantities about a flowsheet stream of common interest: *)
438 mw_y IS_A molar_mass;
439 mole_weight: mw_y = SUM[cd.data[i].mw * y[i] | i IN components];
440
441 mass_flow[components] IS_A mass_rate;
442 FOR i IN components CREATE
443 mass_eqn[i]: mass_flow[i] / (cd.data[i].mw * Details.flowscale)
444 = f[i] / Details.flowscale;
445 END FOR;
446 *)
447
448 boundwidth IS_A bound_width;
449
450 METHODS
451
452 METHOD check_all;
453 RUN pd.check_all;
454 RUN cd.check_all;
455 RUN check_self;
456 END check_all;
457
458 METHOD check_self;
459 RUN smt[phases].check_self;
460 RUN state.check_self;
461 RUN Details.check_self;
462 END check_self;
463
464 METHOD default_all;
465 RUN pd.default_all;
466 RUN cd.default_all;
467 equilibrated := FALSE;
468 RUN default_self;
469 END default_all;
470
471 METHOD default_self;
472 RUN smt[phases].default_self;
473 RUN state.default_self;
474 RUN Details.default_self;
475 END default_self;
476
477 METHOD bound_all;
478 RUN pd.bound_all;
479 RUN cd.bound_all;
480 RUN bound_self;
481 END bound_all;
482
483 METHOD bound_self;
484 smt[phases].boundwidth := boundwidth;
485 state.boundwidth := boundwidth;
486 Details.boundwidth := boundwidth;
487 RUN smt[phases].bound_self;
488 RUN state.bound_self;
489 RUN Details.bound_self;
490 END bound_self;
491
492 METHOD scale_self;
493 RUN smt[phases].scale_self;
494 RUN state.scale_self;
495 RUN Details.scale_self;
496 END scale_self;
497
498 METHOD scale_all;
499 RUN pd.scale_all;
500 RUN cd.scale_all;
501 RUN scale_self;
502 END scale_all;
503
504 METHOD seqmod;
505 RUN Details.seqmod;
506 END seqmod;
507
508 METHOD specify;
509 FIX P;
510 RUN Details.specify;
511 END specify;
512
513 END stream;
514
515 (* ****************************************************************** *)
516
517 MODEL holdup(
518 cd WILL_BE components_data;
519 pd WILL_BE phases_data;
520 equilibrated WILL_BE boolean;
521 ) REFINES sh_base;
522
523 NOTES
524 'purpose' SELF {
525 The holdup model for flowsheet models in ASCEND. This is
526 the model that users should use when creating a holdup. It
527 sets up the appropropriate phase_partials models for each
528 of the phases in the holdup (by including a
529 select_mixture_type model for each phase). It also sets up
530 the extensive variables for the holdup by including a
531 detailed_holdup model as a part.
532 }
533 END NOTES;
534
535 components ALIASES cd.components;
536 phases ALIASES pd.phases;
537 FOR j IN pd.phases CREATE
538 smt[j] IS_A select_mixture_type(cd, pd.phase_type[j]);
539 END FOR;
540
541 FOR j IN pd.phases CREATE
542 phase[j] ALIASES smt[j].phase;
543 END FOR;
544
545 state "control volume thermodynamic state calculation"
546 IS_A thermodynamics(cd, pd, phase, equilibrated);
547 Details "control volume extensive properties"
548 IS_A detailed_holdup(state);
549
550 P ALIASES phase[pd.reference_phase].P;
551 T ALIASES phase[pd.reference_phase].T;
552 holdup ALIASES Details.holdup;
553 m ALIASES Details.m;
554 y ALIASES state.y;
555 V_holdup ALIASES Details.V_holdup;
556 H_holdup ALIASES Details.H_holdup;
557
558 (* put back in when rest is working
559 mw_y IS_A molar_mass;
560 mole_weight: mw_y = SUM[cd.data[i].mw * y[i] | i IN components];
561
562 mass[components] IS_A mass;
563 FOR i IN components CREATE
564 mass_eqn[i]: mass[i] / (cd.data[i].mw * Details.holdupscale)
565 = m[i] / Details.holdupscale;
566 END FOR;
567 *)
568
569 boundwidth IS_A bound_width;
570
571 METHODS
572
573 METHOD check_all;
574 RUN pd.check_all;
575 RUN cd.check_all;
576 RUN check_self;
577 END check_all;
578
579 METHOD check_self;
580 RUN smt[phases].check_self;
581 RUN state.check_self;
582 RUN Details.check_self;
583 END check_self;
584
585 METHOD default_all;
586 RUN pd.default_all;
587 RUN cd.default_all;
588 equilibrated := FALSE;
589 RUN default_self;
590 END default_all;
591
592 METHOD default_self;
593 RUN smt[phases].default_self;
594 RUN state.default_self;
595 RUN Details.default_self;
596 END default_self;
597
598 METHOD bound_all;
599 RUN pd.bound_all;
600 RUN cd.bound_all;
601 RUN bound_self;
602 END bound_all;
603
604 METHOD bound_self;
605 smt[phases].boundwidth := boundwidth;
606 state.boundwidth := boundwidth;
607 Details.boundwidth := boundwidth;
608 RUN smt[phases].bound_self;
609 RUN state.bound_self;
610 RUN Details.bound_self;
611 END bound_self;
612
613 METHOD scale_self;
614 RUN smt[phases].scale_self;
615 RUN state.scale_self;
616 RUN Details.scale_self;
617 END scale_self;
618
619 METHOD scale_all;
620 RUN pd.scale_all;
621 RUN cd.scale_all;
622 RUN scale_self;
623 END scale_all;
624
625 METHOD specify;
626 FIX P;
627 RUN Details.specify;
628 END specify;
629
630 END holdup;
631
632 (* ****************************************************************** *)
633 (* **************** test stream and holdup models ******************* *)
634
635 MODEL test_sh_model REFINES testcmumodel;
636
637 NOTES
638 'purpose' SELF {
639 This is an anchor MODEL for test stream and holdup models.
640 It defines a bunch of methods, all of which assume that the
641 tested part is going to be named t1.
642 }
643 END NOTES;
644 METHODS
645
646 METHOD check_self;
647 RUN cd.check_self;
648 RUN pd.check_self;
649 RUN t1.check_self;
650 END check_self;
651
652 METHOD check_all;
653 (* no parts passed in *)
654 RUN check_self;
655 END check_all;
656
657 METHOD default_self;
658 RUN cd.default_self;
659 RUN pd.default_self;
660 t1.boundwidth := 10;
661 RUN t1.default_self;
662 END default_self;
663
664 METHOD default_all;
665 (* no parts passed in *)
666 RUN default_self;
667 END default_all;
668
669 METHOD scale_all;
670 (* no parts passed in *)
671 RUN scale_self;
672 END scale_all;
673
674 METHOD bound_self;
675 RUN cd.bound_self;
676 RUN pd.bound_self;
677 t1.boundwidth := boundwidth;
678 RUN t1.bound_self;
679 END bound_self;
680
681 METHOD bound_all;
682 RUN bound_self;
683 END bound_all;
684
685 METHOD specify;
686 RUN t1.specify;
687 END specify;
688
689 END test_sh_model;
690
691
692 MODEL test_two_phase_stream REFINES test_sh_model;
693
694 NOTES
695 'purpose' SELF {
696 Test the stream MODEL in VL mode.
697 }
698 END NOTES;
699
700 cd IS_A components_data(['methanol','ethanol','water'], 'water');
701 pd IS_A phases_data('VL', 'Pitzer_vapor_mixture',
702 'UNIFAC_liquid_mixture', 'none');
703 equilibrated IS_A boolean;
704
705 t1 IS_A stream(cd, pd, equilibrated);
706
707 METHODS
708
709 (* inherits methods check_all (the error flavor)
710 * boundself/all, scaleall, defaultself/all, specify, reset, ClearAll.
711 * Does not inherit scale_self.
712 *)
713 METHOD values;
714 t1.P := 1 {atm};
715 t1.T := 365 {K};
716 t1.f['methanol'] := 0.01 {kmol/s};
717 t1.f['ethanol'] := 0.015 {kmol/s};
718 t1.f['water'] := 0.02 {kmol/s};
719 t1.phase['vapor'].alpha['methanol'] := 2;
720 t1.phase['vapor'].alpha['ethanol'] := 1.5;
721 t1.phase['vapor'].alpha['water'] := 1;
722 equilibrated := FALSE;
723 END values;
724
725 METHOD scale_self;
726 RUN cd.check_self;
727 RUN pd.check_self;
728 RUN t1.check_self;
729 t1.flow.nominal := 0.03 {kmol/s};
730 t1.f[cd.components].nominal := 0.03 {kmol/s};
731 END scale_self;
732
733 END test_two_phase_stream;
734
735 (* ****************************************************************** *)
736
737 MODEL test_two_phase_holdup REFINES test_sh_model;
738
739 NOTES
740 'purpose' SELF {
741 Test the holdup MODEL in VL mode.
742 }
743 END NOTES;
744
745 cd IS_A components_data(['methanol','ethanol','water'], 'water');
746 pd IS_A phases_data('VL', 'Pitzer_vapor_mixture',
747 'UNIFAC_liquid_mixture', 'none');
748 equilibrated IS_A boolean;
749
750 t1 IS_A holdup(cd, pd, equilibrated);
751
752 METHODS
753
754 (* inherits methods check_all (the error flavor)
755 * boundself/all, scaleall, defaultself/all, specify, reset, ClearAll.
756 * Does not inherit scale_self.
757 *)
758
759 METHOD values;
760 t1.P := 1 {atm};
761 t1.T := 365 {K};
762 t1.m['methanol'] := 0.01 {kmol};
763 t1.m['ethanol'] := 0.015 {kmol};
764 t1.m['water'] := 0.02 {kmol};
765 t1.phase['vapor'].alpha['methanol'] := 2;
766 t1.phase['vapor'].alpha['ethanol'] := 1.5;
767 t1.phase['vapor'].alpha['water'] := 1;
768 equilibrated := FALSE;
769 END values;
770
771 METHOD scale_self;
772 RUN cd.check_self;
773 RUN pd.check_self;
774 RUN t1.check_self;
775 t1.holdup.nominal := 0.03 {kmol};
776 t1.m[cd.components].nominal := 0.03 {kmol};
777 END scale_self;
778
779 END test_two_phase_holdup;
780
781 (* ****************************************************************** *)
782
783 MODEL test_single_phase_stream REFINES test_sh_model;
784
785 NOTES
786 'purpose' SELF {
787 Test the stream MODEL in vapor mode.
788 }
789 END NOTES;
790
791 cd IS_A components_data(['methanol','ethanol','water'], 'water');
792 pd IS_A phases_data('V', 'Pitzer_vapor_mixture',
793 'none', 'none');
794 equilibrated IS_A boolean;
795
796 t1 IS_A stream(cd, pd, equilibrated);
797
798 METHODS
799
800 (* inherits methods check_all (the error flavor)
801 * boundself/all, scaleall, defaultself/all, specify, reset, ClearAll.
802 * Does not inherit scale_self.
803 *)
804 METHOD scale_self;
805 RUN cd.check_self;
806 RUN pd.check_self;
807 RUN t1.check_self;
808 t1.flow.nominal := 0.03 {kmol/s};
809 t1.f[cd.components].nominal := 0.03 {kmol/s};
810 END scale_self;
811
812 METHOD values;
813 t1.P := 1 {atm};
814 t1.T := 365 {K};
815 t1.f['methanol'] := 0.01 {kmol/s};
816 t1.f['ethanol'] := 0.015 {kmol/s};
817 t1.f['water'] := 0.02 {kmol/s};
818 equilibrated := FALSE;
819 END values;
820
821 END test_single_phase_stream;
822
823 (* ****************************************************************** *)
824
825 MODEL test_material_stream REFINES test_sh_model;
826
827 NOTES
828 'purpose' SELF {
829 Test the stream MODEL in mass-only mode.
830 }
831 END NOTES;
832
833 cd IS_A components_data(['methanol','ethanol','water'],'water');
834 pd IS_A phases_data('M', 'none', 'none', 'none');
835 equilibrated IS_A start_false;
836 t1 IS_A stream(cd, pd, equilibrated);
837
838 METHODS
839
840 (* inherits methods check_all (the error flavor)
841 * boundself/all, scaleall, defaultself/all, specify, reset, ClearAll.
842 * Does not inherit scale_self.
843 *)
844 METHOD scale_self;
845 RUN cd.check_self;
846 RUN pd.check_self;
847 RUN t1.check_self;
848 t1.flow.nominal := 0.03 {kmol/s};
849 t1.f[cd.components].nominal := 0.03 {kmol/s};
850 END scale_self;
851
852 METHOD values;
853 t1.P := 1 {atm};
854 t1.T := 365 {K};
855 t1.f['methanol'] := 0.01 {kmol/s};
856 t1.f['ethanol'] := 0.015 {kmol/s};
857 t1.f['water'] := 0.02 {kmol/s};
858 equilibrated := FALSE;
859 END values;
860
861 END test_material_stream;
862
863 (* ****************************************************************** *)

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