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

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

updates

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 10.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 794 2009-07-15 20:28:09Z 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 InletQ (requires an energy source).
48
49== Initial Conditions ==
50* the tank initial temperature;
51* the tank initial level;
52* the tank initial composition.
53";
54
55PARAMETERS
56        outer PP                as Plugin               (Brief = "External Physical Properties", Type="PP");
57        outer NComp     as Integer;
58       
59        pi                      as positive     (Brief="Pi value", Default=3.141593,Hidden=true);
60        Diameter                as length       (Brief="Tank internal Diameter",Default=1.5);
61        Across                  as area         (Brief="Tank cross section area", Hidden=true);
62        L                       as length       (Brief="Tank length",Default=5);
63
64       
65        Initial_Level                           as length               (Brief="Initial Level of the Tank",Default=1);
66        Initial_Temperature                     as temperature  (Brief="Initial Temperature of Liquid",Default=300);
67        Initial_Composition(NComp)      as positive     (Brief="Initial Liquid Composition",Lower=1E-8, Default=0.10);
68
69SET
70
71        Across = 0.25*pi*(Diameter)^2;
72       
73VARIABLES
74in      Inlet           as stream                       (Brief = "Inlet stream", PosX=0.3037, PosY=0, Symbol="_{in}");
75out     Outlet          as liquid_stream        (Brief = "Outlet liquid stream", PosX=1, PosY=1, Symbol="_{out}");
76in      InletQ          as power                        (Brief="Rate of heat supply", PosX=1, PosY=0.7859, Symbol="_{in}",Protected=true);
77        Vtotal          as volume                       (Brief="Tank total volume",Protected=true);
78        Vfilled         as volume                       (Brief="Tank volume content",Protected=true);
79        Level           as length                       (Brief="Tank level",Protected=true);
80        E                       as energy                       (Brief="Total Energy Holdup on tank",Protected=true);
81        vL                      as volume_mol           (Brief="Liquid Molar Volume",Protected=true);
82        M(NComp)        as mol                          (Brief="Molar Holdup in the tank",Protected=true);
83
84INITIAL
85
86"Initial Level"
87        Level = Initial_Level;
88
89"Initial Liquid Temperature"   
90        Outlet.T = Initial_Temperature;
91
92"Initial Liquid Composition"   
93        Outlet.z(1:NComp-1) = Initial_Composition(1:NComp-1)/sum(Initial_Composition);
94
95EQUATIONS
96
97"Tank total volume"
98        Vtotal = Across*L;
99
100"Mass balance"
101        diff(M) = Inlet.F*Inlet.z - Outlet.F*Outlet.z;
102
103"Energy balance"
104        diff(E) = Inlet.F*Inlet.h - Outlet.F*Outlet.h + InletQ;
105
106"Energy Holdup"
107        E = sum(M)*Outlet.h;
108
109"Mechanical Equilibrium"
110        Inlet.P = Outlet.P;
111
112"Liquid Volume"
113        vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z);
114
115"Composition"
116        M = Outlet.z*sum(M);
117
118"Level of liquid phase"
119        Level = sum(M)*vL/Across;
120
121"Volume Filled of liquid phase"
122        Vfilled = Level*Across;
123       
124end
125
126Model RefluxDrum
127
128ATTRIBUTES
129        Pallete         = true;
130        Icon            = "icon/RefluxDrum";
131        Brief           = "Model of a Reflux Drum with a lain cylinder geometry.";
132        Info            =
133"== Specify ==
134* the Inlet stream;
135* the outlet flow;
136* the InletQ (requires an energy source).
137
138== Initial Conditions ==
139* the tank initial temperature;
140* the tank initial level;
141* the tank initial composition.
142";
143       
144PARAMETERS
145        outer PP                as Plugin               (Brief = "External Physical Properties", Type="PP");
146        outer NComp     as Integer              (Brief = "Number of Components");
147       
148        pi                      as positive     (Brief="Pi value", Default=3.141593,Hidden=true);
149        eps                     as positive     (Brief="small number",Default=1E-8,Hidden=true);
150        Diameter                as length       (Brief="Tank internal Diameter",Default=1.5);
151        radius                  as length       (Brief="Tank radius",Hidden=true);
152        L                               as length       (Brief="Tank length",Default=5);
153       
154        Initial_Level                           as length               (Brief="Initial Level of the Tank",Default=1);
155        Initial_Temperature                     as temperature  (Brief="Initial Temperature of Liquid",Default=300);
156        Initial_Composition(NComp)      as positive     (Brief="Initial Liquid Composition",Lower=1E-8,Default=0.1);
157
158SET
159        radius = 0.5*Diameter;
160
161VARIABLES
162in      Inlet           as stream                       (Brief="Inlet stream", PosX=0.1825, PosY=0, Symbol="_{in}");
163out     Outlet          as liquid_stream        (Brief="Outlet liquid stream", PosX=1, PosY=1, Symbol="_{out}");
164in      InletQ          as power                        (Brief="Rate of heat supply", PosX=1, PosY=0.6160, Symbol="_{in}",Protected=true);
165        Level           as length                       (Brief="Tank level",Protected=true);
166        Vtotal          as volume                       (Brief="Tank total volume",Protected=true);
167        Vfilled         as volume                       (Brief="Tank volume content",Protected=true);
168        Across          as area                         (Brief="Tank cross section area", Default=2,Protected=true);
169        E                       as energy                       (Brief="Total Energy Holdup on tank",Protected=true);
170        vL                      as volume_mol           (Brief="Liquid Molar Volume",Protected=true);
171        M(NComp)        as mol                          (Brief="Molar Holdup in the tank",Protected=true);
172
173INITIAL
174
175"Initial Level"
176        Level = Initial_Level;
177
178"Initial Liquid Temperature"   
179        Outlet.T = Initial_Temperature;
180
181"Initial Liquid Composition"   
182        Outlet.z(1:NComp-1) = Initial_Composition(1:NComp-1)/sum(Initial_Composition);
183
184EQUATIONS
185
186"Tank total volume"
187        Vtotal = (0.25*pi*(Diameter)^2)*L;
188       
189"Mass balance"
190        diff(M) = Inlet.F*Inlet.z - Outlet.F*Outlet.z;
191       
192"Energy balance"
193        diff(E) = Inlet.F*Inlet.h - Outlet.F*Outlet.h + InletQ;
194
195"Energy Holdup"
196        E = sum(M)*Outlet.h;
197       
198"Mechanical Equilibrium"
199        Inlet.P = Outlet.P;
200       
201"Liquid Volume"
202        vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z);
203       
204"Composition"
205        M = Outlet.z*sum(M);
206       
207"Cylindrical Area"
208        Across = radius^2 * (asin(1) - asin((radius-Level)/radius) ) + (Level-radius)*sqrt(Level*(2*radius - Level)+eps*'m^2');
209
210"Level of liquid phase"
211        L*Across = sum(M)*vL;
212
213"Volume Filled of liquid phase"
214        Vfilled = L*Across;
215
216end
217
218Model tank_cylindrical
219        ATTRIBUTES
220        Pallete         = true;
221        Icon            = "icon/TankHorizontal";
222        Brief           = "Model of a tank with a lain cylinder geometry.";
223        Info            =
224"== Specify ==
225* the Inlet stream;
226* the outlet flow;
227* the InletQ (requires an energy source).
228
229== Initial Conditions ==
230* the tank initial temperature;
231* the tank initial level;
232* the tank initial composition.
233";
234       
235PARAMETERS
236        outer PP                as Plugin               (Brief = "External Physical Properties", Type="PP");
237        outer NComp     as Integer              (Brief = "Number of Components");
238       
239        pi                      as positive     (Brief="Pi value", Default=3.141593,Hidden=true);
240        eps                     as positive     (Brief="small number",Default=1E-8,Hidden=true);
241        Diameter                as length       (Brief="Tank internal Diameter",Default=1.5);
242        radius                  as length       (Brief="Tank radius",Hidden=true);
243        L                               as length       (Brief="Tank length",Default=5);
244       
245        Initial_Level                           as length               (Brief="Initial Level of the Tank",Default=1);
246        Initial_Temperature                     as temperature  (Brief="Initial Temperature of Liquid",Default=300);
247        Initial_Composition(NComp)      as positive     (Brief="Initial Liquid Composition",Lower=1E-8,Default=0.1);
248
249SET
250        radius = Diameter/2;
251
252VARIABLES
253in      Inlet           as stream                       (Brief="Inlet stream", PosX=0.1825, PosY=0, Symbol="_{in}");
254out     Outlet          as liquid_stream        (Brief="Outlet liquid stream", PosX=1, PosY=1, Symbol="_{out}");
255in      InletQ          as power                        (Brief="Rate of heat supply", PosX=1, PosY=0.6160, Symbol="_{in}",Protected=true);
256        Level           as length                       (Brief="Tank level",Protected=true);
257        Vtotal          as volume                       (Brief="Tank total volume",Protected=true);
258        Vfilled         as volume                       (Brief="Tank volume content",Protected=true);
259        Across          as area                         (Brief="Tank cross section area", Default=2,Protected=true);
260        E                       as energy                       (Brief="Total Energy Holdup on tank",Protected=true);
261        vL                      as volume_mol           (Brief="Liquid Molar Volume",Protected=true);
262        M(NComp)        as mol                          (Brief="Molar Holdup in the tank",Protected=true);
263
264INITIAL
265
266"Initial Level"
267        Level = Initial_Level;
268
269"Initial Liquid Temperature"   
270        Outlet.T = Initial_Temperature;
271
272"Initial Liquid Composition"   
273        Outlet.z(1:NComp-1) = Initial_Composition(1:NComp-1)/sum(Initial_Composition);
274
275EQUATIONS
276
277"Tank total volume"
278        Vtotal = (0.25*pi*(Diameter)^2)*L;
279       
280"Mass balance"
281        diff(M) = Inlet.F*Inlet.z - Outlet.F*Outlet.z;
282       
283"Energy balance"
284        diff(E) = Inlet.F*Inlet.h - Outlet.F*Outlet.h + InletQ;
285
286"Energy Holdup"
287        E = sum(M)*Outlet.h;
288       
289"Mechanical Equilibrium"
290        Inlet.P = Outlet.P;
291       
292"Liquid Volume"
293        vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z);
294       
295"Composition"
296        M = Outlet.z*sum(M);
297       
298"Cylindrical Area"
299        Across = radius^2 * (asin(1) - asin((radius-Level)/radius) ) + (Level-radius)*sqrt(Level*(2*radius - Level)+eps*'m^2');
300
301"Level of liquid phase"
302        L*Across = sum(M)*vL;
303
304"Volume Filled of liquid phase"
305        Vfilled = L*Across;
306
307end
308
309Model tank_feed
310        ATTRIBUTES
311        Pallete         = true;
312        Icon            = "icon/Tank";
313        Brief           = "Model of a tank with feed stream.";
314        Info            =
315"== Specify ==
316* the Inlet stream;
317* the Feed stream;
318* the outlet flow;
319* the tank Q.
320
321== Initial Conditions ==
322* the tank initial temperature (OutletL.T);
323* the tank initial level (Level);
324* (NoComps - 1) OutletL (OR OutletV) compositions.
325";
326
327        PARAMETERS
328        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
329        outer NComp as Integer;
330        Across as area (Brief="Tank cross section area", Default=2);
331       
332        VARIABLES
333in      Feed as stream (Brief = "Feed stream", PosX=0.32, PosY=0, Symbol="_{feed}");   
334in      Inlet  as stream (Brief = "Inlet stream", PosX=0.3037, PosY=0, Symbol="_{in}");
335out     Outlet as liquid_stream (Brief = "Outlet liquid stream", PosX=1, PosY=1, Symbol="_{out}");
336in      InletQ as power (Brief="Rate of heat supply", PosX=1, PosY=0.7859, Symbol="_{in}");
337
338        Level    as length(Brief="Tank level");
339        M(NComp) as mol (Brief="Molar Holdup in the tank");
340        E as energy (Brief="Total Energy Holdup on tank");
341        vL as volume_mol (Brief="Liquid Molar Volume");
342
343        EQUATIONS
344        "Mass balance"
345        diff(M) = Feed.F*Feed.z + Inlet.F*Inlet.z - Outlet.F*Outlet.z;
346       
347        "Energy balance"
348        diff(E) = Feed.F*Feed.h + Inlet.F*Inlet.h - Outlet.F*Outlet.h + InletQ;
349
350        "Energy Holdup"
351        E = sum(M)*Outlet.h;
352
353        "Mechanical Equilibrium"
354        Inlet.P = Outlet.P;
355       
356        "Liquid Volume"
357        vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z);
358       
359        "Composition"
360        M = Outlet.z*sum(M);
361       
362        "Level of liquid phase"
363        Level = sum(M)*vL/Across;
364end
Note: See TracBrowser for help on using the repository browser.