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 753 2009-05-22 16:55:00Z arge $ |
---|
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 = "Stream Molar Flow Rate"); |
---|
38 | T as temperature (Brief = "Stream Temperature"); |
---|
39 | P as pressure (Brief = "Stream Pressure"); |
---|
40 | h as enth_mol (Brief = "Stream Enthalpy"); |
---|
41 | v as fraction (Brief = "Vapourization fraction"); |
---|
42 | z(NComp) as fraction (Brief = "Stream Molar Fraction"); |
---|
43 | end |
---|
44 | |
---|
45 | Model liquid_stream as stream |
---|
46 | ATTRIBUTES |
---|
47 | Pallete = false; |
---|
48 | Brief = "Liquid Material Stream"; |
---|
49 | Info = |
---|
50 | "Model for liquid material streams. |
---|
51 | This model should be used only when the phase of the stream |
---|
52 | is known ''a priori''."; |
---|
53 | |
---|
54 | PARAMETERS |
---|
55 | outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); |
---|
56 | |
---|
57 | EQUATIONS |
---|
58 | "Liquid Enthalpy" |
---|
59 | h = PP.LiquidEnthalpy(T, P, z); |
---|
60 | "Liquid stream" |
---|
61 | v = 0; |
---|
62 | end |
---|
63 | |
---|
64 | Model vapour_stream as stream |
---|
65 | ATTRIBUTES |
---|
66 | Pallete = false; |
---|
67 | Brief = "Vapour Material Stream"; |
---|
68 | Info = |
---|
69 | "Model for vapour material streams. |
---|
70 | This model should be used only when the phase of the stream |
---|
71 | is known ''a priori''."; |
---|
72 | |
---|
73 | PARAMETERS |
---|
74 | outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); |
---|
75 | |
---|
76 | EQUATIONS |
---|
77 | "Vapour Enthalpy" |
---|
78 | h = PP.VapourEnthalpy(T, P, z); |
---|
79 | "Vapour stream" |
---|
80 | v = 1; |
---|
81 | end |
---|
82 | |
---|
83 | Model streamPH as stream |
---|
84 | ATTRIBUTES |
---|
85 | Brief = "Stream with built-in flash calculation"; |
---|
86 | Info = " |
---|
87 | This model should be used when the vaporization fraction |
---|
88 | is unknown. |
---|
89 | |
---|
90 | The built-in flash calculation will determine the stream |
---|
91 | state as a function of the overall composition '''z''', the |
---|
92 | pressure '''P''' and the enthalpy '''h'''. |
---|
93 | |
---|
94 | Additionally, the liquid composition '''x''' and the vapor |
---|
95 | composition '''y''' are calculated. |
---|
96 | "; |
---|
97 | Pallete = false; |
---|
98 | |
---|
99 | PARAMETERS |
---|
100 | outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); |
---|
101 | |
---|
102 | VARIABLES |
---|
103 | x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); |
---|
104 | y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); |
---|
105 | |
---|
106 | EQUATIONS |
---|
107 | "Flash Calculation" |
---|
108 | [v, x, y] = PP.FlashPH(P, h, z); |
---|
109 | |
---|
110 | "Enthalpy" |
---|
111 | h = (1-v)*PP.LiquidEnthalpy(T, P, x) + v*PP.VapourEnthalpy(T, P, y); |
---|
112 | |
---|
113 | end |
---|
114 | |
---|
115 | Model streamPHS as streamPH |
---|
116 | ATTRIBUTES |
---|
117 | Brief = "Stream with built-in flash calculation"; |
---|
118 | Info = " |
---|
119 | This model should be used when the vaporization fraction |
---|
120 | is unknown. |
---|
121 | |
---|
122 | The built-in flash calculation will determine the stream |
---|
123 | state as a function of the overall composition '''z''', the |
---|
124 | pressure '''P''' and the enthalpy '''h'''. |
---|
125 | |
---|
126 | Additionally, the liquid composition '''x''', the vapor |
---|
127 | composition '''y''' and the stream entropy are calculated. |
---|
128 | "; |
---|
129 | Pallete = false; |
---|
130 | |
---|
131 | PARAMETERS |
---|
132 | outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); |
---|
133 | |
---|
134 | VARIABLES |
---|
135 | s as entr_mol (Brief = "Stream Entropy"); |
---|
136 | |
---|
137 | EQUATIONS |
---|
138 | |
---|
139 | "Entropy" |
---|
140 | s = (1-v)*PP.LiquidEntropy(T, P, x) + v*PP.VapourEntropy(T, P, y); |
---|
141 | |
---|
142 | end |
---|
143 | |
---|
144 | Model source |
---|
145 | ATTRIBUTES |
---|
146 | Pallete = true; |
---|
147 | Icon = "icon/Source"; |
---|
148 | Brief = "Material stream source"; |
---|
149 | Info = " |
---|
150 | This model should be used for boundary streams. |
---|
151 | Usually these streams are known and come from another process |
---|
152 | units. |
---|
153 | |
---|
154 | The user should specify: |
---|
155 | * Total molar (mass or volumetric) flow |
---|
156 | * Temperature |
---|
157 | * Pressure |
---|
158 | * Molar or mass composition |
---|
159 | |
---|
160 | No matter the specification set, the model will calculate some |
---|
161 | additional properties: |
---|
162 | * Mass density |
---|
163 | * Mass flow |
---|
164 | * Mass compostions |
---|
165 | * Specific volume |
---|
166 | * Vapour fraction |
---|
167 | * Volumetric flow |
---|
168 | * Liquid and Vapour compositions |
---|
169 | "; |
---|
170 | |
---|
171 | PARAMETERS |
---|
172 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
173 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
174 | M(NComp) as molweight (Brief = "Component Mol Weight"); |
---|
175 | CompositionBasis as Switcher (Brief = "Molar or Mass Composition", Valid = ["Molar", "Mass"], Default="Molar"); |
---|
176 | ValidPhases as Switcher (Brief = "Valid Phases for Flash Calculation", Valid = ["Vapour-Only", "Liquid-Only","Vapour-Liquid"], Default="Vapour-Liquid"); |
---|
177 | T_std as temperature (Brief = "Standard temperature", Hidden=true, Default = 298.15); |
---|
178 | P_std as pressure (Brief = "Standard pressure", Hidden=true, Default = 1); |
---|
179 | SET |
---|
180 | |
---|
181 | M = PP.MolecularWeight(); |
---|
182 | |
---|
183 | VARIABLES |
---|
184 | |
---|
185 | out Outlet as stream (Brief = "Outlet stream", PosX=1, PosY=0.5256, Symbol="_{out}",Protected=true); |
---|
186 | |
---|
187 | Composition(NComp) as fraction (Brief = "Stream Composition"); |
---|
188 | F as flow_mol (Brief = "Stream Molar Flow Rate"); |
---|
189 | Fw as flow_mass (Brief = "Stream Mass Flow"); |
---|
190 | Fvol as flow_vol (Brief = "Volumetric Flow"); |
---|
191 | Fvol_std as flow_vol (Brief = "Standard Volumetric Flow (1 atm, 20 C)"); |
---|
192 | T as temperature (Brief = "Stream Temperature"); |
---|
193 | T_Cdeg as temperature (Brief = "Temperature in °C", Lower=-200); |
---|
194 | P as pressure (Brief = "Stream Pressure"); |
---|
195 | |
---|
196 | x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); |
---|
197 | y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); |
---|
198 | |
---|
199 | Mw as molweight (Brief = "Average Mol Weight",Protected=true); |
---|
200 | vm as volume_mol (Brief = "Molar Volume",Protected=true); |
---|
201 | vm_std as volume_mol (Brief = "Standard Molar Volume",Protected=true); |
---|
202 | rho as dens_mass (Brief = "Stream Mass Density",Protected=true); |
---|
203 | rhom as dens_mol (Brief = "Stream Molar Density",Protected=true); |
---|
204 | |
---|
205 | zmass(NComp) as fraction (Brief = "Mass Fraction",Protected=true); |
---|
206 | |
---|
207 | EQUATIONS |
---|
208 | |
---|
209 | switch CompositionBasis |
---|
210 | |
---|
211 | case "Molar": |
---|
212 | "Stream Molar Composition" |
---|
213 | Outlet.z = Composition/sum(Composition); |
---|
214 | |
---|
215 | "Stream Mass Composition" |
---|
216 | zmass = M*Outlet.z / Mw; |
---|
217 | |
---|
218 | case "Mass": |
---|
219 | "Stream Mass Composition" |
---|
220 | zmass = Composition/sum(Composition); |
---|
221 | |
---|
222 | "Stream Molar Composition" |
---|
223 | Outlet.z*sum(zmass/M) = zmass/M; |
---|
224 | |
---|
225 | end |
---|
226 | |
---|
227 | switch ValidPhases |
---|
228 | |
---|
229 | case "Liquid-Only": |
---|
230 | |
---|
231 | "Vapour Fraction" |
---|
232 | Outlet.v = 0; |
---|
233 | |
---|
234 | "Liquid Composition" |
---|
235 | x = Outlet.z; |
---|
236 | |
---|
237 | "Vapour Composition" |
---|
238 | y = Outlet.z; |
---|
239 | |
---|
240 | "Overall Enthalpy" |
---|
241 | Outlet.h = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x); |
---|
242 | |
---|
243 | "Molar Volume" |
---|
244 | vm = PP.LiquidVolume(Outlet.T, Outlet.P, x); |
---|
245 | |
---|
246 | "Standard Molar Volume" |
---|
247 | vm_std = PP.LiquidVolume(T_std, P_std, x); |
---|
248 | |
---|
249 | case "Vapour-Only": |
---|
250 | |
---|
251 | "Vapor Fraction" |
---|
252 | Outlet.v = 1; |
---|
253 | |
---|
254 | "Liquid Composition" |
---|
255 | x = Outlet.z; |
---|
256 | |
---|
257 | "Vapour Composition" |
---|
258 | y = Outlet.z; |
---|
259 | |
---|
260 | "Overall Enthalpy" |
---|
261 | Outlet.h = PP.VapourEnthalpy(Outlet.T, Outlet.P, y); |
---|
262 | |
---|
263 | "Molar Volume" |
---|
264 | vm = PP.VapourVolume(Outlet.T, Outlet.P, y); |
---|
265 | |
---|
266 | "Standard Molar Volume" |
---|
267 | vm_std = PP.VapourVolume(T_std, P_std, y); |
---|
268 | |
---|
269 | case "Vapour-Liquid": |
---|
270 | |
---|
271 | "Flash Calculation" |
---|
272 | [Outlet.v, x, y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z); |
---|
273 | |
---|
274 | "Overall Enthalpy" |
---|
275 | Outlet.h = (1-Outlet.v)*PP.LiquidEnthalpy(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourEnthalpy(Outlet.T, Outlet.P, y); |
---|
276 | |
---|
277 | "Molar Volume" |
---|
278 | vm = (1-Outlet.v)*PP.LiquidVolume(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourVolume(Outlet.T, Outlet.P, y); |
---|
279 | |
---|
280 | "Standard Molar Volume" |
---|
281 | vm_std = (1-Outlet.v)*PP.LiquidVolume(T_std, P_std, x) + Outlet.v*PP.VapourVolume(T_std, P_std, y); |
---|
282 | |
---|
283 | end |
---|
284 | |
---|
285 | "Molar Density" |
---|
286 | rhom * vm = 1; |
---|
287 | |
---|
288 | "Average Molecular Weight" |
---|
289 | Mw = sum(M*Outlet.z); |
---|
290 | |
---|
291 | "Mass or Molar Density" |
---|
292 | rhom * Mw = rho; |
---|
293 | |
---|
294 | "Flow Mass" |
---|
295 | Fw = Mw*Outlet.F; |
---|
296 | |
---|
297 | "Volumetric Flow" |
---|
298 | Fvol = Outlet.F*vm ; |
---|
299 | |
---|
300 | "Standard Volumetric Flow" |
---|
301 | Fvol_std = Outlet.F*vm_std ; |
---|
302 | |
---|
303 | "Temperature in °C" |
---|
304 | T_Cdeg = Outlet.T - 273.15 * 'K'; |
---|
305 | |
---|
306 | "Equate Flow" |
---|
307 | Outlet.F = F; |
---|
308 | |
---|
309 | "Equate Pressures" |
---|
310 | Outlet.P = P; |
---|
311 | |
---|
312 | "Equate Temperatures" |
---|
313 | Outlet.T = T; |
---|
314 | |
---|
315 | end |
---|
316 | |
---|
317 | Model simple_source |
---|
318 | |
---|
319 | ATTRIBUTES |
---|
320 | Pallete = true; |
---|
321 | Icon = "icon/Source"; |
---|
322 | Brief = "Simple Material stream source"; |
---|
323 | Info = " |
---|
324 | This model should be used for boundary streams. |
---|
325 | Usually these streams are known and come from another process |
---|
326 | units. |
---|
327 | |
---|
328 | The user should specify: |
---|
329 | * Total molar flow |
---|
330 | * Temperature |
---|
331 | * Pressure |
---|
332 | * Molar composition |
---|
333 | "; |
---|
334 | |
---|
335 | PARAMETERS |
---|
336 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
337 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
338 | M(NComp) as molweight (Brief = "Component Mol Weight"); |
---|
339 | ValidPhases as Switcher (Brief = "Valid Phases for Flash Calculation", Valid = ["Vapour-Only", "Liquid-Only","Vapour-Liquid"], Default="Vapour-Liquid"); |
---|
340 | |
---|
341 | |
---|
342 | SET |
---|
343 | |
---|
344 | M = PP.MolecularWeight(); |
---|
345 | |
---|
346 | VARIABLES |
---|
347 | |
---|
348 | out Outlet as stream (Brief = "Outlet stream", PosX=1, PosY=0.5256, Symbol="_{out}",Protected=true); |
---|
349 | |
---|
350 | MolarComposition(NComp) as fraction (Brief = "Stream Molar Composition"); |
---|
351 | F as flow_mol (Brief = "Stream Molar Flow Rate"); |
---|
352 | T as temperature (Brief = "Stream Temperature"); |
---|
353 | T_Cdeg as temperature (Brief = "Temperature in °C", Lower=-200); |
---|
354 | P as pressure (Brief = "Stream Pressure"); |
---|
355 | |
---|
356 | x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); |
---|
357 | y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); |
---|
358 | |
---|
359 | |
---|
360 | EQUATIONS |
---|
361 | |
---|
362 | "Stream Molar Composition" |
---|
363 | Outlet.z = MolarComposition/sum(MolarComposition); |
---|
364 | |
---|
365 | |
---|
366 | switch ValidPhases |
---|
367 | |
---|
368 | case "Liquid-Only": |
---|
369 | |
---|
370 | "Vapour Fraction" |
---|
371 | Outlet.v = 0; |
---|
372 | |
---|
373 | "Liquid Composition" |
---|
374 | x = Outlet.z; |
---|
375 | |
---|
376 | "Vapour Composition" |
---|
377 | y = Outlet.z; |
---|
378 | |
---|
379 | "Overall Enthalpy" |
---|
380 | Outlet.h = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x); |
---|
381 | |
---|
382 | |
---|
383 | case "Vapour-Only": |
---|
384 | |
---|
385 | "Vapor Fraction" |
---|
386 | Outlet.v = 1; |
---|
387 | |
---|
388 | "Liquid Composition" |
---|
389 | x = Outlet.z; |
---|
390 | |
---|
391 | "Vapour Composition" |
---|
392 | y = Outlet.z; |
---|
393 | |
---|
394 | "Overall Enthalpy" |
---|
395 | Outlet.h = PP.VapourEnthalpy(Outlet.T, Outlet.P, y); |
---|
396 | |
---|
397 | |
---|
398 | case "Vapour-Liquid": |
---|
399 | |
---|
400 | "Flash Calculation" |
---|
401 | [Outlet.v, x, y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z); |
---|
402 | |
---|
403 | "Overall Enthalpy" |
---|
404 | Outlet.h = (1-Outlet.v)*PP.LiquidEnthalpy(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourEnthalpy(Outlet.T, Outlet.P, y); |
---|
405 | |
---|
406 | end |
---|
407 | |
---|
408 | "Temperature in °C" |
---|
409 | T_Cdeg = Outlet.T - 273.15 * 'K'; |
---|
410 | |
---|
411 | "Equate Flow" |
---|
412 | Outlet.F = F; |
---|
413 | |
---|
414 | "Equate Pressures" |
---|
415 | Outlet.P = P; |
---|
416 | |
---|
417 | "Equate Temperatures" |
---|
418 | Outlet.T = T; |
---|
419 | |
---|
420 | end |
---|
421 | |
---|
422 | Model sink |
---|
423 | ATTRIBUTES |
---|
424 | Pallete = true; |
---|
425 | Icon = "icon/Sink"; |
---|
426 | Brief = "Material stream sink"; |
---|
427 | Info = " |
---|
428 | This model should be used for boundary streams when additional |
---|
429 | information about the stream is desired. |
---|
430 | |
---|
431 | Some of the additional informations calculated by this models are: |
---|
432 | * Mass density |
---|
433 | * Mass flow |
---|
434 | * Mass compostions |
---|
435 | * Specific volume |
---|
436 | * Vapour fraction |
---|
437 | * Volumetric flow |
---|
438 | * Liquid and Vapour compositions |
---|
439 | "; |
---|
440 | |
---|
441 | PARAMETERS |
---|
442 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
443 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
444 | M(NComp) as molweight (Brief = "Component Mol Weight"); |
---|
445 | rhoModel as Switcher (Brief = "Density model", Valid = ["volume", "correlation"], Default="volume"); |
---|
446 | T_std as temperature (Brief = "Standard temperature", Hidden=true, Default = 298.15); |
---|
447 | P_std as pressure (Brief = "Standard pressure", Hidden=true, Default = 1); |
---|
448 | |
---|
449 | SET |
---|
450 | |
---|
451 | M = PP.MolecularWeight(); |
---|
452 | |
---|
453 | VARIABLES |
---|
454 | in Inlet as stream (Brief = "Inlet Stream", PosX=0, PosY=0.5308, Symbol="_{in}"); |
---|
455 | v as fraction (Brief = "Vapourization fraction"); |
---|
456 | x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); |
---|
457 | y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); |
---|
458 | zmass(NComp) as fraction (Brief = "Mass Fraction"); |
---|
459 | Mw as molweight (Brief = "Average Mol Weight"); |
---|
460 | vm as volume_mol (Brief = "Molar Volume"); |
---|
461 | vm_std as volume_mol (Brief = "Standard Molar Volume",Protected=true); |
---|
462 | rho as dens_mass (Brief = "Stream Mass Density"); |
---|
463 | rhom as dens_mol (Brief = "Stream Molar Density"); |
---|
464 | Fw as flow_mass (Brief = "Stream Mass Flow"); |
---|
465 | Fvol as flow_vol (Brief = "Volumetric Flow"); |
---|
466 | Fvol_std as flow_vol (Brief = "Standard Volumetric Flow (1 atm, 20 C)"); |
---|
467 | s as entr_mol (Brief = "Stream Entropy"); |
---|
468 | T_Cdeg as temperature (Brief = "Temperature in °C", Lower=-200); |
---|
469 | |
---|
470 | EQUATIONS |
---|
471 | "Flash Calculation" |
---|
472 | [v, x, y] = PP.FlashPH(Inlet.P, Inlet.h, Inlet.z); |
---|
473 | |
---|
474 | "Average Molecular Weight" |
---|
475 | Mw = sum(M*Inlet.z); |
---|
476 | |
---|
477 | switch rhoModel |
---|
478 | case "volume": |
---|
479 | "Molar Density" |
---|
480 | rhom * vm = 1; |
---|
481 | |
---|
482 | case "correlation": |
---|
483 | "Mass Density" |
---|
484 | rho * ((1-v)/PP.LiquidDensity(Inlet.T,Inlet.P,x) + v/PP.VapourDensity(Inlet.T,Inlet.P,y)) = 1; |
---|
485 | end |
---|
486 | |
---|
487 | "Mass or Molar Density" |
---|
488 | rhom * Mw = rho; |
---|
489 | |
---|
490 | "Flow Mass" |
---|
491 | Fw = Mw*Inlet.F; |
---|
492 | |
---|
493 | "Molar Volume" |
---|
494 | vm = (1-v)*PP.LiquidVolume(Inlet.T, Inlet.P, x) + v*PP.VapourVolume(Inlet.T, Inlet.P, y); |
---|
495 | |
---|
496 | "Standard Molar Volume" |
---|
497 | vm_std = (1-v)*PP.LiquidVolume(T_std, P_std, x) + v*PP.VapourVolume(T_std, P_std, y); |
---|
498 | |
---|
499 | "Volumetric Flow" |
---|
500 | Fvol = Inlet.F*vm ; |
---|
501 | |
---|
502 | "Standard Volumetric Flow" |
---|
503 | Fvol_std = Inlet.F*vm_std ; |
---|
504 | |
---|
505 | "Mass Fraction" |
---|
506 | zmass = M*Inlet.z / Mw; |
---|
507 | |
---|
508 | "Overall Entropy" |
---|
509 | s = (1-v)*PP.LiquidEntropy(Inlet.T, Inlet.P, x) + |
---|
510 | v*PP.VapourEntropy(Inlet.T, Inlet.P, y); |
---|
511 | |
---|
512 | "Temperature in °C" |
---|
513 | T_Cdeg = Inlet.T - 273.15 * 'K'; |
---|
514 | |
---|
515 | end |
---|
516 | |
---|
517 | Model simple_sink |
---|
518 | ATTRIBUTES |
---|
519 | Pallete = true; |
---|
520 | Icon = "icon/Sink"; |
---|
521 | Brief = "Simple material stream sink"; |
---|
522 | Info = " |
---|
523 | This model should be used for boundary streams when no additional |
---|
524 | information about the stream is desired. |
---|
525 | "; |
---|
526 | |
---|
527 | VARIABLES |
---|
528 | in Inlet as stream (Brief = "Inlet Stream", PosX=0, PosY=0.5308, Symbol="_{in}"); |
---|
529 | end |
---|
530 | |
---|
531 | Model energy_stream |
---|
532 | ATTRIBUTES |
---|
533 | Pallete = false; |
---|
534 | Brief = "General Energy Stream"; |
---|
535 | Info = |
---|
536 | "This is the basic building block for the EML models. |
---|
537 | Every model should have input and output energy streams |
---|
538 | derived from this model."; |
---|
539 | |
---|
540 | VARIABLES |
---|
541 | Q as heat_rate(Brief="Energy rate"); |
---|
542 | end |
---|
543 | |
---|
544 | Model work_stream |
---|
545 | ATTRIBUTES |
---|
546 | Pallete = false; |
---|
547 | Brief = "General Work Stream"; |
---|
548 | VARIABLES |
---|
549 | Work as power(Brief = "work"); |
---|
550 | end |
---|
551 | |
---|
552 | Model work_source |
---|
553 | ATTRIBUTES |
---|
554 | Pallete = true; |
---|
555 | Icon = "icon/work_source"; |
---|
556 | Brief = "Work stream source"; |
---|
557 | |
---|
558 | VARIABLES |
---|
559 | out OutletWork as work_stream (Brief = "Outlet work stream", PosX=1, PosY=0.46, Symbol="_{out}"); |
---|
560 | |
---|
561 | end |
---|
562 | |
---|
563 | Model work_sink |
---|
564 | ATTRIBUTES |
---|
565 | Pallete = true; |
---|
566 | Icon = "icon/work_sink"; |
---|
567 | Brief = "Work stream sink"; |
---|
568 | |
---|
569 | VARIABLES |
---|
570 | in InletWork as work_stream (Brief = "Inlet work stream", PosX=0, PosY=0.46, Symbol="_{in}"); |
---|
571 | |
---|
572 | end |
---|
573 | |
---|
574 | Model energy_source |
---|
575 | ATTRIBUTES |
---|
576 | Pallete = true; |
---|
577 | Icon = "icon/energy_source"; |
---|
578 | Brief = "Enegry stream source"; |
---|
579 | |
---|
580 | VARIABLES |
---|
581 | out OutletQ as energy_stream (Brief = "Outlet energy stream", PosX=1, PosY=0.46, Symbol="_{out}"); |
---|
582 | end |
---|
583 | |
---|
584 | Model energy_sink |
---|
585 | ATTRIBUTES |
---|
586 | Pallete = true; |
---|
587 | Icon = "icon/energy_sink"; |
---|
588 | Brief = "Enegry stream sink"; |
---|
589 | |
---|
590 | VARIABLES |
---|
591 | in InletQ as energy_stream (Brief = "Inlet energy stream", PosX=0, PosY=0.46, Symbol="_{in}"); |
---|
592 | end |
---|
593 | |
---|
594 | Model sourceNoFlow |
---|
595 | |
---|
596 | ATTRIBUTES |
---|
597 | Pallete = true; |
---|
598 | Icon = "icon/SourceNoFlow"; |
---|
599 | Brief = "Simple Material stream source with no flow."; |
---|
600 | Info = " |
---|
601 | This model should be used for boundary streams. |
---|
602 | Usually these streams are known and come from another process |
---|
603 | units."; |
---|
604 | |
---|
605 | PARAMETERS |
---|
606 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
607 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
608 | |
---|
609 | VARIABLES |
---|
610 | |
---|
611 | out Outlet as stream (Brief = "Outlet stream", PosX=1, PosY=0.5256, Symbol="_{out}",Protected=true); |
---|
612 | |
---|
613 | EQUATIONS |
---|
614 | |
---|
615 | "Stream Molar Composition" |
---|
616 | Outlet.z = 1/NComp; |
---|
617 | |
---|
618 | "Stream Molar Enthalpy" |
---|
619 | Outlet.h = 0 * 'J/mol'; |
---|
620 | |
---|
621 | "Stream Temperature" |
---|
622 | Outlet.T = 300 * 'K'; |
---|
623 | |
---|
624 | "Stream Molar Flow" |
---|
625 | Outlet.F = 0 * 'kmol/h'; |
---|
626 | |
---|
627 | "Stream Pressure" |
---|
628 | Outlet.P = 1 * 'atm'; |
---|
629 | |
---|
630 | "Stream Vapour Fraction" |
---|
631 | Outlet.v = 0; |
---|
632 | |
---|
633 | end |
---|
634 | |
---|
635 | Model info_stream |
---|
636 | |
---|
637 | ATTRIBUTES |
---|
638 | Pallete = true; |
---|
639 | Icon = "icon/Info_Stream"; |
---|
640 | Brief = "Material stream information"; |
---|
641 | Info = " |
---|
642 | This model should be used for middle streams when additional |
---|
643 | information about the stream is desired. |
---|
644 | |
---|
645 | Some of the additional informations calculated by this models are: |
---|
646 | * Mass density |
---|
647 | * Mass flow |
---|
648 | * Mass compostions |
---|
649 | * Specific volume |
---|
650 | * Vapour fraction |
---|
651 | * Volumetric flow |
---|
652 | * Liquid and Vapour compositions |
---|
653 | * Viscosity |
---|
654 | * Heat Capacity |
---|
655 | * Thermal Conductivity |
---|
656 | * Temperature in Celsius Degrees |
---|
657 | "; |
---|
658 | |
---|
659 | PARAMETERS |
---|
660 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
661 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
662 | M(NComp) as molweight (Brief = "Component Mol Weight"); |
---|
663 | |
---|
664 | SET |
---|
665 | |
---|
666 | M = PP.MolecularWeight(); |
---|
667 | |
---|
668 | VARIABLES |
---|
669 | |
---|
670 | in Inlet as stream (Brief = "Inlet Stream", PosX=0, PosY=0.5308, Protected=true , Symbol="_{in}"); |
---|
671 | out Outlet as stream (Brief = "Outlet Stream", PosX=1, PosY=0.5308, Protected=true , Symbol="_{out}"); |
---|
672 | |
---|
673 | v as fraction (Brief = "Vapourization fraction",Hidden=true); |
---|
674 | x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); |
---|
675 | y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); |
---|
676 | |
---|
677 | F(NComp) as flow_mol (Brief = "Component Molar Flow",Protected=true); |
---|
678 | FwTotal as flow_mass (Brief = "Total Mass Flow",Protected=true); |
---|
679 | Fw(NComp) as flow_mass (Brief = "Component Mass Flow",Protected=true); |
---|
680 | FvolTotal as flow_vol (Brief = "Total Volumetric Flow",Protected=true); |
---|
681 | T_Cdeg as temperature (Brief = "Temperature in °C", Lower=-200,Protected=true); |
---|
682 | |
---|
683 | Mu as viscosity (Brief="Stream Viscosity",Lower=0.0001, Symbol = "\mu",Protected=true); |
---|
684 | Cp as cp_mol (Brief="Stream Molar Heat Capacity", Upper=1e10,Protected=true); |
---|
685 | K as conductivity (Brief="Stream Thermal Conductivity", Default=1.0, Lower=1e-5, Upper=500,Protected=true); |
---|
686 | Mw as molweight (Brief = "Average Mol Weight",Protected=true); |
---|
687 | vm as volume_mol (Brief = "Molar Volume",Protected=true); |
---|
688 | rho as dens_mass (Brief = "Stream Mass Density",Protected=true); |
---|
689 | rhom as dens_mol (Brief = "Stream Molar Density",Protected=true); |
---|
690 | s as entr_mol (Brief = "Stream Entropy",Protected=true); |
---|
691 | zmass(NComp) as fraction (Brief = "Mass Fraction",Protected=true); |
---|
692 | |
---|
693 | EQUATIONS |
---|
694 | |
---|
695 | "Flash Calculation" |
---|
696 | [v, x, y] = PP.FlashPH(Inlet.P, Inlet.h, Inlet.z); |
---|
697 | |
---|
698 | "Average Molecular Weight" |
---|
699 | Mw = sum(M*Inlet.z); |
---|
700 | |
---|
701 | "Mass Density" |
---|
702 | rho * ((1-v)/PP.LiquidDensity(Inlet.T,Inlet.P,x) + v/PP.VapourDensity(Inlet.T,Inlet.P,y)) = 1; |
---|
703 | |
---|
704 | "Mass or Molar Density" |
---|
705 | rhom * Mw = rho; |
---|
706 | |
---|
707 | "Total Flow Mass" |
---|
708 | FwTotal = Mw*Inlet.F; |
---|
709 | |
---|
710 | "Component Flow Mass" |
---|
711 | Fw = FwTotal*zmass; |
---|
712 | |
---|
713 | "Molar Volume" |
---|
714 | vm = (1-v)*PP.LiquidVolume(Inlet.T, Inlet.P, x) + v*PP.VapourVolume(Inlet.T,Inlet.P,y); |
---|
715 | |
---|
716 | "Total Volumetric Flow" |
---|
717 | FvolTotal = Inlet.F*vm ; |
---|
718 | |
---|
719 | "Mass Fraction" |
---|
720 | zmass = M*Inlet.z / Mw; |
---|
721 | |
---|
722 | "Stream Heat Capacity" |
---|
723 | Cp = (1-v)*PP.LiquidCp(Inlet.T, Inlet.P, x) + v*PP.VapourCp(Inlet.T,Inlet.P,y); |
---|
724 | |
---|
725 | "Stream Viscosity" |
---|
726 | Mu = (1-v)*PP.LiquidViscosity(Inlet.T, Inlet.P, x) + v*PP.VapourViscosity(Inlet.T,Inlet.P,y); |
---|
727 | |
---|
728 | "Stream ThermalConductivity" |
---|
729 | K = (1-v)*PP.LiquidThermalConductivity(Inlet.T, Inlet.P, x) + v*PP.VapourThermalConductivity(Inlet.T,Inlet.P,y); |
---|
730 | |
---|
731 | "Stream Overall Entropy" |
---|
732 | s = (1-v)*PP.LiquidEntropy(Inlet.T, Inlet.P, x) + v*PP.VapourEntropy(Inlet.T, Inlet.P, y); |
---|
733 | |
---|
734 | "Temperature in °C" |
---|
735 | T_Cdeg = Inlet.T - 273.15 * 'K'; |
---|
736 | |
---|
737 | "Outlet Flow" |
---|
738 | Outlet.F = Inlet.F; |
---|
739 | |
---|
740 | "Component Molar Flow" |
---|
741 | F = Inlet.F*Inlet.z; |
---|
742 | |
---|
743 | "Outlet Temperature" |
---|
744 | Outlet.T = Inlet.T; |
---|
745 | |
---|
746 | "Outlet Pressure" |
---|
747 | Outlet.P = Inlet.P; |
---|
748 | |
---|
749 | "Outlet Vapour Fraction" |
---|
750 | Outlet.v = Inlet.v; |
---|
751 | |
---|
752 | "Outlet Enthalpy" |
---|
753 | Outlet.h = Inlet.h; |
---|
754 | |
---|
755 | "Outlet Composition" |
---|
756 | Outlet.z= Inlet.z; |
---|
757 | end |
---|