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 basic streams |
---|
17 | *---------------------------------------------------------------------- |
---|
18 | * Author: Paula B. Staudt and Rafael de P. Soares |
---|
19 | * $Id: streams.mso 339 2007-08-14 17:46:50Z bicca $ |
---|
20 | *---------------------------------------------------------------------*# |
---|
21 | |
---|
22 | using "types"; |
---|
23 | |
---|
24 | Model stream |
---|
25 | ATTRIBUTES |
---|
26 | Pallete = false; |
---|
27 | Brief = "General Material Stream"; |
---|
28 | Info = |
---|
29 | "This is the basic building block for the EML models. |
---|
30 | Every model should have input and output streams derived |
---|
31 | from this model."; |
---|
32 | |
---|
33 | PARAMETERS |
---|
34 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
35 | |
---|
36 | VARIABLES |
---|
37 | F as flow_mol(Brief = "Molar Flow"); |
---|
38 | T as temperature(Brief = "Temperature"); |
---|
39 | P as pressure(Brief = "Pressure"); |
---|
40 | z(NComp) as fraction(Brief = "Overall Molar Fraction"); |
---|
41 | h as enth_mol(Brief = "Molar Enthalpy"); |
---|
42 | v as fraction(Brief = "Vapourization fraction"); |
---|
43 | end |
---|
44 | |
---|
45 | Model streamTherm as stream |
---|
46 | ATTRIBUTES |
---|
47 | Pallete = false; |
---|
48 | Brief = "General Material Stream"; |
---|
49 | Info = |
---|
50 | "comments."; |
---|
51 | |
---|
52 | PARAMETERS |
---|
53 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
54 | |
---|
55 | VARIABLES |
---|
56 | x(NComp) as fraction(Brief = "Liquid Molar Fraction"); |
---|
57 | y(NComp) as fraction(Brief = "Vapour Molar Fraction"); |
---|
58 | |
---|
59 | end |
---|
60 | |
---|
61 | Model liquid_stream as stream |
---|
62 | ATTRIBUTES |
---|
63 | Pallete = false; |
---|
64 | Brief = "Liquid Material Stream"; |
---|
65 | Info = |
---|
66 | "Model for liquid material streams. |
---|
67 | This model should be used only when the phase of the stream |
---|
68 | is known ''a priori''."; |
---|
69 | |
---|
70 | PARAMETERS |
---|
71 | outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); |
---|
72 | |
---|
73 | EQUATIONS |
---|
74 | "Liquid Enthalpy" |
---|
75 | h = PP.LiquidEnthalpy(T, P, z); |
---|
76 | "Liquid stream" |
---|
77 | v = 0; |
---|
78 | |
---|
79 | end |
---|
80 | |
---|
81 | Model vapour_stream as stream |
---|
82 | ATTRIBUTES |
---|
83 | Pallete = false; |
---|
84 | Brief = "Vapour Material Stream"; |
---|
85 | Info = |
---|
86 | "Model for vapour material streams. |
---|
87 | This model should be used only when the phase of the stream |
---|
88 | is known ''a priori''."; |
---|
89 | |
---|
90 | PARAMETERS |
---|
91 | outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); |
---|
92 | |
---|
93 | EQUATIONS |
---|
94 | "Vapour Enthalpy" |
---|
95 | h = PP.VapourEnthalpy(T, P, z); |
---|
96 | "Vapour stream" |
---|
97 | v = 1; |
---|
98 | |
---|
99 | end |
---|
100 | |
---|
101 | Model streamPH as streamTherm |
---|
102 | ATTRIBUTES |
---|
103 | Brief = "Stream with built-in flash calculation"; |
---|
104 | Info = " |
---|
105 | This model should be used when the vaporization fraction |
---|
106 | is unknown. |
---|
107 | |
---|
108 | The built-in flash calculation will determine the stream |
---|
109 | state as a function of the overall composition '''z''', the |
---|
110 | pressure '''P''' and the enthalpy '''h'''. |
---|
111 | |
---|
112 | Additionally, the liquid composition '''x''' and the vapor |
---|
113 | composition '''y''' are calculated. |
---|
114 | "; |
---|
115 | Pallete = false; |
---|
116 | |
---|
117 | PARAMETERS |
---|
118 | outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); |
---|
119 | |
---|
120 | EQUATIONS |
---|
121 | "Flash Calculation" |
---|
122 | [v, x, y] = PP.FlashPH(P, h, z); |
---|
123 | "Enthalpy" |
---|
124 | h = (1-v)*PP.LiquidEnthalpy(T, P, x) + |
---|
125 | v*PP.VapourEnthalpy(T, P, y); |
---|
126 | end |
---|
127 | |
---|
128 | Model source |
---|
129 | ATTRIBUTES |
---|
130 | Pallete = true; |
---|
131 | Icon = "icon/Source"; |
---|
132 | Brief = "Material stream source"; |
---|
133 | Info = " |
---|
134 | This model should be used for boundary streams. |
---|
135 | Usually these streams are known and come from another process |
---|
136 | units. |
---|
137 | |
---|
138 | The user should specify: |
---|
139 | * Total molar (mass or volumetric) flow |
---|
140 | * Temperature |
---|
141 | * Pressure |
---|
142 | * Molar (mass or volumetric) composition |
---|
143 | |
---|
144 | No matter the specification set, the model will calculate some |
---|
145 | additional properties: |
---|
146 | * Mass density |
---|
147 | * Mass flow |
---|
148 | * Mass compostions |
---|
149 | * Specific volume |
---|
150 | * Vapour fraction |
---|
151 | * Volumetric flow |
---|
152 | * Liquid and Vapour compositions |
---|
153 | "; |
---|
154 | |
---|
155 | PARAMETERS |
---|
156 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
157 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
158 | M(NComp) as molweight (Brief = "Component Mol Weight"); |
---|
159 | rhoModel as Switcher (Brief = "Density model", Valid = ["volume", "correlation"], Default="volume"); |
---|
160 | |
---|
161 | SET |
---|
162 | |
---|
163 | M = PP.MolecularWeight(); |
---|
164 | |
---|
165 | VARIABLES |
---|
166 | out Outlet as streamTherm (Brief = "Outlet stream", PosX=1, PosY=0.5256); |
---|
167 | hl as enth_mol; |
---|
168 | hv as enth_mol; |
---|
169 | zmass(NComp) as fraction (Brief = "Mass Fraction"); |
---|
170 | Mw as molweight (Brief = "Average Mol Weight"); |
---|
171 | vm as volume_mol (Brief = "Molar Volume"); |
---|
172 | rho as dens_mass (Brief = "Stream Mass Density"); |
---|
173 | rhom as dens_mol (Brief = "Stream Molar Density"); |
---|
174 | Fw as flow_mass (Brief = "Stream Mass Flow"); |
---|
175 | Fvol as flow_vol (Brief = "Volumetric Flow"); |
---|
176 | |
---|
177 | EQUATIONS |
---|
178 | "Flash Calculation" |
---|
179 | [Outlet.v, Outlet.x, Outlet.y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z); |
---|
180 | |
---|
181 | "Overall Enthalpy" |
---|
182 | Outlet.h = (1-Outlet.v)*PP.LiquidEnthalpy(Outlet.T, Outlet.P, Outlet.x) + |
---|
183 | Outlet.v*PP.VapourEnthalpy(Outlet.T, Outlet.P, Outlet.y); |
---|
184 | |
---|
185 | hl = PP.LiquidEnthalpy(Outlet.T, Outlet.P, Outlet.x); |
---|
186 | hv = PP.VapourEnthalpy(Outlet.T, Outlet.P, Outlet.y); |
---|
187 | |
---|
188 | "Average Molecular Weight" |
---|
189 | Mw = sum(M*Outlet.z); |
---|
190 | |
---|
191 | switch rhoModel |
---|
192 | case "volume": |
---|
193 | "Molar Density" |
---|
194 | rhom * vm = 1; |
---|
195 | |
---|
196 | case "correlation": |
---|
197 | "Mass Density" |
---|
198 | rho*((1-Outlet.v)/PP.LiquidDensity(Outlet.T,Outlet.P,Outlet.x) + Outlet.v/PP.VapourDensity(Outlet.T,Outlet.P,Outlet.y)) = 1; |
---|
199 | end |
---|
200 | |
---|
201 | "Mass or Molar Density" |
---|
202 | rhom * Mw = rho; |
---|
203 | |
---|
204 | "Flow Mass" |
---|
205 | Fw = Mw*Outlet.F; |
---|
206 | |
---|
207 | "Molar Volume" |
---|
208 | vm = (1-Outlet.v)*PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.x) + Outlet.v*PP.VapourVolume(Outlet.T,Outlet.P,Outlet.y); |
---|
209 | |
---|
210 | "Volumetric Flow" |
---|
211 | Fvol = Outlet.F*vm ; |
---|
212 | |
---|
213 | "Mass Fraction" |
---|
214 | zmass = M*Outlet.z / Mw; |
---|
215 | |
---|
216 | end |
---|
217 | |
---|
218 | Model simple_source |
---|
219 | ATTRIBUTES |
---|
220 | Pallete = true; |
---|
221 | Icon = "icon/Source"; |
---|
222 | Brief = "Simple material stream source"; |
---|
223 | Info = " |
---|
224 | This model should be used for boundary streams. |
---|
225 | Usually these streams are known and come from another process |
---|
226 | units. |
---|
227 | |
---|
228 | The user should specify: |
---|
229 | * Total molar flow |
---|
230 | * Temperature |
---|
231 | * Pressure |
---|
232 | * Molar composition |
---|
233 | "; |
---|
234 | |
---|
235 | PARAMETERS |
---|
236 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
237 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
238 | |
---|
239 | VARIABLES |
---|
240 | out Outlet as streamTherm (Brief = "Outlet stream", PosX=1, PosY=0.5256); |
---|
241 | hl as enth_mol; |
---|
242 | hv as enth_mol; |
---|
243 | |
---|
244 | EQUATIONS |
---|
245 | "Flash Calculation" |
---|
246 | [Outlet.v, Outlet.x, Outlet.y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z); |
---|
247 | |
---|
248 | "Overall Enthalpy" |
---|
249 | Outlet.h = (1-Outlet.v)*PP.LiquidEnthalpy(Outlet.T, Outlet.P, Outlet.x) + |
---|
250 | Outlet.v*PP.VapourEnthalpy(Outlet.T, Outlet.P, Outlet.y); |
---|
251 | |
---|
252 | hl = PP.LiquidEnthalpy(Outlet.T, Outlet.P, Outlet.x); |
---|
253 | hv = PP.VapourEnthalpy(Outlet.T, Outlet.P, Outlet.y); |
---|
254 | end |
---|
255 | |
---|
256 | Model sink |
---|
257 | ATTRIBUTES |
---|
258 | Pallete = true; |
---|
259 | Icon = "icon/Sink"; |
---|
260 | Brief = "Material stream sink"; |
---|
261 | Info = " |
---|
262 | This model should be used for boundary streams when additional |
---|
263 | information about the stream is desired. |
---|
264 | |
---|
265 | Some of the additional informations calculated by this models are: |
---|
266 | * Mass density |
---|
267 | * Mass flow |
---|
268 | * Mass compostions |
---|
269 | * Specific volume |
---|
270 | * Vapour fraction |
---|
271 | * Volumetric flow |
---|
272 | * Liquid and Vapour compositions |
---|
273 | "; |
---|
274 | |
---|
275 | PARAMETERS |
---|
276 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
277 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
278 | M(NComp) as molweight (Brief = "Component Mol Weight"); |
---|
279 | rhoModel as Switcher (Brief = "Density model", Valid = ["volume", "correlation"], Default="volume"); |
---|
280 | |
---|
281 | SET |
---|
282 | |
---|
283 | M = PP.MolecularWeight(); |
---|
284 | |
---|
285 | VARIABLES |
---|
286 | in Inlet as streamTherm (Brief = "Inlet Stream", PosX=0, PosY=0.5308); |
---|
287 | zmass(NComp) as fraction (Brief = "Mass Fraction"); |
---|
288 | Mw as molweight (Brief = "Average Mol Weight"); |
---|
289 | vm as volume_mol (Brief = "Molar Volume"); |
---|
290 | rho as dens_mass (Brief = "Stream Mass Density"); |
---|
291 | rhom as dens_mol (Brief = "Stream Molar Density"); |
---|
292 | Fw as flow_mass (Brief = "Stream Mass Flow"); |
---|
293 | Fvol as flow_vol (Brief = "Volumetric Flow"); |
---|
294 | |
---|
295 | EQUATIONS |
---|
296 | "Average Molecular Weight" |
---|
297 | Mw = sum(M*Inlet.z); |
---|
298 | |
---|
299 | switch rhoModel |
---|
300 | case "volume": |
---|
301 | "Molar Density" |
---|
302 | rhom * vm = 1; |
---|
303 | |
---|
304 | case "correlation": |
---|
305 | "Mass Density" |
---|
306 | rho * ((1-Inlet.v)/PP.LiquidDensity(Inlet.T,Inlet.P,Inlet.x) + Inlet.v/PP.VapourDensity(Inlet.T,Inlet.P,Inlet.y)) = 1; |
---|
307 | end |
---|
308 | |
---|
309 | "Mass or Molar Density" |
---|
310 | rhom * Mw = rho; |
---|
311 | |
---|
312 | "Flow Mass" |
---|
313 | Fw = Mw*Inlet.F; |
---|
314 | |
---|
315 | "Molar Volume" |
---|
316 | vm = (1-Inlet.v)*PP.LiquidVolume(Inlet.T, Inlet.P, Inlet.x) + Inlet.v*PP.VapourVolume(Inlet.T,Inlet.P,Inlet.y); |
---|
317 | |
---|
318 | "Volumetric Flow" |
---|
319 | Fvol = Inlet.F*vm ; |
---|
320 | |
---|
321 | "Mass Fraction" |
---|
322 | zmass = M*Inlet.z / Mw; |
---|
323 | |
---|
324 | end |
---|
325 | |
---|
326 | Model simple_sink |
---|
327 | ATTRIBUTES |
---|
328 | Pallete = true; |
---|
329 | Icon = "icon/Sink"; |
---|
330 | Brief = "Simple material stream sink"; |
---|
331 | Info = " |
---|
332 | This model should be used for boundary streams when no additional |
---|
333 | information about the stream is desired. |
---|
334 | "; |
---|
335 | |
---|
336 | VARIABLES |
---|
337 | in Inlet as stream (Brief = "Inlet Stream", PosX=0, PosY=0.5308); |
---|
338 | end |
---|
339 | |
---|
340 | Model energy_stream |
---|
341 | ATTRIBUTES |
---|
342 | Pallete = false; |
---|
343 | Brief = "General Energy Stream"; |
---|
344 | Info = |
---|
345 | "This is the basic building block for the EML models. |
---|
346 | Every model should have input and output energy streams |
---|
347 | derived from this model."; |
---|
348 | |
---|
349 | VARIABLES |
---|
350 | Q as heat_rate(Brief="Energy rate"); |
---|
351 | end |
---|
352 | |
---|
353 | Model energy_source |
---|
354 | ATTRIBUTES |
---|
355 | Pallete = true; |
---|
356 | Icon = "icon/energy_source"; |
---|
357 | Brief = "Enegry stream source"; |
---|
358 | |
---|
359 | VARIABLES |
---|
360 | out OutletQ as energy_stream (Brief = "Outlet energy stream", PosX=1, PosY=0.5349); |
---|
361 | end |
---|