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

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

updated tank model

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