Changeset 690


Ignore:
Timestamp:
Nov 21, 2008, 3:02:51 PM (15 years ago)
Author:
jjunges
Message:

valve gas update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/gui/eml/pressure_changers/valve.mso

    r587 r690  
    1 #*-------------------------------------------------------------------
     1 #*-------------------------------------------------------------------
    22* EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC.
    33*
     
    176176        ValveType       as Switcher             (Valid = ["linear", "parabolic", "equal", "quick", "hyperbolic"], Default = "linear");
    177177        ValidPhases     as Switcher             (Brief = "Valid Phases for Flash Calculation", Valid = ["Vapour-Only", "Liquid-Only"], Default="Liquid-Only");
    178         Tau                     as time_sec             (Brief="valve time constant");
     178#       Tau                     as time_sec             (Brief="valve time constant");
    179179        rho60F                  as dens_mass            (Brief = "Water Mass Density at 60 F",Hidden=true);     
    180180
    181181VARIABLES
    182 
     182        W as flow_mass(DisplayUnit='kg/s');
    183183        Pdrop                   as press_delta          (Brief = "Pressure Drop", DisplayUnit = 'kPa', Symbol ="\Delta P");
    184184        Fvol                            as flow_vol                     (Brief = "Volumetric Flow");
    185185        fc                              as positive                     (Brief = "Opening Function",Hidden=true);
    186186        Cv                              as Real                                 (Brief="Valve Flow Coefficient", Unit='gal/min/psi^0.5');
     187        Cv1                             as Real                                 (Brief="Valve Flow Coefficient", Unit='m^2');
     188        Cg                              as Real                                 (Brief="Valve Gas Flow Coefficient", Unit='ft^3/h/psi');
     189        C                               as Real                                 (Brief="Liquid-gas Coefficient Ratio", Unit='(ft^3/gal)*(min/h)/(psi^.5)');
    187190        StemPosition    as fraction                     (Brief = "Actual valve stem position");
    188        
    189 
     191        a as Real;
     192        #b as Real (Brief="d", Unit='1/(psi^.5)');
    190193        vm                              as vol_mol                      (Brief = "Mixture Molar Volume");
    191194        rho                             as dens_mass            (Brief = "Mixture Mass Density");       
    192         vsp                             as fraction                     (Brief = "Valve stem position",Hidden=true);
     195#       vsp                             as fraction                     (Brief = "Valve stem position",Hidden=true);
    193196       
    194197in              Inlet   as stream                       (Brief = "Inlet stream", PosX=0, PosY=0.7365, Symbol="_{in}");
    195198out     Outlet  as streamPH             (Brief = "Outlet stream", PosX=1, PosY=0.7365, Symbol="_{out}");
    196 in              vsignal as fraction             (Brief = "Flow Signal", PosX=0.5, PosY=0);
     199#in             vsignal as fraction             (Brief = "Flow Signal", PosX=0.5, PosY=0);
    197200
    198201SET
     
    202205EQUATIONS
    203206
    204 "First order valve dynamics"
    205         Tau*diff(StemPosition) = vsp-StemPosition;
    206 
    207 "Flow Signal"
    208         vsp = vsignal;
     207#"First order valve dynamics"
     208#       Tau*diff(StemPosition) = vsp-StemPosition;
     209
     210#"Flow Signal"
     211#       vsp = vsignal;
    209212
    210213"Pressure Drop"
     
    219222"Outlet Composition"
    220223        Outlet.z = Inlet.z;
    221 
    222 switch ValidPhases     
    223        
     224       
     225        Cv1=Cv*'1/(gal/min/psi^0.5)'*2.3837e-5*'m^2';
     226
     227switch ValidPhases
     228               
     229#############################################################
     230
    224231        case "Liquid-Only":
    225232       
     
    228235"Valve Equation - Liquid Flow"
    229236        Fvol = fc*(Cv/sqrt(1/rho60F))*sqrt(Pdrop/rho);
    230        
     237        "Liquid-gas Coefficient Ratio"
     238        C*Cv=Cg;
     239a=1/(1.6764e-2*C*'1/((ft^3/gal)*(min/h)/(psi^.5))')*sqrt(Pdrop/Inlet.P);       
    231240else
    232241
    233242"Valve Equation - Liquid Flow"
    234243        Fvol = fc*(Cv/sqrt(1/rho60F))*sqrt(Pdrop/rho);
    235 
     244        "Liquid-gas Coefficient Ratio"
     245        C*Cv=Cg;
     246a=1/(1.6764e-2*C*'1/((ft^3/gal)*(min/h)/(psi^.5))')*sqrt(Pdrop/Inlet.P);
    236247end
    237248       
     
    241252"Liquid Molar Volume"
    242253        vm = PP.LiquidVolume(Inlet.T,Inlet.P,Inlet.z);
     254       
     255
     256       
     257############################################################
    243258
    244259        case "Vapour-Only":
    245260       
    246261if Pdrop > 0 then #Update for gas flow !!!!
     262       
     263"Liquid-gas Coefficient Ratio"
     264        C*Cv=Cg;
     265        a=1/(1.6764e-2*C*'1/((ft^3/gal)*(min/h)/(psi^.5))')*sqrt(Pdrop/Inlet.P);
     266
     267        if 1.5708 > a then
     268        "Valve Equation - Vapour Flow"
     269                #Fvol = fc*Cg*sqrt(Inlet.P/1000*rho60F/rho);####rho60f/rho ok!!!!
     270                #Fvol = fc*Cv*sqrt(Pdrop/1000*rho60F/rho);
     271                #W = fc*Cv1*sqrt(Pdrop/1000*rho);
     272                Fvol = fc*0.13446*'psi^.5'*Cg*sqrt(Inlet.P/1000*rho60F/rho)*sin(a*'rad');
     273               
     274        else
     275        "Valve Equation - Vapour Flow"
     276                Fvol = fc*0.13446*Cv*sqrt(Inlet.P*rho60F/rho);
     277        end
     278else
    247279
    248280"Valve Equation - Vapour Flow"
    249281        Fvol = fc*(Cv/sqrt(1/rho60F))*sqrt(Pdrop/rho);
    250        
    251 else
    252 
    253 "Valve Equation - Vapour Flow"
    254         Fvol = fc*(Cv/sqrt(1/rho60F))*sqrt(Pdrop/rho);
    255 
     282
     283"Liquid-gas Coefficient Ratio"
     284        C*Cv=Cg;
     285        a=1/(1.6764e-2*C*'1/((ft^3/gal)*(min/h)/(psi^.5))')*sqrt(Pdrop/Inlet.P);
    256286end
    257287       
    258288"Vapour Mass Density"
    259289        rho = PP.VapourDensity(Inlet.T,Inlet.P,Inlet.z);
    260 
     290        #rho=3.708741*'kg/m^3';
    261291"Vapour Molar Volume"
    262292        vm = PP.VapourVolume(Inlet.T,Inlet.P,Inlet.z);
     
    264294end
    265295
     296######################################################
     297
    266298"Calculate Mass Flow"
    267         Fvol = Inlet.F*vm;     
     299        Fvol = Inlet.F*vm;
     300       
     301        W=Fvol*rho;
     302       
    268303       
    269304switch ValveType #Update the valve Type
Note: See TracChangeset for help on using the changeset viewer.