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

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

Fixing some wiki notation.

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