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

Last change on this file since 781 was 781, checked in by gerson bicca, 13 years ago

updated column/tank model

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 7.7 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 781 2009-06-25 21:05:45Z 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);
[781]59        L                                       as length                       (Brief="Tank length");
60        Vtotal                          as volume       (Brief="Tank total volume");
[1]61       
[721]62        Initial_Level                           as length               (Brief="Initial Level of the Tank");
63        Initial_Temperature                     as temperature  (Brief="Initial Temperature of Liquid");
64        Initial_Composition(NComp)      as fraction     (Brief="Initial Liquid Composition");
[781]65
66SET
67        Vtotal =Across*L;
[721]68       
[649]69VARIABLES
70in      Inlet                   as stream                               (Brief = "Inlet stream", PosX=0.3037, PosY=0, Symbol="_{in}");
71out     Outlet          as liquid_stream        (Brief = "Outlet liquid stream", PosX=1, PosY=1, Symbol="_{out}");
72in      InletQ                  as power                                (Brief="Rate of heat supply", PosX=1, PosY=0.7859, Symbol="_{in}");
[781]73        Vfilled         as volume                               (Brief="Tank volume content");
[649]74        Level                   as length                               (Brief="Tank level");
75        M(NComp)        as mol                                  (Brief="Molar Holdup in the tank");
76        E                                       as energy                               (Brief="Total Energy Holdup on tank");
77        vL                              as volume_mol           (Brief="Liquid Molar Volume");
[1]78
[721]79INITIAL
80
81        Level                                   = Initial_Level;
82        Outlet.T                                = Initial_Temperature;
83        Outlet.z(1:NComp-1)     = Initial_Composition(1:NComp-1)/sum(Initial_Composition);
84
[649]85EQUATIONS
86
87"Mass balance"
[1]88        diff(M) = Inlet.F*Inlet.z - Outlet.F*Outlet.z;
[649]89
90"Energy balance"
[555]91        diff(E) = Inlet.F*Inlet.h - Outlet.F*Outlet.h + InletQ;
[1]92
[649]93"Energy Holdup"
[1]94        E = sum(M)*Outlet.h;
95
[649]96"Mechanical Equilibrium"
[1]97        Inlet.P = Outlet.P;
[649]98
99"Liquid Volume"
[1]100        vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z);
[649]101
102"Composition"
[1]103        M = Outlet.z*sum(M);
[649]104
105"Level of liquid phase"
[1]106        Level = sum(M)*vL/Across;
[649]107
[781]108"Volume Filled of liquid phase"
109        Vfilled = Level*Across;
110       
[1]111end
112
[72]113#*----------------------------------------------------------
114*
115*Model of a tank with a lain cylinder geometry
116*
117*---------------------------------------------------------*#
[1]118Model tank_cylindrical
[270]119        ATTRIBUTES
120        Pallete         = true;
[300]121        Icon            = "icon/TankHorizontal";
[270]122        Brief           = "Model of a tank with a lain cylinder geometry.";
123        Info            =
[353]124"== Specify ==
125* the Inlet stream;
126* the outlet flow;
127* the tank Q.
[1]128
[353]129== Initial Conditions ==
130* the tank initial temperature (OutletL.T);
131* the tank initial level (Level);
132* (NoComps - 1) OutletL (OR OutletV) compositions.
133";
[270]134       
[649]135PARAMETERS
136        outer PP                        as Plugin               (Brief = "External Physical Properties", Type="PP");
137        outer NComp     as Integer;
[781]138        pi                                      as positive     (Brief="Pi value", Default=3.141593,Hidden=true);
[649]139        radius                          as length               (Brief="Tank radius");
140        L                                               as length               (Brief="Tank length");
[781]141        Vtotal                          as volume       (Brief="Tank total volume");
[1]142       
[721]143        Initial_Level                   as length                       (Brief="Initial Level of the Tank");
144        Initial_Temperature             as temperature                  (Brief="Initial Temperature of Liquid");
145        Initial_Composition(NComp)      as fraction                             (Brief="Initial Liquid Composition");
[781]146
147SET
148        Vtotal = (0.25*pi*(2*radius)^2)*L;
149
[649]150VARIABLES
151in      Inlet           as stream                               (Brief = "Inlet stream", PosX=0.1825, PosY=0, Symbol="_{in}");
152out     Outlet  as liquid_stream        (Brief = "Outlet liquid stream", PosX=1, PosY=1, Symbol="_{out}");
153in      InletQ          as power                                (Brief="Rate of heat supply", PosX=1, PosY=0.6160, Symbol="_{in}");
154        Level           as length                               (Brief="Tank level");
[781]155        Vfilled         as volume                               (Brief="Tank volume content");
[649]156        Across          as area                                         (Brief="Tank cross section area", Default=2);
157        M(NComp) as mol                                         (Brief="Molar Holdup in the tank");
158        E                               as energy                               (Brief="Total Energy Holdup on tank");
159        vL                      as volume_mol           (Brief="Liquid Molar Volume");
[1]160
[721]161INITIAL
162
163        Level                                   = Initial_Level;
164        Outlet.T                                = Initial_Temperature;
165        Outlet.z(1:NComp-1)     = Initial_Composition(1:NComp-1)/sum(Initial_Composition);
166
[649]167EQUATIONS
168
169"Mass balance"
[1]170        diff(M) = Inlet.F*Inlet.z - Outlet.F*Outlet.z;
171       
[649]172"Energy balance"
[555]173        diff(E) = Inlet.F*Inlet.h - Outlet.F*Outlet.h + InletQ;
[1]174
[649]175"Energy Holdup"
[1]176        E = sum(M)*Outlet.h;
177       
[649]178"Mechanical Equilibrium"
[1]179        Inlet.P = Outlet.P;
180       
[649]181"Liquid Volume"
[1]182        vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z);
183       
[649]184"Composition"
[1]185        M = Outlet.z*sum(M);
186       
[649]187"Cylindrical Area"
[781]188        Across = radius^2 * (asin(1) - asin((radius-Level)/radius) ) + (Level-radius)*sqrt(Level*(2*radius - Level)+1E-8);
[1]189
[649]190"Level of liquid phase"
[183]191        L*Across = sum(M)*vL;
[649]192
[781]193"Volume Filled of liquid phase"
194        Vfilled = L*Across;
195
[1]196end
197
198Model tank_simplified
[313]199        ATTRIBUTES
200        Pallete         = true;
201        Icon            = "icon/Tank";
202        Brief           = "Model of a simplified tank.";
203        Info            =
[353]204"== Specify ==
205* the Inlet flow rate;
[313]206
[353]207== Initial Conditions ==
208* the tank initial level (Level);
209";
[313]210
[1]211        PARAMETERS
[174]212        k as Real (Brief="Valve Constant", Unit = 'm^2.5/h', Default=4);
[1]213        A as area (Brief="Tank area", Default=2);
214
215        VARIABLES
[313]216        Level as length(Brief="Tank level");
[325]217in      Fin  as flow_vol(Brief="Input flow", PosX=0.3037, PosY=0);
218out     Fout as flow_vol(Brief="Output flow", PosX=1, PosY=1);
[1]219
220        EQUATIONS
221        "Mass balance"
[313]222        diff(A*Level) = Fin - Fout;
223
[1]224        "Valve equation"
[313]225        Fout = k*sqrt(Level);           
[1]226end
[64]227
228Model tank_feed
[313]229        ATTRIBUTES
230        Pallete         = true;
231        Icon            = "icon/Tank";
232        Brief           = "Model of a tank with feed stream.";
233        Info            =
[353]234"== Specify ==
235* the Inlet stream;
236* the Feed stream;
237* the outlet flow;
238* the tank Q.
[64]239
[353]240== Initial Conditions ==
241* the tank initial temperature (OutletL.T);
242* the tank initial level (Level);
243* (NoComps - 1) OutletL (OR OutletV) compositions.
244";
[313]245
[64]246        PARAMETERS
[210]247        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
[125]248        outer NComp as Integer;
[64]249        Across as area (Brief="Tank cross section area", Default=2);
250       
251        VARIABLES
[352]252in      Feed as stream (Brief = "Feed stream", PosX=0.32, PosY=0, Symbol="_{feed}");   
253in      Inlet  as stream (Brief = "Inlet stream", PosX=0.3037, PosY=0, Symbol="_{in}");
254out     Outlet as liquid_stream (Brief = "Outlet liquid stream", PosX=1, PosY=1, Symbol="_{out}");
[555]255in      InletQ as power (Brief="Rate of heat supply", PosX=1, PosY=0.7859, Symbol="_{in}");
[64]256
257        Level    as length(Brief="Tank level");
258        M(NComp) as mol (Brief="Molar Holdup in the tank");
259        E as energy (Brief="Total Energy Holdup on tank");
260        vL as volume_mol (Brief="Liquid Molar Volume");
261
262        EQUATIONS
263        "Mass balance"
264        diff(M) = Feed.F*Feed.z + Inlet.F*Inlet.z - Outlet.F*Outlet.z;
265       
266        "Energy balance"
[555]267        diff(E) = Feed.F*Feed.h + Inlet.F*Inlet.h - Outlet.F*Outlet.h + InletQ;
[64]268
269        "Energy Holdup"
270        E = sum(M)*Outlet.h;
271
272        "Mechanical Equilibrium"
273        Inlet.P = Outlet.P;
274       
275        "Liquid Volume"
276        vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z);
277       
278        "Composition"
279        M = Outlet.z*sum(M);
280       
281        "Level of liquid phase"
282        Level = sum(M)*vL/Across;
283end
Note: See TracBrowser for help on using the repository browser.