source: branches/newlanguage/eml/stage_separators/flashPH.mso @ 125

Last change on this file since 125 was 101, checked in by Rafael de Pelegrini Soares, 16 years ago

Updated flashPH model

  • Property svn:Keywords set to Id
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.1 KB
Line 
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
36using "streams";
37
38Model FlashPHSteady
39        PARAMETERS
40ext PP as CalcObject;
41ext NComp as Integer;
42        B as Real(Default=1000, Brief="Regularization Factor");
43       
44        VARIABLES
45in      Inlet as stream; #(Brief="Feed Stream");
46out     OutletL as stream_therm; #(Brief="Liquid outlet stream");
47out     OutletV as stream_therm; #(Brief="Vapour outlet stream");
48in      Q as heat_rate (Brief="Rate of heat supply");
49        vfrac as fraction(Brief="Real vaporization fraction");
50        vsat as Real(Lower=-5, Upper=5, Brief="Vaporization fraction if saturated");
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"
60        PP.LiquidFugacityCoefficient(Tsat, OutletL.P, xsat)*xsat =
61                PP.VapourFugacityCoefficient(Tsat, OutletV.P, ysat)*ysat;
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 =
73                Inlet.F*(1-vsat)*PP.LiquidEnthalpy(Tsat, OutletL.P, xsat) +
74                Inlet.F*vsat*PP.VapourEnthalpy(Tsat, OutletV.P, ysat);
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;
98end
Note: See TracBrowser for help on using the repository browser.