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 72 2006-12-08 18:29:10Z paula $ |
---|
34 | *--------------------------------------------------------------------*# |
---|
35 | |
---|
36 | using "streams"; |
---|
37 | |
---|
38 | Model tank |
---|
39 | |
---|
40 | PARAMETERS |
---|
41 | ext PP as CalcObject; |
---|
42 | ext NComp as Integer; |
---|
43 | Across as area (Brief="Tank cross section area", Default=2); |
---|
44 | |
---|
45 | VARIABLES |
---|
46 | in Inlet as stream; |
---|
47 | out Outlet as stream_therm; |
---|
48 | |
---|
49 | in Q as heat_rate (Brief="Rate of heat supply"); |
---|
50 | Level as length(Brief="Tank level"); |
---|
51 | M(NComp) as mol (Brief="Molar Holdup in the tank"); |
---|
52 | E as energy (Brief="Total Energy Holdup on tank"); |
---|
53 | vL as volume_mol (Brief="Liquid Molar Volume"); |
---|
54 | |
---|
55 | EQUATIONS |
---|
56 | "Mass balance" |
---|
57 | diff(M) = Inlet.F*Inlet.z - Outlet.F*Outlet.z; |
---|
58 | |
---|
59 | "Energy balance" |
---|
60 | diff(E) = Inlet.F*Inlet.h - Outlet.F*Outlet.h + Q; |
---|
61 | |
---|
62 | "Energy Holdup" |
---|
63 | E = sum(M)*Outlet.h; |
---|
64 | |
---|
65 | "Mechanical Equilibrium" |
---|
66 | Inlet.P = Outlet.P; |
---|
67 | |
---|
68 | "Liquid Volume" |
---|
69 | vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z); |
---|
70 | |
---|
71 | "Composition" |
---|
72 | M = Outlet.z*sum(M); |
---|
73 | |
---|
74 | "Level of liquid phase" |
---|
75 | Level = sum(M)*vL/Across; |
---|
76 | |
---|
77 | "Vapourisation Fraction" |
---|
78 | Outlet.v = Inlet.v; |
---|
79 | end |
---|
80 | |
---|
81 | #*---------------------------------------------------------- |
---|
82 | * |
---|
83 | *Model of a tank with a lain cylinder geometry |
---|
84 | * |
---|
85 | *---------------------------------------------------------*# |
---|
86 | Model tank_cylindrical |
---|
87 | |
---|
88 | PARAMETERS |
---|
89 | ext PP as CalcObject; |
---|
90 | ext NComp as Integer; |
---|
91 | radius as length(Brief="Tank radius"); |
---|
92 | L as length(Brief="Tank length"); |
---|
93 | |
---|
94 | VARIABLES |
---|
95 | in Inlet as stream; |
---|
96 | out Outlet as stream_therm; |
---|
97 | |
---|
98 | in Q as heat_rate (Brief="Rate of heat supply"); |
---|
99 | Level as length(Brief="Tank level"); |
---|
100 | Across as area (Brief="Tank cross section area", Default=2); |
---|
101 | M(NComp) as mol (Brief="Molar Holdup in the tank"); |
---|
102 | E as energy (Brief="Total Energy Holdup on tank"); |
---|
103 | vL as volume_mol (Brief="Liquid Molar Volume"); |
---|
104 | |
---|
105 | EQUATIONS |
---|
106 | "Mass balance" |
---|
107 | diff(M) = Inlet.F*Inlet.z - Outlet.F*Outlet.z; |
---|
108 | |
---|
109 | "Energy balance" |
---|
110 | diff(E) = Inlet.F*Inlet.h - Outlet.F*Outlet.h + Q; |
---|
111 | |
---|
112 | "Energy Holdup" |
---|
113 | E = sum(M)*Outlet.h; |
---|
114 | |
---|
115 | "Mechanical Equilibrium" |
---|
116 | Inlet.P = Outlet.P; |
---|
117 | |
---|
118 | "Liquid Volume" |
---|
119 | vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z); |
---|
120 | |
---|
121 | "Composition" |
---|
122 | M = Outlet.z*sum(M); |
---|
123 | |
---|
124 | "Cylindrical Area" |
---|
125 | Across = radius^2 * (asin(1) - asin((radius-Level)/radius) ) + |
---|
126 | (Level-radius)*sqrt(Level*(2*radius - Level)); |
---|
127 | |
---|
128 | "Level of liquid phase" |
---|
129 | Level = sum(M)*vL/Across; |
---|
130 | |
---|
131 | "Vapourisation Fraction" |
---|
132 | Outlet.v = Inlet.v; |
---|
133 | end |
---|
134 | |
---|
135 | Model tank_simplified |
---|
136 | PARAMETERS |
---|
137 | k as Real (Brief="Valve Constant", Unit = "m^2.5/h", Default=4); |
---|
138 | A as area (Brief="Tank area", Default=2); |
---|
139 | |
---|
140 | VARIABLES |
---|
141 | h as length(Brief="Tank level"); |
---|
142 | in Fin as flow_vol(Brief="Input flow"); |
---|
143 | out Fout as flow_vol(Brief="Output flow"); |
---|
144 | |
---|
145 | EQUATIONS |
---|
146 | "Mass balance" |
---|
147 | diff(A*h) = Fin - Fout; |
---|
148 | |
---|
149 | "Valve equation" |
---|
150 | Fout = k*sqrt(h); |
---|
151 | end |
---|
152 | |
---|
153 | Model tank_feed |
---|
154 | |
---|
155 | PARAMETERS |
---|
156 | ext PP as CalcObject; |
---|
157 | ext NComp as Integer; |
---|
158 | Across as area (Brief="Tank cross section area", Default=2); |
---|
159 | |
---|
160 | VARIABLES |
---|
161 | in Feed as stream; |
---|
162 | in Inlet as stream; |
---|
163 | out Outlet as stream_therm; |
---|
164 | |
---|
165 | in Q as heat_rate (Brief="Rate of heat supply"); |
---|
166 | Level as length(Brief="Tank level"); |
---|
167 | M(NComp) as mol (Brief="Molar Holdup in the tank"); |
---|
168 | E as energy (Brief="Total Energy Holdup on tank"); |
---|
169 | vL as volume_mol (Brief="Liquid Molar Volume"); |
---|
170 | |
---|
171 | EQUATIONS |
---|
172 | "Mass balance" |
---|
173 | diff(M) = Feed.F*Feed.z + Inlet.F*Inlet.z - Outlet.F*Outlet.z; |
---|
174 | |
---|
175 | "Energy balance" |
---|
176 | diff(E) = Feed.F*Feed.h + Inlet.F*Inlet.h - Outlet.F*Outlet.h + Q; |
---|
177 | |
---|
178 | "Energy Holdup" |
---|
179 | E = sum(M)*Outlet.h; |
---|
180 | |
---|
181 | "Mechanical Equilibrium" |
---|
182 | Inlet.P = Outlet.P; |
---|
183 | |
---|
184 | "Liquid Volume" |
---|
185 | vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z); |
---|
186 | |
---|
187 | "Composition" |
---|
188 | M = Outlet.z*sum(M); |
---|
189 | |
---|
190 | "Level of liquid phase" |
---|
191 | Level = sum(M)*vL/Across; |
---|
192 | |
---|
193 | "Vapourisation Fraction" |
---|
194 | Outlet.v = Inlet.v; |
---|
195 | |
---|
196 | end |
---|