source: branches/gui/eml/stage_separators/tank.mso @ 737

Last change on this file since 737 was 721, checked in by gerson bicca, 14 years ago

updates (tank/reboiler/condenser/column)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 7.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 tanks
17*--------------------------------------------------------------------
18*       Streams:
19*               * an inlet stream
20*               * an outlet stream
21*
22*       Specify:
23*               * the Inlet stream
24*               * the Outlet flow
25*               * the tank Q
26*
27*       Initial:
28*               * the tank temperature (OutletL.T)
29*               * the tank level (h)
30*               * (NoComps - 1) Outlet compositions
31*----------------------------------------------------------------------
32* Author: Paula B. Staudt
33* $Id: tank.mso 721 2009-02-25 22:51:53Z bicca $
34*--------------------------------------------------------------------*#
35
36using "streams";
37
38Model tank
39        ATTRIBUTES
40        Pallete         = true;
41        Icon            = "icon/Tank";
42        Brief           = "Model of a cylindrical tank.";
43        Info            =
44"== Specify ==
45* the Inlet stream;
46* the outlet flow;
47* the tank Q.
48
49== Initial Conditions ==
50* the tank initial temperature (OutletL.T);
51* the tank initial level (Level);
52* (NoComps - 1) OutletL (OR OutletV) compositions.
53";
54
55PARAMETERS
56        outer PP                        as Plugin               (Brief = "External Physical Properties", Type="PP");
57        outer NComp     as Integer;
58        Across                          as area                         (Brief="Tank cross section area", Default=2);
59       
60        Initial_Level                           as length               (Brief="Initial Level of the Tank");
61        Initial_Temperature                     as temperature  (Brief="Initial Temperature of Liquid");
62        Initial_Composition(NComp)      as fraction     (Brief="Initial Liquid Composition");
63       
64VARIABLES
65in      Inlet                   as stream                               (Brief = "Inlet stream", PosX=0.3037, PosY=0, Symbol="_{in}");
66out     Outlet          as liquid_stream        (Brief = "Outlet liquid stream", PosX=1, PosY=1, Symbol="_{out}");
67in      InletQ                  as power                                (Brief="Rate of heat supply", PosX=1, PosY=0.7859, Symbol="_{in}");
68        Level                   as length                               (Brief="Tank level");
69        M(NComp)        as mol                                  (Brief="Molar Holdup in the tank");
70        E                                       as energy                               (Brief="Total Energy Holdup on tank");
71        vL                              as volume_mol           (Brief="Liquid Molar Volume");
72
73INITIAL
74
75        Level                                   = Initial_Level;
76        Outlet.T                                = Initial_Temperature;
77        Outlet.z(1:NComp-1)     = Initial_Composition(1:NComp-1)/sum(Initial_Composition);
78
79EQUATIONS
80
81"Mass balance"
82        diff(M) = Inlet.F*Inlet.z - Outlet.F*Outlet.z;
83
84"Energy balance"
85        diff(E) = Inlet.F*Inlet.h - Outlet.F*Outlet.h + InletQ;
86
87"Energy Holdup"
88        E = sum(M)*Outlet.h;
89
90"Mechanical Equilibrium"
91        Inlet.P = Outlet.P;
92
93"Liquid Volume"
94        vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z);
95
96"Composition"
97        M = Outlet.z*sum(M);
98
99"Level of liquid phase"
100        Level = sum(M)*vL/Across;
101
102end
103
104#*----------------------------------------------------------
105*
106*Model of a tank with a lain cylinder geometry
107*
108*---------------------------------------------------------*#
109Model tank_cylindrical
110        ATTRIBUTES
111        Pallete         = true;
112        Icon            = "icon/TankHorizontal";
113        Brief           = "Model of a tank with a lain cylinder geometry.";
114        Info            =
115"== Specify ==
116* the Inlet stream;
117* the outlet flow;
118* the tank Q.
119
120== Initial Conditions ==
121* the tank initial temperature (OutletL.T);
122* the tank initial level (Level);
123* (NoComps - 1) OutletL (OR OutletV) compositions.
124";
125       
126PARAMETERS
127        outer PP                        as Plugin               (Brief = "External Physical Properties", Type="PP");
128        outer NComp     as Integer;
129        radius                          as length               (Brief="Tank radius");
130        L                                               as length               (Brief="Tank length");
131       
132        Initial_Level                   as length                       (Brief="Initial Level of the Tank");
133        Initial_Temperature             as temperature                  (Brief="Initial Temperature of Liquid");
134        Initial_Composition(NComp)      as fraction                             (Brief="Initial Liquid Composition");
135       
136VARIABLES
137in      Inlet           as stream                               (Brief = "Inlet stream", PosX=0.1825, PosY=0, Symbol="_{in}");
138out     Outlet  as liquid_stream        (Brief = "Outlet liquid stream", PosX=1, PosY=1, Symbol="_{out}");
139in      InletQ          as power                                (Brief="Rate of heat supply", PosX=1, PosY=0.6160, Symbol="_{in}");
140        Level           as length                               (Brief="Tank level");
141        Across          as area                                         (Brief="Tank cross section area", Default=2);
142        M(NComp) as mol                                         (Brief="Molar Holdup in the tank");
143        E                               as energy                               (Brief="Total Energy Holdup on tank");
144        vL                      as volume_mol           (Brief="Liquid Molar Volume");
145
146INITIAL
147
148        Level                                   = Initial_Level;
149        Outlet.T                                = Initial_Temperature;
150        Outlet.z(1:NComp-1)     = Initial_Composition(1:NComp-1)/sum(Initial_Composition);
151
152EQUATIONS
153
154"Mass balance"
155        diff(M) = Inlet.F*Inlet.z - Outlet.F*Outlet.z;
156       
157"Energy balance"
158        diff(E) = Inlet.F*Inlet.h - Outlet.F*Outlet.h + InletQ;
159
160"Energy Holdup"
161        E = sum(M)*Outlet.h;
162       
163"Mechanical Equilibrium"
164        Inlet.P = Outlet.P;
165       
166"Liquid Volume"
167        vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z);
168       
169"Composition"
170        M = Outlet.z*sum(M);
171       
172"Cylindrical Area"
173        Across = radius^2 * (asin(1) - asin((radius-Level)/radius) ) + (Level-radius)*sqrt(Level*(2*radius - Level));
174
175"Level of liquid phase"
176        L*Across = sum(M)*vL;
177
178end
179
180Model tank_simplified
181        ATTRIBUTES
182        Pallete         = true;
183        Icon            = "icon/Tank";
184        Brief           = "Model of a simplified tank.";
185        Info            =
186"== Specify ==
187* the Inlet flow rate;
188
189== Initial Conditions ==
190* the tank initial level (Level);
191";
192
193        PARAMETERS
194        k as Real (Brief="Valve Constant", Unit = 'm^2.5/h', Default=4);
195        A as area (Brief="Tank area", Default=2);
196
197        VARIABLES
198        Level as length(Brief="Tank level");
199in      Fin  as flow_vol(Brief="Input flow", PosX=0.3037, PosY=0);
200out     Fout as flow_vol(Brief="Output flow", PosX=1, PosY=1);
201
202        EQUATIONS
203        "Mass balance"
204        diff(A*Level) = Fin - Fout;
205
206        "Valve equation"
207        Fout = k*sqrt(Level);           
208end
209
210Model tank_feed
211        ATTRIBUTES
212        Pallete         = true;
213        Icon            = "icon/Tank";
214        Brief           = "Model of a tank with feed stream.";
215        Info            =
216"== Specify ==
217* the Inlet stream;
218* the Feed stream;
219* the outlet flow;
220* the tank Q.
221
222== Initial Conditions ==
223* the tank initial temperature (OutletL.T);
224* the tank initial level (Level);
225* (NoComps - 1) OutletL (OR OutletV) compositions.
226";
227
228        PARAMETERS
229        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
230        outer NComp as Integer;
231        Across as area (Brief="Tank cross section area", Default=2);
232       
233        VARIABLES
234in      Feed as stream (Brief = "Feed stream", PosX=0.32, PosY=0, Symbol="_{feed}");   
235in      Inlet  as stream (Brief = "Inlet stream", PosX=0.3037, PosY=0, Symbol="_{in}");
236out     Outlet as liquid_stream (Brief = "Outlet liquid stream", PosX=1, PosY=1, Symbol="_{out}");
237in      InletQ as power (Brief="Rate of heat supply", PosX=1, PosY=0.7859, Symbol="_{in}");
238
239        Level    as length(Brief="Tank level");
240        M(NComp) as mol (Brief="Molar Holdup in the tank");
241        E as energy (Brief="Total Energy Holdup on tank");
242        vL as volume_mol (Brief="Liquid Molar Volume");
243
244        EQUATIONS
245        "Mass balance"
246        diff(M) = Feed.F*Feed.z + Inlet.F*Inlet.z - Outlet.F*Outlet.z;
247       
248        "Energy balance"
249        diff(E) = Feed.F*Feed.h + Inlet.F*Inlet.h - Outlet.F*Outlet.h + InletQ;
250
251        "Energy Holdup"
252        E = sum(M)*Outlet.h;
253
254        "Mechanical Equilibrium"
255        Inlet.P = Outlet.P;
256       
257        "Liquid Volume"
258        vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z);
259       
260        "Composition"
261        M = Outlet.z*sum(M);
262       
263        "Level of liquid phase"
264        Level = sum(M)*vL/Across;
265end
Note: See TracBrowser for help on using the repository browser.