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 valves: |
---|
17 | * |
---|
18 | * - Linear |
---|
19 | * - Parabolic |
---|
20 | * - Equal |
---|
21 | * - Quick |
---|
22 | * - valve: a very simple model |
---|
23 | * |
---|
24 | *-------------------------------------------------------------------- |
---|
25 | * - Assumptions |
---|
26 | * * Steady State |
---|
27 | * * Isentalpic |
---|
28 | * * Liquid |
---|
29 | * |
---|
30 | *--------------------------------------------------------------------- |
---|
31 | * Author: Estefane Horn, Núbia do Carmo Ferreira |
---|
32 | *$Id: valve.mso 108 2007-01-11 19:32:06Z nubinha $ |
---|
33 | *-------------------------------------------------------------------*# |
---|
34 | |
---|
35 | using "streams"; |
---|
36 | using "pressure_changers/flux_machine_basic"; |
---|
37 | |
---|
38 | |
---|
39 | Model valve_basic as flux_machine_basic_TP |
---|
40 | |
---|
41 | PARAMETERS |
---|
42 | ext PP as CalcObject (Brief = "External Physical Properties", File = "vrpp"); |
---|
43 | ext NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
44 | rho60F as dens_mass; |
---|
45 | |
---|
46 | VARIABLES |
---|
47 | Pdiff as press_delta (Brief = "Pressure Increase", Unit = "kPa"); |
---|
48 | Qv as flow_vol (Brief = "Volumetric Flow"); |
---|
49 | fc as positive (Brief = "Opening Function"); |
---|
50 | cv as positive (Brief = "Valve Coefficient", Unit = "m^3/h/kPa^0.5"); |
---|
51 | Gf as positive (Brief = "Specific Gravity"); |
---|
52 | rho as dens_mass; |
---|
53 | vm as vol_mol (Brief = "Mixture Molar Volume", Unit = "m^3/kmol"); |
---|
54 | |
---|
55 | SET |
---|
56 | rho60F = 99.022 * "kg/m^3"; |
---|
57 | |
---|
58 | EQUATIONS |
---|
59 | "Calculate Outlet Stream Pressure" |
---|
60 | Inlet.P - Outlet.P = Pdiff; |
---|
61 | |
---|
62 | "Enthalpy Balance" |
---|
63 | Outlet.h = Inlet.h; |
---|
64 | |
---|
65 | "Molar Balance" |
---|
66 | Outlet.F = Inlet.F; |
---|
67 | |
---|
68 | "Calculate Outlet Composition" |
---|
69 | Outlet.z = Inlet.z; |
---|
70 | |
---|
71 | "Valve Equation" |
---|
72 | #if Pdiff >= 0 then |
---|
73 | # "Flow" |
---|
74 | Qv = fc*cv*sqrt(Pdiff/Gf); |
---|
75 | #else |
---|
76 | # "Closed" |
---|
77 | # Pdiff < 0 * "kmol/h"; |
---|
78 | #end |
---|
79 | |
---|
80 | "Calculate Gf" |
---|
81 | Gf = rho/rho60F; |
---|
82 | |
---|
83 | "Calculate Specific Mass" |
---|
84 | rho = PP.LiquidDensity(Inlet.T,Inlet.P,Inlet.z); |
---|
85 | |
---|
86 | "Calculate Mass Flow" |
---|
87 | Qv = Inlet.F*vm; |
---|
88 | |
---|
89 | "Calculate Liquid Molar Volume" |
---|
90 | vm = PP.LiquidVolume(Inlet.T,Inlet.P,Inlet.z); |
---|
91 | |
---|
92 | end |
---|
93 | |
---|
94 | #*---------------------------------------------------------------------- |
---|
95 | * Model of a valve_linear |
---|
96 | *---------------------------------------------------------------------*# |
---|
97 | #* - Specify: |
---|
98 | * * Opening fraction (x) |
---|
99 | * |
---|
100 | *---------------------------------------------------------------------*# |
---|
101 | |
---|
102 | |
---|
103 | Model valve_linear as valve_basic |
---|
104 | |
---|
105 | VARIABLES |
---|
106 | x as fraction (Brief = "Opening"); |
---|
107 | |
---|
108 | EQUATIONS |
---|
109 | |
---|
110 | "Opening Equation" |
---|
111 | fc = x; |
---|
112 | |
---|
113 | end |
---|
114 | |
---|
115 | #*---------------------------------------------------------------------- |
---|
116 | * Model of a valve_parabolic |
---|
117 | *---------------------------------------------------------------------*# |
---|
118 | #* - Specify: |
---|
119 | * * Opening fraction (x) |
---|
120 | * |
---|
121 | *---------------------------------------------------------------------*# |
---|
122 | |
---|
123 | Model valve_parabolic as valve_basic |
---|
124 | |
---|
125 | PARAMETERS |
---|
126 | n as positive (Brief = "Constant", Lower = 1.4, Upper = 2.6); |
---|
127 | |
---|
128 | VARIABLES |
---|
129 | x as fraction (Brief = "Opening"); |
---|
130 | |
---|
131 | EQUATIONS |
---|
132 | |
---|
133 | "Opening Equation" |
---|
134 | fc = x^n; |
---|
135 | |
---|
136 | end |
---|
137 | |
---|
138 | #*---------------------------------------------------------------------- |
---|
139 | * Model of a valve_equal |
---|
140 | *---------------------------------------------------------------------*# |
---|
141 | #* - Specify: |
---|
142 | * * Opening fraction (x) |
---|
143 | * |
---|
144 | *---------------------------------------------------------------------*# |
---|
145 | |
---|
146 | Model valve_equal as valve_basic |
---|
147 | |
---|
148 | PARAMETERS |
---|
149 | a as Real (Brief = "Constant", Default = 100); |
---|
150 | |
---|
151 | VARIABLES |
---|
152 | x as fraction (Brief = "Opening"); |
---|
153 | |
---|
154 | EQUATIONS |
---|
155 | |
---|
156 | "Opening Equation" |
---|
157 | fc = a^(x-1); |
---|
158 | |
---|
159 | end |
---|
160 | |
---|
161 | #*---------------------------------------------------------------------- |
---|
162 | * Model of a valve_quick |
---|
163 | *---------------------------------------------------------------------*# |
---|
164 | #* - Specify: |
---|
165 | * * Opening fraction (x) |
---|
166 | * |
---|
167 | *---------------------------------------------------------------------*# |
---|
168 | |
---|
169 | Model valve_quick as valve_basic |
---|
170 | |
---|
171 | PARAMETERS |
---|
172 | a as positive (Brief = "Constant", Default = 0.05); |
---|
173 | n as positive (Brief = "Constant", Default = 5); |
---|
174 | |
---|
175 | VARIABLES |
---|
176 | x as fraction (Brief = "Opening"); |
---|
177 | |
---|
178 | EQUATIONS |
---|
179 | |
---|
180 | "Opening Equation" |
---|
181 | fc = (1-(a*(1-x)-(a-1)*(1-x)^n)); |
---|
182 | |
---|
183 | end |
---|
184 | |
---|
185 | #*------------------------------------------------------------------- |
---|
186 | * Model of a valve (simplified) |
---|
187 | *-------------------------------------------------------------------- |
---|
188 | * |
---|
189 | * Streams: |
---|
190 | * * an inlet stream |
---|
191 | * * an outlet stream |
---|
192 | * |
---|
193 | * Assumptions: |
---|
194 | * * no flashing liquid in the valve |
---|
195 | * * the flow in the valve is adiabatic |
---|
196 | * * dynamics in the valve are neglected |
---|
197 | * * linear flow type |
---|
198 | * |
---|
199 | * Specify: |
---|
200 | * * the inlet stream |
---|
201 | * * one of: plug position (x), outlet temperature (Outlet.T) or |
---|
202 | * outlet pressure (Outlet.P) |
---|
203 | * or |
---|
204 | * * the inlet stream excluding its flow (Inlet.F) |
---|
205 | * * the outlet pressure (Outlet.P) OR outlet flow (Outlet.F) |
---|
206 | * * the plug position (x) |
---|
207 | * |
---|
208 | * |
---|
209 | *---------------------------------------------------------------------- |
---|
210 | * Author: Paula B. Staudt |
---|
211 | *--------------------------------------------------------------------*# |
---|
212 | Model valve |
---|
213 | PARAMETERS |
---|
214 | ext PP as CalcObject; |
---|
215 | ext NComp as Integer; |
---|
216 | |
---|
217 | VARIABLES |
---|
218 | in Inlet as stream; |
---|
219 | out Outlet as stream_therm; |
---|
220 | x as fraction (Brief="Plug Position"); |
---|
221 | rho as dens_mass (Brief="Fluid Density", Default=1e3); |
---|
222 | v as vol_mol (Brief="Specific volume", Default=1e3); |
---|
223 | |
---|
224 | PARAMETERS |
---|
225 | rho_ref as dens_mass (Brief="Reference Density", Default=1e4); |
---|
226 | k as Real (Brief="Valve Constant", Unit="gal/min/psi^0.5"); |
---|
227 | |
---|
228 | EQUATIONS |
---|
229 | "Molar Balance" |
---|
230 | Inlet.F = Outlet.F; |
---|
231 | Inlet.z = Outlet.z; |
---|
232 | |
---|
233 | "Energy Balance" |
---|
234 | Inlet.h = Outlet.h; |
---|
235 | |
---|
236 | "Vapourisation Fraction" |
---|
237 | Outlet.v = Inlet.v; |
---|
238 | |
---|
239 | "Density" |
---|
240 | rho = Inlet.v*PP.VapourDensity((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z) + |
---|
241 | (1-Inlet.v)*PP.LiquidDensity((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z); |
---|
242 | |
---|
243 | "Volume" |
---|
244 | v = Inlet.v*PP.VapourVolume((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z) + |
---|
245 | (1-Inlet.v)*PP.LiquidVolume((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z); |
---|
246 | |
---|
247 | #if Inlet.P > Outlet.P then |
---|
248 | # "Flow" |
---|
249 | Outlet.F * v = cv*x*sqrt((Inlet.P - Outlet.P)*rho_ref / rho ) ; |
---|
250 | #else |
---|
251 | # "Closed" |
---|
252 | # Outlet.F = 0 * "kmol/h"; |
---|
253 | #end |
---|
254 | end |
---|