[1] | 1 | #*------------------------------------------------------------------- |
---|
[72] | 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 | *------------------------------------------------------------------- |
---|
[1] | 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 310 2007-07-13 21:28:33Z arge $ |
---|
| 34 | *--------------------------------------------------------------------*# |
---|
| 35 | |
---|
| 36 | using "streams"; |
---|
| 37 | |
---|
| 38 | Model tank |
---|
[270] | 39 | ATTRIBUTES |
---|
| 40 | Pallete = true; |
---|
[300] | 41 | Icon = "icon/Tank"; |
---|
[270] | 42 | Brief = "Model of a cylindrical tank."; |
---|
| 43 | Info = |
---|
| 44 | "Specify: |
---|
| 45 | * the Inlet stream; |
---|
| 46 | * the outlet flow; |
---|
| 47 | * the tank Q. |
---|
[1] | 48 | |
---|
[270] | 49 | Initial Conditions: |
---|
| 50 | * the tank initial temperature (OutletL.T); |
---|
| 51 | * the tank initial level (Level); |
---|
| 52 | * (NoComps - 1) OutletL (OR OutletV) compositions. |
---|
| 53 | "; |
---|
| 54 | |
---|
[1] | 55 | PARAMETERS |
---|
[210] | 56 | outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); |
---|
[125] | 57 | outer NComp as Integer; |
---|
[1] | 58 | Across as area (Brief="Tank cross section area", Default=2); |
---|
| 59 | |
---|
| 60 | VARIABLES |
---|
| 61 | in Inlet as stream; |
---|
[125] | 62 | out Outlet as liquid_stream; |
---|
[1] | 63 | |
---|
[310] | 64 | in InletQ as energy_stream (Brief="Rate of heat supply"); |
---|
[1] | 65 | Level as length(Brief="Tank level"); |
---|
| 66 | M(NComp) as mol (Brief="Molar Holdup in the tank"); |
---|
| 67 | E as energy (Brief="Total Energy Holdup on tank"); |
---|
| 68 | vL as volume_mol (Brief="Liquid Molar Volume"); |
---|
| 69 | |
---|
| 70 | EQUATIONS |
---|
| 71 | "Mass balance" |
---|
| 72 | diff(M) = Inlet.F*Inlet.z - Outlet.F*Outlet.z; |
---|
| 73 | |
---|
| 74 | "Energy balance" |
---|
[310] | 75 | diff(E) = Inlet.F*Inlet.h - Outlet.F*Outlet.h + InletQ.Q; |
---|
[1] | 76 | |
---|
| 77 | "Energy Holdup" |
---|
| 78 | E = sum(M)*Outlet.h; |
---|
| 79 | |
---|
| 80 | "Mechanical Equilibrium" |
---|
| 81 | Inlet.P = Outlet.P; |
---|
| 82 | |
---|
| 83 | "Liquid Volume" |
---|
| 84 | vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z); |
---|
| 85 | |
---|
| 86 | "Composition" |
---|
| 87 | M = Outlet.z*sum(M); |
---|
| 88 | |
---|
| 89 | "Level of liquid phase" |
---|
| 90 | Level = sum(M)*vL/Across; |
---|
| 91 | end |
---|
| 92 | |
---|
[72] | 93 | #*---------------------------------------------------------- |
---|
| 94 | * |
---|
| 95 | *Model of a tank with a lain cylinder geometry |
---|
| 96 | * |
---|
| 97 | *---------------------------------------------------------*# |
---|
[1] | 98 | Model tank_cylindrical |
---|
[270] | 99 | ATTRIBUTES |
---|
| 100 | Pallete = true; |
---|
[300] | 101 | Icon = "icon/TankHorizontal"; |
---|
[270] | 102 | Brief = "Model of a tank with a lain cylinder geometry."; |
---|
| 103 | Info = |
---|
| 104 | "Specify: |
---|
| 105 | * the Inlet stream; |
---|
| 106 | * the outlet flow; |
---|
| 107 | * the tank Q. |
---|
[1] | 108 | |
---|
[270] | 109 | Initial Conditions: |
---|
| 110 | * the tank initial temperature (OutletL.T); |
---|
| 111 | * the tank initial level (Level); |
---|
| 112 | * (NoComps - 1) OutletL (OR OutletV) compositions. |
---|
| 113 | "; |
---|
| 114 | |
---|
[1] | 115 | PARAMETERS |
---|
[210] | 116 | outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); |
---|
[125] | 117 | outer NComp as Integer; |
---|
[1] | 118 | radius as length(Brief="Tank radius"); |
---|
| 119 | L as length(Brief="Tank length"); |
---|
| 120 | |
---|
| 121 | VARIABLES |
---|
| 122 | in Inlet as stream; |
---|
[125] | 123 | out Outlet as liquid_stream; |
---|
[1] | 124 | |
---|
[310] | 125 | in InletQ as energy_stream (Brief="Rate of heat supply"); |
---|
[1] | 126 | Level as length(Brief="Tank level"); |
---|
| 127 | Across as area (Brief="Tank cross section area", Default=2); |
---|
| 128 | M(NComp) as mol (Brief="Molar Holdup in the tank"); |
---|
| 129 | E as energy (Brief="Total Energy Holdup on tank"); |
---|
| 130 | vL as volume_mol (Brief="Liquid Molar Volume"); |
---|
| 131 | |
---|
| 132 | EQUATIONS |
---|
| 133 | "Mass balance" |
---|
| 134 | diff(M) = Inlet.F*Inlet.z - Outlet.F*Outlet.z; |
---|
| 135 | |
---|
| 136 | "Energy balance" |
---|
[310] | 137 | diff(E) = Inlet.F*Inlet.h - Outlet.F*Outlet.h + InletQ.Q; |
---|
[1] | 138 | |
---|
| 139 | "Energy Holdup" |
---|
| 140 | E = sum(M)*Outlet.h; |
---|
| 141 | |
---|
| 142 | "Mechanical Equilibrium" |
---|
| 143 | Inlet.P = Outlet.P; |
---|
| 144 | |
---|
| 145 | "Liquid Volume" |
---|
| 146 | vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z); |
---|
| 147 | |
---|
| 148 | "Composition" |
---|
| 149 | M = Outlet.z*sum(M); |
---|
| 150 | |
---|
| 151 | "Cylindrical Area" |
---|
| 152 | Across = radius^2 * (asin(1) - asin((radius-Level)/radius) ) + |
---|
| 153 | (Level-radius)*sqrt(Level*(2*radius - Level)); |
---|
| 154 | |
---|
| 155 | "Level of liquid phase" |
---|
[183] | 156 | L*Across = sum(M)*vL; |
---|
[1] | 157 | end |
---|
| 158 | |
---|
| 159 | Model tank_simplified |
---|
| 160 | PARAMETERS |
---|
[174] | 161 | k as Real (Brief="Valve Constant", Unit = 'm^2.5/h', Default=4); |
---|
[1] | 162 | A as area (Brief="Tank area", Default=2); |
---|
| 163 | |
---|
| 164 | VARIABLES |
---|
| 165 | h as length(Brief="Tank level"); |
---|
| 166 | in Fin as flow_vol(Brief="Input flow"); |
---|
| 167 | out Fout as flow_vol(Brief="Output flow"); |
---|
| 168 | |
---|
| 169 | EQUATIONS |
---|
| 170 | "Mass balance" |
---|
| 171 | diff(A*h) = Fin - Fout; |
---|
| 172 | |
---|
| 173 | "Valve equation" |
---|
| 174 | Fout = k*sqrt(h); |
---|
| 175 | end |
---|
[64] | 176 | |
---|
| 177 | Model tank_feed |
---|
| 178 | |
---|
| 179 | PARAMETERS |
---|
[210] | 180 | outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); |
---|
[125] | 181 | outer NComp as Integer; |
---|
[64] | 182 | Across as area (Brief="Tank cross section area", Default=2); |
---|
| 183 | |
---|
| 184 | VARIABLES |
---|
| 185 | in Feed as stream; |
---|
| 186 | in Inlet as stream; |
---|
[125] | 187 | out Outlet as liquid_stream; |
---|
[64] | 188 | |
---|
[310] | 189 | in InletQ as energy_stream (Brief="Rate of heat supply"); |
---|
[64] | 190 | Level as length(Brief="Tank level"); |
---|
| 191 | M(NComp) as mol (Brief="Molar Holdup in the tank"); |
---|
| 192 | E as energy (Brief="Total Energy Holdup on tank"); |
---|
| 193 | vL as volume_mol (Brief="Liquid Molar Volume"); |
---|
| 194 | |
---|
| 195 | EQUATIONS |
---|
| 196 | "Mass balance" |
---|
| 197 | diff(M) = Feed.F*Feed.z + Inlet.F*Inlet.z - Outlet.F*Outlet.z; |
---|
| 198 | |
---|
| 199 | "Energy balance" |
---|
[310] | 200 | diff(E) = Feed.F*Feed.h + Inlet.F*Inlet.h - Outlet.F*Outlet.h + InletQ.Q; |
---|
[64] | 201 | |
---|
| 202 | "Energy Holdup" |
---|
| 203 | E = sum(M)*Outlet.h; |
---|
| 204 | |
---|
| 205 | "Mechanical Equilibrium" |
---|
| 206 | Inlet.P = Outlet.P; |
---|
| 207 | |
---|
| 208 | "Liquid Volume" |
---|
| 209 | vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z); |
---|
| 210 | |
---|
| 211 | "Composition" |
---|
| 212 | M = Outlet.z*sum(M); |
---|
| 213 | |
---|
| 214 | "Level of liquid phase" |
---|
| 215 | Level = sum(M)*vL/Across; |
---|
| 216 | end |
---|