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

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

Updated models to include Type attribute for Plugins

  • Property svn:Keywords set to Id
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.0 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 209 2007-03-15 11:29:10Z rafael $
34*--------------------------------------------------------------------*#
35
36using "streams";
37
38Model FlashPHSteady
39        PARAMETERS
40outer PP as Plugin(Type="PP");
41outer 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 liquid_stream (Brief="Liquid outlet stream");
47out     OutletV as vapour_stream (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=1473, 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        # regularization functions
87        zero_one = (1 + tanh(B * vsat))/2;
88        one_zero = (1 - tanh(B * (vsat - 1)))/2;
89       
90        vfrac = zero_one * one_zero * vsat + 1 - one_zero;
91        OutletL.z = zero_one*one_zero*xsat + (1-zero_one*one_zero)*Inlet.z;
92        OutletV.z = zero_one*one_zero*ysat + (1-zero_one*one_zero)*Inlet.z;
93end
Note: See TracBrowser for help on using the repository browser.