- Timestamp:
- Jul 20, 2007, 11:30:53 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/eml/stage_separators/flash.mso
r310 r321 164 164 OutletV.P = OutletL.P; 165 165 end 166 167 #*---------------------------------------------------------------------- 168 * Model of a steady-state PH flash. 169 *---------------------------------------------------------------------*# 170 Model FlashPHSteady 171 ATTRIBUTES 172 Pallete = true; 173 Icon = "icon/Flash"; 174 Brief = "Model of a static PH flash."; 175 Info = " 176 This model is for using the flashPH 177 routine available on VRTherm. 178 179 Assumptions: 180 * perfect mixing of both phases; 181 182 Specify: 183 * the feed stream; 184 * the heat duty; 185 * the outlet pressure. 186 "; 187 188 PARAMETERS 189 outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); 190 outer NComp as Integer; 191 192 VARIABLES 193 in Inlet as stream (Brief="Feed Stream"); 194 out OutletL as liquid_stream (Brief="Liquid outlet stream"); 195 out OutletV as vapour_stream (Brief="Vapour outlet stream"); 196 in InletQ as energy_stream (Brief="Rate of heat supply"); 197 vfrac as fraction(Brief="Real vaporization fraction"); 198 h as enth_mol(Brief="Mixture enthalpy"); 199 200 EQUATIONS 201 202 "Chemical equilibrium" 203 [vfrac,OutletL.z,OutletV.z]=PP.FlashPH(OutletL.P,h,Inlet.z); 204 205 "Global Molar Balance" 206 Inlet.F = OutletV.F + OutletL.F; 207 OutletV.F = Inlet.F * vfrac; 208 209 "Energy Balance" 210 Inlet.F*(h - Inlet.h) = InletQ.Q; 211 Inlet.F*h = Inlet.F*(1-vfrac)*OutletL.h + Inlet.F*vfrac*OutletV.h; 212 213 "Thermal Equilibrium" 214 OutletV.T = OutletL.T; 215 216 "Mechanical Equilibrium" 217 OutletV.P = OutletL.P; 218 end 219 220 #*---------------------------------------------------------------------- 221 * Another model of a steady-state PH flash. 222 * It is recommended to use [v,x,y]=PP.FlashPH(P,h,z) instead of. 223 *---------------------------------------------------------------------*# 224 Model FlashPHSteadyA 225 ATTRIBUTES 226 Pallete = true; 227 Icon = "icon/Flash"; 228 Brief = "Another model of a static PH flash."; 229 Info = " 230 This model shows how to model a pressure enthalpy flash 231 directly with the EMSO modeling language. 232 233 This model is for demonstration purposes only, the flashPH 234 routine available on VRTherm is much more robust. 235 236 Assumptions: 237 * perfect mixing of both phases; 238 239 Specify: 240 * the feed stream; 241 * the heat duty; 242 * the outlet pressure. 243 "; 244 245 PARAMETERS 246 outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); 247 outer NComp as Integer; 248 B as Real(Default=1000, Brief="Regularization Factor"); 249 250 VARIABLES 251 in Inlet as stream (Brief="Feed Stream"); 252 out OutletL as liquid_stream (Brief="Liquid outlet stream"); 253 out OutletV as vapour_stream (Brief="Vapour outlet stream"); 254 in InletQ as energy_stream (Brief="Rate of heat supply"); 255 vfrac as fraction(Brief="Real vaporization fraction"); 256 vsat as Real(Lower=-0.1, Upper=1.1, Brief="Vaporization fraction if saturated"); 257 Tsat as temperature(Lower=173, Upper=1473, Brief="Temperature if saturated"); 258 xsat(NComp) as Real(Lower=0, Upper=1, Brief="Liquid composition if saturated"); 259 ysat(NComp) as Real(Lower=0, Upper=1, Brief="Vapour composition if saturated"); 260 261 zero_one as fraction(Brief="Regularization Variable"); 262 one_zero as fraction(Brief="Regularization Variable"); 263 264 EQUATIONS 265 "Chemical equilibrium" 266 PP.LiquidFugacityCoefficient(Tsat, OutletL.P, xsat)*xsat = 267 PP.VapourFugacityCoefficient(Tsat, OutletV.P, ysat)*ysat; 268 269 "Global Molar Balance" 270 Inlet.F = OutletV.F + OutletL.F; 271 OutletV.F = Inlet.F * vfrac; 272 273 "Component Molar Balance" 274 Inlet.F*Inlet.z = OutletL.F*xsat + OutletV.F*ysat; 275 sum(xsat) = sum(ysat); 276 277 "Energy Balance if saturated" 278 Inlet.F*Inlet.h + InletQ.Q = 279 Inlet.F*(1-vsat)*PP.LiquidEnthalpy(Tsat, OutletL.P, xsat) + 280 Inlet.F*vsat*PP.VapourEnthalpy(Tsat, OutletV.P, ysat); 281 282 "Real Energy Balance" 283 Inlet.F*Inlet.h + InletQ.Q = 284 Inlet.F*(1-vfrac)*OutletL.h + Inlet.F*vfrac*OutletV.h; 285 286 "Thermal Equilibrium" 287 OutletV.T = OutletL.T; 288 289 "Mechanical Equilibrium" 290 OutletV.P = OutletL.P; 291 292 # regularization functions 293 zero_one = (1 + tanh(B * vsat))/2; 294 one_zero = (1 - tanh(B * (vsat - 1)))/2; 295 296 vfrac = zero_one * one_zero * vsat + 1 - one_zero; 297 OutletL.z = zero_one*one_zero*xsat + (1-zero_one*one_zero)*Inlet.z; 298 OutletV.z = zero_one*one_zero*ysat + (1-zero_one*one_zero)*Inlet.z; 299 end -
trunk/eml/streams.mso
r313 r321 114 114 Model source 115 115 ATTRIBUTES 116 Pallete = true; 116 117 Icon = "icon/Source"; 117 118 Brief = "Material stream source"; … … 205 206 Model simple_source 206 207 ATTRIBUTES 208 Pallete = true; 207 209 Icon = "icon/Source"; 208 210 Brief = "Simple material stream source"; … … 244 246 Model sink 245 247 ATTRIBUTES 248 Pallete = true; 246 249 Icon = "icon/Sink"; 247 250 Brief = "Material stream sink"; … … 319 322 Model simple_sink 320 323 ATTRIBUTES 324 Pallete = true; 321 325 Icon = "icon/Sink"; 322 326 Brief = "Simple material stream sink"; … … 345 349 Model energy_source 346 350 ATTRIBUTES 351 Pallete = true; 347 352 Icon = "icon/energy_source"; 348 353 Brief = "Enegry stream source";
Note: See TracChangeset
for help on using the changeset viewer.