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

Last change on this file since 106 was 106, checked in by Rafael de Pelegrini Soares, 15 years ago

Fixed valve model error

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