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

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

testing column model in the GUI (Distillation_thermosyphon_subcooling)

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