Changeset 879 for branches/gui/eml/stage_separators/tank.mso
 Timestamp:
 Nov 9, 2009, 2:11:31 PM (13 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

branches/gui/eml/stage_separators/tank.mso
r834 r879 19 19 using "streams"; 20 20 21 Model VesselVolume 22 23 ATTRIBUTES 24 Pallete = false; 25 Brief = "Model to calculate vessel total volume and vessel filled volume from 26 different geometries and orientations."; 27 Info = 28 "== SET == 29 *Orientation: vessel position  vertical or horizontal; 30 *Heads (bottom and top heads are identical) 31 **elliptical: 2:1 elliptical heads (25% of vessel diameter); 32 **hemispherical: hemispherical heads (50% of vessel diameter); 33 **flat: flat heads (0% of vessel diameter); 34 *Diameter: Vessel diameter; 35 *Lenght: Side length of the cylinder shell; 36 "; 37 38 PARAMETERS 39 PI as positive (Brief="Pi value", Default=3.141593,Hidden=true, Symbol="\pi"); 40 Gconst as acceleration (Brief="Gravity Acceleration",Default=9.81,Hidden=true); 41 42 Orientation as Switcher (Valid=["vertical","horizontal"],Default="vertical"); 43 Heads as Switcher (Valid=["elliptical","hemispherical","flat"],Default="flat"); 44 Diameter as length (Brief="Vessel diameter", Default= 2, Symbol="D_{i}"); 45 Lenght as length (Brief="Side length of the cylinder shell", Default= 6, Symbol="L_{vessel}"); 46 47 Vhead_elliptical as volume (Brief="Elliptical Head Total Volume",Hidden=true, Symbol="V_{head}^{elliptical}"); 48 Vhead_hemispherical as volume (Brief="Hemispherical Head Total Volume",Hidden=true, Symbol="V_{head}^{hemispherical}"); 49 Vcylinder as volume (Brief="Cylinder Total Volume",Hidden=true, Symbol="V_{cylinder}"); 50 radius as length (Brief="Vessel radius",Hidden=true, Symbol="R_{cylinder}"); 51 52 SET 53 54 Gconst = 9.81 * 'm/(s^2)'; 55 Vhead_elliptical = (PI*Diameter^3)/12; 56 Vhead_hemispherical = (PI*Diameter^3)/6; 57 Vcylinder = 0.25*(PI*Diameter^2)*Lenght; 58 radius = 0.5*Diameter; 59 60 VARIABLES 61 62 Vtotal as volume (Brief="Vessel total volume",Protected=true, Symbol="V_{total}"); 63 Vfilled as volume (Brief="Vessel volume content",Protected=true, Symbol="V_{filled}"); 64 Level as length (Brief="liquid height", Protected=true); 65 Across as area (Brief="Vessel cylinder shell Cross section area", Hidden=true, Symbol="A_{cross}"); 66 67 EQUATIONS 68 69 switch Orientation 70 71 case "vertical": 72 73 "Vessel Cross Section Area" 74 Across = 0.25*(PI*Diameter^2); 75 76 switch Heads 77 78 case "elliptical": 79 80 "Vessel Total Volume" 81 Vtotal = Vhead_elliptical + Vcylinder; 82 83 if Level < 0.25*Diameter then 84 85 "Vessel Filled Volume" 86 Vfilled = 0.25*PI*(((Diameter*Level)/(0.25*Diameter))^2)*(0.25*DiameterLevel/3); 87 88 else 89 90 "Vessel Filled Volume" 91 Vfilled = 0.25*PI*(Diameter^2)*(Level  0.25*Diameter/3); 92 93 end 94 95 case "hemispherical": 96 97 "Vessel Total Volume" 98 Vtotal = Vhead_hemispherical + Vcylinder; 99 100 if Level < 0.5*Diameter then 101 102 "Vessel Filled Volume" 103 Vfilled = 0.25*PI*(Level^2)*(2*Diameter4*Level/3); 104 105 else 106 107 "Vessel Filled Volume" 108 Vfilled = 0.25*PI*((2/3)*((0.5*Diameter)^3)  (0.25*(Diameter)^3) + Level*Diameter^2); 109 110 end 111 112 case "flat": 113 114 "Vessel Total Volume" 115 Vtotal = Vcylinder; 116 117 "Vessel Filled Volume" 118 Vfilled = Across*Level; 119 120 end 121 122 case "horizontal": 123 124 "Vessel Cross Section Area" 125 Across = (radius^2)*acos((radiusLevel)/radius)(radiusLevel)*sqrt((2*radius*LevelLevel^2)); 126 127 switch Heads 128 129 case "elliptical": 130 131 "Vessel Total Volume" 132 Vtotal = Vhead_elliptical + Vcylinder; 133 134 "Vessel Filled Volume" 135 Vfilled = 0.5236*Level^2*(1.5*DiameterLevel) + Across*Lenght; 136 137 case "hemispherical": 138 139 "Vessel Total Volume" 140 Vtotal = Vhead_hemispherical + Vcylinder; 141 142 "Vessel Filled Volume" 143 Vfilled = 1.0472*Level^2*(1.5*DiameterLevel) + Across*Lenght; 144 145 case "flat": 146 147 "Vessel Total Volume" 148 Vtotal = Vcylinder; 149 150 "Vessel Filled Volume" 151 Vfilled = Across*Lenght; 152 153 end 154 155 end 156 157 end 158 21 159 Model TankVL 22 160 … … 61 199 62 200 Mw(NComp) as molweight (Brief="Mol Weight", Hidden=true); 63 pi as positive (Brief="Pi value", Default=3.141593,Hidden=true, Symbol="\pi"); 64 g as acceleration (Brief="Gravity Acceleration",Default=9.81,Hidden=true); 65 66 67 Orientation as Switcher (Valid=["vertical","horizontal"],Default="vertical"); 68 Heads as Switcher (Valid=["elliptical","hemispherical","flat"],Default="flat"); 69 Diameter as length (Brief="Vessel diameter", Symbol="D_{i}"); 70 Lenght as length (Brief="Side length of the cylinder shell", Symbol="L_{vessel}"); 71 72 Vhead_elliptical as volume (Brief="Elliptical Head Total Volume",Hidden=true, Symbol="V_{head}^{elliptical}"); 73 Vhead_hemispherical as volume (Brief="Hemispherical Head Total Volume",Hidden=true, Symbol="V_{head}^{hemispherical}"); 74 Vcylinder as volume (Brief="Cylinder Total Volume",Hidden=true, Symbol="V_{cylinder}"); 75 radius as length (Brief="Vessel radius",Hidden=true, Symbol="R_{cylinder}"); 76 201 202 Gconst as acceleration (Brief="Gravity Acceleration",Default=9.81,Hidden=true); 77 203 low_flow as flow_mol (Brief = "Low Flow",Default = 1E6, Hidden=true); 78 204 zero_flow as flow_mol (Brief = "No Flow",Default = 0, Hidden=true); … … 89 215 90 216 Mw=PP.MolecularWeight(); 91 g = 9.81 * 'm/(s^2)'; 92 Vhead_elliptical = (pi*Diameter^3)/12; 93 Vhead_hemispherical = (pi*Diameter^3)/6; 94 Vcylinder = 0.25*(pi*Diameter^2)*Lenght; 95 radius = 0.5*Diameter; 96 217 Gconst = 9.81 * 'm/(s^2)'; 97 218 low_flow = 1E6 * 'kmol/h'; 98 219 zero_flow = 0 * 'kmol/h'; … … 100 221 101 222 VARIABLES 223 224 Geometry as VesselVolume (Brief="Vessel Geometry", Symbol=" "); 102 225 103 226 in Inlet as stream (Brief="Feed Stream", PosX=0.22, PosY=0, Symbol="_{in}"); … … 106 229 in InletQ as power (Brief="Heat Duty", PosX=0.735, PosY=1, Protected =true,Symbol="Q_{in}"); 107 230 108 Vtotal as volume (Brief="Vessel total volume",Protected=true, Symbol="V_{total}");109 Vfilled as volume (Brief="Vessel volume content",Protected=true, Symbol="V_{filled}");110 111 231 TotalHoldup(NComp) as mol (Brief="Molar Holdup in the Vessel", Protected=true); 112 232 LiquidHoldup as mol (Brief="Molar liquid holdup", Protected=true); … … 116 236 vL as volume_mol (Brief="Liquid Molar Volume", Protected=true); 117 237 vV as volume_mol (Brief="Vapour Molar volume", Protected=true); 118 Level as length (Brief="liquid height", Protected=true);119 Across as area (Brief="Vessel cylinder shell Cross section area", Hidden=true, Symbol="A_{cross}");120 238 Pdrop as press_delta (Brief = "Pressure Drop", DisplayUnit = 'kPa', Symbol ="\Delta P", Protected=true); 121 239 Peq as pressure (Brief="Equilibrium pressure on the liquid surface", Protected=true, Symbol="\Delta P_{eq}"); … … 139 257 EQUATIONS 140 258 141 switch Orientation142 143 case "vertical":144 145 "Vessel Cross Section Area"146 Across = 0.25*(pi*Diameter^2);147 148 switch Heads149 150 case "elliptical":151 152 "Vessel Total Volume"153 Vtotal = Vhead_elliptical + Vcylinder;154 155 if Level < 0.25*Diameter then156 157 "Vessel Filled Volume"158 Vfilled = 0.25*pi*(((Diameter*Level)/(0.25*Diameter))^2)*(0.25*DiameterLevel/3);159 160 else161 162 "Vessel Filled Volume"163 Vfilled = 0.25*pi*(Diameter^2)*(Level  0.25*Diameter/3);164 165 end166 167 case "hemispherical":168 169 "Vessel Total Volume"170 Vtotal = Vhead_hemispherical + Vcylinder;171 172 if Level < 0.5*Diameter then173 174 "Vessel Filled Volume"175 Vfilled = 0.25*pi*(Level^2)*(2*Diameter4*Level/3);176 177 else178 179 "Vessel Filled Volume"180 Vfilled = 0.25*pi*((2/3)*((0.5*Diameter)^3)  (0.25*(Diameter)^3) + Level*Diameter^2);181 182 end183 184 case "flat":185 186 "Vessel Total Volume"187 Vtotal = Vcylinder;188 189 "Vessel Filled Volume"190 Vfilled = Across*Level;191 192 end193 194 case "horizontal":195 196 "Vessel Cross Section Area"197 Across = (radius^2)*acos((radiusLevel)/radius)(radiusLevel)*sqrt((2*radius*LevelLevel^2));198 199 switch Heads200 201 case "elliptical":202 203 "Vessel Total Volume"204 Vtotal = Vhead_elliptical + Vcylinder;205 206 "Vessel Filled Volume"207 Vfilled = 0.5236*Level^2*(1.5*DiameterLevel) + Across*Lenght;208 209 case "hemispherical":210 211 "Vessel Total Volume"212 Vtotal = Vhead_hemispherical + Vcylinder;213 214 "Vessel Filled Volume"215 Vfilled = 1.0472*Level^2*(1.5*DiameterLevel) + Across*Lenght;216 217 case "flat":218 219 "Vessel Total Volume"220 Vtotal = Vcylinder;221 222 "Vessel Filled Volume"223 Vfilled = Across*Lenght;224 225 end226 227 end228 229 259 switch NormalFlow 230 260 … … 251 281 252 282 "Energy Holdup" 253 E = LiquidHoldup*OutletLiquid.h + VapourHoldup*OutletVapour.h  OutletLiquid.P* Vtotal;283 E = LiquidHoldup*OutletLiquid.h + VapourHoldup*OutletVapour.h  OutletLiquid.P*Geometry.Vtotal; 254 284 255 285 "Mol fraction normalisation" … … 276 306 277 307 "Static Head" 278 Pstatic = PP.LiquidDensity(OutletLiquid.T, Peq, OutletLiquid.z) * g *Level;308 Pstatic = PP.LiquidDensity(OutletLiquid.T, Peq, OutletLiquid.z) * Gconst * Geometry.Level; 279 309 280 310 "Mechanical Equilibrium for the Liquid Phase" … … 285 315 286 316 "Geometry Constraint" 287 Vtotal = LiquidHoldup * vL + VapourHoldup * vV;317 Geometry.Vtotal = LiquidHoldup * vL + VapourHoldup * vV; 288 318 289 319 "Temperature indicator" … … 294 324 295 325 "Level indicator" 296 LI* Vtotal=Vfilled;326 LI*Geometry.Vtotal= Geometry.Vfilled; 297 327 298 328 "Liquid Level" 299 LiquidHoldup * vL = Vfilled;329 LiquidHoldup * vL = Geometry.Vfilled; 300 330 301 331 end … … 341 371 outer NComp as Integer (Brief = "Number of components", Lower = 1); 342 372 343 pi as positive (Brief="Pi value", Default=3.141593,Hidden=true, Symbol="\pi"); 344 g as acceleration (Brief="Gravity Acceleration",Default=9.81,Hidden=true); 345 346 Orientation as Switcher (Valid=["vertical","horizontal"],Default="vertical"); 347 Heads as Switcher (Valid=["elliptical","hemispherical","flat"],Default="flat"); 348 Diameter as length (Brief="Vessel diameter", Symbol="D_{i}"); 349 Lenght as length (Brief="Side length of the cylinder shell", Symbol="L_{vessel}"); 350 351 Vhead_elliptical as volume (Brief="Elliptical Head Total Volume",Hidden=true, Symbol="V_{head}^{elliptical}"); 352 Vhead_hemispherical as volume (Brief="Hemispherical Head Total Volume",Hidden=true, Symbol="V_{head}^{hemispherical}"); 353 Vcylinder as volume (Brief="Cylinder Total Volume",Hidden=true, Symbol="V_{cylinder}"); 354 radius as length (Brief="Vessel radius",Hidden=true, Symbol="R_{cylinder}"); 355 373 Gconst as acceleration (Brief="Gravity Acceleration",Default=9.81,Hidden=true); 356 374 low_flow as flow_mol (Brief = "Low Flow",Default = 1E6, Hidden=true); 357 375 zero_flow as flow_mol (Brief = "No Flow",Default = 0, Hidden=true); … … 368 386 SET 369 387 370 Vhead_elliptical = (pi*Diameter^3)/12; 371 Vhead_hemispherical = (pi*Diameter^3)/6; 372 Vcylinder = 0.25*(pi*Diameter^2)*Lenght; 373 radius = 0.5*Diameter; 374 388 Gconst = 9.81 * 'm/(s^2)'; 375 389 low_flow = 1E6 * 'kmol/h'; 376 390 zero_flow = 0 * 'kmol/h'; … … 379 393 VARIABLES 380 394 395 Geometry as VesselVolume (Brief="Vessel Geometry", Symbol=" "); 396 381 397 in Inlet as stream (Brief="Feed Stream", PosX=0.22, PosY=0, Symbol="_{in}"); 382 398 out OutletLiquid as liquid_stream (Brief="Liquid outlet stream", PosX=0.43, PosY=1, Symbol="_{out}^{Liquid}"); 383 399 in InletQ as power (Brief="Heat Duty", PosX=0.735, PosY=1, Protected =true,Symbol="Q_{in}"); 384 400 385 Vtotal as volume (Brief="Vessel total volume",Protected=true, Symbol="V_{total}");386 Vfilled as volume (Brief="Vessel volume content",Protected=true, Symbol="V_{filled}");387 388 401 TotalHoldup(NComp) as mol (Brief="Molar Holdup in the Vessel", Protected=true); 389 402 390 403 E as energy (Brief="Total Energy Holdup in the Vessel", Protected=true); 391 404 vL as volume_mol (Brief="Liquid Molar Volume", Protected=true); 392 Level as length (Brief="liquid height", Protected=true);393 Across as area (Brief="Vessel cylinder shell Cross section area", Hidden=true, Symbol="A_{cross}");394 395 405 Pstatic as pressure (Brief="Static head at the bottom of the tank", Protected = true, Symbol="P_{static}^{Liquid}"); 396 406 … … 412 422 EQUATIONS 413 423 414 switch Orientation415 416 case "vertical":417 418 "Vessel Cross Section Area"419 Across = 0.25*(pi*Diameter^2);420 421 switch Heads422 423 case "elliptical":424 425 "Vessel Total Volume"426 Vtotal = Vhead_elliptical + Vcylinder;427 428 if Level < 0.25*Diameter then429 430 "Vessel Filled Volume"431 Vfilled = 0.25*pi*(((Diameter*Level)/(0.25*Diameter))^2)*(0.25*DiameterLevel/3);432 433 else434 435 "Vessel Filled Volume"436 Vfilled = 0.25*pi*(Diameter^2)*(Level  0.25*Diameter/3);437 438 end439 440 case "hemispherical":441 442 "Vessel Total Volume"443 Vtotal = Vhead_hemispherical + Vcylinder;444 445 if Level < 0.5*Diameter then446 447 "Vessel Filled Volume"448 Vfilled = 0.25*pi*(Level^2)*(2*Diameter4*Level/3);449 450 else451 452 "Vessel Filled Volume"453 Vfilled = 0.25*pi*((2/3)*((0.5*Diameter)^3)  (0.25*(Diameter)^3) + Level*Diameter^2);454 455 end456 457 case "flat":458 459 "Vessel Total Volume"460 Vtotal = Vcylinder;461 462 "Vessel Filled Volume"463 Vfilled = Across*Level;464 465 end466 467 case "horizontal":468 469 "Vessel Cross Section Area"470 Across = (radius^2)*acos((radiusLevel)/radius)(radiusLevel)*sqrt((2*radius*LevelLevel^2));471 472 switch Heads473 474 case "elliptical":475 476 "Vessel Total Volume"477 Vtotal = Vhead_elliptical + Vcylinder;478 479 "Vessel Filled Volume"480 Vfilled = 0.5236*Level^2*(1.5*DiameterLevel) + Across*Lenght;481 482 case "hemispherical":483 484 "Vessel Total Volume"485 Vtotal = Vhead_hemispherical + Vcylinder;486 487 "Vessel Filled Volume"488 Vfilled = 1.0472*Level^2*(1.5*DiameterLevel) + Across*Lenght;489 490 case "flat":491 492 "Vessel Total Volume"493 Vtotal = Vcylinder;494 495 "Vessel Filled Volume"496 Vfilled = Across*Lenght;497 498 end499 500 end501 502 424 #* 503 425 switch NormalFlow … … 525 447 526 448 "Static Head" 527 Pstatic = PP.LiquidDensity(OutletLiquid.T, Inlet.P, OutletLiquid.z) * g *Level;449 Pstatic = PP.LiquidDensity(OutletLiquid.T, Inlet.P, OutletLiquid.z) * Gconst * Geometry.Level; 528 450 529 451 "Mechanical Equilibrium" … … 537 459 538 460 "Liquid Level" 539 Vfilled = sum(TotalHoldup) * vL;461 Geometry.Vfilled = sum(TotalHoldup) * vL; 540 462 541 463 "Temperature indicator" … … 546 468 547 469 "Level indicator" 548 LI* Vtotal=Vfilled;470 LI*Geometry.Vtotal= Geometry.Vfilled; 549 471 550 472 end
Note: See TracChangeset
for help on using the changeset viewer.