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

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

Fixed warning and error messages

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.9 KB
Line 
1#*-------------------------------------------------------------------
2* Model of a valve
3*--------------------------------------------------------------------
4*
5*       Streams:
6*               * an  inlet stream
7*               * an  outlet stream
8*
9*       Assumptions:
10*               * no flashing liquid in the valve
11*               * the flow in the valve is adiabatic
12*               * dynamics in the valve are neglected
13*               * linear flow type
14*
15*       Specify:
16*               * the inlet stream
17*               * one of: plug position (x), outlet temperature (Outlet.T) or
18*                                                               outlet pressure (Outlet.P)
19*       or             
20*               * the inlet stream excluding its flow (Inlet.F)
21*               * the outlet pressure (Outlet.P) OR outlet flow (Outlet.F)
22*               * the plug position (x)
23*
24*
25*----------------------------------------------------------------------
26* Author: Paula B. Staudt
27* $Id: valve.mso 37 2006-10-23 16:47:17Z paula $
28*--------------------------------------------------------------------*#
29
30using "streams";
31
32Model valve
33        PARAMETERS
34ext PP as CalcObject;
35ext NComp as Integer;
36       
37        VARIABLES
38in      Inlet as stream;
39out     Outlet as stream_therm;
40        x as fraction (Brief="Plug Position");
41        rho as dens_mass (Brief="Fluid Density", Default=1e3);
42        v as vol_mol (Brief="Specific volume", Default=1e3);
43
44        PARAMETERS
45        rho_ref as dens_mass (Brief="Reference Density", Default=1e4);
46        k as Real (Brief="Valve Constant", Unit="gal/min/psi^0.5");
47
48        EQUATIONS
49        "Molar Balance"
50        Inlet.F = Outlet.F;
51        Inlet.z = Outlet.z;
52       
53        "Energy Balance"
54        Inlet.h = Outlet.h;
55
56        "Vapourisation Fraction"
57        Outlet.v = Inlet.v;
58       
59        "Density"
60        rho = Inlet.v*PP.VapourDensity((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z) +
61                (1-Inlet.v)*PP.LiquidDensity((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z);
62
63        "Volume"
64        v = Inlet.v*PP.VapourVolume((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z) +
65                (1-Inlet.v)*PP.LiquidVolume((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z);
66
67        #if Inlet.P > Outlet.P then
68        #       "Flow"
69                Outlet.F * v = k*x*sqrt((Inlet.P - Outlet.P)*rho_ref / rho ) ;
70        #else
71        #       "Closed"
72        #       Outlet.F = 0 * "kmol/h";
73        #end
74end
Note: See TracBrowser for help on using the repository browser.