Changeset 795 for branches/gui/eml
 Timestamp:
 Jul 18, 2009, 5:08:06 PM (14 years ago)
 Location:
 branches/gui/eml/stage_separators
 Files:

 2 added
 2 deleted
 1 edited
Legend:
 Unmodified
 Added
 Removed

branches/gui/eml/stage_separators/tank.mso
r794 r795 12 12 * EMSO is distributed under the therms of the ALSOC LICENSE as 13 13 * available at http://www.enq.ufrgs.br/alsoc. 14 *15 *16 * Model of tanks17 *18 * Streams:19 * * an inlet stream20 * * an outlet stream21 *22 * Specify:23 * * the Inlet stream24 * * the Outlet flow25 * * the tank Q26 *27 * Initial:28 * * the tank temperature (OutletL.T)29 * * the tank level (h)30 * * (NoComps  1) Outlet compositions31 14 * 32 15 * Author: Paula B. Staudt … … 124 107 end 125 108 126 Model RefluxDrum109 Model TankVL 127 110 128 111 ATTRIBUTES 129 112 Pallete = true; 130 Icon = "icon/RefluxDrum"; 131 Brief = "Model of a Reflux Drum with a lain cylinder geometry."; 113 Icon = "icon/TankVL"; 114 Brief = "Model of a Tank With Thermodynamic Equilibrium."; 115 Info = 116 "== ASSUMPTIONS == 117 * perfect mixing of both phases; 118 * thermodynamics equilibrium. 119 120 == SET == 121 *Orientation: vessel position  vertical or horizontal; 122 *Heads (bottom and top heads are identical) 123 **elliptical: 2:1 elliptical heads (25% of vessel diameter); 124 **hemispherical: hemispherical heads (50% of vessel diameter); 125 **flat: flat heads (0% of vessel diameter); 126 *Diameter: Vessel diameter; 127 *Lenght: Side length of the cylinder shell; 128 129 == SPECIFY == 130 * the Inlet stream; 131 * the outlet flows: OutletVapour.F and OutletLiquid.F; 132 * the InletQ (the model requires an energy stream, also you can use a controller for setting the heat duty using the heat_flow model). 133 134 == OPTIONAL == 135 * the TankVL model has three control ports 136 ** TI OutletLiquid Temperature Indicator; 137 ** PI OutletLiquid Pressure Indicator; 138 ** LI Level Indicator; 139 140 == INITIAL CONDITIONS == 141 * Initial_Temperature : the Tank temperature (OutletLiquid.T); 142 * Initial_Level : the Tank liquid level (Level); 143 * Initial_Composition : (NoComps) OutletLiquid compositions. 144 "; 145 146 PARAMETERS 147 outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); 148 outer NComp as Integer (Brief = "Number of components", Lower = 1); 149 150 Mw(NComp) as molweight (Brief="Mol Weight", Hidden=true); 151 pi as positive (Brief="Pi value", Default=3.141593,Hidden=true, Symbol="\pi"); 152 153 Orientation as Switcher (Valid=["vertical","horizontal"],Default="vertical"); 154 Heads as Switcher (Valid=["elliptical","hemispherical","flat"],Default="flat"); 155 Diameter as length (Brief="Vessel diameter", Symbol="D_{i}"); 156 Lenght as length (Brief="Side length of the cylinder shell", Symbol="L_{vessel}"); 157 158 Vhead_elliptical as volume (Brief="Elliptical Head Total Volume",Hidden=true, Symbol="V_{head}^{elliptical}"); 159 Vhead_hemispherical as volume (Brief="Hemispherical Head Total Volume",Hidden=true, Symbol="V_{head}^{hemispherical}"); 160 Vcylinder as volume (Brief="Cylinder Total Volume",Hidden=true, Symbol="V_{cylinder}"); 161 radius as length (Brief="Vessel radius",Hidden=true, Symbol="R_{cylinder}"); 162 163 Levelpercent_Initial as positive (Brief="Initial liquid height in Percent", Default = 0.70); 164 Temperature_Initial as temperature (Brief="Initial Liquid Temperature", Default = 330); 165 Composition_Initial(NComp) as fraction (Brief="Initial Composition", Default = 0.10); 166 167 SET 168 169 Mw=PP.MolecularWeight(); 170 171 Vhead_elliptical = (pi*Diameter^3)/12; 172 Vhead_hemispherical = (pi*Diameter^3)/6; 173 Vcylinder = 0.25*(pi*Diameter^2)*Lenght; 174 radius = 0.5*Diameter; 175 176 VARIABLES 177 178 in Inlet as stream (Brief="Feed Stream", PosX=0.22, PosY=0, Symbol="_{in}"); 179 out OutletLiquid as liquid_stream (Brief="Liquid outlet stream", PosX=0.43, PosY=1, Symbol="_{out}^{Liquid}"); 180 out OutletVapour as vapour_stream (Brief="Vapour outlet stream", PosX=0.68, PosY=0, Symbol="_{out}^{Vapour}"); 181 in InletQ as power (Brief="Heat Duty", PosX=0.735, PosY=1, Protected =true,Symbol="Q_{in}"); 182 183 Vtotal as volume (Brief="Vessel total volume",Protected=true, Symbol="V_{total}"); 184 Vfilled as volume (Brief="Vessel volume content",Protected=true, Symbol="V_{filled}"); 185 186 TotalHoldup(NComp) as mol (Brief="Molar Holdup in the Vessel", Protected=true); 187 LiquidHoldup as mol (Brief="Molar liquid holdup", Protected=true); 188 VapourHoldup as mol (Brief="Molar vapour holdup", Protected=true); 189 190 E as energy (Brief="Total Energy Holdup in the Vessel", Protected=true); 191 vL as volume_mol (Brief="Liquid Molar Volume", Protected=true); 192 vV as volume_mol (Brief="Vapour Molar volume", Protected=true); 193 Level as length (Brief="liquid height", Protected=true); 194 Across as area (Brief="Vessel cylinder shell Cross section area", Hidden=true, Symbol="A_{cross}"); 195 vfrac as positive (Brief="Vapourization fraction", Symbol="\phi", Protected=true); 196 Pratio as positive (Brief = "Pressure Ratio", Symbol ="P_{ratio}", Protected=true); 197 Pdrop as press_delta (Brief = "Pressure Drop", DisplayUnit = 'kPa', Symbol ="\Delta P", Protected=true); 198 199 out TI as control_signal (Brief="Temperature Indicator", PosX=0.525, PosY=0, Protected=true); 200 out PI as control_signal (Brief="Pressure Indicator", PosX=0.368, PosY=0, Protected=true); 201 out LI as control_signal (Brief="Level Indicator", PosX=1, PosY=0.6, Protected=true); 202 203 INITIAL 204 205 "Initial level Percent" 206 LI = Levelpercent_Initial; 207 208 "Initial Outlet Liquid Temperature" 209 OutletLiquid.T = Temperature_Initial; 210 211 "Initial Outlet Liquid Composition Normalized" 212 OutletLiquid.z(1:NComp  1) = Composition_Initial(1:NComp  1)/sum(Composition_Initial); 213 214 EQUATIONS 215 216 switch Orientation 217 218 case "vertical": 219 220 "Vessel Cross Section Area" 221 Across = 0.25*(pi*Diameter^2); 222 223 switch Heads 224 225 case "elliptical": 226 227 "Vessel Total Volume" 228 Vtotal = Vhead_elliptical + Vcylinder; 229 230 if Level < 0.25*Diameter then 231 232 "Vessel Filled Volume" 233 Vfilled = 0.25*pi*(((Diameter*Level)/(0.25*Diameter))^2)*(0.25*DiameterLevel/3); 234 235 else 236 237 "Vessel Filled Volume" 238 Vfilled = 0.25*pi*(Diameter^2)*(Level  0.25*Diameter/3); 239 240 end 241 242 case "hemispherical": 243 244 "Vessel Total Volume" 245 Vtotal = Vhead_hemispherical + Vcylinder; 246 247 if Level < 0.5*Diameter then 248 249 "Vessel Filled Volume" 250 Vfilled = 0.25*pi*(Level^2)*(2*Diameter4*Level/3); 251 252 else 253 254 "Vessel Filled Volume" 255 Vfilled = 0.25*pi*((2/3)*((0.5*Diameter)^3)  (0.25*(Diameter)^3) + Level*Diameter^2); 256 257 end 258 259 case "flat": 260 261 "Vessel Total Volume" 262 Vtotal = Vcylinder; 263 264 "Vessel Filled Volume" 265 Vfilled = Across*Level; 266 267 end 268 269 case "horizontal": 270 271 "Vessel Cross Section Area" 272 Across = (radius^2)*acos((radiusLevel)/radius)(radiusLevel)*sqrt((2*radius*LevelLevel^2)); 273 274 switch Heads 275 276 case "elliptical": 277 278 "Vessel Total Volume" 279 Vtotal = Vhead_elliptical + Vcylinder; 280 281 "Vessel Filled Volume" 282 Vfilled = 0.5236*Level^2*(1.5*DiameterLevel) + Across*Lenght; 283 284 case "hemispherical": 285 286 "Vessel Total Volume" 287 Vtotal = Vhead_hemispherical + Vcylinder; 288 289 "Vessel Filled Volume" 290 Vfilled = 1.0472*Level^2*(1.5*DiameterLevel) + Across*Lenght; 291 292 case "flat": 293 294 "Vessel Total Volume" 295 Vtotal = Vcylinder; 296 297 "Vessel Filled Volume" 298 Vfilled = Across*Lenght; 299 300 end 301 302 end 303 304 "Component Molar Balance" 305 diff(TotalHoldup)=Inlet.F*Inlet.z  OutletLiquid.F*OutletLiquid.z  OutletVapour.F*OutletVapour.z; 306 307 "Energy Balance" 308 diff(E) = Inlet.F*Inlet.h  OutletLiquid.F*OutletLiquid.h  OutletVapour.F*OutletVapour.h + InletQ; 309 310 "Molar Holdup" 311 TotalHoldup = LiquidHoldup*OutletLiquid.z + VapourHoldup*OutletVapour.z; 312 313 "Energy Holdup" 314 E = LiquidHoldup*OutletLiquid.h + VapourHoldup*OutletVapour.h  OutletLiquid.P*Vtotal; 315 316 "Mol fraction normalisation" 317 sum(OutletLiquid.z)=1.0; 318 319 "Mol fraction normalisation" 320 sum(OutletLiquid.z)=sum(OutletVapour.z); 321 322 "Vaporization Fraction" 323 OutletVapour.F = Inlet.F * vfrac; 324 325 "Liquid Volume" 326 vL = PP.LiquidVolume(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z); 327 328 "Vapour Volume" 329 vV = PP.VapourVolume(OutletVapour.T, OutletVapour.P, OutletVapour.z); 330 331 "Chemical Equilibrium" 332 PP.LiquidFugacityCoefficient(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z)*OutletLiquid.z = 333 PP.VapourFugacityCoefficient(OutletVapour.T, OutletVapour.P, OutletVapour.z)*OutletVapour.z; 334 335 "Thermal Equilibrium" 336 OutletVapour.T = OutletLiquid.T; 337 338 "Mechanical Equilibrium" 339 OutletVapour.P = OutletLiquid.P; 340 341 "Pressure Drop" 342 OutletLiquid.P = Inlet.P  Pdrop; 343 344 "Pressure Ratio" 345 OutletLiquid.P = Inlet.P * Pratio; 346 347 "Geometry Constraint" 348 Vtotal = LiquidHoldup * vL + VapourHoldup * vV; 349 350 "Temperature indicator" 351 TI * 'K' = OutletLiquid.T; 352 353 "Pressure indicator" 354 PI * 'atm' = OutletLiquid.P; 355 356 "Level indicator" 357 LI*Vtotal= Vfilled; 358 359 "Liquid Level" 360 LiquidHoldup * vL = Vfilled; 361 362 end 363 364 Model tank_cylindrical 365 ATTRIBUTES 366 Pallete = true; 367 Icon = "icon/TankHorizontal"; 368 Brief = "Model of a tank with a lain cylinder geometry."; 132 369 Info = 133 370 "== Specify == … … 157 394 158 395 SET 159 radius = 0.5*Diameter;396 radius = Diameter/2; 160 397 161 398 VARIABLES … … 216 453 end 217 454 218 Model tank_cylindrical219 ATTRIBUTES220 Pallete = true;221 Icon = "icon/TankHorizontal";222 Brief = "Model of a tank with a lain cylinder geometry.";223 Info =224 "== Specify ==225 * the Inlet stream;226 * the outlet flow;227 * the InletQ (requires an energy source).228 229 == Initial Conditions ==230 * the tank initial temperature;231 * the tank initial level;232 * the tank initial composition.233 ";234 235 PARAMETERS236 outer PP as Plugin (Brief = "External Physical Properties", Type="PP");237 outer NComp as Integer (Brief = "Number of Components");238 239 pi as positive (Brief="Pi value", Default=3.141593,Hidden=true);240 eps as positive (Brief="small number",Default=1E8,Hidden=true);241 Diameter as length (Brief="Tank internal Diameter",Default=1.5);242 radius as length (Brief="Tank radius",Hidden=true);243 L as length (Brief="Tank length",Default=5);244 245 Initial_Level as length (Brief="Initial Level of the Tank",Default=1);246 Initial_Temperature as temperature (Brief="Initial Temperature of Liquid",Default=300);247 Initial_Composition(NComp) as positive (Brief="Initial Liquid Composition",Lower=1E8,Default=0.1);248 249 SET250 radius = Diameter/2;251 252 VARIABLES253 in Inlet as stream (Brief="Inlet stream", PosX=0.1825, PosY=0, Symbol="_{in}");254 out Outlet as liquid_stream (Brief="Outlet liquid stream", PosX=1, PosY=1, Symbol="_{out}");255 in InletQ as power (Brief="Rate of heat supply", PosX=1, PosY=0.6160, Symbol="_{in}",Protected=true);256 Level as length (Brief="Tank level",Protected=true);257 Vtotal as volume (Brief="Tank total volume",Protected=true);258 Vfilled as volume (Brief="Tank volume content",Protected=true);259 Across as area (Brief="Tank cross section area", Default=2,Protected=true);260 E as energy (Brief="Total Energy Holdup on tank",Protected=true);261 vL as volume_mol (Brief="Liquid Molar Volume",Protected=true);262 M(NComp) as mol (Brief="Molar Holdup in the tank",Protected=true);263 264 INITIAL265 266 "Initial Level"267 Level = Initial_Level;268 269 "Initial Liquid Temperature"270 Outlet.T = Initial_Temperature;271 272 "Initial Liquid Composition"273 Outlet.z(1:NComp1) = Initial_Composition(1:NComp1)/sum(Initial_Composition);274 275 EQUATIONS276 277 "Tank total volume"278 Vtotal = (0.25*pi*(Diameter)^2)*L;279 280 "Mass balance"281 diff(M) = Inlet.F*Inlet.z  Outlet.F*Outlet.z;282 283 "Energy balance"284 diff(E) = Inlet.F*Inlet.h  Outlet.F*Outlet.h + InletQ;285 286 "Energy Holdup"287 E = sum(M)*Outlet.h;288 289 "Mechanical Equilibrium"290 Inlet.P = Outlet.P;291 292 "Liquid Volume"293 vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z);294 295 "Composition"296 M = Outlet.z*sum(M);297 298 "Cylindrical Area"299 Across = radius^2 * (asin(1)  asin((radiusLevel)/radius) ) + (Levelradius)*sqrt(Level*(2*radius  Level)+eps*'m^2');300 301 "Level of liquid phase"302 L*Across = sum(M)*vL;303 304 "Volume Filled of liquid phase"305 Vfilled = L*Across;306 307 end308 309 455 Model tank_feed 310 456 ATTRIBUTES
Note: See TracChangeset
for help on using the changeset viewer.