[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 277 2007-06-16 20:17:45Z paula $ |
---|
| 18 | *-------------------------------------------------------------------*# |
---|
[57] | 19 | |
---|
| 20 | using "pressure_changers/flux_machine_basic"; |
---|
| 21 | |
---|
| 22 | |
---|
[204] | 23 | Model valve as flux_machine_basic_PH |
---|
[277] | 24 | ATTRIBUTES |
---|
| 25 | Pallete = true; |
---|
| 26 | Icon = "Valve"; |
---|
| 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"); |
---|
[57] | 64 | |
---|
| 65 | SET |
---|
[204] | 66 | rho60F = 999.02 * 'kg/m^3'; |
---|
[57] | 67 | |
---|
| 68 | EQUATIONS |
---|
| 69 | "Calculate Outlet Stream Pressure" |
---|
| 70 | Inlet.P - Outlet.P = Pdiff; |
---|
| 71 | |
---|
| 72 | "Enthalpy Balance" |
---|
| 73 | Outlet.h = Inlet.h; |
---|
| 74 | |
---|
| 75 | "Molar Balance" |
---|
| 76 | Outlet.F = Inlet.F; |
---|
| 77 | |
---|
| 78 | "Calculate Outlet Composition" |
---|
| 79 | Outlet.z = Inlet.z; |
---|
| 80 | |
---|
[109] | 81 | if Pdiff > 0 then |
---|
| 82 | "Valve Equation - Flow" |
---|
[98] | 83 | Qv = fc*cv*sqrt(Pdiff/Gf); |
---|
[109] | 84 | else |
---|
| 85 | "Valve Equation - Closed" |
---|
[176] | 86 | Qv = 0 * 'm^3/h'; |
---|
[109] | 87 | end |
---|
[57] | 88 | |
---|
| 89 | "Calculate Gf" |
---|
| 90 | Gf = rho/rho60F; |
---|
| 91 | |
---|
| 92 | "Calculate Specific Mass" |
---|
| 93 | rho = PP.LiquidDensity(Inlet.T,Inlet.P,Inlet.z); |
---|
| 94 | |
---|
| 95 | "Calculate Mass Flow" |
---|
| 96 | Qv = Inlet.F*vm; |
---|
| 97 | |
---|
| 98 | "Calculate Liquid Molar Volume" |
---|
| 99 | vm = PP.LiquidVolume(Inlet.T,Inlet.P,Inlet.z); |
---|
| 100 | |
---|
[206] | 101 | switch valve_type |
---|
| 102 | case "linear": |
---|
[57] | 103 | |
---|
[204] | 104 | "Opening Equation" |
---|
| 105 | fc = x; |
---|
[57] | 106 | |
---|
[206] | 107 | case "parabolic": |
---|
| 108 | |
---|
[204] | 109 | "Opening Equation" |
---|
| 110 | fc = x^2; |
---|
[57] | 111 | |
---|
[206] | 112 | case "equal": |
---|
[57] | 113 | |
---|
[204] | 114 | "Opening Equation" |
---|
| 115 | fc = x^2/(2-x^4)^(1/2); |
---|
[57] | 116 | |
---|
[206] | 117 | case "quick": |
---|
[57] | 118 | |
---|
[204] | 119 | "Opening Equation" |
---|
| 120 | fc = 10*x/sqrt(1+99*x^2); |
---|
[57] | 121 | |
---|
[206] | 122 | case "hyperbolic": |
---|
[57] | 123 | |
---|
[204] | 124 | "Opening Equation" |
---|
| 125 | fc = 0.1*x/sqrt(1-0.99*x^2); |
---|
[57] | 126 | |
---|
[204] | 127 | end |
---|
[57] | 128 | end |
---|
| 129 | |
---|
[1] | 130 | #*------------------------------------------------------------------- |
---|
[75] | 131 | * Model of a valve (simplified) |
---|
[1] | 132 | *-------------------------------------------------------------------- |
---|
| 133 | * |
---|
| 134 | * Author: Paula B. Staudt |
---|
| 135 | *--------------------------------------------------------------------*# |
---|
[204] | 136 | Model valve_simplified |
---|
[277] | 137 | ATTRIBUTES |
---|
| 138 | Pallete = true; |
---|
| 139 | Icon = "Valve"; |
---|
| 140 | Brief = "Model of a very simple valve - used in distillation column models."; |
---|
| 141 | Info = |
---|
| 142 | "Assumptions: |
---|
| 143 | * no flashing liquid in the valve; |
---|
| 144 | * the flow in the valve is adiabatic; |
---|
| 145 | * dynamics in the valve are neglected; |
---|
| 146 | * linear flow type. |
---|
| 147 | |
---|
| 148 | Specify: |
---|
| 149 | * the inlet stream |
---|
| 150 | * the plug position (x) OR outlet temperature (Outlet.T) OR outlet pressure (Outlet.P) |
---|
| 151 | |
---|
| 152 | OR |
---|
| 153 | |
---|
| 154 | * the inlet stream excluding its flow (Inlet.F) |
---|
| 155 | * the outlet pressure (Outlet.P) OR outlet flow (Outlet.F) |
---|
| 156 | * the plug position (x) |
---|
| 157 | "; |
---|
[204] | 158 | |
---|
[1] | 159 | PARAMETERS |
---|
[270] | 160 | outer PP as Plugin(Type="PP"); |
---|
[176] | 161 | outer NComp as Integer; |
---|
[1] | 162 | |
---|
| 163 | VARIABLES |
---|
| 164 | in Inlet as stream; |
---|
[176] | 165 | out Outlet as streamPH; |
---|
[1] | 166 | x as fraction (Brief="Plug Position"); |
---|
| 167 | rho as dens_mass (Brief="Fluid Density", Default=1e3); |
---|
[37] | 168 | v as vol_mol (Brief="Specific volume", Default=1e3); |
---|
[1] | 169 | |
---|
| 170 | PARAMETERS |
---|
| 171 | rho_ref as dens_mass (Brief="Reference Density", Default=1e4); |
---|
[176] | 172 | k as Real (Brief="Valve Constant", Unit='gal/min/psi^0.5'); |
---|
[1] | 173 | |
---|
| 174 | EQUATIONS |
---|
| 175 | "Molar Balance" |
---|
| 176 | Inlet.F = Outlet.F; |
---|
| 177 | Inlet.z = Outlet.z; |
---|
| 178 | |
---|
| 179 | "Energy Balance" |
---|
| 180 | Inlet.h = Outlet.h; |
---|
| 181 | |
---|
| 182 | "Density" |
---|
| 183 | rho = Inlet.v*PP.VapourDensity((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z) + |
---|
| 184 | (1-Inlet.v)*PP.LiquidDensity((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z); |
---|
| 185 | |
---|
[37] | 186 | "Volume" |
---|
| 187 | v = Inlet.v*PP.VapourVolume((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z) + |
---|
| 188 | (1-Inlet.v)*PP.LiquidVolume((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z); |
---|
| 189 | |
---|
[109] | 190 | if Inlet.P > Outlet.P then |
---|
| 191 | "Flow" |
---|
| 192 | Outlet.F * v = k*x*sqrt((Inlet.P - Outlet.P)*rho_ref / rho ) ; |
---|
| 193 | else |
---|
| 194 | "Closed" |
---|
[176] | 195 | Outlet.F = 0 * 'kmol/h'; |
---|
[109] | 196 | end |
---|
[1] | 197 | end |
---|