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

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

Updated ATTRIBUTES section in pressure_changers folder

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