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

Last change on this file since 767 was 721, checked in by gerson bicca, 13 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
RevLine 
[1]1#*-------------------------------------------------------------------
[72]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*-------------------------------------------------------------------
[1]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
[270]39        ATTRIBUTES
40        Pallete         = true;
[300]41        Icon            = "icon/Tank";
[270]42        Brief           = "Model of a cylindrical tank.";
43        Info            =
[353]44"== Specify ==
45* the Inlet stream;
46* the outlet flow;
47* the tank Q.
[1]48
[353]49== Initial Conditions ==
50* the tank initial temperature (OutletL.T);
51* the tank initial level (Level);
52* (NoComps - 1) OutletL (OR OutletV) compositions.
53";
[270]54
[649]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);
[1]59       
[721]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       
[649]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");
[1]72
[721]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
[649]79EQUATIONS
80
81"Mass balance"
[1]82        diff(M) = Inlet.F*Inlet.z - Outlet.F*Outlet.z;
[649]83
84"Energy balance"
[555]85        diff(E) = Inlet.F*Inlet.h - Outlet.F*Outlet.h + InletQ;
[1]86
[649]87"Energy Holdup"
[1]88        E = sum(M)*Outlet.h;
89
[649]90"Mechanical Equilibrium"
[1]91        Inlet.P = Outlet.P;
[649]92
93"Liquid Volume"
[1]94        vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z);
[649]95
96"Composition"
[1]97        M = Outlet.z*sum(M);
[649]98
99"Level of liquid phase"
[1]100        Level = sum(M)*vL/Across;
[649]101
[1]102end
103
[72]104#*----------------------------------------------------------
105*
106*Model of a tank with a lain cylinder geometry
107*
108*---------------------------------------------------------*#
[1]109Model tank_cylindrical
[270]110        ATTRIBUTES
111        Pallete         = true;
[300]112        Icon            = "icon/TankHorizontal";
[270]113        Brief           = "Model of a tank with a lain cylinder geometry.";
114        Info            =
[353]115"== Specify ==
116* the Inlet stream;
117* the outlet flow;
118* the tank Q.
[1]119
[353]120== Initial Conditions ==
121* the tank initial temperature (OutletL.T);
122* the tank initial level (Level);
123* (NoComps - 1) OutletL (OR OutletV) compositions.
124";
[270]125       
[649]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");
[1]131       
[721]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       
[649]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");
[1]145
[721]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
[649]152EQUATIONS
153
154"Mass balance"
[1]155        diff(M) = Inlet.F*Inlet.z - Outlet.F*Outlet.z;
156       
[649]157"Energy balance"
[555]158        diff(E) = Inlet.F*Inlet.h - Outlet.F*Outlet.h + InletQ;
[1]159
[649]160"Energy Holdup"
[1]161        E = sum(M)*Outlet.h;
162       
[649]163"Mechanical Equilibrium"
[1]164        Inlet.P = Outlet.P;
165       
[649]166"Liquid Volume"
[1]167        vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z);
168       
[649]169"Composition"
[1]170        M = Outlet.z*sum(M);
171       
[649]172"Cylindrical Area"
173        Across = radius^2 * (asin(1) - asin((radius-Level)/radius) ) + (Level-radius)*sqrt(Level*(2*radius - Level));
[1]174
[649]175"Level of liquid phase"
[183]176        L*Across = sum(M)*vL;
[649]177
[1]178end
179
180Model tank_simplified
[313]181        ATTRIBUTES
182        Pallete         = true;
183        Icon            = "icon/Tank";
184        Brief           = "Model of a simplified tank.";
185        Info            =
[353]186"== Specify ==
187* the Inlet flow rate;
[313]188
[353]189== Initial Conditions ==
190* the tank initial level (Level);
191";
[313]192
[1]193        PARAMETERS
[174]194        k as Real (Brief="Valve Constant", Unit = 'm^2.5/h', Default=4);
[1]195        A as area (Brief="Tank area", Default=2);
196
197        VARIABLES
[313]198        Level as length(Brief="Tank level");
[325]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);
[1]201
202        EQUATIONS
203        "Mass balance"
[313]204        diff(A*Level) = Fin - Fout;
205
[1]206        "Valve equation"
[313]207        Fout = k*sqrt(Level);           
[1]208end
[64]209
210Model tank_feed
[313]211        ATTRIBUTES
212        Pallete         = true;
213        Icon            = "icon/Tank";
214        Brief           = "Model of a tank with feed stream.";
215        Info            =
[353]216"== Specify ==
217* the Inlet stream;
218* the Feed stream;
219* the outlet flow;
220* the tank Q.
[64]221
[353]222== Initial Conditions ==
223* the tank initial temperature (OutletL.T);
224* the tank initial level (Level);
225* (NoComps - 1) OutletL (OR OutletV) compositions.
226";
[313]227
[64]228        PARAMETERS
[210]229        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
[125]230        outer NComp as Integer;
[64]231        Across as area (Brief="Tank cross section area", Default=2);
232       
233        VARIABLES
[352]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}");
[555]237in      InletQ as power (Brief="Rate of heat supply", PosX=1, PosY=0.7859, Symbol="_{in}");
[64]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"
[555]249        diff(E) = Feed.F*Feed.h + Inlet.F*Inlet.h - Outlet.F*Outlet.h + InletQ;
[64]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.