1 |
REQUIRE "simple_fs.a4c"; |
2 |
(* => simple_fs.a4c, atoms.a4l, measures.a4l, system.a4l, basemodel.a4l *) |
3 |
PROVIDE "simple_fs_ext.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 |
* simple_fs_cost.a4s. |
10 |
*) |
11 |
|
12 |
UNIVERSAL MODEL stream_parameters; |
13 |
|
14 |
components IS_A set OF symbol_constant; |
15 |
MW[components] IS_A molar_weight_constant; |
16 |
SpGr[components] IS_A factor_constant; |
17 |
|
18 |
END stream_parameters; |
19 |
|
20 |
|
21 |
MODEL mod_mixture REFINES mixture; |
22 |
|
23 |
sp IS_A stream_parameters; |
24 |
MW_ave IS_A molar_mass; |
25 |
SpGr_ave IS_A factor; |
26 |
|
27 |
sp.components, |
28 |
components ARE_THE_SAME; |
29 |
|
30 |
yw[components], |
31 |
yv_liq[components] IS_A fraction; |
32 |
|
33 |
|
34 |
sp.MW['A'] :== 50{g/mol}; |
35 |
sp.MW['B'] :== 120{g/mol}; |
36 |
sp.MW['C'] :== 120{g/mol}; |
37 |
|
38 |
sp.SpGr['A'] :== 0.8; |
39 |
sp.SpGr['B'] :== 0.8; |
40 |
sp.SpGr['C'] :== 0.8; |
41 |
|
42 |
FOR i IN components CREATE |
43 |
yw_def[i]: yw[i]*MW_ave = y[i]*sp.MW[i]; |
44 |
END FOR; |
45 |
|
46 |
FOR i IN components CREATE |
47 |
yv_liq_def[i]: yv_liq[i]*sp.SpGr[i] = yw[i]*SpGr_ave; |
48 |
END FOR; |
49 |
|
50 |
sum_yw: SUM[yw[components]] = 1.0; |
51 |
sum_yv_liq: SUM[yv_liq[components]] = 1.0; |
52 |
|
53 |
|
54 |
METHODS |
55 |
|
56 |
METHOD clear; |
57 |
y[components].fixed := FALSE; |
58 |
yw[components].fixed := FALSE; |
59 |
yv_liq[components].fixed := FALSE; |
60 |
MW_ave.fixed := FALSE; |
61 |
SpGr_ave.fixed := FALSE; |
62 |
END clear; |
63 |
|
64 |
METHOD specify; |
65 |
y[components].fixed := TRUE; |
66 |
y[CHOICE[components]].fixed := FALSE; |
67 |
END specify; |
68 |
|
69 |
END mod_mixture; |
70 |
|
71 |
|
72 |
MODEL mod_stream REFINES molar_stream; |
73 |
|
74 |
Wtot,w[components] IS_A mass_rate; |
75 |
Vtot_liq,v_liq[components] IS_A volume_rate; |
76 |
|
77 |
state IS_REFINED_TO mod_mixture; |
78 |
state.components, |
79 |
components ARE_THE_SAME; |
80 |
|
81 |
Wtot_def: Wtot = Ftot*state.MW_ave; |
82 |
Vtot_liq_def: Vtot_liq = Wtot/state.SpGr_ave; |
83 |
|
84 |
FOR i IN components CREATE |
85 |
w_def[i]: w[i] = state.yw[i]*Wtot; |
86 |
END FOR; |
87 |
|
88 |
FOR i IN components CREATE |
89 |
v_liq_def[i]: v_liq[i] = state.yv_liq[i]*Vtot_liq; |
90 |
END FOR; |
91 |
|
92 |
METHODS |
93 |
|
94 |
METHOD clear; |
95 |
|
96 |
RUN state.clear; |
97 |
Ftot.fixed := FALSE; |
98 |
f[components].fixed := FALSE; |
99 |
Wtot.fixed := FALSE; |
100 |
w[components].fixed := FALSE; |
101 |
Vtot_liq.fixed := FALSE; |
102 |
v_liq[components].fixed := FALSE; |
103 |
Wtot.fixed := FALSE; |
104 |
|
105 |
END clear; |
106 |
|
107 |
METHOD specify; |
108 |
f[components].fixed := TRUE; |
109 |
END specify; |
110 |
|
111 |
END mod_stream; |
112 |
|
113 |
|
114 |
(* |
115 |
* simple_fs_ext.a4c |
116 |
* by Arthur W. Westerberg |
117 |
* Part of the ASCEND Library |
118 |
* $Date: 1998/06/17 19:43:48 $ |
119 |
* $Revision: 1.2 $ |
120 |
* $Author: mthomas $ |
121 |
* $Source: /afs/cs.cmu.edu/project/ascend/Repository/models/simple_fs_ext.a4c,v $ |
122 |
* |
123 |
* This file is part of the ASCEND Modeling Library. |
124 |
* |
125 |
* Copyright (C) 1994-1998 Carnegie Mellon University |
126 |
* |
127 |
* The ASCEND Modeling Library is free software; you can redistribute |
128 |
* it and/or modify it under the terms of the GNU General Public |
129 |
* License as published by the Free Software Foundation; either |
130 |
* version 2 of the License, or (at your option) any later version. |
131 |
* |
132 |
* The ASCEND Modeling Library is distributed in hope that it will be |
133 |
* useful, but WITHOUT ANY WARRANTY; without even the implied |
134 |
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
135 |
* See the GNU General Public License for more details. |
136 |
* |
137 |
* You should have received a copy of the GNU General Public License |
138 |
* along with the program; if not, write to the Free Software |
139 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check |
140 |
* the file named COPYING. |
141 |
*) |