[75] | 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 | *--------------------------------------------------------------------- |
---|
[98] | 16 | * Author: Estefane Horn, Núbia do Carmo Ferreira |
---|
[75] | 17 | *$Id: valve.mso 325 2007-07-29 00:41:04Z arge $ |
---|
| 18 | *-------------------------------------------------------------------*# |
---|
[57] | 19 | |
---|
[325] | 20 | using "streams"; |
---|
[57] | 21 | |
---|
| 22 | |
---|
[325] | 23 | Model valve |
---|
[277] | 24 | ATTRIBUTES |
---|
| 25 | Pallete = true; |
---|
[305] | 26 | Icon = "icon/Valve"; |
---|
[277] | 27 | Brief = "Model of a valve."; |
---|
| 28 | Info = |
---|
| 29 | "Model of valves: |
---|
| 30 | * Linear; |
---|
| 31 | * Parabolic; |
---|
| 32 | * Equal; |
---|
| 33 | * Quick; |
---|
| 34 | * Hyperbolic. |
---|
[57] | 35 | |
---|
[277] | 36 | Assumptions: |
---|
| 37 | * Steady State; |
---|
| 38 | * Liquid; |
---|
| 39 | * Isentalpic. |
---|
| 40 | |
---|
| 41 | Specify: |
---|
| 42 | * the valve type; |
---|
| 43 | * the inlet stream; |
---|
| 44 | * the Volumetric Flow (Qv); |
---|
| 45 | * the Valve Coefficient (cv); |
---|
| 46 | * the opening (x). |
---|
| 47 | "; |
---|
| 48 | |
---|
[57] | 49 | PARAMETERS |
---|
[206] | 50 | valve_type as Switcher (Valid = ["linear", "parabolic", "equal", "quick", "hyperbolic"], Default = "linear"); |
---|
[204] | 51 | outer PP as Plugin (Brief = "External Physical Properties", Type = "PP"); |
---|
| 52 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
[57] | 53 | rho60F as dens_mass; |
---|
| 54 | |
---|
| 55 | VARIABLES |
---|
[204] | 56 | Pdiff as press_delta (Brief = "Pressure Increase"); |
---|
[57] | 57 | Qv as flow_vol (Brief = "Volumetric Flow"); |
---|
| 58 | fc as positive (Brief = "Opening Function"); |
---|
[176] | 59 | cv as positive (Brief = "Valve Coefficient", Unit = 'm^3/h/kPa^0.5'); |
---|
[57] | 60 | Gf as positive (Brief = "Specific Gravity"); |
---|
| 61 | rho as dens_mass; |
---|
[196] | 62 | vm as vol_mol (Brief = "Mixture Molar Volume"); |
---|
[204] | 63 | x as fraction (Brief = "Opening"); |
---|
[325] | 64 | in Inlet as stream (Brief = "Inlet stream", PosX=0, PosY=0.7365); |
---|
| 65 | out Outlet as streamPH (Brief = "Outlet stream", PosX=1, PosY=0.7365); |
---|
[57] | 66 | |
---|
| 67 | SET |
---|
[204] | 68 | rho60F = 999.02 * 'kg/m^3'; |
---|
[57] | 69 | |
---|
| 70 | EQUATIONS |
---|
| 71 | "Calculate Outlet Stream Pressure" |
---|
| 72 | Inlet.P - Outlet.P = Pdiff; |
---|
| 73 | |
---|
| 74 | "Enthalpy Balance" |
---|
| 75 | Outlet.h = Inlet.h; |
---|
| 76 | |
---|
| 77 | "Molar Balance" |
---|
| 78 | Outlet.F = Inlet.F; |
---|
| 79 | |
---|
| 80 | "Calculate Outlet Composition" |
---|
| 81 | Outlet.z = Inlet.z; |
---|
| 82 | |
---|
[109] | 83 | if Pdiff > 0 then |
---|
| 84 | "Valve Equation - Flow" |
---|
[98] | 85 | Qv = fc*cv*sqrt(Pdiff/Gf); |
---|
[109] | 86 | else |
---|
| 87 | "Valve Equation - Closed" |
---|
[176] | 88 | Qv = 0 * 'm^3/h'; |
---|
[109] | 89 | end |
---|
[57] | 90 | |
---|
| 91 | "Calculate Gf" |
---|
| 92 | Gf = rho/rho60F; |
---|
| 93 | |
---|
| 94 | "Calculate Specific Mass" |
---|
| 95 | rho = PP.LiquidDensity(Inlet.T,Inlet.P,Inlet.z); |
---|
| 96 | |
---|
| 97 | "Calculate Mass Flow" |
---|
| 98 | Qv = Inlet.F*vm; |
---|
| 99 | |
---|
| 100 | "Calculate Liquid Molar Volume" |
---|
| 101 | vm = PP.LiquidVolume(Inlet.T,Inlet.P,Inlet.z); |
---|
| 102 | |
---|
[206] | 103 | switch valve_type |
---|
| 104 | case "linear": |
---|
[57] | 105 | |
---|
[204] | 106 | "Opening Equation" |
---|
| 107 | fc = x; |
---|
[57] | 108 | |
---|
[206] | 109 | case "parabolic": |
---|
| 110 | |
---|
[204] | 111 | "Opening Equation" |
---|
| 112 | fc = x^2; |
---|
[57] | 113 | |
---|
[206] | 114 | case "equal": |
---|
[57] | 115 | |
---|
[204] | 116 | "Opening Equation" |
---|
| 117 | fc = x^2/(2-x^4)^(1/2); |
---|
[57] | 118 | |
---|
[206] | 119 | case "quick": |
---|
[57] | 120 | |
---|
[204] | 121 | "Opening Equation" |
---|
| 122 | fc = 10*x/sqrt(1+99*x^2); |
---|
[57] | 123 | |
---|
[206] | 124 | case "hyperbolic": |
---|
[57] | 125 | |
---|
[204] | 126 | "Opening Equation" |
---|
| 127 | fc = 0.1*x/sqrt(1-0.99*x^2); |
---|
[57] | 128 | |
---|
[204] | 129 | end |
---|
[57] | 130 | end |
---|
| 131 | |
---|
[1] | 132 | #*------------------------------------------------------------------- |
---|
[75] | 133 | * Model of a valve (simplified) |
---|
[1] | 134 | *-------------------------------------------------------------------- |
---|
| 135 | * |
---|
| 136 | * Author: Paula B. Staudt |
---|
| 137 | *--------------------------------------------------------------------*# |
---|
[204] | 138 | Model valve_simplified |
---|
[277] | 139 | ATTRIBUTES |
---|
| 140 | Pallete = true; |
---|
[305] | 141 | Icon = "icon/Valve"; |
---|
[277] | 142 | Brief = "Model of a very simple valve - used in distillation column models."; |
---|
| 143 | Info = |
---|
| 144 | "Assumptions: |
---|
| 145 | * no flashing liquid in the valve; |
---|
| 146 | * the flow in the valve is adiabatic; |
---|
| 147 | * dynamics in the valve are neglected; |
---|
| 148 | * linear flow type. |
---|
| 149 | |
---|
| 150 | Specify: |
---|
| 151 | * the inlet stream |
---|
| 152 | * the plug position (x) OR outlet temperature (Outlet.T) OR outlet pressure (Outlet.P) |
---|
| 153 | |
---|
| 154 | OR |
---|
| 155 | |
---|
| 156 | * the inlet stream excluding its flow (Inlet.F) |
---|
| 157 | * the outlet pressure (Outlet.P) OR outlet flow (Outlet.F) |
---|
| 158 | * the plug position (x) |
---|
| 159 | "; |
---|
[204] | 160 | |
---|
[1] | 161 | PARAMETERS |
---|
[270] | 162 | outer PP as Plugin(Type="PP"); |
---|
[176] | 163 | outer NComp as Integer; |
---|
[1] | 164 | |
---|
| 165 | VARIABLES |
---|
[325] | 166 | in Inlet as stream (Brief = "Inlet stream", PosX=0, PosY=0.7365); |
---|
| 167 | out Outlet as streamPH (Brief = "Outlet stream", PosX=1, PosY=0.7365); |
---|
[1] | 168 | x as fraction (Brief="Plug Position"); |
---|
| 169 | rho as dens_mass (Brief="Fluid Density", Default=1e3); |
---|
[37] | 170 | v as vol_mol (Brief="Specific volume", Default=1e3); |
---|
[1] | 171 | |
---|
| 172 | PARAMETERS |
---|
| 173 | rho_ref as dens_mass (Brief="Reference Density", Default=1e4); |
---|
[176] | 174 | k as Real (Brief="Valve Constant", Unit='gal/min/psi^0.5'); |
---|
[1] | 175 | |
---|
| 176 | EQUATIONS |
---|
| 177 | "Molar Balance" |
---|
| 178 | Inlet.F = Outlet.F; |
---|
| 179 | Inlet.z = Outlet.z; |
---|
| 180 | |
---|
| 181 | "Energy Balance" |
---|
| 182 | Inlet.h = Outlet.h; |
---|
| 183 | |
---|
| 184 | "Density" |
---|
| 185 | rho = Inlet.v*PP.VapourDensity((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z) + |
---|
| 186 | (1-Inlet.v)*PP.LiquidDensity((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z); |
---|
| 187 | |
---|
[37] | 188 | "Volume" |
---|
| 189 | v = Inlet.v*PP.VapourVolume((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z) + |
---|
| 190 | (1-Inlet.v)*PP.LiquidVolume((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z); |
---|
| 191 | |
---|
[109] | 192 | if Inlet.P > Outlet.P then |
---|
| 193 | "Flow" |
---|
| 194 | Outlet.F * v = k*x*sqrt((Inlet.P - Outlet.P)*rho_ref / rho ) ; |
---|
| 195 | else |
---|
| 196 | "Closed" |
---|
[176] | 197 | Outlet.F = 0 * 'kmol/h'; |
---|
[109] | 198 | end |
---|
[1] | 199 | end |
---|