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 669 2008-10-24 18:25:17Z 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 | |
---|
178 | |
---|
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 | T as temperature (Brief = "Stream Temperature"); |
---|
192 | T_Cdeg as temperature (Brief = "Temperature in °C", Lower=-200); |
---|
193 | P as pressure (Brief = "Stream Pressure"); |
---|
194 | |
---|
195 | x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); |
---|
196 | y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); |
---|
197 | |
---|
198 | Mw as molweight (Brief = "Average Mol Weight",Protected=true); |
---|
199 | vm as volume_mol (Brief = "Molar Volume",Protected=true); |
---|
200 | rho as dens_mass (Brief = "Stream Mass Density",Protected=true); |
---|
201 | rhom as dens_mol (Brief = "Stream Molar Density",Protected=true); |
---|
202 | |
---|
203 | zmass(NComp) as fraction (Brief = "Mass Fraction",Protected=true); |
---|
204 | |
---|
205 | EQUATIONS |
---|
206 | |
---|
207 | switch CompositionBasis |
---|
208 | |
---|
209 | case "Molar": |
---|
210 | "Stream Molar Composition" |
---|
211 | Outlet.z = Composition/sum(Composition); |
---|
212 | |
---|
213 | "Stream Mass Composition" |
---|
214 | zmass = M*Outlet.z / Mw; |
---|
215 | |
---|
216 | case "Mass": |
---|
217 | "Stream Mass Composition" |
---|
218 | zmass = Composition/sum(Composition); |
---|
219 | |
---|
220 | "Stream Molar Composition" |
---|
221 | Outlet.z*sum(zmass/M) = zmass/M; |
---|
222 | |
---|
223 | end |
---|
224 | |
---|
225 | switch ValidPhases |
---|
226 | |
---|
227 | case "Liquid-Only": |
---|
228 | |
---|
229 | "Vapour Fraction" |
---|
230 | Outlet.v = 0; |
---|
231 | |
---|
232 | "Liquid Composition" |
---|
233 | x = Outlet.z; |
---|
234 | |
---|
235 | "Vapour Composition" |
---|
236 | y = Outlet.z; |
---|
237 | |
---|
238 | "Overall Enthalpy" |
---|
239 | Outlet.h = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x); |
---|
240 | |
---|
241 | "Molar Volume" |
---|
242 | vm = PP.LiquidVolume(Outlet.T, Outlet.P, x); |
---|
243 | |
---|
244 | case "Vapour-Only": |
---|
245 | |
---|
246 | "Vapor Fraction" |
---|
247 | Outlet.v = 1; |
---|
248 | |
---|
249 | "Liquid Composition" |
---|
250 | x = Outlet.z; |
---|
251 | |
---|
252 | "Vapour Composition" |
---|
253 | y = Outlet.z; |
---|
254 | |
---|
255 | "Overall Enthalpy" |
---|
256 | Outlet.h = PP.VapourEnthalpy(Outlet.T, Outlet.P, y); |
---|
257 | |
---|
258 | "Molar Volume" |
---|
259 | vm = PP.VapourVolume(Outlet.T, Outlet.P, y); |
---|
260 | |
---|
261 | |
---|
262 | case "Vapour-Liquid": |
---|
263 | |
---|
264 | "Flash Calculation" |
---|
265 | [Outlet.v, x, y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z); |
---|
266 | |
---|
267 | "Overall Enthalpy" |
---|
268 | Outlet.h = (1-Outlet.v)*PP.LiquidEnthalpy(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourEnthalpy(Outlet.T, Outlet.P, y); |
---|
269 | |
---|
270 | "Molar Volume" |
---|
271 | vm = (1-Outlet.v)*PP.LiquidVolume(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourVolume(Outlet.T,Outlet.P,y); |
---|
272 | |
---|
273 | end |
---|
274 | |
---|
275 | "Molar Density" |
---|
276 | rhom * vm = 1; |
---|
277 | |
---|
278 | "Average Molecular Weight" |
---|
279 | Mw = sum(M*Outlet.z); |
---|
280 | |
---|
281 | "Mass or Molar Density" |
---|
282 | rhom * Mw = rho; |
---|
283 | |
---|
284 | "Flow Mass" |
---|
285 | Fw = Mw*Outlet.F; |
---|
286 | |
---|
287 | "Volumetric Flow" |
---|
288 | Fvol = Outlet.F*vm ; |
---|
289 | |
---|
290 | "Temperature in °C" |
---|
291 | T_Cdeg = Outlet.T - 273.15 * 'K'; |
---|
292 | |
---|
293 | "Equate Flow" |
---|
294 | Outlet.F = F; |
---|
295 | |
---|
296 | "Equate Pressures" |
---|
297 | Outlet.P = P; |
---|
298 | |
---|
299 | "Equate Temperatures" |
---|
300 | Outlet.T = T; |
---|
301 | |
---|
302 | end |
---|
303 | |
---|
304 | Model simple_source |
---|
305 | |
---|
306 | ATTRIBUTES |
---|
307 | Pallete = true; |
---|
308 | Icon = "icon/Source"; |
---|
309 | Brief = "Simple Material stream source"; |
---|
310 | Info = " |
---|
311 | This model should be used for boundary streams. |
---|
312 | Usually these streams are known and come from another process |
---|
313 | units. |
---|
314 | |
---|
315 | The user should specify: |
---|
316 | * Total molar flow |
---|
317 | * Temperature |
---|
318 | * Pressure |
---|
319 | * Molar composition |
---|
320 | "; |
---|
321 | |
---|
322 | PARAMETERS |
---|
323 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
324 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
325 | M(NComp) as molweight (Brief = "Component Mol Weight"); |
---|
326 | ValidPhases as Switcher (Brief = "Valid Phases for Flash Calculation", Valid = ["Vapour-Only", "Liquid-Only","Vapour-Liquid"], Default="Vapour-Liquid"); |
---|
327 | |
---|
328 | |
---|
329 | SET |
---|
330 | |
---|
331 | M = PP.MolecularWeight(); |
---|
332 | |
---|
333 | VARIABLES |
---|
334 | |
---|
335 | out Outlet as stream (Brief = "Outlet stream", PosX=1, PosY=0.5256, Symbol="_{out}",Protected=true); |
---|
336 | |
---|
337 | MolarComposition(NComp) as fraction (Brief = "Stream Molar Composition"); |
---|
338 | F as flow_mol (Brief = "Stream Molar Flow Rate"); |
---|
339 | T as temperature (Brief = "Stream Temperature"); |
---|
340 | T_Cdeg as temperature (Brief = "Temperature in °C", Lower=-200); |
---|
341 | P as pressure (Brief = "Stream Pressure"); |
---|
342 | |
---|
343 | x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); |
---|
344 | y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); |
---|
345 | |
---|
346 | |
---|
347 | EQUATIONS |
---|
348 | |
---|
349 | "Stream Molar Composition" |
---|
350 | Outlet.z = MolarComposition/sum(MolarComposition); |
---|
351 | |
---|
352 | |
---|
353 | switch ValidPhases |
---|
354 | |
---|
355 | case "Liquid-Only": |
---|
356 | |
---|
357 | "Vapour Fraction" |
---|
358 | Outlet.v = 0; |
---|
359 | |
---|
360 | "Liquid Composition" |
---|
361 | x = Outlet.z; |
---|
362 | |
---|
363 | "Vapour Composition" |
---|
364 | y = Outlet.z; |
---|
365 | |
---|
366 | "Overall Enthalpy" |
---|
367 | Outlet.h = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x); |
---|
368 | |
---|
369 | |
---|
370 | case "Vapour-Only": |
---|
371 | |
---|
372 | "Vapor Fraction" |
---|
373 | Outlet.v = 1; |
---|
374 | |
---|
375 | "Liquid Composition" |
---|
376 | x = Outlet.z; |
---|
377 | |
---|
378 | "Vapour Composition" |
---|
379 | y = Outlet.z; |
---|
380 | |
---|
381 | "Overall Enthalpy" |
---|
382 | Outlet.h = PP.VapourEnthalpy(Outlet.T, Outlet.P, y); |
---|
383 | |
---|
384 | |
---|
385 | case "Vapour-Liquid": |
---|
386 | |
---|
387 | "Flash Calculation" |
---|
388 | [Outlet.v, x, y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z); |
---|
389 | |
---|
390 | "Overall Enthalpy" |
---|
391 | Outlet.h = (1-Outlet.v)*PP.LiquidEnthalpy(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourEnthalpy(Outlet.T, Outlet.P, y); |
---|
392 | |
---|
393 | end |
---|
394 | |
---|
395 | "Temperature in °C" |
---|
396 | T_Cdeg = Outlet.T - 273.15 * 'K'; |
---|
397 | |
---|
398 | "Equate Flow" |
---|
399 | Outlet.F = F; |
---|
400 | |
---|
401 | "Equate Pressures" |
---|
402 | Outlet.P = P; |
---|
403 | |
---|
404 | "Equate Temperatures" |
---|
405 | Outlet.T = T; |
---|
406 | |
---|
407 | end |
---|
408 | |
---|
409 | Model sink |
---|
410 | ATTRIBUTES |
---|
411 | Pallete = true; |
---|
412 | Icon = "icon/Sink"; |
---|
413 | Brief = "Material stream sink"; |
---|
414 | Info = " |
---|
415 | This model should be used for boundary streams when additional |
---|
416 | information about the stream is desired. |
---|
417 | |
---|
418 | Some of the additional informations calculated by this models are: |
---|
419 | * Mass density |
---|
420 | * Mass flow |
---|
421 | * Mass compostions |
---|
422 | * Specific volume |
---|
423 | * Vapour fraction |
---|
424 | * Volumetric flow |
---|
425 | * Liquid and Vapour compositions |
---|
426 | "; |
---|
427 | |
---|
428 | PARAMETERS |
---|
429 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
430 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
431 | M(NComp) as molweight (Brief = "Component Mol Weight"); |
---|
432 | rhoModel as Switcher (Brief = "Density model", Valid = ["volume", "correlation"], Default="volume"); |
---|
433 | |
---|
434 | SET |
---|
435 | |
---|
436 | M = PP.MolecularWeight(); |
---|
437 | |
---|
438 | VARIABLES |
---|
439 | in Inlet as stream (Brief = "Inlet Stream", PosX=0, PosY=0.5308, Symbol="_{in}"); |
---|
440 | v as fraction (Brief = "Vapourization fraction"); |
---|
441 | x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); |
---|
442 | y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); |
---|
443 | zmass(NComp) as fraction (Brief = "Mass Fraction"); |
---|
444 | Mw as molweight (Brief = "Average Mol Weight"); |
---|
445 | vm as volume_mol (Brief = "Molar Volume"); |
---|
446 | rho as dens_mass (Brief = "Stream Mass Density"); |
---|
447 | rhom as dens_mol (Brief = "Stream Molar Density"); |
---|
448 | Fw as flow_mass (Brief = "Stream Mass Flow"); |
---|
449 | Fvol as flow_vol (Brief = "Volumetric Flow"); |
---|
450 | s as entr_mol (Brief = "Stream Entropy"); |
---|
451 | T_Cdeg as temperature (Brief = "Temperature in °C", Lower=-200); |
---|
452 | |
---|
453 | EQUATIONS |
---|
454 | "Flash Calculation" |
---|
455 | [v, x, y] = PP.FlashPH(Inlet.P, Inlet.h, Inlet.z); |
---|
456 | |
---|
457 | "Average Molecular Weight" |
---|
458 | Mw = sum(M*Inlet.z); |
---|
459 | |
---|
460 | switch rhoModel |
---|
461 | case "volume": |
---|
462 | "Molar Density" |
---|
463 | rhom * vm = 1; |
---|
464 | |
---|
465 | case "correlation": |
---|
466 | "Mass Density" |
---|
467 | rho * ((1-v)/PP.LiquidDensity(Inlet.T,Inlet.P,x) + v/PP.VapourDensity(Inlet.T,Inlet.P,y)) = 1; |
---|
468 | end |
---|
469 | |
---|
470 | "Mass or Molar Density" |
---|
471 | rhom * Mw = rho; |
---|
472 | |
---|
473 | "Flow Mass" |
---|
474 | Fw = Mw*Inlet.F; |
---|
475 | |
---|
476 | "Molar Volume" |
---|
477 | vm = (1-v)*PP.LiquidVolume(Inlet.T, Inlet.P, x) + v*PP.VapourVolume(Inlet.T,Inlet.P,y); |
---|
478 | |
---|
479 | "Volumetric Flow" |
---|
480 | Fvol = Inlet.F*vm ; |
---|
481 | |
---|
482 | "Mass Fraction" |
---|
483 | zmass = M*Inlet.z / Mw; |
---|
484 | |
---|
485 | "Overall Entropy" |
---|
486 | s = (1-v)*PP.LiquidEntropy(Inlet.T, Inlet.P, x) + |
---|
487 | v*PP.VapourEntropy(Inlet.T, Inlet.P, y); |
---|
488 | |
---|
489 | "Temperature in °C" |
---|
490 | T_Cdeg = Inlet.T - 273.15 * 'K'; |
---|
491 | |
---|
492 | end |
---|
493 | |
---|
494 | Model simple_sink |
---|
495 | ATTRIBUTES |
---|
496 | Pallete = true; |
---|
497 | Icon = "icon/Sink"; |
---|
498 | Brief = "Simple material stream sink"; |
---|
499 | Info = " |
---|
500 | This model should be used for boundary streams when no additional |
---|
501 | information about the stream is desired. |
---|
502 | "; |
---|
503 | |
---|
504 | VARIABLES |
---|
505 | in Inlet as stream (Brief = "Inlet Stream", PosX=0, PosY=0.5308, Symbol="_{in}"); |
---|
506 | end |
---|
507 | |
---|
508 | Model energy_stream |
---|
509 | ATTRIBUTES |
---|
510 | Pallete = false; |
---|
511 | Brief = "General Energy Stream"; |
---|
512 | Info = |
---|
513 | "This is the basic building block for the EML models. |
---|
514 | Every model should have input and output energy streams |
---|
515 | derived from this model."; |
---|
516 | |
---|
517 | VARIABLES |
---|
518 | Q as heat_rate(Brief="Energy rate"); |
---|
519 | end |
---|
520 | |
---|
521 | Model work_stream |
---|
522 | ATTRIBUTES |
---|
523 | Pallete = false; |
---|
524 | Brief = "General Work Stream"; |
---|
525 | VARIABLES |
---|
526 | Work as power(Brief = "work"); |
---|
527 | end |
---|
528 | |
---|
529 | Model work_source |
---|
530 | ATTRIBUTES |
---|
531 | Pallete = true; |
---|
532 | Icon = "icon/work_source"; |
---|
533 | Brief = "Work stream source"; |
---|
534 | |
---|
535 | VARIABLES |
---|
536 | out OutletWork as work_stream (Brief = "Outlet work stream", PosX=1, PosY=0.46, Symbol="_{out}"); |
---|
537 | |
---|
538 | end |
---|
539 | |
---|
540 | Model work_sink |
---|
541 | ATTRIBUTES |
---|
542 | Pallete = true; |
---|
543 | Icon = "icon/work_sink"; |
---|
544 | Brief = "Work stream sink"; |
---|
545 | |
---|
546 | VARIABLES |
---|
547 | in InletWork as work_stream (Brief = "Inlet work stream", PosX=0, PosY=0.46, Symbol="_{in}"); |
---|
548 | |
---|
549 | end |
---|
550 | |
---|
551 | Model energy_source |
---|
552 | ATTRIBUTES |
---|
553 | Pallete = true; |
---|
554 | Icon = "icon/energy_source"; |
---|
555 | Brief = "Enegry stream source"; |
---|
556 | |
---|
557 | VARIABLES |
---|
558 | out OutletQ as energy_stream (Brief = "Outlet energy stream", PosX=1, PosY=0.46, Symbol="_{out}"); |
---|
559 | end |
---|
560 | |
---|
561 | Model energy_sink |
---|
562 | ATTRIBUTES |
---|
563 | Pallete = true; |
---|
564 | Icon = "icon/energy_sink"; |
---|
565 | Brief = "Enegry stream sink"; |
---|
566 | |
---|
567 | VARIABLES |
---|
568 | in InletQ as energy_stream (Brief = "Inlet energy stream", PosX=0, PosY=0.46, Symbol="_{in}"); |
---|
569 | end |
---|
570 | |
---|
571 | Model sourceNoFlow |
---|
572 | |
---|
573 | ATTRIBUTES |
---|
574 | Pallete = true; |
---|
575 | Icon = "icon/SourceNoFlow"; |
---|
576 | Brief = "Simple Material stream source with no flow."; |
---|
577 | Info = " |
---|
578 | This model should be used for boundary streams. |
---|
579 | Usually these streams are known and come from another process |
---|
580 | units."; |
---|
581 | |
---|
582 | PARAMETERS |
---|
583 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
584 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
585 | |
---|
586 | VARIABLES |
---|
587 | |
---|
588 | out Outlet as stream (Brief = "Outlet stream", PosX=1, PosY=0.5256, Symbol="_{out}",Protected=true); |
---|
589 | |
---|
590 | EQUATIONS |
---|
591 | |
---|
592 | "Stream Molar Composition" |
---|
593 | Outlet.z = 1/NComp; |
---|
594 | |
---|
595 | "Stream Molar Enthalpy" |
---|
596 | Outlet.h = 0 * 'J/mol'; |
---|
597 | |
---|
598 | "Stream Temperature" |
---|
599 | Outlet.T = 300 * 'K'; |
---|
600 | |
---|
601 | "Stream Molar Flow" |
---|
602 | Outlet.F = 0 * 'kmol/h'; |
---|
603 | |
---|
604 | "Stream Pressure" |
---|
605 | Outlet.P = 1 * 'atm'; |
---|
606 | |
---|
607 | "Stream Vapour Fraction" |
---|
608 | Outlet.v = 0; |
---|
609 | |
---|
610 | end |
---|
611 | |
---|
612 | Model info_stream |
---|
613 | |
---|
614 | ATTRIBUTES |
---|
615 | Pallete = true; |
---|
616 | Icon = "icon/Info_Stream"; |
---|
617 | Brief = "Material stream information"; |
---|
618 | Info = " |
---|
619 | This model should be used for middle streams when additional |
---|
620 | information about the stream is desired. |
---|
621 | |
---|
622 | Some of the additional informations calculated by this models are: |
---|
623 | * Mass density |
---|
624 | * Mass flow |
---|
625 | * Mass compostions |
---|
626 | * Specific volume |
---|
627 | * Vapour fraction |
---|
628 | * Volumetric flow |
---|
629 | * Liquid and Vapour compositions |
---|
630 | * Viscosity |
---|
631 | * Heat Capacity |
---|
632 | * Thermal Conductivity |
---|
633 | * Temperature in Celsius Degrees |
---|
634 | "; |
---|
635 | |
---|
636 | PARAMETERS |
---|
637 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
638 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
639 | M(NComp) as molweight (Brief = "Component Mol Weight"); |
---|
640 | |
---|
641 | SET |
---|
642 | |
---|
643 | M = PP.MolecularWeight(); |
---|
644 | |
---|
645 | VARIABLES |
---|
646 | |
---|
647 | in Inlet as stream (Brief = "Inlet Stream", PosX=0, PosY=0.5308, Protected=true , Symbol="_{in}"); |
---|
648 | out Outlet as stream (Brief = "Outlet Stream", PosX=1, PosY=0.5308, Protected=true , Symbol="_{out}"); |
---|
649 | |
---|
650 | v as fraction (Brief = "Vapourization fraction",Hidden=true); |
---|
651 | x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); |
---|
652 | y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); |
---|
653 | |
---|
654 | F(NComp) as flow_mol (Brief = "Component Molar Flow",Protected=true); |
---|
655 | FwTotal as flow_mass (Brief = "Total Mass Flow",Protected=true); |
---|
656 | Fw(NComp) as flow_mass (Brief = "Component Mass Flow",Protected=true); |
---|
657 | FvolTotal as flow_vol (Brief = "Total Volumetric Flow",Protected=true); |
---|
658 | T_Cdeg as temperature (Brief = "Temperature in °C", Lower=-200,Protected=true); |
---|
659 | |
---|
660 | Mu as viscosity (Brief="Stream Viscosity",Lower=0.0001, Symbol = "\mu",Protected=true); |
---|
661 | Cp as cp_mol (Brief="Stream Molar Heat Capacity", Upper=1e10,Protected=true); |
---|
662 | K as conductivity (Brief="Stream Thermal Conductivity", Default=1.0, Lower=1e-5, Upper=500,Protected=true); |
---|
663 | Mw as molweight (Brief = "Average Mol Weight",Protected=true); |
---|
664 | vm as volume_mol (Brief = "Molar Volume",Protected=true); |
---|
665 | rho as dens_mass (Brief = "Stream Mass Density",Protected=true); |
---|
666 | rhom as dens_mol (Brief = "Stream Molar Density",Protected=true); |
---|
667 | s as entr_mol (Brief = "Stream Entropy",Protected=true); |
---|
668 | zmass(NComp) as fraction (Brief = "Mass Fraction",Protected=true); |
---|
669 | |
---|
670 | EQUATIONS |
---|
671 | |
---|
672 | "Flash Calculation" |
---|
673 | [v, x, y] = PP.FlashPH(Inlet.P, Inlet.h, Inlet.z); |
---|
674 | |
---|
675 | "Average Molecular Weight" |
---|
676 | Mw = sum(M*Inlet.z); |
---|
677 | |
---|
678 | "Mass Density" |
---|
679 | rho * ((1-v)/PP.LiquidDensity(Inlet.T,Inlet.P,x) + v/PP.VapourDensity(Inlet.T,Inlet.P,y)) = 1; |
---|
680 | |
---|
681 | "Mass or Molar Density" |
---|
682 | rhom * Mw = rho; |
---|
683 | |
---|
684 | "Total Flow Mass" |
---|
685 | FwTotal = Mw*Inlet.F; |
---|
686 | |
---|
687 | "Component Flow Mass" |
---|
688 | Fw = FwTotal*zmass; |
---|
689 | |
---|
690 | "Molar Volume" |
---|
691 | vm = (1-v)*PP.LiquidVolume(Inlet.T, Inlet.P, x) + v*PP.VapourVolume(Inlet.T,Inlet.P,y); |
---|
692 | |
---|
693 | "Total Volumetric Flow" |
---|
694 | FvolTotal = Inlet.F*vm ; |
---|
695 | |
---|
696 | "Mass Fraction" |
---|
697 | zmass = M*Inlet.z / Mw; |
---|
698 | |
---|
699 | "Stream Heat Capacity" |
---|
700 | Cp = (1-v)*PP.LiquidCp(Inlet.T, Inlet.P, x) + v*PP.VapourCp(Inlet.T,Inlet.P,y); |
---|
701 | |
---|
702 | "Stream Viscosity" |
---|
703 | Mu = (1-v)*PP.LiquidViscosity(Inlet.T, Inlet.P, x) + v*PP.VapourViscosity(Inlet.T,Inlet.P,y); |
---|
704 | |
---|
705 | "Stream ThermalConductivity" |
---|
706 | K = (1-v)*PP.LiquidThermalConductivity(Inlet.T, Inlet.P, x) + v*PP.VapourThermalConductivity(Inlet.T,Inlet.P,y); |
---|
707 | |
---|
708 | "Stream Overall Entropy" |
---|
709 | s = (1-v)*PP.LiquidEntropy(Inlet.T, Inlet.P, x) + v*PP.VapourEntropy(Inlet.T, Inlet.P, y); |
---|
710 | |
---|
711 | "Temperature in °C" |
---|
712 | T_Cdeg = Inlet.T - 273.15 * 'K'; |
---|
713 | |
---|
714 | "Outlet Flow" |
---|
715 | Outlet.F = Inlet.F; |
---|
716 | |
---|
717 | "Component Molar Flow" |
---|
718 | F = Inlet.F*Inlet.z; |
---|
719 | |
---|
720 | "Outlet Temperature" |
---|
721 | Outlet.T = Inlet.T; |
---|
722 | |
---|
723 | "Outlet Pressure" |
---|
724 | Outlet.P = Inlet.P; |
---|
725 | |
---|
726 | "Outlet Vapour Fraction" |
---|
727 | Outlet.v = Inlet.v; |
---|
728 | |
---|
729 | "Outlet Enthalpy" |
---|
730 | Outlet.h = Inlet.h; |
---|
731 | |
---|
732 | "Outlet Composition" |
---|
733 | Outlet.z= Inlet.z; |
---|
734 | end |
---|