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 | * Author: Estefane Horn, Núbia do Carmo Ferreira |
---|
17 | *$Id: valve.mso 372 2007-09-21 22:17:36Z arge $ |
---|
18 | *-------------------------------------------------------------------*# |
---|
19 | |
---|
20 | using "streams"; |
---|
21 | |
---|
22 | |
---|
23 | Model valve |
---|
24 | ATTRIBUTES |
---|
25 | Pallete = true; |
---|
26 | Icon = "icon/Valve"; |
---|
27 | Brief = "Model of a valve."; |
---|
28 | Info = |
---|
29 | "== Model of valves == |
---|
30 | * Linear; |
---|
31 | * Parabolic; |
---|
32 | * Equal; |
---|
33 | * Quick; |
---|
34 | * Hyperbolic. |
---|
35 | |
---|
36 | == Assumptions == |
---|
37 | * Steady State; |
---|
38 | * Liquid; |
---|
39 | * Isentalpic. |
---|
40 | |
---|
41 | == Specify == |
---|
42 | * the valve type; |
---|
43 | * the inlet stream; |
---|
44 | * the Volumetric Flow (Qv); |
---|
45 | * the Valve Coefficient (cv); |
---|
46 | * the opening (x). |
---|
47 | "; |
---|
48 | |
---|
49 | PARAMETERS |
---|
50 | valve_type as Switcher (Valid = ["linear", "parabolic", "equal", "quick", "hyperbolic"], Default = "linear"); |
---|
51 | outer PP as Plugin (Brief = "External Physical Properties", Type = "PP"); |
---|
52 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
53 | rho60F as dens_mass; |
---|
54 | |
---|
55 | VARIABLES |
---|
56 | Pratio as positive (Brief = "Pressure Ratio", Symbol ="P_{ratio}"); |
---|
57 | Pdrop as press_delta (Brief = "Pressure Drop", DisplayUnit = 'kPa', Symbol ="\Delta P"); |
---|
58 | Qv as flow_vol (Brief = "Volumetric Flow"); |
---|
59 | fc as positive (Brief = "Opening Function"); |
---|
60 | cv as positive (Brief = "Valve Coefficient", Unit = 'm^3/h/kPa^0.5'); |
---|
61 | Gf as positive (Brief = "Specific Gravity"); |
---|
62 | rho as dens_mass; |
---|
63 | vm as vol_mol (Brief = "Mixture Molar Volume"); |
---|
64 | x as fraction (Brief = "Opening"); |
---|
65 | in Inlet as stream (Brief = "Inlet stream", PosX=0, PosY=0.7365, Symbol="_{in}"); |
---|
66 | out Outlet as streamPH (Brief = "Outlet stream", PosX=1, PosY=0.7365, Symbol="_{out}"); |
---|
67 | |
---|
68 | SET |
---|
69 | rho60F = 999.02 * 'kg/m^3'; |
---|
70 | |
---|
71 | EQUATIONS |
---|
72 | "Pressure Drop" |
---|
73 | Outlet.P = Inlet.P - Pdrop; |
---|
74 | |
---|
75 | "Pressure Ratio" |
---|
76 | Outlet.P = Inlet.P * Pratio; |
---|
77 | |
---|
78 | "Enthalpy Balance" |
---|
79 | Outlet.h = Inlet.h; |
---|
80 | |
---|
81 | "Molar Balance" |
---|
82 | Outlet.F = Inlet.F; |
---|
83 | |
---|
84 | "Calculate Outlet Composition" |
---|
85 | Outlet.z = Inlet.z; |
---|
86 | |
---|
87 | if Pdrop > 0 then |
---|
88 | "Valve Equation - Flow" |
---|
89 | Qv = fc*cv*sqrt(Pdrop/Gf); |
---|
90 | else |
---|
91 | "Valve Equation - Closed" |
---|
92 | Qv = 0 * 'm^3/h'; |
---|
93 | end |
---|
94 | |
---|
95 | "Calculate Gf" |
---|
96 | Gf = rho/rho60F; |
---|
97 | |
---|
98 | "Calculate Specific Mass" |
---|
99 | rho = PP.LiquidDensity(Inlet.T,Inlet.P,Inlet.z); |
---|
100 | |
---|
101 | "Calculate Mass Flow" |
---|
102 | Qv = Inlet.F*vm; |
---|
103 | |
---|
104 | "Calculate Liquid Molar Volume" |
---|
105 | vm = PP.LiquidVolume(Inlet.T,Inlet.P,Inlet.z); |
---|
106 | |
---|
107 | switch valve_type |
---|
108 | case "linear": |
---|
109 | |
---|
110 | "Opening Equation" |
---|
111 | fc = x; |
---|
112 | |
---|
113 | case "parabolic": |
---|
114 | |
---|
115 | "Opening Equation" |
---|
116 | fc = x^2; |
---|
117 | |
---|
118 | case "equal": |
---|
119 | |
---|
120 | "Opening Equation" |
---|
121 | fc = x^2/(2-x^4)^(1/2); |
---|
122 | |
---|
123 | case "quick": |
---|
124 | |
---|
125 | "Opening Equation" |
---|
126 | fc = 10*x/sqrt(1+99*x^2); |
---|
127 | |
---|
128 | case "hyperbolic": |
---|
129 | |
---|
130 | "Opening Equation" |
---|
131 | fc = 0.1*x/sqrt(1-0.99*x^2); |
---|
132 | |
---|
133 | end |
---|
134 | end |
---|
135 | |
---|
136 | #*------------------------------------------------------------------- |
---|
137 | * Model of a valve (simplified) |
---|
138 | *-------------------------------------------------------------------- |
---|
139 | * |
---|
140 | * Author: Paula B. Staudt |
---|
141 | *--------------------------------------------------------------------*# |
---|
142 | Model valve_simplified |
---|
143 | ATTRIBUTES |
---|
144 | Pallete = true; |
---|
145 | Icon = "icon/Valve"; |
---|
146 | Brief = "Model of a very simple valve - used in distillation column models."; |
---|
147 | Info = |
---|
148 | "== Assumptions == |
---|
149 | * no flashing liquid in the valve; |
---|
150 | * the flow in the valve is adiabatic; |
---|
151 | * dynamics in the valve are neglected; |
---|
152 | * linear flow type. |
---|
153 | |
---|
154 | == Specify == |
---|
155 | * the inlet stream |
---|
156 | * the plug position (x) OR outlet temperature (Outlet.T) OR outlet pressure (Outlet.P) |
---|
157 | |
---|
158 | OR |
---|
159 | |
---|
160 | * the inlet stream excluding its flow (Inlet.F) |
---|
161 | * the outlet pressure (Outlet.P) OR outlet flow (Outlet.F) |
---|
162 | * the plug position (x) |
---|
163 | "; |
---|
164 | |
---|
165 | PARAMETERS |
---|
166 | outer PP as Plugin(Type="PP"); |
---|
167 | outer NComp as Integer; |
---|
168 | |
---|
169 | VARIABLES |
---|
170 | in Inlet as stream (Brief = "Inlet stream", PosX=0, PosY=0.7365, Symbol="_{in}"); |
---|
171 | out Outlet as streamPH (Brief = "Outlet stream", PosX=1, PosY=0.7365, Symbol="_{out}"); |
---|
172 | x as fraction (Brief="Plug Position"); |
---|
173 | rho as dens_mass (Brief="Fluid Density", Default=1e3); |
---|
174 | v as vol_mol (Brief="Specific volume", Default=1e3); |
---|
175 | Pdrop as press_delta (Brief = "Pressure Drop", DisplayUnit = 'kPa', Symbol ="\Delta P"); |
---|
176 | Pratio as positive (Brief = "Pressure Ratio", Symbol ="P_{ratio}"); |
---|
177 | |
---|
178 | PARAMETERS |
---|
179 | rho_ref as dens_mass (Brief="Reference Density", Default=1e4); |
---|
180 | k as Real (Brief="Valve Constant", Unit='gal/min/psi^0.5'); |
---|
181 | |
---|
182 | EQUATIONS |
---|
183 | "Overall Molar Balance" |
---|
184 | Inlet.F = Outlet.F; |
---|
185 | |
---|
186 | "Componente Molar Balance" |
---|
187 | Inlet.z = Outlet.z; |
---|
188 | |
---|
189 | "Energy Balance" |
---|
190 | Inlet.h = Outlet.h; |
---|
191 | |
---|
192 | "Pressure Drop" |
---|
193 | Outlet.P = Inlet.P - Pdrop; |
---|
194 | |
---|
195 | "Pressure Ratio" |
---|
196 | Outlet.P = Inlet.P * Pratio; |
---|
197 | |
---|
198 | "Density" |
---|
199 | rho = Inlet.v*PP.VapourDensity((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z) + |
---|
200 | (1-Inlet.v)*PP.LiquidDensity((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z); |
---|
201 | |
---|
202 | "Volume" |
---|
203 | v = Inlet.v*PP.VapourVolume((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z) + |
---|
204 | (1-Inlet.v)*PP.LiquidVolume((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z); |
---|
205 | |
---|
206 | if Pdrop > 0 then |
---|
207 | "Flow" |
---|
208 | Outlet.F * v = k*x*sqrt(Pdrop * rho_ref / rho ) ; |
---|
209 | else |
---|
210 | "Closed" |
---|
211 | Outlet.F = 0 * 'kmol/h'; |
---|
212 | end |
---|
213 | end |
---|