source: trunk/eml/pressure_changers/valve.mso @ 270

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

Updated ATTRIBUTES section and some stage_separators icons

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.7 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*       - Hyperbolic
23*       - valve_simplified: a very simple model
24*
25*--------------------------------------------------------------------
26*       - Assumptions
27*               * Steady State
28*               * Isentalpic
29*               * Liquid
30*
31*---------------------------------------------------------------------
32* Author: Estefane Horn, Núbia do Carmo Ferreira
33*$Id: valve.mso 270 2007-06-16 19:18:47Z paula $                                                                       
34*-------------------------------------------------------------------*#
35
36using "streams";
37using "pressure_changers/flux_machine_basic";
38       
39
40Model valve as flux_machine_basic_PH
41       
42        PARAMETERS
43        valve_type as Switcher (Valid = ["linear", "parabolic", "equal", "quick", "hyperbolic"], Default = "linear");
44outer PP                as Plugin       (Brief = "External Physical Properties", Type = "PP");
45outer NComp     as Integer      (Brief = "Number of chemical components", Lower = 1);
46        rho60F  as dens_mass;
47
48        VARIABLES
49        Pdiff   as press_delta          (Brief = "Pressure Increase");
50        Qv              as flow_vol                     (Brief = "Volumetric Flow");
51        fc              as positive                     (Brief = "Opening Function");
52        cv              as positive                     (Brief = "Valve Coefficient", Unit = 'm^3/h/kPa^0.5');
53        Gf              as positive                     (Brief = "Specific Gravity");
54        rho     as dens_mass;   
55        vm              as vol_mol                      (Brief = "Mixture Molar Volume");       
56        x               as fraction             (Brief = "Opening");
57       
58        SET
59        rho60F = 999.02 * 'kg/m^3';
60       
61        EQUATIONS
62        "Calculate Outlet Stream Pressure"
63        Inlet.P - Outlet.P = Pdiff;
64       
65        "Enthalpy Balance"
66        Outlet.h = Inlet.h;
67       
68        "Molar Balance"
69        Outlet.F = Inlet.F;
70       
71        "Calculate Outlet Composition"
72        Outlet.z = Inlet.z;
73
74        if Pdiff > 0 then
75                "Valve Equation - Flow"
76                Qv = fc*cv*sqrt(Pdiff/Gf);     
77        else
78                "Valve Equation - Closed"
79                Qv = 0 * 'm^3/h';
80        end
81       
82        "Calculate Gf"
83        Gf = rho/rho60F;
84       
85        "Calculate Specific Mass"
86        rho = PP.LiquidDensity(Inlet.T,Inlet.P,Inlet.z);
87       
88        "Calculate Mass Flow"
89        Qv = Inlet.F*vm;       
90       
91        "Calculate Liquid Molar Volume"
92        vm = PP.LiquidVolume(Inlet.T,Inlet.P,Inlet.z);
93       
94        switch valve_type
95        case "linear":
96
97                "Opening Equation"
98                fc = x;
99
100        case "parabolic":
101
102                "Opening Equation"
103                fc = x^2;
104
105        case "equal":
106
107                "Opening Equation"
108                fc = x^2/(2-x^4)^(1/2);
109
110        case "quick":
111       
112                "Opening Equation"
113                fc = 10*x/sqrt(1+99*x^2);
114
115        case "hyperbolic":
116
117                "Opening Equation"
118                fc = 0.1*x/sqrt(1-0.99*x^2);
119
120        end
121end
122
123#*-------------------------------------------------------------------
124* Model of a valve (simplified)
125*--------------------------------------------------------------------
126*
127*       Streams:
128*               * an  inlet stream
129*               * an  outlet stream
130*
131*       Assumptions:
132*               * no flashing liquid in the valve
133*               * the flow in the valve is adiabatic
134*               * dynamics in the valve are neglected
135*               * linear flow type
136*
137*       Specify:
138*               * the inlet stream
139*               * one of: plug position (x), outlet temperature (Outlet.T) or
140*                                                               outlet pressure (Outlet.P)
141*       or             
142*               * the inlet stream excluding its flow (Inlet.F)
143*               * the outlet pressure (Outlet.P) OR outlet flow (Outlet.F)
144*               * the plug position (x)
145*
146*
147*----------------------------------------------------------------------
148* Author: Paula B. Staudt
149*--------------------------------------------------------------------*#
150Model valve_simplified
151
152        PARAMETERS
153outer PP as Plugin(Type="PP");
154outer NComp as Integer;
155       
156        VARIABLES
157in      Inlet as stream;
158out     Outlet as streamPH;
159        x as fraction (Brief="Plug Position");
160        rho as dens_mass (Brief="Fluid Density", Default=1e3);
161        v as vol_mol (Brief="Specific volume", Default=1e3);
162
163        PARAMETERS
164        rho_ref as dens_mass (Brief="Reference Density", Default=1e4);
165        k as Real (Brief="Valve Constant", Unit='gal/min/psi^0.5');
166
167        EQUATIONS
168        "Molar Balance"
169        Inlet.F = Outlet.F;
170        Inlet.z = Outlet.z;
171       
172        "Energy Balance"
173        Inlet.h = Outlet.h;
174
175        "Density"
176        rho = Inlet.v*PP.VapourDensity((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z) +
177                (1-Inlet.v)*PP.LiquidDensity((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z);
178
179        "Volume"
180        v = Inlet.v*PP.VapourVolume((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z) +
181                (1-Inlet.v)*PP.LiquidVolume((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z);
182
183        if Inlet.P > Outlet.P then
184                "Flow"
185                Outlet.F * v = k*x*sqrt((Inlet.P - Outlet.P)*rho_ref / rho ) ;
186        else
187                "Closed"
188                Outlet.F = 0 * 'kmol/h';
189        end
190end
Note: See TracBrowser for help on using the repository browser.