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 353 2007-08-30 16:12:27Z 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 (Brief = "Inlet stream", PosX=0.3037, PosY=0, Symbol="_{in}"); |
---|
62 | out Outlet as liquid_stream (Brief = "Outlet liquid stream", PosX=1, PosY=1, Symbol="_{out}"); |
---|
63 | in InletQ as energy_stream (Brief="Rate of heat supply", PosX=1, PosY=0.7859, Symbol="_{in}"); |
---|
64 | Level as length(Brief="Tank level"); |
---|
65 | M(NComp) as mol (Brief="Molar Holdup in the tank"); |
---|
66 | E as energy (Brief="Total Energy Holdup on tank"); |
---|
67 | vL as volume_mol (Brief="Liquid Molar Volume"); |
---|
68 | |
---|
69 | EQUATIONS |
---|
70 | "Mass balance" |
---|
71 | diff(M) = Inlet.F*Inlet.z - Outlet.F*Outlet.z; |
---|
72 | |
---|
73 | "Energy balance" |
---|
74 | diff(E) = Inlet.F*Inlet.h - Outlet.F*Outlet.h + InletQ.Q; |
---|
75 | |
---|
76 | "Energy Holdup" |
---|
77 | E = sum(M)*Outlet.h; |
---|
78 | |
---|
79 | "Mechanical Equilibrium" |
---|
80 | Inlet.P = Outlet.P; |
---|
81 | |
---|
82 | "Liquid Volume" |
---|
83 | vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z); |
---|
84 | |
---|
85 | "Composition" |
---|
86 | M = Outlet.z*sum(M); |
---|
87 | |
---|
88 | "Level of liquid phase" |
---|
89 | Level = sum(M)*vL/Across; |
---|
90 | end |
---|
91 | |
---|
92 | #*---------------------------------------------------------- |
---|
93 | * |
---|
94 | *Model of a tank with a lain cylinder geometry |
---|
95 | * |
---|
96 | *---------------------------------------------------------*# |
---|
97 | Model tank_cylindrical |
---|
98 | ATTRIBUTES |
---|
99 | Pallete = true; |
---|
100 | Icon = "icon/TankHorizontal"; |
---|
101 | Brief = "Model of a tank with a lain cylinder geometry."; |
---|
102 | Info = |
---|
103 | "== Specify == |
---|
104 | * the Inlet stream; |
---|
105 | * the outlet flow; |
---|
106 | * the tank Q. |
---|
107 | |
---|
108 | == Initial Conditions == |
---|
109 | * the tank initial temperature (OutletL.T); |
---|
110 | * the tank initial level (Level); |
---|
111 | * (NoComps - 1) OutletL (OR OutletV) compositions. |
---|
112 | "; |
---|
113 | |
---|
114 | PARAMETERS |
---|
115 | outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); |
---|
116 | outer NComp as Integer; |
---|
117 | radius as length(Brief="Tank radius"); |
---|
118 | L as length(Brief="Tank length"); |
---|
119 | |
---|
120 | VARIABLES |
---|
121 | in Inlet as stream (Brief = "Inlet stream", PosX=0.1825, PosY=0, Symbol="_{in}"); |
---|
122 | out Outlet as liquid_stream (Brief = "Outlet liquid stream", PosX=1, PosY=1, Symbol="_{out}"); |
---|
123 | in InletQ as energy_stream (Brief="Rate of heat supply", PosX=1, PosY=0.6160, Symbol="_{in}"); |
---|
124 | Level as length(Brief="Tank level"); |
---|
125 | Across as area (Brief="Tank cross section area", Default=2); |
---|
126 | M(NComp) as mol (Brief="Molar Holdup in the tank"); |
---|
127 | E as energy (Brief="Total Energy Holdup on tank"); |
---|
128 | vL as volume_mol (Brief="Liquid Molar Volume"); |
---|
129 | |
---|
130 | EQUATIONS |
---|
131 | "Mass balance" |
---|
132 | diff(M) = Inlet.F*Inlet.z - Outlet.F*Outlet.z; |
---|
133 | |
---|
134 | "Energy balance" |
---|
135 | diff(E) = Inlet.F*Inlet.h - Outlet.F*Outlet.h + InletQ.Q; |
---|
136 | |
---|
137 | "Energy Holdup" |
---|
138 | E = sum(M)*Outlet.h; |
---|
139 | |
---|
140 | "Mechanical Equilibrium" |
---|
141 | Inlet.P = Outlet.P; |
---|
142 | |
---|
143 | "Liquid Volume" |
---|
144 | vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z); |
---|
145 | |
---|
146 | "Composition" |
---|
147 | M = Outlet.z*sum(M); |
---|
148 | |
---|
149 | "Cylindrical Area" |
---|
150 | Across = radius^2 * (asin(1) - asin((radius-Level)/radius) ) + |
---|
151 | (Level-radius)*sqrt(Level*(2*radius - Level)); |
---|
152 | |
---|
153 | "Level of liquid phase" |
---|
154 | L*Across = sum(M)*vL; |
---|
155 | end |
---|
156 | |
---|
157 | Model tank_simplified |
---|
158 | ATTRIBUTES |
---|
159 | Pallete = true; |
---|
160 | Icon = "icon/Tank"; |
---|
161 | Brief = "Model of a simplified tank."; |
---|
162 | Info = |
---|
163 | "== Specify == |
---|
164 | * the Inlet flow rate; |
---|
165 | |
---|
166 | == Initial Conditions == |
---|
167 | * the tank initial level (Level); |
---|
168 | "; |
---|
169 | |
---|
170 | PARAMETERS |
---|
171 | k as Real (Brief="Valve Constant", Unit = 'm^2.5/h', Default=4); |
---|
172 | A as area (Brief="Tank area", Default=2); |
---|
173 | |
---|
174 | VARIABLES |
---|
175 | Level as length(Brief="Tank level"); |
---|
176 | in Fin as flow_vol(Brief="Input flow", PosX=0.3037, PosY=0); |
---|
177 | out Fout as flow_vol(Brief="Output flow", PosX=1, PosY=1); |
---|
178 | |
---|
179 | EQUATIONS |
---|
180 | "Mass balance" |
---|
181 | diff(A*Level) = Fin - Fout; |
---|
182 | |
---|
183 | "Valve equation" |
---|
184 | Fout = k*sqrt(Level); |
---|
185 | end |
---|
186 | |
---|
187 | Model tank_feed |
---|
188 | ATTRIBUTES |
---|
189 | Pallete = true; |
---|
190 | Icon = "icon/Tank"; |
---|
191 | Brief = "Model of a tank with feed stream."; |
---|
192 | Info = |
---|
193 | "== Specify == |
---|
194 | * the Inlet stream; |
---|
195 | * the Feed stream; |
---|
196 | * the outlet flow; |
---|
197 | * the tank Q. |
---|
198 | |
---|
199 | == Initial Conditions == |
---|
200 | * the tank initial temperature (OutletL.T); |
---|
201 | * the tank initial level (Level); |
---|
202 | * (NoComps - 1) OutletL (OR OutletV) compositions. |
---|
203 | "; |
---|
204 | |
---|
205 | PARAMETERS |
---|
206 | outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); |
---|
207 | outer NComp as Integer; |
---|
208 | Across as area (Brief="Tank cross section area", Default=2); |
---|
209 | |
---|
210 | VARIABLES |
---|
211 | in Feed as stream (Brief = "Feed stream", PosX=0.32, PosY=0, Symbol="_{feed}"); |
---|
212 | in Inlet as stream (Brief = "Inlet stream", PosX=0.3037, PosY=0, Symbol="_{in}"); |
---|
213 | out Outlet as liquid_stream (Brief = "Outlet liquid stream", PosX=1, PosY=1, Symbol="_{out}"); |
---|
214 | in InletQ as energy_stream (Brief="Rate of heat supply", PosX=1, PosY=0.7859, Symbol="_{in}"); |
---|
215 | |
---|
216 | Level as length(Brief="Tank level"); |
---|
217 | M(NComp) as mol (Brief="Molar Holdup in the tank"); |
---|
218 | E as energy (Brief="Total Energy Holdup on tank"); |
---|
219 | vL as volume_mol (Brief="Liquid Molar Volume"); |
---|
220 | |
---|
221 | EQUATIONS |
---|
222 | "Mass balance" |
---|
223 | diff(M) = Feed.F*Feed.z + Inlet.F*Inlet.z - Outlet.F*Outlet.z; |
---|
224 | |
---|
225 | "Energy balance" |
---|
226 | diff(E) = Feed.F*Feed.h + Inlet.F*Inlet.h - Outlet.F*Outlet.h + InletQ.Q; |
---|
227 | |
---|
228 | "Energy Holdup" |
---|
229 | E = sum(M)*Outlet.h; |
---|
230 | |
---|
231 | "Mechanical Equilibrium" |
---|
232 | Inlet.P = Outlet.P; |
---|
233 | |
---|
234 | "Liquid Volume" |
---|
235 | vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z); |
---|
236 | |
---|
237 | "Composition" |
---|
238 | M = Outlet.z*sum(M); |
---|
239 | |
---|
240 | "Level of liquid phase" |
---|
241 | Level = sum(M)*vL/Across; |
---|
242 | end |
---|