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 | * Author: Paula B. Staudt |
---|
16 | * $Id: tank.mso 821 2009-08-11 01:28:33Z bicca $ |
---|
17 | *--------------------------------------------------------------------*# |
---|
18 | |
---|
19 | using "streams"; |
---|
20 | |
---|
21 | Model TankVL |
---|
22 | |
---|
23 | ATTRIBUTES |
---|
24 | Pallete = true; |
---|
25 | Icon = "icon/TankVL"; |
---|
26 | Brief = "Model of a Tank With Thermodynamic Equilibrium."; |
---|
27 | Info = |
---|
28 | "== ASSUMPTIONS == |
---|
29 | * perfect mixing of both phases; |
---|
30 | * thermodynamics equilibrium. |
---|
31 | |
---|
32 | == SET == |
---|
33 | *Orientation: vessel position - vertical or horizontal; |
---|
34 | *Heads (bottom and top heads are identical) |
---|
35 | **elliptical: 2:1 elliptical heads (25% of vessel diameter); |
---|
36 | **hemispherical: hemispherical heads (50% of vessel diameter); |
---|
37 | **flat: flat heads (0% of vessel diameter); |
---|
38 | *Diameter: Vessel diameter; |
---|
39 | *Lenght: Side length of the cylinder shell; |
---|
40 | |
---|
41 | == SPECIFY == |
---|
42 | * the Inlet stream; |
---|
43 | * the outlet flows: OutletVapour.F and OutletLiquid.F; |
---|
44 | * the InletQ (the model requires an energy stream, also you can use a controller for setting the heat duty using the heat_flow model). |
---|
45 | |
---|
46 | == OPTIONAL == |
---|
47 | * the TankVL model has three control ports |
---|
48 | ** TI OutletLiquid Temperature Indicator; |
---|
49 | ** PI OutletLiquid Pressure Indicator; |
---|
50 | ** LI Level Indicator; |
---|
51 | |
---|
52 | == INITIAL CONDITIONS == |
---|
53 | * Initial_Temperature : the Tank temperature (OutletLiquid.T); |
---|
54 | * Levelpercent_Initial : the Tank liquid level in percent (LI); |
---|
55 | * Initial_Composition : (NoComps) OutletLiquid compositions. |
---|
56 | "; |
---|
57 | |
---|
58 | PARAMETERS |
---|
59 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
60 | outer NComp as Integer (Brief = "Number of components", Lower = 1); |
---|
61 | |
---|
62 | Mw(NComp) as molweight (Brief="Mol Weight", Hidden=true); |
---|
63 | pi as positive (Brief="Pi value", Default=3.141593,Hidden=true, Symbol="\pi"); |
---|
64 | |
---|
65 | Orientation as Switcher (Valid=["vertical","horizontal"],Default="vertical"); |
---|
66 | Heads as Switcher (Valid=["elliptical","hemispherical","flat"],Default="flat"); |
---|
67 | Diameter as length (Brief="Vessel diameter", Symbol="D_{i}"); |
---|
68 | Lenght as length (Brief="Side length of the cylinder shell", Symbol="L_{vessel}"); |
---|
69 | |
---|
70 | Vhead_elliptical as volume (Brief="Elliptical Head Total Volume",Hidden=true, Symbol="V_{head}^{elliptical}"); |
---|
71 | Vhead_hemispherical as volume (Brief="Hemispherical Head Total Volume",Hidden=true, Symbol="V_{head}^{hemispherical}"); |
---|
72 | Vcylinder as volume (Brief="Cylinder Total Volume",Hidden=true, Symbol="V_{cylinder}"); |
---|
73 | radius as length (Brief="Vessel radius",Hidden=true, Symbol="R_{cylinder}"); |
---|
74 | |
---|
75 | Levelpercent_Initial as positive (Brief="Initial liquid height in Percent", Default = 0.70); |
---|
76 | Temperature_Initial as temperature (Brief="Initial Liquid Temperature", Default = 330); |
---|
77 | Composition_Initial(NComp) as fraction (Brief="Initial Composition", Default = 0.10); |
---|
78 | |
---|
79 | SET |
---|
80 | |
---|
81 | Mw=PP.MolecularWeight(); |
---|
82 | |
---|
83 | Vhead_elliptical = (pi*Diameter^3)/12; |
---|
84 | Vhead_hemispherical = (pi*Diameter^3)/6; |
---|
85 | Vcylinder = 0.25*(pi*Diameter^2)*Lenght; |
---|
86 | radius = 0.5*Diameter; |
---|
87 | |
---|
88 | VARIABLES |
---|
89 | |
---|
90 | in Inlet as stream (Brief="Feed Stream", PosX=0.22, PosY=0, Symbol="_{in}"); |
---|
91 | out OutletLiquid as liquid_stream (Brief="Liquid outlet stream", PosX=0.43, PosY=1, Symbol="_{out}^{Liquid}"); |
---|
92 | out OutletVapour as vapour_stream (Brief="Vapour outlet stream", PosX=0.68, PosY=0, Symbol="_{out}^{Vapour}"); |
---|
93 | in InletQ as power (Brief="Heat Duty", PosX=0.735, PosY=1, Protected =true,Symbol="Q_{in}"); |
---|
94 | |
---|
95 | Vtotal as volume (Brief="Vessel total volume",Protected=true, Symbol="V_{total}"); |
---|
96 | Vfilled as volume (Brief="Vessel volume content",Protected=true, Symbol="V_{filled}"); |
---|
97 | |
---|
98 | TotalHoldup(NComp) as mol (Brief="Molar Holdup in the Vessel", Protected=true); |
---|
99 | LiquidHoldup as mol (Brief="Molar liquid holdup", Protected=true); |
---|
100 | VapourHoldup as mol (Brief="Molar vapour holdup", Protected=true); |
---|
101 | |
---|
102 | E as energy (Brief="Total Energy Holdup in the Vessel", Protected=true); |
---|
103 | vL as volume_mol (Brief="Liquid Molar Volume", Protected=true); |
---|
104 | vV as volume_mol (Brief="Vapour Molar volume", Protected=true); |
---|
105 | Level as length (Brief="liquid height", Protected=true); |
---|
106 | Across as area (Brief="Vessel cylinder shell Cross section area", Hidden=true, Symbol="A_{cross}"); |
---|
107 | vfrac as positive (Brief="Vapourization fraction", Symbol="\phi", Protected=true); |
---|
108 | Pratio as positive (Brief = "Pressure Ratio", Symbol ="P_{ratio}", Protected=true); |
---|
109 | Pdrop as press_delta (Brief = "Pressure Drop", DisplayUnit = 'kPa', Symbol ="\Delta P", Protected=true); |
---|
110 | |
---|
111 | out TI as control_signal (Brief="Temperature Indicator", PosX=0.525, PosY=0, Protected=true); |
---|
112 | out PI as control_signal (Brief="Pressure Indicator", PosX=0.368, PosY=0, Protected=true); |
---|
113 | out LI as control_signal (Brief="Level Indicator", PosX=1, PosY=0.6, Protected=true); |
---|
114 | |
---|
115 | INITIAL |
---|
116 | |
---|
117 | "Initial level Percent" |
---|
118 | LI = Levelpercent_Initial; |
---|
119 | |
---|
120 | "Initial Outlet Liquid Temperature" |
---|
121 | OutletLiquid.T = Temperature_Initial; |
---|
122 | |
---|
123 | "Initial Outlet Liquid Composition Normalized" |
---|
124 | OutletLiquid.z(1:NComp - 1) = Composition_Initial(1:NComp - 1)/sum(Composition_Initial); |
---|
125 | |
---|
126 | EQUATIONS |
---|
127 | |
---|
128 | switch Orientation |
---|
129 | |
---|
130 | case "vertical": |
---|
131 | |
---|
132 | "Vessel Cross Section Area" |
---|
133 | Across = 0.25*(pi*Diameter^2); |
---|
134 | |
---|
135 | switch Heads |
---|
136 | |
---|
137 | case "elliptical": |
---|
138 | |
---|
139 | "Vessel Total Volume" |
---|
140 | Vtotal = Vhead_elliptical + Vcylinder; |
---|
141 | |
---|
142 | if Level < 0.25*Diameter then |
---|
143 | |
---|
144 | "Vessel Filled Volume" |
---|
145 | Vfilled = 0.25*pi*(((Diameter*Level)/(0.25*Diameter))^2)*(0.25*Diameter-Level/3); |
---|
146 | |
---|
147 | else |
---|
148 | |
---|
149 | "Vessel Filled Volume" |
---|
150 | Vfilled = 0.25*pi*(Diameter^2)*(Level - 0.25*Diameter/3); |
---|
151 | |
---|
152 | end |
---|
153 | |
---|
154 | case "hemispherical": |
---|
155 | |
---|
156 | "Vessel Total Volume" |
---|
157 | Vtotal = Vhead_hemispherical + Vcylinder; |
---|
158 | |
---|
159 | if Level < 0.5*Diameter then |
---|
160 | |
---|
161 | "Vessel Filled Volume" |
---|
162 | Vfilled = 0.25*pi*(Level^2)*(2*Diameter-4*Level/3); |
---|
163 | |
---|
164 | else |
---|
165 | |
---|
166 | "Vessel Filled Volume" |
---|
167 | Vfilled = 0.25*pi*((2/3)*((0.5*Diameter)^3) - (0.25*(Diameter)^3) + Level*Diameter^2); |
---|
168 | |
---|
169 | end |
---|
170 | |
---|
171 | case "flat": |
---|
172 | |
---|
173 | "Vessel Total Volume" |
---|
174 | Vtotal = Vcylinder; |
---|
175 | |
---|
176 | "Vessel Filled Volume" |
---|
177 | Vfilled = Across*Level; |
---|
178 | |
---|
179 | end |
---|
180 | |
---|
181 | case "horizontal": |
---|
182 | |
---|
183 | "Vessel Cross Section Area" |
---|
184 | Across = (radius^2)*acos((radius-Level)/radius)-(radius-Level)*sqrt((2*radius*Level-Level^2)); |
---|
185 | |
---|
186 | switch Heads |
---|
187 | |
---|
188 | case "elliptical": |
---|
189 | |
---|
190 | "Vessel Total Volume" |
---|
191 | Vtotal = Vhead_elliptical + Vcylinder; |
---|
192 | |
---|
193 | "Vessel Filled Volume" |
---|
194 | Vfilled = 0.5236*Level^2*(1.5*Diameter-Level) + Across*Lenght; |
---|
195 | |
---|
196 | case "hemispherical": |
---|
197 | |
---|
198 | "Vessel Total Volume" |
---|
199 | Vtotal = Vhead_hemispherical + Vcylinder; |
---|
200 | |
---|
201 | "Vessel Filled Volume" |
---|
202 | Vfilled = 1.0472*Level^2*(1.5*Diameter-Level) + Across*Lenght; |
---|
203 | |
---|
204 | case "flat": |
---|
205 | |
---|
206 | "Vessel Total Volume" |
---|
207 | Vtotal = Vcylinder; |
---|
208 | |
---|
209 | "Vessel Filled Volume" |
---|
210 | Vfilled = Across*Lenght; |
---|
211 | |
---|
212 | end |
---|
213 | |
---|
214 | end |
---|
215 | |
---|
216 | "Component Molar Balance" |
---|
217 | diff(TotalHoldup)=Inlet.F*Inlet.z - OutletLiquid.F*OutletLiquid.z - OutletVapour.F*OutletVapour.z; |
---|
218 | |
---|
219 | "Energy Balance" |
---|
220 | diff(E) = Inlet.F*Inlet.h - OutletLiquid.F*OutletLiquid.h - OutletVapour.F*OutletVapour.h + InletQ; |
---|
221 | |
---|
222 | "Molar Holdup" |
---|
223 | TotalHoldup = LiquidHoldup*OutletLiquid.z + VapourHoldup*OutletVapour.z; |
---|
224 | |
---|
225 | "Energy Holdup" |
---|
226 | E = LiquidHoldup*OutletLiquid.h + VapourHoldup*OutletVapour.h - OutletLiquid.P*Vtotal; |
---|
227 | |
---|
228 | "Mol fraction normalisation" |
---|
229 | sum(OutletLiquid.z)=1.0; |
---|
230 | |
---|
231 | "Mol fraction normalisation" |
---|
232 | sum(OutletLiquid.z)=sum(OutletVapour.z); |
---|
233 | |
---|
234 | "Vaporization Fraction" |
---|
235 | OutletVapour.F = Inlet.F * vfrac; |
---|
236 | |
---|
237 | "Liquid Volume" |
---|
238 | vL = PP.LiquidVolume(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z); |
---|
239 | |
---|
240 | "Vapour Volume" |
---|
241 | vV = PP.VapourVolume(OutletVapour.T, OutletVapour.P, OutletVapour.z); |
---|
242 | |
---|
243 | "Chemical Equilibrium" |
---|
244 | PP.LiquidFugacityCoefficient(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z)*OutletLiquid.z = |
---|
245 | PP.VapourFugacityCoefficient(OutletVapour.T, OutletVapour.P, OutletVapour.z)*OutletVapour.z; |
---|
246 | |
---|
247 | "Thermal Equilibrium" |
---|
248 | OutletVapour.T = OutletLiquid.T; |
---|
249 | |
---|
250 | "Mechanical Equilibrium" |
---|
251 | OutletVapour.P = OutletLiquid.P; |
---|
252 | |
---|
253 | "Pressure Drop" |
---|
254 | OutletLiquid.P = Inlet.P - Pdrop; |
---|
255 | |
---|
256 | "Pressure Ratio" |
---|
257 | OutletLiquid.P = Inlet.P * Pratio; |
---|
258 | |
---|
259 | "Geometry Constraint" |
---|
260 | Vtotal = LiquidHoldup * vL + VapourHoldup * vV; |
---|
261 | |
---|
262 | "Temperature indicator" |
---|
263 | TI * 'K' = OutletLiquid.T; |
---|
264 | |
---|
265 | "Pressure indicator" |
---|
266 | PI * 'atm' = OutletLiquid.P; |
---|
267 | |
---|
268 | "Level indicator" |
---|
269 | LI*Vtotal= Vfilled; |
---|
270 | |
---|
271 | "Liquid Level" |
---|
272 | LiquidHoldup * vL = Vfilled; |
---|
273 | |
---|
274 | end |
---|
275 | |
---|
276 | Model TankL |
---|
277 | |
---|
278 | ATTRIBUTES |
---|
279 | Pallete = true; |
---|
280 | Icon = "icon/TankL"; |
---|
281 | Brief = "Model of a Tank."; |
---|
282 | Info = |
---|
283 | "== ASSUMPTIONS == |
---|
284 | * liquid phase only; |
---|
285 | |
---|
286 | == SET == |
---|
287 | *Orientation: vessel position - vertical or horizontal; |
---|
288 | *Heads (bottom and top heads are identical) |
---|
289 | **elliptical: 2:1 elliptical heads (25% of vessel diameter); |
---|
290 | **hemispherical: hemispherical heads (50% of vessel diameter); |
---|
291 | **flat: flat heads (0% of vessel diameter); |
---|
292 | *Diameter: Vessel diameter; |
---|
293 | *Lenght: Side length of the cylinder shell; |
---|
294 | |
---|
295 | == SPECIFY == |
---|
296 | * the Inlet stream; |
---|
297 | * the OutletLiquid.F; |
---|
298 | * the InletQ (the model requires an energy stream, also you can use a controller for setting the heat duty using the heat_flow model). |
---|
299 | |
---|
300 | == OPTIONAL == |
---|
301 | * the TankL model has three control ports |
---|
302 | ** TI OutletLiquid Temperature Indicator; |
---|
303 | ** PI OutletLiquid Pressure Indicator; |
---|
304 | ** LI Level Indicator; |
---|
305 | |
---|
306 | == INITIAL CONDITIONS == |
---|
307 | * Initial_Temperature : the Tank temperature (OutletLiquid.T); |
---|
308 | * Levelpercent_Initial : the Tank liquid level in percent (LI); |
---|
309 | * Initial_Composition : (NoComps) OutletLiquid compositions. |
---|
310 | "; |
---|
311 | |
---|
312 | PARAMETERS |
---|
313 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
314 | outer NComp as Integer (Brief = "Number of components", Lower = 1); |
---|
315 | |
---|
316 | pi as positive (Brief="Pi value", Default=3.141593,Hidden=true, Symbol="\pi"); |
---|
317 | |
---|
318 | Orientation as Switcher (Valid=["vertical","horizontal"],Default="vertical"); |
---|
319 | Heads as Switcher (Valid=["elliptical","hemispherical","flat"],Default="flat"); |
---|
320 | Diameter as length (Brief="Vessel diameter", Symbol="D_{i}"); |
---|
321 | Lenght as length (Brief="Side length of the cylinder shell", Symbol="L_{vessel}"); |
---|
322 | |
---|
323 | Vhead_elliptical as volume (Brief="Elliptical Head Total Volume",Hidden=true, Symbol="V_{head}^{elliptical}"); |
---|
324 | Vhead_hemispherical as volume (Brief="Hemispherical Head Total Volume",Hidden=true, Symbol="V_{head}^{hemispherical}"); |
---|
325 | Vcylinder as volume (Brief="Cylinder Total Volume",Hidden=true, Symbol="V_{cylinder}"); |
---|
326 | radius as length (Brief="Vessel radius",Hidden=true, Symbol="R_{cylinder}"); |
---|
327 | |
---|
328 | Levelpercent_Initial as positive (Brief="Initial liquid height in Percent", Default = 0.70); |
---|
329 | Temperature_Initial as temperature (Brief="Initial Liquid Temperature", Default = 330); |
---|
330 | Composition_Initial(NComp) as fraction (Brief="Initial Composition", Default = 0.10); |
---|
331 | |
---|
332 | SET |
---|
333 | |
---|
334 | Vhead_elliptical = (pi*Diameter^3)/12; |
---|
335 | Vhead_hemispherical = (pi*Diameter^3)/6; |
---|
336 | Vcylinder = 0.25*(pi*Diameter^2)*Lenght; |
---|
337 | radius = 0.5*Diameter; |
---|
338 | |
---|
339 | VARIABLES |
---|
340 | |
---|
341 | in Inlet as stream (Brief="Feed Stream", PosX=0.22, PosY=0, Symbol="_{in}"); |
---|
342 | out OutletLiquid as liquid_stream (Brief="Liquid outlet stream", PosX=0.43, PosY=1, Symbol="_{out}^{Liquid}"); |
---|
343 | in InletQ as power (Brief="Heat Duty", PosX=0.735, PosY=1, Protected =true,Symbol="Q_{in}"); |
---|
344 | |
---|
345 | Vtotal as volume (Brief="Vessel total volume",Protected=true, Symbol="V_{total}"); |
---|
346 | Vfilled as volume (Brief="Vessel volume content",Protected=true, Symbol="V_{filled}"); |
---|
347 | |
---|
348 | TotalHoldup(NComp) as mol (Brief="Molar Holdup in the Vessel", Protected=true); |
---|
349 | |
---|
350 | E as energy (Brief="Total Energy Holdup in the Vessel", Protected=true); |
---|
351 | vL as volume_mol (Brief="Liquid Molar Volume", Protected=true); |
---|
352 | Level as length (Brief="liquid height", Protected=true); |
---|
353 | Across as area (Brief="Vessel cylinder shell Cross section area", Hidden=true, Symbol="A_{cross}"); |
---|
354 | |
---|
355 | out TI as control_signal (Brief="Temperature Indicator", PosX=0.525, PosY=0, Protected=true); |
---|
356 | out PI as control_signal (Brief="Pressure Indicator", PosX=0.368, PosY=0, Protected=true); |
---|
357 | out LI as control_signal (Brief="Level Indicator", PosX=1, PosY=0.6, Protected=true); |
---|
358 | |
---|
359 | INITIAL |
---|
360 | |
---|
361 | "Initial level Percent" |
---|
362 | LI = Levelpercent_Initial; |
---|
363 | |
---|
364 | "Initial Outlet Liquid Temperature" |
---|
365 | OutletLiquid.T = Temperature_Initial; |
---|
366 | |
---|
367 | "Initial Outlet Liquid Composition Normalized" |
---|
368 | OutletLiquid.z(1:NComp - 1) = Composition_Initial(1:NComp - 1)/sum(Composition_Initial); |
---|
369 | |
---|
370 | EQUATIONS |
---|
371 | |
---|
372 | switch Orientation |
---|
373 | |
---|
374 | case "vertical": |
---|
375 | |
---|
376 | "Vessel Cross Section Area" |
---|
377 | Across = 0.25*(pi*Diameter^2); |
---|
378 | |
---|
379 | switch Heads |
---|
380 | |
---|
381 | case "elliptical": |
---|
382 | |
---|
383 | "Vessel Total Volume" |
---|
384 | Vtotal = Vhead_elliptical + Vcylinder; |
---|
385 | |
---|
386 | if Level < 0.25*Diameter then |
---|
387 | |
---|
388 | "Vessel Filled Volume" |
---|
389 | Vfilled = 0.25*pi*(((Diameter*Level)/(0.25*Diameter))^2)*(0.25*Diameter-Level/3); |
---|
390 | |
---|
391 | else |
---|
392 | |
---|
393 | "Vessel Filled Volume" |
---|
394 | Vfilled = 0.25*pi*(Diameter^2)*(Level - 0.25*Diameter/3); |
---|
395 | |
---|
396 | end |
---|
397 | |
---|
398 | case "hemispherical": |
---|
399 | |
---|
400 | "Vessel Total Volume" |
---|
401 | Vtotal = Vhead_hemispherical + Vcylinder; |
---|
402 | |
---|
403 | if Level < 0.5*Diameter then |
---|
404 | |
---|
405 | "Vessel Filled Volume" |
---|
406 | Vfilled = 0.25*pi*(Level^2)*(2*Diameter-4*Level/3); |
---|
407 | |
---|
408 | else |
---|
409 | |
---|
410 | "Vessel Filled Volume" |
---|
411 | Vfilled = 0.25*pi*((2/3)*((0.5*Diameter)^3) - (0.25*(Diameter)^3) + Level*Diameter^2); |
---|
412 | |
---|
413 | end |
---|
414 | |
---|
415 | case "flat": |
---|
416 | |
---|
417 | "Vessel Total Volume" |
---|
418 | Vtotal = Vcylinder; |
---|
419 | |
---|
420 | "Vessel Filled Volume" |
---|
421 | Vfilled = Across*Level; |
---|
422 | |
---|
423 | end |
---|
424 | |
---|
425 | case "horizontal": |
---|
426 | |
---|
427 | "Vessel Cross Section Area" |
---|
428 | Across = (radius^2)*acos((radius-Level)/radius)-(radius-Level)*sqrt((2*radius*Level-Level^2)); |
---|
429 | |
---|
430 | switch Heads |
---|
431 | |
---|
432 | case "elliptical": |
---|
433 | |
---|
434 | "Vessel Total Volume" |
---|
435 | Vtotal = Vhead_elliptical + Vcylinder; |
---|
436 | |
---|
437 | "Vessel Filled Volume" |
---|
438 | Vfilled = 0.5236*Level^2*(1.5*Diameter-Level) + Across*Lenght; |
---|
439 | |
---|
440 | case "hemispherical": |
---|
441 | |
---|
442 | "Vessel Total Volume" |
---|
443 | Vtotal = Vhead_hemispherical + Vcylinder; |
---|
444 | |
---|
445 | "Vessel Filled Volume" |
---|
446 | Vfilled = 1.0472*Level^2*(1.5*Diameter-Level) + Across*Lenght; |
---|
447 | |
---|
448 | case "flat": |
---|
449 | |
---|
450 | "Vessel Total Volume" |
---|
451 | Vtotal = Vcylinder; |
---|
452 | |
---|
453 | "Vessel Filled Volume" |
---|
454 | Vfilled = Across*Lenght; |
---|
455 | |
---|
456 | end |
---|
457 | |
---|
458 | end |
---|
459 | |
---|
460 | "Component Molar Balance" |
---|
461 | diff(TotalHoldup)=Inlet.F*Inlet.z - OutletLiquid.F*OutletLiquid.z; |
---|
462 | |
---|
463 | "Energy Balance" |
---|
464 | diff(E) = Inlet.F*Inlet.h - OutletLiquid.F*OutletLiquid.h + InletQ; |
---|
465 | |
---|
466 | "Energy Holdup" |
---|
467 | E = sum(TotalHoldup)*OutletLiquid.h; |
---|
468 | |
---|
469 | "Mechanical Equilibrium" |
---|
470 | Inlet.P = OutletLiquid.P; |
---|
471 | |
---|
472 | "Liquid Volume" |
---|
473 | vL = PP.LiquidVolume(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z); |
---|
474 | |
---|
475 | "Molar Holdup" |
---|
476 | TotalHoldup = OutletLiquid.z*sum(TotalHoldup); |
---|
477 | |
---|
478 | "Liquid Level" |
---|
479 | Vfilled = sum(TotalHoldup) * vL; |
---|
480 | |
---|
481 | "Temperature indicator" |
---|
482 | TI * 'K' = OutletLiquid.T; |
---|
483 | |
---|
484 | "Pressure indicator" |
---|
485 | PI * 'atm' = OutletLiquid.P; |
---|
486 | |
---|
487 | "Level indicator" |
---|
488 | LI*Vtotal= Vfilled; |
---|
489 | |
---|
490 | end |
---|
491 | |
---|
492 | Model SumpTank |
---|
493 | |
---|
494 | ATTRIBUTES |
---|
495 | Pallete = true; |
---|
496 | Icon = "icon/SumpTank"; |
---|
497 | Brief = "Model of a tank with 2 material inlet streams and with thermodynamic equilibrium."; |
---|
498 | Info = |
---|
499 | "== ASSUMPTIONS == |
---|
500 | * perfect mixing of both phases; |
---|
501 | * thermodynamics equilibrium. |
---|
502 | |
---|
503 | == SET == |
---|
504 | *Orientation: vessel position - vertical or horizontal; |
---|
505 | *Heads (bottom and top heads are identical) |
---|
506 | **elliptical: 2:1 elliptical heads (25% of vessel diameter); |
---|
507 | **hemispherical: hemispherical heads (50% of vessel diameter); |
---|
508 | **flat: flat heads (0% of vessel diameter); |
---|
509 | *Diameter: Vessel diameter; |
---|
510 | *Lenght: Side length of the cylinder shell; |
---|
511 | |
---|
512 | == SPECIFY == |
---|
513 | * the Inlet stream; |
---|
514 | * the outlet flows: OutletVapour.F and OutletLiquid.F; |
---|
515 | * the InletQ (the model requires an energy stream, also you can use a controller for setting the heat duty using the heat_flow model). |
---|
516 | |
---|
517 | == OPTIONAL == |
---|
518 | * the SumpTank model has three control ports |
---|
519 | ** TI OutletLiquid Temperature Indicator; |
---|
520 | ** PI OutletLiquid Pressure Indicator; |
---|
521 | ** LI Level Indicator; |
---|
522 | |
---|
523 | == INITIAL CONDITIONS == |
---|
524 | * Initial_Temperature : the Tank temperature (OutletLiquid.T); |
---|
525 | * Levelpercent_Initial : the Tank liquid level in percent (LI); |
---|
526 | * Initial_Composition : (NoComps) OutletLiquid compositions. |
---|
527 | "; |
---|
528 | |
---|
529 | PARAMETERS |
---|
530 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
531 | outer NComp as Integer (Brief = "Number of components", Lower = 1); |
---|
532 | |
---|
533 | Mw(NComp) as molweight (Brief="Mol Weight", Hidden=true); |
---|
534 | pi as positive (Brief="Pi value", Default=3.141593,Hidden=true, Symbol="\pi"); |
---|
535 | g as acceleration (Brief="Gravity Acceleration",Default=9.81,Hidden=true); |
---|
536 | |
---|
537 | Heads as Switcher (Valid=["elliptical","hemispherical","flat"],Default="flat"); |
---|
538 | Diameter as length (Brief="Vessel diameter", Symbol="D_{i}"); |
---|
539 | Lenght as length (Brief="Side length of the cylinder shell", Symbol="L_{vessel}"); |
---|
540 | |
---|
541 | Vhead_elliptical as volume (Brief="Elliptical Head Total Volume",Hidden=true, Symbol="V_{head}^{elliptical}"); |
---|
542 | Vhead_hemispherical as volume (Brief="Hemispherical Head Total Volume",Hidden=true, Symbol="V_{head}^{hemispherical}"); |
---|
543 | Vcylinder as volume (Brief="Cylinder Total Volume",Hidden=true, Symbol="V_{cylinder}"); |
---|
544 | radius as length (Brief="Vessel radius",Hidden=true, Symbol="R_{cylinder}"); |
---|
545 | |
---|
546 | Levelpercent_Initial as positive (Brief="Initial liquid height in Percent", Default = 0.70); |
---|
547 | Temperature_Initial as temperature (Brief="Initial Liquid Temperature", Default = 330); |
---|
548 | Composition_Initial(NComp) as fraction (Brief="Initial Composition", Default = 0.10); |
---|
549 | |
---|
550 | SET |
---|
551 | |
---|
552 | Mw=PP.MolecularWeight(); |
---|
553 | |
---|
554 | g = 9.81 * 'm/(s^2)'; |
---|
555 | Vhead_elliptical = (pi*Diameter^3)/12; |
---|
556 | Vhead_hemispherical = (pi*Diameter^3)/6; |
---|
557 | Vcylinder = 0.25*(pi*Diameter^2)*Lenght; |
---|
558 | radius = 0.5*Diameter; |
---|
559 | |
---|
560 | VARIABLES |
---|
561 | |
---|
562 | in InletLiquid as stream (Brief="Feed Stream", PosX=0.22, PosY=0, Symbol="_{in}"); |
---|
563 | out OutletLiquid as liquid_stream (Brief="Liquid outlet stream", PosX=0.50, PosY=1, Symbol="_{out}^{Liquid}"); |
---|
564 | in InletVapour as stream (Brief="Vapour outlet stream", PosX=1, PosY=0.20, Symbol="_{out}^{Vapour}"); |
---|
565 | out OutletVapour as vapour_stream (Brief="Vapour outlet stream", PosX=0.68, PosY=0, Symbol="_{out}^{Vapour}"); |
---|
566 | InletQ as power (Brief="Heat Duty", Protected =false,Symbol="Q_{in}"); |
---|
567 | |
---|
568 | Vtotal as volume (Brief="Vessel total volume",Protected=true, Symbol="V_{total}"); |
---|
569 | Vfilled as volume (Brief="Vessel volume content",Protected=true, Symbol="V_{filled}"); |
---|
570 | |
---|
571 | TotalHoldup(NComp) as mol (Brief="Molar Holdup in the Vessel", Protected=true); |
---|
572 | LiquidHoldup as mol (Brief="Molar liquid holdup", Protected=true); |
---|
573 | VapourHoldup as mol (Brief="Molar vapour holdup", Protected=true); |
---|
574 | |
---|
575 | E as energy (Brief="Total Energy Holdup in the Vessel", Protected=true); |
---|
576 | vL as volume_mol (Brief="Liquid Molar Volume", Protected=true); |
---|
577 | vV as volume_mol (Brief="Vapour Molar volume", Protected=true); |
---|
578 | Level as length (Brief="liquid height", Protected=true); |
---|
579 | Across as area (Brief="Vessel cylinder shell Cross section area", Hidden=true, Symbol="A_{cross}"); |
---|
580 | Pdrop as press_delta (Brief = "Pressure Drop", DisplayUnit = 'kPa', Symbol ="\Delta P", Protected=true); |
---|
581 | |
---|
582 | Peq as pressure (Brief="Equilibrium pressure on the liquid surface", Protected=true, DisplayUnit = 'kPa', Symbol="P_{eq}"); |
---|
583 | Pstatic as pressure (Brief="Static head at the bottom of the tank", Protected = true, DisplayUnit = 'kPa', Symbol="P_{static}^{Liquid}"); |
---|
584 | |
---|
585 | out LI as control_signal (Brief="Level Indicator", PosX=1, PosY=0.7, Protected=true); |
---|
586 | out TI as control_signal (Brief="Temperature Indicator", PosX=1, PosY=0.6, Protected=true); |
---|
587 | |
---|
588 | INITIAL |
---|
589 | |
---|
590 | "Initial level Percent" |
---|
591 | LI = Levelpercent_Initial; |
---|
592 | |
---|
593 | "Initial Outlet Liquid Temperature" |
---|
594 | OutletLiquid.T = Temperature_Initial; |
---|
595 | |
---|
596 | "Initial Outlet Liquid Composition Normalized" |
---|
597 | OutletLiquid.z(1:NComp - 1) = Composition_Initial(1:NComp - 1)/sum(Composition_Initial); |
---|
598 | |
---|
599 | EQUATIONS |
---|
600 | |
---|
601 | "Vessel Cross Section Area" |
---|
602 | Across = 0.25*(pi*Diameter^2); |
---|
603 | |
---|
604 | switch Heads |
---|
605 | |
---|
606 | case "elliptical": |
---|
607 | |
---|
608 | "Vessel Total Volume" |
---|
609 | Vtotal = Vhead_elliptical + Vcylinder; |
---|
610 | |
---|
611 | if Level < 0.25*Diameter then |
---|
612 | |
---|
613 | "Vessel Filled Volume" |
---|
614 | Vfilled = 0.25*pi*(((Diameter*Level)/(0.25*Diameter))^2)*(0.25*Diameter-Level/3); |
---|
615 | |
---|
616 | else |
---|
617 | |
---|
618 | "Vessel Filled Volume" |
---|
619 | Vfilled = 0.25*pi*(Diameter^2)*(Level - 0.25*Diameter/3); |
---|
620 | |
---|
621 | end |
---|
622 | |
---|
623 | case "hemispherical": |
---|
624 | |
---|
625 | "Vessel Total Volume" |
---|
626 | Vtotal = Vhead_hemispherical + Vcylinder; |
---|
627 | |
---|
628 | if Level < 0.5*Diameter then |
---|
629 | |
---|
630 | "Vessel Filled Volume" |
---|
631 | Vfilled = 0.25*pi*(Level^2)*(2*Diameter-4*Level/3); |
---|
632 | |
---|
633 | else |
---|
634 | |
---|
635 | "Vessel Filled Volume" |
---|
636 | Vfilled = 0.25*pi*((2/3)*((0.5*Diameter)^3) - (0.25*(Diameter)^3) + Level*Diameter^2); |
---|
637 | |
---|
638 | end |
---|
639 | |
---|
640 | case "flat": |
---|
641 | |
---|
642 | "Vessel Total Volume" |
---|
643 | Vtotal = Vcylinder; |
---|
644 | |
---|
645 | "Vessel Filled Volume" |
---|
646 | Vfilled = Across*Level; |
---|
647 | |
---|
648 | end |
---|
649 | |
---|
650 | "Component Molar Balance" |
---|
651 | diff(TotalHoldup) = InletLiquid.F*InletLiquid.z + InletVapour.F*InletVapour.z- OutletLiquid.F*OutletLiquid.z - OutletVapour.F*OutletVapour.z; |
---|
652 | |
---|
653 | "Energy Balance" |
---|
654 | diff(E) = InletLiquid.F*InletLiquid.h + InletVapour.F*InletVapour.h - OutletLiquid.F*OutletLiquid.h - OutletVapour.F*OutletVapour.h + InletQ; |
---|
655 | |
---|
656 | "Molar Holdup" |
---|
657 | TotalHoldup = LiquidHoldup*OutletLiquid.z + VapourHoldup*OutletVapour.z; |
---|
658 | |
---|
659 | "Energy Holdup" |
---|
660 | E = LiquidHoldup*OutletLiquid.h + VapourHoldup*OutletVapour.h - OutletLiquid.P*Vtotal; |
---|
661 | |
---|
662 | "Mol fraction normalisation" |
---|
663 | sum(OutletLiquid.z)=1.0; |
---|
664 | |
---|
665 | "Mol fraction normalisation" |
---|
666 | sum(OutletLiquid.z)=sum(OutletVapour.z); |
---|
667 | |
---|
668 | "Liquid Volume" |
---|
669 | vL = PP.LiquidVolume(OutletLiquid.T, Peq, OutletLiquid.z); |
---|
670 | |
---|
671 | "Vapour Volume" |
---|
672 | vV = PP.VapourVolume(OutletVapour.T, Peq, OutletVapour.z); |
---|
673 | |
---|
674 | "Chemical Equilibrium" |
---|
675 | PP.LiquidFugacityCoefficient(OutletLiquid.T, Peq, OutletLiquid.z)*OutletLiquid.z = |
---|
676 | PP.VapourFugacityCoefficient(OutletVapour.T, Peq, OutletVapour.z)*OutletVapour.z; |
---|
677 | |
---|
678 | "Thermal Equilibrium" |
---|
679 | OutletVapour.T = OutletLiquid.T; |
---|
680 | |
---|
681 | "Mechanical Equilibrium for the Vapour Phase" |
---|
682 | OutletVapour.P = Peq; |
---|
683 | |
---|
684 | "Static Head" |
---|
685 | Pstatic = PP.LiquidDensity(OutletLiquid.T, Peq, OutletLiquid.z) * g * Level; |
---|
686 | |
---|
687 | "Mechanical Equilibrium for the Liquid Phase" |
---|
688 | OutletLiquid.P = Peq + Pstatic; |
---|
689 | |
---|
690 | "Pressure Drop" |
---|
691 | Pdrop = min([InletLiquid.P,InletVapour.P]) - OutletLiquid.P; |
---|
692 | #OutletLiquid.P = InletLiquid.P - Pdrop; |
---|
693 | |
---|
694 | "Geometry Constraint" |
---|
695 | Vtotal = LiquidHoldup * vL + VapourHoldup * vV; |
---|
696 | |
---|
697 | "Level indicator" |
---|
698 | LI*Vtotal= Vfilled; |
---|
699 | |
---|
700 | "Temperature indicator" |
---|
701 | TI * 'K' = OutletLiquid.T; |
---|
702 | |
---|
703 | "Liquid Level" |
---|
704 | LiquidHoldup * vL = Vfilled; |
---|
705 | |
---|
706 | end |
---|
707 | |
---|