[97] | 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 | *------------------------------------------------------------------- |
---|
| 16 | * Model of a static PH flash |
---|
| 17 | *-------------------------------------------------------------------- |
---|
| 18 | * - Streams |
---|
| 19 | * * a liquid outlet stream |
---|
| 20 | * * a vapour outlet stream |
---|
| 21 | * * a feed stream |
---|
| 22 | * |
---|
| 23 | * - Assumptions |
---|
| 24 | * * both phases are perfectly mixed |
---|
| 25 | * |
---|
| 26 | * - Specify: |
---|
| 27 | * * the feed stream; |
---|
| 28 | * * the heat duty |
---|
| 29 | * * the outlet pressure |
---|
| 30 | * |
---|
| 31 | *---------------------------------------------------------------------- |
---|
| 32 | * Author: Rafael de P. Soares and Paula B. Staudt |
---|
| 33 | * $Id: flashPH.mso 101 2007-01-09 15:59:59Z rafael $ |
---|
| 34 | *--------------------------------------------------------------------*# |
---|
| 35 | |
---|
| 36 | using "streams"; |
---|
| 37 | |
---|
| 38 | Model FlashPHSteady |
---|
| 39 | PARAMETERS |
---|
| 40 | ext PP as CalcObject; |
---|
| 41 | ext NComp as Integer; |
---|
| 42 | B as Real(Default=1000, Brief="Regularization Factor"); |
---|
| 43 | |
---|
| 44 | VARIABLES |
---|
| 45 | in Inlet as stream; #(Brief="Feed Stream"); |
---|
| 46 | out OutletL as stream_therm; #(Brief="Liquid outlet stream"); |
---|
| 47 | out OutletV as stream_therm; #(Brief="Vapour outlet stream"); |
---|
| 48 | in Q as heat_rate (Brief="Rate of heat supply"); |
---|
| 49 | vfrac as fraction(Brief="Real vaporization fraction"); |
---|
[101] | 50 | vsat as Real(Lower=-5, Upper=5, Brief="Vaporization fraction if saturated"); |
---|
[97] | 51 | Tsat as temperature(Lower=173, Upper=473, Brief="Temperature if saturated"); |
---|
| 52 | xsat(NComp) as Real(Lower=-5, Upper=5, Brief="Liquid composition if saturated"); |
---|
| 53 | ysat(NComp) as Real(Lower=-5, Upper=5, Brief="Vapour composition if saturated"); |
---|
| 54 | |
---|
| 55 | zero_one as fraction(Brief="Regularization Variable"); |
---|
| 56 | one_zero as fraction(Brief="Regularization Variable"); |
---|
| 57 | |
---|
| 58 | EQUATIONS |
---|
| 59 | "Chemical equilibrium" |
---|
[101] | 60 | PP.LiquidFugacityCoefficient(Tsat, OutletL.P, xsat)*xsat = |
---|
| 61 | PP.VapourFugacityCoefficient(Tsat, OutletV.P, ysat)*ysat; |
---|
[97] | 62 | |
---|
| 63 | "Global Molar Balance" |
---|
| 64 | Inlet.F = OutletV.F + OutletL.F; |
---|
| 65 | OutletV.F = Inlet.F * vfrac; |
---|
| 66 | |
---|
| 67 | "Component Molar Balance" |
---|
| 68 | Inlet.F*Inlet.z = OutletL.F*xsat + OutletV.F*ysat; |
---|
| 69 | sum(xsat) = sum(ysat); |
---|
| 70 | |
---|
| 71 | "Energy Balance if saturated" |
---|
| 72 | Inlet.F*Inlet.h + Q = |
---|
[101] | 73 | Inlet.F*(1-vsat)*PP.LiquidEnthalpy(Tsat, OutletL.P, xsat) + |
---|
| 74 | Inlet.F*vsat*PP.VapourEnthalpy(Tsat, OutletV.P, ysat); |
---|
[97] | 75 | |
---|
| 76 | "Real Energy Balance" |
---|
| 77 | Inlet.F*Inlet.h + Q = |
---|
| 78 | Inlet.F*(1-vfrac)*OutletL.h + Inlet.F*vfrac*OutletV.h; |
---|
| 79 | |
---|
| 80 | "Thermal Equilibrium" |
---|
| 81 | OutletV.T = OutletL.T; |
---|
| 82 | |
---|
| 83 | "Mechanical Equilibrium" |
---|
| 84 | OutletV.P = OutletL.P; |
---|
| 85 | |
---|
| 86 | "vaporization fraction " |
---|
| 87 | OutletV.v = 1.0; |
---|
| 88 | "vaporization fraction " |
---|
| 89 | OutletL.v = 0.0; |
---|
| 90 | |
---|
| 91 | # regularization functions |
---|
| 92 | zero_one = (1 + tanh(B * vsat))/2; |
---|
| 93 | one_zero = (1 - tanh(B * (vsat - 1)))/2; |
---|
| 94 | |
---|
| 95 | vfrac = zero_one * one_zero * vsat + 1 - one_zero; |
---|
| 96 | OutletL.z = zero_one*one_zero*xsat + (1-zero_one*one_zero)*Inlet.z; |
---|
| 97 | OutletV.z = zero_one*one_zero*ysat + (1-zero_one*one_zero)*Inlet.z; |
---|
| 98 | end |
---|