1 | #*------------------------------------------------------------------- |
---|
2 | * EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC. |
---|
3 | * |
---|
4 | * This LIBRARY is free software; you can distribute it and/or modify |
---|
5 | * it under the therms of the ALSOC FREE LICENSE as available at |
---|
6 | * http://www.enq.ufrgs.br/alsoc. |
---|
7 | * |
---|
8 | * EMSO Copyright (C) 2004 - 2007 ALSOC, original code |
---|
9 | * from http://www.rps.eng.br Copyright (C) 2002-2004. |
---|
10 | * All rights reserved. |
---|
11 | * |
---|
12 | * EMSO is distributed under the therms of the ALSOC LICENSE as |
---|
13 | * available at http://www.enq.ufrgs.br/alsoc. |
---|
14 | * |
---|
15 | *------------------------------------------------------------------- |
---|
16 | * Model of tanks |
---|
17 | *-------------------------------------------------------------------- |
---|
18 | * Streams: |
---|
19 | * * an inlet stream |
---|
20 | * * an outlet stream |
---|
21 | * |
---|
22 | * Specify: |
---|
23 | * * the Inlet stream |
---|
24 | * * the Outlet flow |
---|
25 | * * the tank Q |
---|
26 | * |
---|
27 | * Initial: |
---|
28 | * * the tank temperature (OutletL.T) |
---|
29 | * * the tank level (h) |
---|
30 | * * (NoComps - 1) Outlet compositions |
---|
31 | *---------------------------------------------------------------------- |
---|
32 | * Author: Paula B. Staudt |
---|
33 | * $Id: tank.mso 313 2007-07-14 16:45:55Z arge $ |
---|
34 | *--------------------------------------------------------------------*# |
---|
35 | |
---|
36 | using "streams"; |
---|
37 | |
---|
38 | Model tank |
---|
39 | ATTRIBUTES |
---|
40 | Pallete = true; |
---|
41 | Icon = "icon/Tank"; |
---|
42 | Brief = "Model of a cylindrical tank."; |
---|
43 | Info = |
---|
44 | "Specify: |
---|
45 | * the Inlet stream; |
---|
46 | * the outlet flow; |
---|
47 | * the tank Q. |
---|
48 | |
---|
49 | Initial Conditions: |
---|
50 | * the tank initial temperature (OutletL.T); |
---|
51 | * the tank initial level (Level); |
---|
52 | * (NoComps - 1) OutletL (OR OutletV) compositions. |
---|
53 | "; |
---|
54 | |
---|
55 | PARAMETERS |
---|
56 | outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); |
---|
57 | outer NComp as Integer; |
---|
58 | Across as area (Brief="Tank cross section area", Default=2); |
---|
59 | |
---|
60 | VARIABLES |
---|
61 | in Inlet as stream; |
---|
62 | out Outlet as liquid_stream; |
---|
63 | |
---|
64 | in InletQ as energy_stream (Brief="Rate of heat supply"); |
---|
65 | Level as length(Brief="Tank level"); |
---|
66 | M(NComp) as mol (Brief="Molar Holdup in the tank"); |
---|
67 | E as energy (Brief="Total Energy Holdup on tank"); |
---|
68 | vL as volume_mol (Brief="Liquid Molar Volume"); |
---|
69 | |
---|
70 | EQUATIONS |
---|
71 | "Mass balance" |
---|
72 | diff(M) = Inlet.F*Inlet.z - Outlet.F*Outlet.z; |
---|
73 | |
---|
74 | "Energy balance" |
---|
75 | diff(E) = Inlet.F*Inlet.h - Outlet.F*Outlet.h + InletQ.Q; |
---|
76 | |
---|
77 | "Energy Holdup" |
---|
78 | E = sum(M)*Outlet.h; |
---|
79 | |
---|
80 | "Mechanical Equilibrium" |
---|
81 | Inlet.P = Outlet.P; |
---|
82 | |
---|
83 | "Liquid Volume" |
---|
84 | vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z); |
---|
85 | |
---|
86 | "Composition" |
---|
87 | M = Outlet.z*sum(M); |
---|
88 | |
---|
89 | "Level of liquid phase" |
---|
90 | Level = sum(M)*vL/Across; |
---|
91 | end |
---|
92 | |
---|
93 | #*---------------------------------------------------------- |
---|
94 | * |
---|
95 | *Model of a tank with a lain cylinder geometry |
---|
96 | * |
---|
97 | *---------------------------------------------------------*# |
---|
98 | Model tank_cylindrical |
---|
99 | ATTRIBUTES |
---|
100 | Pallete = true; |
---|
101 | Icon = "icon/TankHorizontal"; |
---|
102 | Brief = "Model of a tank with a lain cylinder geometry."; |
---|
103 | Info = |
---|
104 | "Specify: |
---|
105 | * the Inlet stream; |
---|
106 | * the outlet flow; |
---|
107 | * the tank Q. |
---|
108 | |
---|
109 | Initial Conditions: |
---|
110 | * the tank initial temperature (OutletL.T); |
---|
111 | * the tank initial level (Level); |
---|
112 | * (NoComps - 1) OutletL (OR OutletV) compositions. |
---|
113 | "; |
---|
114 | |
---|
115 | PARAMETERS |
---|
116 | outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); |
---|
117 | outer NComp as Integer; |
---|
118 | radius as length(Brief="Tank radius"); |
---|
119 | L as length(Brief="Tank length"); |
---|
120 | |
---|
121 | VARIABLES |
---|
122 | in Inlet as stream; |
---|
123 | out Outlet as liquid_stream; |
---|
124 | |
---|
125 | in InletQ as energy_stream (Brief="Rate of heat supply"); |
---|
126 | Level as length(Brief="Tank level"); |
---|
127 | Across as area (Brief="Tank cross section area", Default=2); |
---|
128 | M(NComp) as mol (Brief="Molar Holdup in the tank"); |
---|
129 | E as energy (Brief="Total Energy Holdup on tank"); |
---|
130 | vL as volume_mol (Brief="Liquid Molar Volume"); |
---|
131 | |
---|
132 | EQUATIONS |
---|
133 | "Mass balance" |
---|
134 | diff(M) = Inlet.F*Inlet.z - Outlet.F*Outlet.z; |
---|
135 | |
---|
136 | "Energy balance" |
---|
137 | diff(E) = Inlet.F*Inlet.h - Outlet.F*Outlet.h + InletQ.Q; |
---|
138 | |
---|
139 | "Energy Holdup" |
---|
140 | E = sum(M)*Outlet.h; |
---|
141 | |
---|
142 | "Mechanical Equilibrium" |
---|
143 | Inlet.P = Outlet.P; |
---|
144 | |
---|
145 | "Liquid Volume" |
---|
146 | vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z); |
---|
147 | |
---|
148 | "Composition" |
---|
149 | M = Outlet.z*sum(M); |
---|
150 | |
---|
151 | "Cylindrical Area" |
---|
152 | Across = radius^2 * (asin(1) - asin((radius-Level)/radius) ) + |
---|
153 | (Level-radius)*sqrt(Level*(2*radius - Level)); |
---|
154 | |
---|
155 | "Level of liquid phase" |
---|
156 | L*Across = sum(M)*vL; |
---|
157 | end |
---|
158 | |
---|
159 | Model tank_simplified |
---|
160 | ATTRIBUTES |
---|
161 | Pallete = true; |
---|
162 | Icon = "icon/Tank"; |
---|
163 | Brief = "Model of a simplified tank."; |
---|
164 | Info = |
---|
165 | "Specify: |
---|
166 | * the Inlet flow rate; |
---|
167 | |
---|
168 | Initial Conditions: |
---|
169 | * the tank initial level (Level); |
---|
170 | "; |
---|
171 | |
---|
172 | PARAMETERS |
---|
173 | k as Real (Brief="Valve Constant", Unit = 'm^2.5/h', Default=4); |
---|
174 | A as area (Brief="Tank area", Default=2); |
---|
175 | |
---|
176 | VARIABLES |
---|
177 | Level as length(Brief="Tank level"); |
---|
178 | in Fin as flow_vol(Brief="Input flow"); |
---|
179 | out Fout as flow_vol(Brief="Output flow"); |
---|
180 | |
---|
181 | EQUATIONS |
---|
182 | "Mass balance" |
---|
183 | diff(A*Level) = Fin - Fout; |
---|
184 | |
---|
185 | "Valve equation" |
---|
186 | Fout = k*sqrt(Level); |
---|
187 | end |
---|
188 | |
---|
189 | Model tank_feed |
---|
190 | ATTRIBUTES |
---|
191 | Pallete = true; |
---|
192 | Icon = "icon/Tank"; |
---|
193 | Brief = "Model of a tank with feed stream."; |
---|
194 | Info = |
---|
195 | "Specify: |
---|
196 | * the Inlet stream; |
---|
197 | * the Feed stream; |
---|
198 | * the outlet flow; |
---|
199 | * the tank Q. |
---|
200 | |
---|
201 | Initial Conditions: |
---|
202 | * the tank initial temperature (OutletL.T); |
---|
203 | * the tank initial level (Level); |
---|
204 | * (NoComps - 1) OutletL (OR OutletV) compositions. |
---|
205 | "; |
---|
206 | |
---|
207 | PARAMETERS |
---|
208 | outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); |
---|
209 | outer NComp as Integer; |
---|
210 | Across as area (Brief="Tank cross section area", Default=2); |
---|
211 | |
---|
212 | VARIABLES |
---|
213 | in Feed as stream; |
---|
214 | in Inlet as stream; |
---|
215 | out Outlet as liquid_stream; |
---|
216 | |
---|
217 | in InletQ as energy_stream (Brief="Rate of heat supply"); |
---|
218 | Level as length(Brief="Tank level"); |
---|
219 | M(NComp) as mol (Brief="Molar Holdup in the tank"); |
---|
220 | E as energy (Brief="Total Energy Holdup on tank"); |
---|
221 | vL as volume_mol (Brief="Liquid Molar Volume"); |
---|
222 | |
---|
223 | EQUATIONS |
---|
224 | "Mass balance" |
---|
225 | diff(M) = Feed.F*Feed.z + Inlet.F*Inlet.z - Outlet.F*Outlet.z; |
---|
226 | |
---|
227 | "Energy balance" |
---|
228 | diff(E) = Feed.F*Feed.h + Inlet.F*Inlet.h - Outlet.F*Outlet.h + InletQ.Q; |
---|
229 | |
---|
230 | "Energy Holdup" |
---|
231 | E = sum(M)*Outlet.h; |
---|
232 | |
---|
233 | "Mechanical Equilibrium" |
---|
234 | Inlet.P = Outlet.P; |
---|
235 | |
---|
236 | "Liquid Volume" |
---|
237 | vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z); |
---|
238 | |
---|
239 | "Composition" |
---|
240 | M = Outlet.z*sum(M); |
---|
241 | |
---|
242 | "Level of liquid phase" |
---|
243 | Level = sum(M)*vL/Across; |
---|
244 | end |
---|