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