#*------------------------------------------------------------------- * Model of a valve *-------------------------------------------------------------------- * * Streams: * * an inlet stream * * an outlet stream * * Assumptions: * * no flashing liquid in the valve * * the flow in the valve is adiabatic * * dynamics in the valve are neglected * * linear flow type * * Specify: * * the inlet stream * * one of: plug position (x), outlet temperature (Outlet.T) or * outlet pressure (Outlet.P) * or * * the inlet stream excluding its flow (Inlet.F) * * the outlet pressure (Outlet.P) OR outlet flow (Outlet.F) * * the plug position (x) * * *---------------------------------------------------------------------- * Author: Paula B. Staudt * \$Id: valve.mso 37 2006-10-23 16:47:17Z paula \$ *--------------------------------------------------------------------*# using "streams"; Model valve PARAMETERS ext PP as CalcObject; ext NComp as Integer; VARIABLES in Inlet as stream; out Outlet as stream_therm; x as fraction (Brief="Plug Position"); rho as dens_mass (Brief="Fluid Density", Default=1e3); v as vol_mol (Brief="Specific volume", Default=1e3); PARAMETERS rho_ref as dens_mass (Brief="Reference Density", Default=1e4); k as Real (Brief="Valve Constant", Unit="gal/min/psi^0.5"); EQUATIONS "Molar Balance" Inlet.F = Outlet.F; Inlet.z = Outlet.z; "Energy Balance" Inlet.h = Outlet.h; "Vapourisation Fraction" Outlet.v = Inlet.v; "Density" rho = Inlet.v*PP.VapourDensity((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z) + (1-Inlet.v)*PP.LiquidDensity((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z); "Volume" v = Inlet.v*PP.VapourVolume((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z) + (1-Inlet.v)*PP.LiquidVolume((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z); #if Inlet.P > Outlet.P then # "Flow" Outlet.F * v = k*x*sqrt((Inlet.P - Outlet.P)*rho_ref / rho ) ; #else # "Closed" # Outlet.F = 0 * "kmol/h"; #end end