source: branches/newlanguage/eml/stage_separators/tank.mso @ 174

Last change on this file since 174 was 174, checked in by gerson bicca, 15 years ago

updated tank model and tutorial

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.4 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 174 2007-03-02 15:31:29Z bicca $
34*--------------------------------------------------------------------*#
35
36using "streams";
37
38Model tank
39
40        PARAMETERS
41        outer PP as Plugin;
42        outer NComp as Integer;
43        Across as area (Brief="Tank cross section area", Default=2);
44       
45        VARIABLES
46in      Inlet as stream;
47out     Outlet as liquid_stream;
48
49in      Q as heat_rate (Brief="Rate of heat supply");
50        Level    as length(Brief="Tank level");
51        M(NComp) as mol (Brief="Molar Holdup in the tank");
52        E as energy (Brief="Total Energy Holdup on tank");
53        vL as volume_mol (Brief="Liquid Molar Volume");
54
55        EQUATIONS
56        "Mass balance"
57        diff(M) = Inlet.F*Inlet.z - Outlet.F*Outlet.z;
58       
59        "Energy balance"
60        diff(E) = Inlet.F*Inlet.h - Outlet.F*Outlet.h + Q;
61
62        "Energy Holdup"
63        E = sum(M)*Outlet.h;
64
65        "Mechanical Equilibrium"
66        Inlet.P = Outlet.P;
67       
68        "Liquid Volume"
69        vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z);
70       
71        "Composition"
72        M = Outlet.z*sum(M);
73       
74        "Level of liquid phase"
75        Level = sum(M)*vL/Across;
76end
77
78#*----------------------------------------------------------
79*
80*Model of a tank with a lain cylinder geometry
81*
82*---------------------------------------------------------*#
83Model tank_cylindrical
84
85        PARAMETERS
86        outer PP as Plugin;
87        outer NComp as Integer;
88        radius as length(Brief="Tank radius");
89        L as length(Brief="Tank length");
90       
91        VARIABLES
92in      Inlet as stream;
93out     Outlet as liquid_stream;
94
95in      Q as heat_rate (Brief="Rate of heat supply");
96        Level    as length(Brief="Tank level");
97        Across as area (Brief="Tank cross section area", Default=2);
98        M(NComp) as mol (Brief="Molar Holdup in the tank");
99        E as energy (Brief="Total Energy Holdup on tank");
100        vL as volume_mol (Brief="Liquid Molar Volume");
101
102        EQUATIONS
103        "Mass balance"
104        diff(M) = Inlet.F*Inlet.z - Outlet.F*Outlet.z;
105       
106        "Energy balance"
107        diff(E) = Inlet.F*Inlet.h - Outlet.F*Outlet.h + Q;
108
109        "Energy Holdup"
110        E = sum(M)*Outlet.h;
111       
112        "Mechanical Equilibrium"
113        Inlet.P = Outlet.P;
114       
115        "Liquid Volume"
116        vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z);
117       
118        "Composition"
119        M = Outlet.z*sum(M);
120       
121        "Cylindrical Area"
122        Across = radius^2 * (asin(1) - asin((radius-Level)/radius) ) +
123                                (Level-radius)*sqrt(Level*(2*radius - Level));
124
125        "Level of liquid phase"
126        Level = sum(M)*vL/Across;
127end
128
129Model tank_simplified
130        PARAMETERS
131        k as Real (Brief="Valve Constant", Unit = 'm^2.5/h', Default=4);
132        A as area (Brief="Tank area", Default=2);
133
134        VARIABLES
135        h    as length(Brief="Tank level");
136in      Fin  as flow_vol(Brief="Input flow");
137out     Fout as flow_vol(Brief="Output flow");
138
139        EQUATIONS
140        "Mass balance"
141        diff(A*h) = Fin - Fout;
142       
143        "Valve equation"
144        Fout = k*sqrt(h);               
145end
146
147Model tank_feed
148
149        PARAMETERS
150        outer PP as Plugin;
151        outer NComp as Integer;
152        Across as area (Brief="Tank cross section area", Default=2);
153       
154        VARIABLES
155in      Feed as stream;
156in      Inlet as stream;
157out     Outlet as liquid_stream;
158
159in      Q as heat_rate (Brief="Rate of heat supply");
160        Level    as length(Brief="Tank level");
161        M(NComp) as mol (Brief="Molar Holdup in the tank");
162        E as energy (Brief="Total Energy Holdup on tank");
163        vL as volume_mol (Brief="Liquid Molar Volume");
164
165        EQUATIONS
166        "Mass balance"
167        diff(M) = Feed.F*Feed.z + Inlet.F*Inlet.z - Outlet.F*Outlet.z;
168       
169        "Energy balance"
170        diff(E) = Feed.F*Feed.h + Inlet.F*Inlet.h - Outlet.F*Outlet.h + Q;
171
172        "Energy Holdup"
173        E = sum(M)*Outlet.h;
174
175        "Mechanical Equilibrium"
176        Inlet.P = Outlet.P;
177       
178        "Liquid Volume"
179        vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z);
180       
181        "Composition"
182        M = Outlet.z*sum(M);
183       
184        "Level of liquid phase"
185        Level = sum(M)*vL/Across;
186end
Note: See TracBrowser for help on using the repository browser.