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

Last change on this file since 75 was 75, checked in by Paula Bettio Staudt, 16 years ago

Updated pressure_changers files header

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