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: flash.mso 270 2007-06-16 19:18:47Z paula $ |
---|
17 | *--------------------------------------------------------------------*# |
---|
18 | |
---|
19 | using "streams"; |
---|
20 | |
---|
21 | Model flash |
---|
22 | ATTRIBUTES |
---|
23 | Pallete = true; |
---|
24 | Icon = "Flash"; |
---|
25 | Brief = "Model of a dynamic flash."; |
---|
26 | Info = |
---|
27 | "Assumptions: |
---|
28 | * both phases are perfectly mixed. |
---|
29 | |
---|
30 | Specify: |
---|
31 | * the feed stream; |
---|
32 | * the outlet flows: OutletV.F and OutletL.F. |
---|
33 | |
---|
34 | Initial Conditions: |
---|
35 | * the flash initial temperature (OutletL.T); |
---|
36 | * the flash initial level (Level); |
---|
37 | * (NoComps - 1) OutletL (OR OutletV) compositions. |
---|
38 | "; |
---|
39 | |
---|
40 | PARAMETERS |
---|
41 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
42 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
43 | V as volume (Brief="Total Volume of the flash"); |
---|
44 | Mw(NComp) as molweight; |
---|
45 | orientation as Switcher (Valid=["vertical","horizontal"],Default="vertical"); |
---|
46 | diameter as length (Brief="Vessel diameter"); |
---|
47 | |
---|
48 | SET |
---|
49 | Mw=PP.MolecularWeight(); |
---|
50 | |
---|
51 | VARIABLES |
---|
52 | in Inlet as stream(Brief="Feed Stream"); |
---|
53 | out OutletL as liquid_stream(Brief="Liquid outlet stream"); |
---|
54 | out OutletV as vapour_stream(Brief="Vapour outlet stream"); |
---|
55 | in Q as heat_rate (Brief="Rate of heat supply"); |
---|
56 | |
---|
57 | M(NComp) as mol (Brief="Molar Holdup in the tray"); |
---|
58 | ML as mol (Brief="Molar liquid holdup"); |
---|
59 | MV as mol (Brief="Molar vapour holdup"); |
---|
60 | E as energy (Brief="Total Energy Holdup on tray"); |
---|
61 | vL as volume_mol (Brief="Liquid Molar Volume"); |
---|
62 | vV as volume_mol (Brief="Vapour Molar volume"); |
---|
63 | Level as length (Brief="liquid height"); |
---|
64 | Across as area (Brief="Flash Cross section area"); |
---|
65 | |
---|
66 | EQUATIONS |
---|
67 | "Component Molar Balance" |
---|
68 | diff(M)=Inlet.F*Inlet.z - OutletL.F*OutletL.z - OutletV.F*OutletV.z; |
---|
69 | |
---|
70 | "Energy Balance" |
---|
71 | diff(E) = Inlet.F*Inlet.h - OutletL.F*OutletL.h - OutletV.F*OutletV.h + Q; |
---|
72 | |
---|
73 | "Molar Holdup" |
---|
74 | M = ML*OutletL.z + MV*OutletV.z; |
---|
75 | |
---|
76 | "Energy Holdup" |
---|
77 | E = ML*OutletL.h + MV*OutletV.h - OutletL.P*V; |
---|
78 | |
---|
79 | "Mol fraction normalisation" |
---|
80 | sum(OutletL.z)=1.0; |
---|
81 | "Mol fraction normalisation" |
---|
82 | sum(OutletL.z)=sum(OutletV.z); |
---|
83 | |
---|
84 | "Liquid Volume" |
---|
85 | vL = PP.LiquidVolume(OutletL.T, OutletL.P, OutletL.z); |
---|
86 | "Vapour Volume" |
---|
87 | vV = PP.VapourVolume(OutletV.T, OutletV.P, OutletV.z); |
---|
88 | |
---|
89 | "Chemical Equilibrium" |
---|
90 | PP.LiquidFugacityCoefficient(OutletL.T, OutletL.P, OutletL.z)*OutletL.z = |
---|
91 | PP.VapourFugacityCoefficient(OutletV.T, OutletV.P, OutletV.z)*OutletV.z; |
---|
92 | |
---|
93 | "Thermal Equilibrium" |
---|
94 | OutletV.T = OutletL.T; |
---|
95 | |
---|
96 | "Mechanical Equilibrium" |
---|
97 | OutletV.P = OutletL.P; |
---|
98 | |
---|
99 | "Geometry Constraint" |
---|
100 | V = ML * vL + MV * vV; |
---|
101 | |
---|
102 | switch orientation |
---|
103 | case "vertical": |
---|
104 | "Cross Section Area" |
---|
105 | Across = 0.5 * asin(1) * diameter^2; |
---|
106 | |
---|
107 | "Liquid Level" |
---|
108 | ML * vL = Across * Level; |
---|
109 | |
---|
110 | case "horizontal": |
---|
111 | "Cylindrical Side Area" |
---|
112 | Across = 0.25*diameter^2 * (asin(1) - asin((diameter - 2*Level)/diameter)) + |
---|
113 | (Level - 0.5*diameter)*sqrt(Level*(diameter - Level)); |
---|
114 | |
---|
115 | "Liquid Level" |
---|
116 | 0.5 * asin(1) * diameter^2 * ML* vL = Across * V; |
---|
117 | end |
---|
118 | end |
---|
119 | |
---|
120 | #*---------------------------------------------------------------------- |
---|
121 | * Model of a Steady State flash |
---|
122 | *---------------------------------------------------------------------*# |
---|
123 | Model flash_steady |
---|
124 | ATTRIBUTES |
---|
125 | Pallete = true; |
---|
126 | Icon = "Flash"; |
---|
127 | Brief = "Model of a Steady State flash."; |
---|
128 | Info = |
---|
129 | "Assumptions: |
---|
130 | * both phases are perfectly mixed. |
---|
131 | |
---|
132 | Specify: |
---|
133 | * the feed stream; |
---|
134 | * the outlet pressure (OutletV.P); |
---|
135 | * the outlet temperature OR the heat supplied. |
---|
136 | "; |
---|
137 | |
---|
138 | PARAMETERS |
---|
139 | outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); |
---|
140 | |
---|
141 | VARIABLES |
---|
142 | in Inlet as stream(Brief="Feed Stream"); |
---|
143 | out OutletL as liquid_stream(Brief="Liquid outlet stream"); |
---|
144 | out OutletV as vapour_stream(Brief="Vapour outlet stream"); |
---|
145 | in Q as heat_rate (Brief="Rate of heat supply"); |
---|
146 | vfrac as fraction; |
---|
147 | |
---|
148 | EQUATIONS |
---|
149 | "The flash calculation" |
---|
150 | [vfrac, OutletL.z, OutletV.z] = PP.Flash(OutletV.T, OutletV.P, Inlet.z); |
---|
151 | |
---|
152 | "Global Molar Balance" |
---|
153 | Inlet.F = OutletV.F + OutletL.F; |
---|
154 | "Vaporisation Fraction" |
---|
155 | OutletV.F = Inlet.F * vfrac; |
---|
156 | |
---|
157 | "Energy Balance" |
---|
158 | Inlet.F*Inlet.h + Q = OutletL.F*OutletL.h + OutletV.F*OutletV.h; |
---|
159 | |
---|
160 | "Thermal Equilibrium" |
---|
161 | OutletV.T = OutletL.T; |
---|
162 | |
---|
163 | "Mechanical Equilibrium" |
---|
164 | OutletV.P = OutletL.P; |
---|
165 | end |
---|