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 300 2007-07-04 22:55:05Z 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 Q as heat_rate (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 + 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 Q as heat_rate (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 + 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 | PARAMETERS |
---|
161 | k as Real (Brief="Valve Constant", Unit = 'm^2.5/h', Default=4); |
---|
162 | A as area (Brief="Tank area", Default=2); |
---|
163 | |
---|
164 | VARIABLES |
---|
165 | h as length(Brief="Tank level"); |
---|
166 | in Fin as flow_vol(Brief="Input flow"); |
---|
167 | out Fout as flow_vol(Brief="Output flow"); |
---|
168 | |
---|
169 | EQUATIONS |
---|
170 | "Mass balance" |
---|
171 | diff(A*h) = Fin - Fout; |
---|
172 | |
---|
173 | "Valve equation" |
---|
174 | Fout = k*sqrt(h); |
---|
175 | end |
---|
176 | |
---|
177 | Model tank_feed |
---|
178 | |
---|
179 | PARAMETERS |
---|
180 | outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); |
---|
181 | outer NComp as Integer; |
---|
182 | Across as area (Brief="Tank cross section area", Default=2); |
---|
183 | |
---|
184 | VARIABLES |
---|
185 | in Feed as stream; |
---|
186 | in Inlet as stream; |
---|
187 | out Outlet as liquid_stream; |
---|
188 | |
---|
189 | in Q as heat_rate (Brief="Rate of heat supply"); |
---|
190 | Level as length(Brief="Tank level"); |
---|
191 | M(NComp) as mol (Brief="Molar Holdup in the tank"); |
---|
192 | E as energy (Brief="Total Energy Holdup on tank"); |
---|
193 | vL as volume_mol (Brief="Liquid Molar Volume"); |
---|
194 | |
---|
195 | EQUATIONS |
---|
196 | "Mass balance" |
---|
197 | diff(M) = Feed.F*Feed.z + Inlet.F*Inlet.z - Outlet.F*Outlet.z; |
---|
198 | |
---|
199 | "Energy balance" |
---|
200 | diff(E) = Feed.F*Feed.h + Inlet.F*Inlet.h - Outlet.F*Outlet.h + Q; |
---|
201 | |
---|
202 | "Energy Holdup" |
---|
203 | E = sum(M)*Outlet.h; |
---|
204 | |
---|
205 | "Mechanical Equilibrium" |
---|
206 | Inlet.P = Outlet.P; |
---|
207 | |
---|
208 | "Liquid Volume" |
---|
209 | vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z); |
---|
210 | |
---|
211 | "Composition" |
---|
212 | M = Outlet.z*sum(M); |
---|
213 | |
---|
214 | "Level of liquid phase" |
---|
215 | Level = sum(M)*vL/Across; |
---|
216 | end |
---|