[1] | 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 | |
---|
| 30 | using "streams"; |
---|
| 31 | |
---|
| 32 | Model valve |
---|
| 33 | PARAMETERS |
---|
| 34 | ext PP as CalcObject; |
---|
| 35 | ext NComp as Integer; |
---|
| 36 | |
---|
| 37 | VARIABLES |
---|
| 38 | in Inlet as stream; |
---|
| 39 | out Outlet as stream_therm; |
---|
| 40 | x as fraction (Brief="Plug Position"); |
---|
| 41 | rho as dens_mass (Brief="Fluid Density", Default=1e3); |
---|
[37] | 42 | v as vol_mol (Brief="Specific volume", Default=1e3); |
---|
[1] | 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 | |
---|
[37] | 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 | |
---|
[1] | 67 | #if Inlet.P > Outlet.P then |
---|
| 68 | # "Flow" |
---|
[37] | 69 | Outlet.F * v = k*x*sqrt((Inlet.P - Outlet.P)*rho_ref / rho ) ; |
---|
[1] | 70 | #else |
---|
| 71 | # "Closed" |
---|
| 72 | # Outlet.F = 0 * "kmol/h"; |
---|
| 73 | #end |
---|
| 74 | end |
---|