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 238 2007-04-13 00:02:34Z 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; |
---|
38 | T as temperature; |
---|
39 | P as pressure; |
---|
40 | z(NComp) as fraction(Brief = "Overall Molar Fraction"); |
---|
41 | h as enth_mol; |
---|
42 | v as fraction(Brief = "Vapourisation 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 | PARAMETERS |
---|
85 | outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); |
---|
86 | |
---|
87 | VARIABLES |
---|
88 | x(NComp) as fraction(Brief = "Liquid Molar Fraction"); |
---|
89 | y(NComp) as fraction(Brief = "Vapour Molar Fraction"); |
---|
90 | |
---|
91 | EQUATIONS |
---|
92 | "Flash Calculation" |
---|
93 | [v, x, y] = PP.FlashPH(P, h, z); |
---|
94 | "Enthalpy" |
---|
95 | h = (1-v)*PP.LiquidEnthalpy(T, P, x) + |
---|
96 | v*PP.VapourEnthalpy(T, P, y); |
---|
97 | end |
---|
98 | |
---|
99 | Model source |
---|
100 | ATTRIBUTES |
---|
101 | Info = |
---|
102 | "Material stream source. |
---|
103 | This model should be used for boundary streams. |
---|
104 | Usually these streams are known and come from another process |
---|
105 | units."; |
---|
106 | |
---|
107 | PARAMETERS |
---|
108 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
109 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
110 | M(NComp) as molweight (Brief="Component Mol Weight"); |
---|
111 | |
---|
112 | SET |
---|
113 | |
---|
114 | M = PP.MolecularWeight(); |
---|
115 | |
---|
116 | VARIABLES |
---|
117 | out Outlet as stream; |
---|
118 | x(NComp) as fraction(Brief = "Liquid Molar Fraction"); |
---|
119 | y(NComp) as fraction(Brief = "Vapour Molar Fraction"); |
---|
120 | hl as enth_mol; |
---|
121 | hv as enth_mol; |
---|
122 | zmass(NComp) as fraction (Brief = "Mass Fraction"); |
---|
123 | Mw as molweight (Brief="Average Mol Weight"); |
---|
124 | vm as volume_mol (Brief="Molar Volume"); |
---|
125 | rho as dens_mass (Brief="Stream Density"); |
---|
126 | Fw as flow_mass (Brief="Stream Mass Flow"); |
---|
127 | Fvol as flow_vol (Brief = "Volumetric Flow"); |
---|
128 | |
---|
129 | EQUATIONS |
---|
130 | "Flash Calculation" |
---|
131 | [Outlet.v, x, y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z); |
---|
132 | |
---|
133 | "Overall Enthalpy" |
---|
134 | Outlet.h = (1-Outlet.v)*PP.LiquidEnthalpy(Outlet.T, Outlet.P, x) + |
---|
135 | Outlet.v*PP.VapourEnthalpy(Outlet.T, Outlet.P, y); |
---|
136 | |
---|
137 | hl = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x); |
---|
138 | hv = PP.VapourEnthalpy(Outlet.T, Outlet.P, y); |
---|
139 | |
---|
140 | "Average Molecular Weight" |
---|
141 | Mw = sum(M*Outlet.z); |
---|
142 | |
---|
143 | "Mass Density" |
---|
144 | rho = (1-Outlet.v)*PP.LiquidDensity(Outlet.T,Outlet.P,x) + Outlet.v*PP.VapourDensity(Outlet.T,Outlet.P,y); |
---|
145 | |
---|
146 | "Flow Mass" |
---|
147 | Fw = Mw*Outlet.F; |
---|
148 | |
---|
149 | "Molar Volume" |
---|
150 | vm = (1-Outlet.v)*PP.LiquidVolume(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourVolume(Outlet.T,Outlet.P,y); |
---|
151 | |
---|
152 | "Volumetric Flow" |
---|
153 | Fvol = Outlet.F*vm ; |
---|
154 | |
---|
155 | "Mass Fraction" |
---|
156 | zmass = M*Outlet.z / Mw; |
---|
157 | |
---|
158 | end |
---|
159 | |
---|
160 | Model sink |
---|
161 | ATTRIBUTES |
---|
162 | Info = |
---|
163 | "Material stream sink. |
---|
164 | This model should be used for boundary streams."; |
---|
165 | |
---|
166 | PARAMETERS |
---|
167 | outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); |
---|
168 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
169 | M(NComp) as molweight (Brief="Component Mol Weight"); |
---|
170 | |
---|
171 | SET |
---|
172 | |
---|
173 | M = PP.MolecularWeight(); |
---|
174 | |
---|
175 | VARIABLES |
---|
176 | in Inlet as stream; |
---|
177 | v as fraction; |
---|
178 | x(NComp) as fraction (Brief = "Liquid Molar Fraction"); |
---|
179 | y(NComp) as fraction (Brief = "Vapour Molar Fraction"); |
---|
180 | zmass(NComp) as fraction (Brief = "Mass Fraction"); |
---|
181 | Mw as molweight (Brief="Average Mol Weight"); |
---|
182 | vm as volume_mol (Brief="Molar Volume"); |
---|
183 | rho as dens_mass (Brief="Stream Density"); |
---|
184 | Fw as flow_mass (Brief="Stream Mass Flow"); |
---|
185 | Fvol as flow_vol (Brief = "Volumetric Flow"); |
---|
186 | |
---|
187 | EQUATIONS |
---|
188 | "Flash Calculation" |
---|
189 | [v, x, y] = PP.FlashPH(Inlet.P, Inlet.h, Inlet.z); |
---|
190 | |
---|
191 | "Average Molecular Weight" |
---|
192 | Mw = sum(M*Inlet.z); |
---|
193 | |
---|
194 | "Mass Density" |
---|
195 | rho = (1-v)*PP.LiquidDensity(Inlet.T,Inlet.P,x) + v*PP.VapourDensity(Inlet.T,Inlet.P,y); |
---|
196 | |
---|
197 | "Flow Mass" |
---|
198 | Fw = Mw*Inlet.F; |
---|
199 | |
---|
200 | "Molar Volume" |
---|
201 | vm = (1-v)*PP.LiquidVolume(Inlet.T, Inlet.P, x) + v*PP.VapourVolume(Inlet.T,Inlet.P,y); |
---|
202 | |
---|
203 | "Volumetric Flow" |
---|
204 | Fvol = Inlet.F*vm ; |
---|
205 | |
---|
206 | "Mass Fraction" |
---|
207 | zmass = M*Inlet.z / Mw; |
---|
208 | |
---|
209 | end |
---|