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