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 757 2009-06-03 20:07:22Z 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 = "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 | |
---|