source: mso/eml/pressure_changers/valve.mso @ 109

Last change on this file since 109 was 109, checked in by Argimiro Resende Secchi, 15 years ago

corrected the water specific density at 60F and uncommented some equations.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 5.0 KB
Line 
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 109 2007-01-11 22:03:27Z arge $                                                                 
33*-------------------------------------------------------------------*#
34
35using "streams";
36using "pressure_changers/flux_machine_basic";
37       
38
39Model valve_basic as flux_machine_basic_TP
40       
41        PARAMETERS
42ext PP                  as CalcObject   (Brief = "External Physical Properties", File = "vrpp");
43ext 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 = 999.2  * "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        if Pdiff > 0 then
72                "Valve Equation - Flow"
73                Qv = fc*cv*sqrt(Pdiff/Gf);     
74        else
75                "Valve Equation - Closed"
76                Qv = 0 * "m^3/h";
77        end
78       
79        "Calculate Gf"
80        Gf = rho/rho60F;
81       
82        "Calculate Specific Mass"
83        rho = PP.LiquidDensity(Inlet.T,Inlet.P,Inlet.z);
84       
85        "Calculate Mass Flow"
86        Qv = Inlet.F*vm;       
87       
88        "Calculate Liquid Molar Volume"
89        vm = PP.LiquidVolume(Inlet.T,Inlet.P,Inlet.z);
90       
91end
92
93Model valve_linear as valve_basic
94
95        VARIABLES
96        x               as fraction (Brief = "Opening");
97
98        EQUATIONS
99       
100        "Opening Equation"
101        fc = x;
102
103end
104
105Model valve_parabolic as valve_basic
106
107        PARAMETERS
108        n               as positive (Brief = "Constant", Lower = 1.4, Upper = 2.6);
109
110        VARIABLES
111        x               as fraction (Brief = "Opening");
112       
113        EQUATIONS
114       
115        "Opening Equation"
116        fc = x^n;
117
118end
119
120Model valve_equal as valve_basic
121
122        PARAMETERS
123        a               as Real (Brief = "Constant", Default = 100);
124
125        VARIABLES
126        x               as fraction (Brief = "Opening");
127
128        EQUATIONS
129       
130        "Opening Equation"
131        fc = a^(x-1);
132
133end
134
135Model valve_quick as valve_basic
136
137        PARAMETERS
138        a               as positive     (Brief = "Constant", Default = 0.05);
139        n               as positive (Brief = "Constant", Default = 5);
140
141        VARIABLES
142        x               as fraction (Brief = "Opening");
143
144        EQUATIONS
145       
146        "Opening Equation"
147        fc = (1-(a*(1-x)-(a-1)*(1-x)^n));
148
149end
150
151#*-------------------------------------------------------------------
152* Model of a valve (simplified)
153*--------------------------------------------------------------------
154*
155*       Streams:
156*               * an  inlet stream
157*               * an  outlet stream
158*
159*       Assumptions:
160*               * no flashing liquid in the valve
161*               * the flow in the valve is adiabatic
162*               * dynamics in the valve are neglected
163*               * linear flow type
164*
165*       Specify:
166*               * the inlet stream
167*               * one of: plug position (x), outlet temperature (Outlet.T) or
168*                                                               outlet pressure (Outlet.P)
169*       or             
170*               * the inlet stream excluding its flow (Inlet.F)
171*               * the outlet pressure (Outlet.P) OR outlet flow (Outlet.F)
172*               * the plug position (x)
173*
174*
175*----------------------------------------------------------------------
176* Author: Paula B. Staudt
177*--------------------------------------------------------------------*#
178Model valve
179        PARAMETERS
180ext PP as CalcObject;
181ext NComp as Integer;
182       
183        VARIABLES
184in      Inlet as stream;
185out     Outlet as stream_therm;
186        x as fraction (Brief="Plug Position");
187        rho as dens_mass (Brief="Fluid Density", Default=1e3);
188        v as vol_mol (Brief="Specific volume", Default=1e3);
189
190        PARAMETERS
191        rho_ref as dens_mass (Brief="Reference Density", Default=1e4);
192        k as Real (Brief="Valve Constant", Unit="gal/min/psi^0.5");
193
194        EQUATIONS
195        "Molar Balance"
196        Inlet.F = Outlet.F;
197        Inlet.z = Outlet.z;
198       
199        "Energy Balance"
200        Inlet.h = Outlet.h;
201
202        "Vapourisation Fraction"
203        Outlet.v = Inlet.v;
204       
205        "Density"
206        rho = Inlet.v*PP.VapourDensity((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z) +
207                (1-Inlet.v)*PP.LiquidDensity((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z);
208
209        "Volume"
210        v = Inlet.v*PP.VapourVolume((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z) +
211                (1-Inlet.v)*PP.LiquidVolume((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z);
212
213        if Inlet.P > Outlet.P then
214                "Flow"
215                Outlet.F * v = k*x*sqrt((Inlet.P - Outlet.P)*rho_ref / rho ) ;
216        else
217                "Closed"
218                Outlet.F = 0 * "kmol/h";
219        end
220end
Note: See TracBrowser for help on using the repository browser.