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

Annotation of /trunk/models/stream_holdup.a4l

Parent Directory Parent Directory | Revision Log Revision Log


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

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