source: trunk/eml/reactors/tank_basic.mso @ 1006

Last change on this file since 1006 was 426, checked in by Rodolfo Rodrigues, 16 years ago

Updated to use vol_tank.mso

File size: 5.2 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 tank basic
17*----------------------------------------------------------------------
18*
19*   Description:
20*       Generic model for a dynamic tank.
21*
22*   Assumptions:
23*               * single- and two-phases involved
24*       * dynamic
25*
26*----------------------------------------------------------------------
27* Author: Rodolfo Rodrigues
28* $Id$
29*--------------------------------------------------------------------*#
30
31using "streams";
32using "vol_tank";
33
34
35Model tank_basic
36        ATTRIBUTES
37        Brief   = "Basic model for a dynamic tank";
38       
39        PARAMETERS
40outer PP        as Plugin       (Brief="External physical properties", Type="PP");
41outer NComp as Integer  (Brief="Number of components", Default=1);
42       
43        VARIABLES
44in      Inlet   as stream       (Brief="Inlet stream", PosX=0, PosY=0, Symbol="_{in}");
45        Outletm as stream       (Brief="Intermediary outlet stream", Symbol="_{outm}");
46        Tank    as vol_tank     (Brief="Routine to volume tank calculation", Symbol="_{tank}");
47       
48        M(NComp)as mol          (Brief="Component molar holdup");
49        Mt              as mol          (Brief="Total component molar holdup");
50        E               as energy       (Brief="Internal energy");
51        Q               as heat_rate(Brief="Reactor duty", Default=0);
52       
53        EQUATIONS
54        "Component molar balance"
55        diff(M) = Inlet.F*Inlet.z - Outletm.F*Outletm.z;
56       
57        "Component molar"
58        M = Mt*Outletm.z;
59       
60        "Mole fraction normalisation"
61        sum(Outletm.z) = 1;
62       
63        "Energy balance"
64        diff(E) = Inlet.F*Inlet.h - Outletm.F*Outletm.h + Q;
65end
66
67
68#*---------------------------------------------------------------------
69*       only vapour phase
70*--------------------------------------------------------------------*#
71Model tank_vap as tank_basic
72        ATTRIBUTES
73        Brief   = "Model of a generic vapour-phase tank";
74       
75        EQUATIONS
76        "Vapourisation fraction"
77        Outletm.v = 1;
78
79        "Vapour Enthalpy"
80        Outletm.h = PP.VapourEnthalpy(Outletm.T,Outletm.P,Outletm.z);
81
82        "Volume constraint"
83        Tank.V = Mt*PP.VapourVolume(Outletm.T,Outletm.P,Outletm.z);
84
85        "Total internal energy"
86        E = Mt*Outletm.h;
87end
88
89
90#*---------------------------------------------------------------------
91*       only liquid phase
92*--------------------------------------------------------------------*#
93Model tank_liq as tank_basic
94        ATTRIBUTES
95        Brief   = "Model of a generic liquid-phase tank";
96       
97        EQUATIONS
98        "Vapourisation fraction"
99        Outletm.v = 0;
100
101        "Liquid Enthalpy"
102        Outletm.h = PP.LiquidEnthalpy(Outletm.T,Outletm.P,Outletm.z);
103       
104        "Volume constraint"
105        Tank.V = Mt*PP.LiquidVolume(Outletm.T,Outletm.P,Outletm.z);
106       
107        "Total internal energy"
108        E = Mt*Outletm.h - Outletm.P*Tank.V;
109end
110
111
112#*---------------------------------------------------------------------
113*       liquid and vapour phases
114*--------------------------------------------------------------------*#
115Model tank_liqvap
116        ATTRIBUTES
117        Brief   = "Model of a generic two-phase tank";
118       
119        PARAMETERS
120outer PP                as Plugin(Brief="External physical properties", Type="PP");
121outer NComp     as Integer      (Brief="Number of components", Default=1);
122
123        VARIABLES
124in      Inlet    as stream                      (Brief="Inlet stream", PosX=0, PosY=0, Symbol="_{in}");
125        OutletmL as liquid_stream       (Brief="Intermediary liquid outlet stream", Symbol="_{outmL}");
126out     OutletV  as vapour_stream       (Brief="Outlet vapour stream", Symbol="_{outV}");
127        Tank     as vol_tank            (Brief="Routine to volume tank calculation", Symbol="_{tank}");
128       
129        M(NComp)as mol                  (Brief="Component molar holdup");
130        ML              as mol                  (Brief="Molar liquid holdup");
131        MV              as mol                  (Brief="Molar vapour holdup");
132        E               as energy               (Brief="Internal energy");
133        Q               as heat_rate    (Brief="Reactor duty", Default=0);
134        vL              as volume_mol   (Brief="Liquid Molar Volume");
135       
136        EQUATIONS
137        "Component molar balance"
138        diff(M) = Inlet.F*Inlet.z - (OutletmL.F*OutletmL.z + OutletV.F*OutletV.z);
139
140        "Molar holdup"
141        M = ML*OutletmL.z + MV*OutletV.z;
142       
143       
144        "Mole fraction normalisation"
145        sum(OutletmL.z) = 1;
146       
147        "Mole fraction normalisation"
148        sum(OutletmL.z) = sum(OutletV.z);
149       
150       
151        "Vapourisation fraction"
152        OutletV.v = 1;
153       
154        "Vapourisation fraction"
155        OutletmL.v = 0;
156       
157       
158        "Energy balance"
159        diff(E) = Inlet.F*Inlet.h - (OutletmL.F*OutletmL.h + OutletV.F*OutletV.h) + Q;
160       
161        "Total internal energy"
162        E = ML*OutletmL.h + MV*OutletV.h;
163       
164        "Geometry constraint"
165        Tank.V = ML*vL + MV*PP.VapourVolume(OutletV.T,OutletV.P,OutletV.z);
166       
167       
168        "Chemical Equilibrium"
169        PP.LiquidFugacityCoefficient(OutletmL.T,OutletmL.P,OutletmL.z)*OutletmL.z =
170                PP.VapourFugacityCoefficient(OutletV.T,OutletV.P,OutletV.z)*OutletV.z;
171       
172        "Mechanical Equilibrium"
173        OutletmL.P = OutletV.P;
174       
175        "Thermal Equilibrium"
176        OutletmL.T = OutletV.T;
177       
178        "Liquid Volume"
179        vL = PP.LiquidVolume(OutletmL.T,OutletmL.P,OutletmL.z);
180       
181        "Tank Level"
182        ML*vL = Tank.V;
183end
Note: See TracBrowser for help on using the repository browser.