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

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

Added symbols

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