1 |
REQUIRE "stream_holdup.a4l"; |
2 |
(* => stream_holdup.a4l, thermodynamics.a4l, components.a4l, phases.a4l, |
3 |
* atoms.a4l, measures.a4l, system.a4l, basemodel.a4l *) |
4 |
PROVIDE "mix.a4l"; |
5 |
|
6 |
(* |
7 |
* mix.a4l |
8 |
* by Duncan Coffey |
9 |
* Part of the ASCEND Library |
10 |
* $Date: 1998/06/24 10:47:06 $ |
11 |
* $Revision: 1.2 $ |
12 |
* $Author: mthomas $ |
13 |
* $Source: /afs/cs.cmu.edu/project/ascend/Repository/models/mix.a4l,v $ |
14 |
* |
15 |
* This file is part of the ASCEND Modeling Library. |
16 |
* |
17 |
* Copyright (C) 1998 Duncan Coffey |
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 will be |
25 |
* 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 |
|
36 |
(* ***********************************+************************************ *) |
37 |
(* ************************ Mixer **************************** *) |
38 |
(* ***********************************+************************************ *) |
39 |
MODEL mixer( |
40 |
inputs WILL_BE set OF symbol_constant; |
41 |
input[inputs] WILL_BE stream; |
42 |
output WILL_BE stream; |
43 |
)WHERE( |
44 |
|
45 |
)REFINES cmumodel; |
46 |
|
47 |
Ftot_scale ALIASES output.Details.flowscale; |
48 |
Htot_scale ALIASES output.Details.H_flowscale; |
49 |
cd ALIASES output.cd; |
50 |
|
51 |
FOR j IN cd.components CREATE |
52 |
output.f[j]/Ftot_scale=SUM[input[k].f[j] | k IN inputs]/Ftot_scale; |
53 |
END FOR; |
54 |
|
55 |
output.H_flow/Htot_scale=SUM[input[k].H_flow | k IN inputs]/Htot_scale; |
56 |
|
57 |
METHODS |
58 |
METHOD default_self; |
59 |
Ftot_scale :=1000 {mol/s}; |
60 |
Htot_scale :=1e6 {J/s}; |
61 |
END default_self; |
62 |
|
63 |
METHOD default_all; |
64 |
RUN input[inputs].default_all; |
65 |
RUN output.default_all; |
66 |
RUN default_self; |
67 |
END default_all; |
68 |
|
69 |
METHOD check_self; |
70 |
|
71 |
END check_self; |
72 |
|
73 |
METHOD check_all; |
74 |
RUN check_self; |
75 |
END check_all; |
76 |
|
77 |
METHOD bound_self; |
78 |
END bound_self; |
79 |
|
80 |
METHOD bound_all; |
81 |
END bound_all; |
82 |
|
83 |
METHOD scale_self; |
84 |
END scale_self; |
85 |
|
86 |
METHOD scale_all; |
87 |
RUN input[inputs].scale_self; |
88 |
RUN output.scale_self; |
89 |
END scale_all; |
90 |
|
91 |
METHOD seqmod; |
92 |
RUN output.specify; |
93 |
output.T.fixed :=FALSE; |
94 |
FOR i IN cd.components DO |
95 |
output.f[i].fixed :=FALSE; |
96 |
END FOR; |
97 |
END seqmod; |
98 |
|
99 |
METHOD specify; |
100 |
RUN input[inputs].specify; |
101 |
RUN seqmod; |
102 |
END specify; |
103 |
|
104 |
END mixer; |
105 |
|
106 |
MODEL mix_test; |
107 |
|
108 |
cd IS_A components_data(['methanol','ethanol','water'],'water'); |
109 |
pdV IS_A phases_data('V', 'Pitzer_vapor_mixture', 'none', 'none'); |
110 |
pdL IS_A phases_data('L', 'none', 'UNIFAC_liquid_mixture','none'); |
111 |
pdVL IS_A phases_data('VL', 'Pitzer_vapor_mixture','UNIFAC_liquid_mixture', 'none'); |
112 |
equil IS_A boolean; |
113 |
|
114 |
output IS_A stream(cd, pdVL, equil); |
115 |
|
116 |
inputs IS_A set OF symbol_constant; |
117 |
inputs :== ['input_1','input_2','input_3','input_4']; |
118 |
input[inputs] IS_A stream(cd, pdVL, equil); |
119 |
mix IS_A mixer(inputs, input, output); |
120 |
|
121 |
METHODS |
122 |
METHOD check_self; |
123 |
RUN check_all; |
124 |
END check_self; |
125 |
|
126 |
METHOD check_all; |
127 |
RUN mix.check_all; |
128 |
END check_all; |
129 |
|
130 |
METHOD default_self; |
131 |
RUN default_all; |
132 |
END default_self; |
133 |
|
134 |
METHOD default_all; |
135 |
RUN mix.default_all; |
136 |
END default_all; |
137 |
|
138 |
METHOD bound_self; |
139 |
RUN bound_all; |
140 |
END bound_self; |
141 |
|
142 |
METHOD bound_all; |
143 |
RUN mix.bound_all; |
144 |
END bound_all; |
145 |
|
146 |
METHOD scale_self; |
147 |
RUN scale_all; |
148 |
END scale_self; |
149 |
|
150 |
METHOD scale_all; |
151 |
RUN mix.scale_all; |
152 |
END scale_all; |
153 |
|
154 |
METHOD specify; |
155 |
RUN mix.specify; |
156 |
END specify; |
157 |
|
158 |
METHOD values; |
159 |
END values; |
160 |
|
161 |
END mix_test; |