source: trunk/sample/miscellaneous/ntanks_plant.mso @ 411

Last change on this file since 411 was 411, checked in by Rodolfo Rodrigues, 16 years ago

Dynamic plant of n-tanks (didactic sample). First update.

File size: 3.9 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";
33using "reactors/vol_tank";
34
35
36
37#*---------------------------------------------------------------------
38* Simple feed model
39*--------------------------------------------------------------------*#
40Model stream
41        VARIABLES
42        F       as flow_vol             (Brief="Volumetric flow", DisplayUnit='cm^3/s');
43end
44
45Model feed_inlet
46        ATTRIBUTES
47        Pallete = true;
48        Brief   = "Simple inlet stream";
49        Icon    = "icon/inlet";
50       
51        VARIABLES
52out Outlet      as stream       (Brief="Outlet stream", PosX=0.5, PosY=0);
53end
54
55Model feed_outlet
56        ATTRIBUTES
57        Pallete = true;
58        Brief   = "Simple outlet stream";
59        Icon    = "icon/outlet";
60       
61        VARIABLES
62in      Inlet   as stream       (Brief="Inlet stream", PosX=0.5, PosY=0);
63end
64
65
66#*---------------------------------------------------------------------
67* Simple splitter model
68*--------------------------------------------------------------------*#
69Model simple_splitter
70        ATTRIBUTES
71        Pallete = true;
72        Icon = "icon/connection";
73        Brief = "Simple model of a splitter with 2 outlet streams.";
74       
75        VARIABLES
76in  Inlet   as stream   (Brief="Inlet stream", PosX=0.5, PosY=1);
77out Outlet1 as stream   (Brief="Outlet stream 1", PosX=1, PosY=0.5);
78out Outlet2 as stream   (Brief="Outlet stream 2", PosX=0.5, PosY=0);
79        X               as fraction     (Brief="Fraction to Outlet 1");
80
81        EQUATIONS
82        "Material balance"
83        Outlet1.F + Outlet2.F = Inlet.F;
84       
85        "Outlet stream 1"
86        Outlet1.F = Inlet.F*X;
87end
88
89
90#*---------------------------------------------------------------------
91* Simple mixer model
92*--------------------------------------------------------------------*#
93Model simple_mixer
94        ATTRIBUTES
95        Pallete = true;
96        Icon = "icon/connection";
97        Brief = "Simple model of a mixer with 2 inlet streams.";
98       
99        VARIABLES
100in  Inlet1      as stream       (Brief="Inlet stream 1", PosX=0, PosY=0.5);
101in  Inlet2      as stream       (Brief="Inlet stream 2", PosX=0.5, PosY=0);
102out Outlet      as stream       (Brief="Outlet stream", PosX=0.5, PosY=1);
103       
104        EQUATIONS
105        "Material balance"
106        Outlet.F = Inlet1.F + Inlet1.F;
107end
108
109
110#*---------------------------------------------------------------------
111* Simple tank model
112*--------------------------------------------------------------------*#
113Model simple_tank
114        ATTRIBUTES
115        Pallete = true;
116        Icon = "icon/tank";
117        Brief = "Simple model of a tank.";
118       
119        PARAMETERS
120        pi              as Real         (Brief="Number pi", Default=3.141593);
121        g               as acceleration(Brief="Acceleration of gravity", Default=9.80665);
122       
123        VARIABLES
124in      Inlet   as stream       (Brief="Inlet stream", PosX=0.5, PosY=0);
125out     Outlet  as stream       (Brief="Outlet stream", PosX=0.5, PosY=1);
126
127        tank    as vol_tank     (Brief="Tank volume routine calculation");
128        K               as Real         (Brief="Discharge constant", Unit='cm^2.5/s');
129        a               as area         (Brief="Cross-section of outlet hole", DisplayUnit='cm^2');
130       
131        EQUATIONS
132        "Material balance"
133        diff(tank.V) = Inlet.F - Outlet.F;
134       
135        "Outlet flow"
136        Outlet.F = K*sqrt(tank.Level);
137       
138        "Constant"
139        K = a*sqrt(2*g);
140end
Note: See TracBrowser for help on using the repository browser.