source: branches/new_gui/my_folders/ntanks_plant/ntanks_plant.mso @ 918

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

more folders

File size: 5.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* Plant of n-Tanks
17*----------------------------------------------------------------------
18*
19*   Description:
20*      Plant of n-tanks
21*
22*   Devices:
23*       * inlet and outlet feeds
24*       * mixer
25*       * splitter
26*               * tank
27*
28*----------------------------------------------------------------------
29* Author: Rodolfo Rodrigues
30*--------------------------------------------------------------------*#
31
32using "types";
33
34
35Model vol_tank
36        ATTRIBUTES
37        Pallete = false;
38        Brief = "Routine to calculate tank volume";
39        Info = "
40Based in 2 geometry and 2 configurations/orientations
41
42== Geometry ==
43* Flat (no head) (default)
44* Spherical
45
46== Orientation ==
47* Vertical (default)
48* Horizontal
49";
50       
51        PARAMETERS
52        pi              as positive     (Brief="Pi value", Default=3.141593, Symbol="\pi");
53        Geometry        as Switcher     (Brief="Tank head type", Valid=["flat","spherical"], Default="flat");
54        Orientation     as Switcher(Brief="Tank orientation", Valid=["vertical","horizontal"], Default="vertical");
55       
56        VARIABLES
57        V       as volume       (Brief="Level tank volume");
58        Vt              as volume       (Brief="Tank volume");
59        L       as length       (Brief="Tank length");
60        Level   as length       (Brief="Tank level");
61        D               as length       (Brief="Tank diameter");
62        Across  as area         (Brief="Tank cross section area");
63       
64        EQUATIONS
65        "Content volume"
66        V = Across*Level;
67       
68        switch Orientation
69                case "vertical":
70                        switch Geometry
71                                case "flat":
72                                "Tank volume"
73                                        Vt = pi/4*(D^2)*L;
74                                "Level tank volume"
75                                        V = pi/4*(D^2)*Level;
76       
77                                case "spherical":
78                                "Tank volume"
79                                        Vt = pi/6*D^3;
80                                "Level tank volume"
81                                        V = pi/3*Level^2*(3*D/2 - Level);
82                        end     
83                case "horizontal":
84                        switch Geometry
85                                case "flat":
86                                "Tank volume"
87                                        Vt = pi/4*(D^2)*L;
88                                "Level tank volume"
89                                        V = ((D^2)*acos((D - 2*Level)/D)/4/'rad' -
90                                        (D - 2*Level)*sqrt(D*Level - Level^2)/2)*L;
91                       
92                                case "spherical":
93                                "Tank volume"
94                                        Vt = pi/6*D^3;
95                                "Level tank volume"
96                                        V = pi/3*Level^2*(3*D/2 - Level);
97                        end
98        end
99end
100
101
102#*---------------------------------------------------------------------
103* Simple feed model
104*--------------------------------------------------------------------*#
105Model stream
106        ATTRIBUTES
107        Brief   = "Simple stream model";
108       
109        VARIABLES
110        F       as flow_vol             (Brief="Volumetric flow", DisplayUnit='cm^3/s');
111end
112
113Model feed_inlet
114        ATTRIBUTES
115        Pallete = true;
116        Brief   = "Simple inlet stream";
117        Icon    = "icon/inlet";
118       
119        VARIABLES
120out Outlet      as stream       (Brief="Outlet stream", PosX=0.5, PosY=0, Symbol="_{out}");
121end
122
123Model feed_outlet
124        ATTRIBUTES
125        Pallete = true;
126        Brief   = "Simple outlet stream";
127        Icon    = "icon/outlet";
128       
129        VARIABLES
130in      Inlet   as stream       (Brief="Inlet stream", PosX=0.5, PosY=0, Symbol="_{in}");
131end
132
133
134#*---------------------------------------------------------------------
135* Simple splitter model
136*--------------------------------------------------------------------*#
137Model simple_splitter
138        ATTRIBUTES
139        Pallete = true;
140        Icon = "icon/connection";
141        Brief = "Simple model of a splitter with 2 outlet streams.";
142       
143        VARIABLES
144in  Inlet   as stream   (Brief="Inlet stream", PosX=0.5, PosY=1, Symbol="_{in}");
145out Outlet1 as stream   (Brief="Outlet stream 1", PosX=1, PosY=0.5, Symbol="_{out,1}");
146out Outlet2 as stream   (Brief="Outlet stream 2", PosX=0.5, PosY=0, Symbol="_{out,2}");
147        X               as fraction     (Brief="Fraction to Outlet 1");
148
149        EQUATIONS
150        "Material balance"
151        Outlet1.F + Outlet2.F = Inlet.F;
152       
153        "Outlet stream 1"
154        Outlet1.F = Inlet.F*X;
155end
156
157
158#*---------------------------------------------------------------------
159* Simple mixer model
160*--------------------------------------------------------------------*#
161Model simple_mixer
162        ATTRIBUTES
163        Pallete = true;
164        Icon = "icon/connection";
165        Brief = "Simple model of a mixer with 2 inlet streams.";
166       
167        VARIABLES
168in  Inlet1      as stream       (Brief="Inlet stream 1", PosX=0, PosY=0.5, Symbol="_{in,1}");
169in  Inlet2      as stream       (Brief="Inlet stream 2", PosX=0.5, PosY=0, Symbol="_{in,2}");
170out Outlet      as stream       (Brief="Outlet stream", PosX=0.5, PosY=1, Symbol="_{out}");
171       
172        EQUATIONS
173        "Material balance"
174        Outlet.F = Inlet1.F + Inlet1.F;
175end
176
177
178#*---------------------------------------------------------------------
179* Simple tank model
180*--------------------------------------------------------------------*#
181Model simple_tank
182        ATTRIBUTES
183        Pallete = true;
184        Icon = "icon/tank";
185        Brief = "Simple model of a tank.";
186       
187        PARAMETERS
188        g               as acceleration(Brief="Acceleration of gravity", Default=9.80665);
189       
190        VARIABLES
191in      Inlet   as stream       (Brief="Inlet stream", PosX=0.5, PosY=0, Symbol="_{in}");
192out     Outlet  as stream       (Brief="Outlet stream", PosX=0.5, PosY=1, Symbol="_{out}");
193
194        tank    as vol_tank     (Brief="Tank volume routine calculation", Symbol="_{tank}");
195        K               as Real         (Brief="Discharge constant", Unit='cm^2.5/s');
196        a               as area         (Brief="Cross-section of outlet hole", DisplayUnit='cm^2');
197       
198        EQUATIONS
199        "Material balance"
200        diff(tank.V) = Inlet.F - Outlet.F;
201       
202        "Outlet flow"
203        Outlet.F = K*sqrt(tank.Level);
204       
205        "Discharge constant"
206        K = a*sqrt(2*g);
207end
Note: See TracBrowser for help on using the repository browser.