Changeset 799
 Timestamp:
 Jul 18, 2009, 10:17:25 PM (13 years ago)
 Location:
 branches/gui
 Files:

 4 added
 2 deleted
 1 edited
Legend:
 Unmodified
 Added
 Removed

branches/gui/eml/stage_separators/tank.mso
r795 r799 362 362 end 363 363 364 Model tank_cylindrical 365 ATTRIBUTES 364 Model TankL 365 366 ATTRIBUTES 366 367 Pallete = true; 367 Icon = "icon/Tank Horizontal";368 Brief = "Model of a tank with a lain cylinder geometry.";368 Icon = "icon/TankL"; 369 Brief = "Model of a Tank."; 369 370 Info = 370 "== Specify == 371 "== ASSUMPTIONS == 372 * liquid phase only; 373 374 == SET == 375 *Orientation: vessel position  vertical or horizontal; 376 *Heads (bottom and top heads are identical) 377 **elliptical: 2:1 elliptical heads (25% of vessel diameter); 378 **hemispherical: hemispherical heads (50% of vessel diameter); 379 **flat: flat heads (0% of vessel diameter); 380 *Diameter: Vessel diameter; 381 *Lenght: Side length of the cylinder shell; 382 383 == SPECIFY == 371 384 * the Inlet stream; 372 * the outlet flow; 373 * the InletQ (requires an energy source). 374 375 == Initial Conditions == 376 * the tank initial temperature; 377 * the tank initial level; 378 * the tank initial composition. 385 * the OutletLiquid.F; 386 * the InletQ (the model requires an energy stream, also you can use a controller for setting the heat duty using the heat_flow model). 387 388 == OPTIONAL == 389 * the TankL model has three control ports 390 ** TI OutletLiquid Temperature Indicator; 391 ** PI OutletLiquid Pressure Indicator; 392 ** LI Level Indicator; 393 394 == INITIAL CONDITIONS == 395 * Initial_Temperature : the Tank temperature (OutletLiquid.T); 396 * Initial_Level : the Tank liquid level (Level); 397 * Initial_Composition : (NoComps) OutletLiquid compositions. 379 398 "; 380 399 381 400 PARAMETERS 382 outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); 383 outer NComp as Integer (Brief = "Number of Components"); 384 385 pi as positive (Brief="Pi value", Default=3.141593,Hidden=true); 386 eps as positive (Brief="small number",Default=1E8,Hidden=true); 387 Diameter as length (Brief="Tank internal Diameter",Default=1.5); 388 radius as length (Brief="Tank radius",Hidden=true); 389 L as length (Brief="Tank length",Default=5); 390 391 Initial_Level as length (Brief="Initial Level of the Tank",Default=1); 392 Initial_Temperature as temperature (Brief="Initial Temperature of Liquid",Default=300); 393 Initial_Composition(NComp) as positive (Brief="Initial Liquid Composition",Lower=1E8,Default=0.1); 401 outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); 402 outer NComp as Integer (Brief = "Number of components", Lower = 1); 403 404 pi as positive (Brief="Pi value", Default=3.141593,Hidden=true, Symbol="\pi"); 405 406 Orientation as Switcher (Valid=["vertical","horizontal"],Default="vertical"); 407 Heads as Switcher (Valid=["elliptical","hemispherical","flat"],Default="flat"); 408 Diameter as length (Brief="Vessel diameter", Symbol="D_{i}"); 409 Lenght as length (Brief="Side length of the cylinder shell", Symbol="L_{vessel}"); 410 411 Vhead_elliptical as volume (Brief="Elliptical Head Total Volume",Hidden=true, Symbol="V_{head}^{elliptical}"); 412 Vhead_hemispherical as volume (Brief="Hemispherical Head Total Volume",Hidden=true, Symbol="V_{head}^{hemispherical}"); 413 Vcylinder as volume (Brief="Cylinder Total Volume",Hidden=true, Symbol="V_{cylinder}"); 414 radius as length (Brief="Vessel radius",Hidden=true, Symbol="R_{cylinder}"); 415 416 Levelpercent_Initial as positive (Brief="Initial liquid height in Percent", Default = 0.70); 417 Temperature_Initial as temperature (Brief="Initial Liquid Temperature", Default = 330); 418 Composition_Initial(NComp) as fraction (Brief="Initial Composition", Default = 0.10); 394 419 395 420 SET 396 radius = Diameter/2; 421 422 Vhead_elliptical = (pi*Diameter^3)/12; 423 Vhead_hemispherical = (pi*Diameter^3)/6; 424 Vcylinder = 0.25*(pi*Diameter^2)*Lenght; 425 radius = 0.5*Diameter; 397 426 398 427 VARIABLES 399 in Inlet as stream (Brief="Inlet stream", PosX=0.1825, PosY=0, Symbol="_{in}"); 400 out Outlet as liquid_stream (Brief="Outlet liquid stream", PosX=1, PosY=1, Symbol="_{out}"); 401 in InletQ as power (Brief="Rate of heat supply", PosX=1, PosY=0.6160, Symbol="_{in}",Protected=true); 402 Level as length (Brief="Tank level",Protected=true); 403 Vtotal as volume (Brief="Tank total volume",Protected=true); 404 Vfilled as volume (Brief="Tank volume content",Protected=true); 405 Across as area (Brief="Tank cross section area", Default=2,Protected=true); 406 E as energy (Brief="Total Energy Holdup on tank",Protected=true); 407 vL as volume_mol (Brief="Liquid Molar Volume",Protected=true); 408 M(NComp) as mol (Brief="Molar Holdup in the tank",Protected=true); 428 429 in Inlet as stream (Brief="Feed Stream", PosX=0.22, PosY=0, Symbol="_{in}"); 430 out OutletLiquid as liquid_stream (Brief="Liquid outlet stream", PosX=0.43, PosY=1, Symbol="_{out}^{Liquid}"); 431 in InletQ as power (Brief="Heat Duty", PosX=0.735, PosY=1, Protected =true,Symbol="Q_{in}"); 432 433 Vtotal as volume (Brief="Vessel total volume",Protected=true, Symbol="V_{total}"); 434 Vfilled as volume (Brief="Vessel volume content",Protected=true, Symbol="V_{filled}"); 435 436 TotalHoldup(NComp) as mol (Brief="Molar Holdup in the Vessel", Protected=true); 437 438 E as energy (Brief="Total Energy Holdup in the Vessel", Protected=true); 439 vL as volume_mol (Brief="Liquid Molar Volume", Protected=true); 440 Level as length (Brief="liquid height", Protected=true); 441 Across as area (Brief="Vessel cylinder shell Cross section area", Hidden=true, Symbol="A_{cross}"); 442 443 out TI as control_signal (Brief="Temperature Indicator", PosX=0.525, PosY=0, Protected=true); 444 out PI as control_signal (Brief="Pressure Indicator", PosX=0.368, PosY=0, Protected=true); 445 out LI as control_signal (Brief="Level Indicator", PosX=1, PosY=0.6, Protected=true); 409 446 410 447 INITIAL 411 448 412 "Initial Level"413 L evel = Initial_Level;414 415 "Initial Liquid Temperature"416 Outlet .T = Initial_Temperature;417 418 "Initial Liquid Composition"419 Outlet .z(1:NComp1) = Initial_Composition(1:NComp1)/sum(Initial_Composition);449 "Initial level Percent" 450 LI = Levelpercent_Initial; 451 452 "Initial Outlet Liquid Temperature" 453 OutletLiquid.T = Temperature_Initial; 454 455 "Initial Outlet Liquid Composition Normalized" 456 OutletLiquid.z(1:NComp  1) = Composition_Initial(1:NComp  1)/sum(Composition_Initial); 420 457 421 458 EQUATIONS 422 459 423 "Tank total volume" 424 Vtotal = (0.25*pi*(Diameter)^2)*L; 425 426 "Mass balance" 427 diff(M) = Inlet.F*Inlet.z  Outlet.F*Outlet.z; 428 429 "Energy balance" 430 diff(E) = Inlet.F*Inlet.h  Outlet.F*Outlet.h + InletQ; 460 switch Orientation 461 462 case "vertical": 463 464 "Vessel Cross Section Area" 465 Across = 0.25*(pi*Diameter^2); 466 467 switch Heads 468 469 case "elliptical": 470 471 "Vessel Total Volume" 472 Vtotal = Vhead_elliptical + Vcylinder; 473 474 if Level < 0.25*Diameter then 475 476 "Vessel Filled Volume" 477 Vfilled = 0.25*pi*(((Diameter*Level)/(0.25*Diameter))^2)*(0.25*DiameterLevel/3); 478 479 else 480 481 "Vessel Filled Volume" 482 Vfilled = 0.25*pi*(Diameter^2)*(Level  0.25*Diameter/3); 483 484 end 485 486 case "hemispherical": 487 488 "Vessel Total Volume" 489 Vtotal = Vhead_hemispherical + Vcylinder; 490 491 if Level < 0.5*Diameter then 492 493 "Vessel Filled Volume" 494 Vfilled = 0.25*pi*(Level^2)*(2*Diameter4*Level/3); 495 496 else 497 498 "Vessel Filled Volume" 499 Vfilled = 0.25*pi*((2/3)*((0.5*Diameter)^3)  (0.25*(Diameter)^3) + Level*Diameter^2); 500 501 end 502 503 case "flat": 504 505 "Vessel Total Volume" 506 Vtotal = Vcylinder; 507 508 "Vessel Filled Volume" 509 Vfilled = Across*Level; 510 511 end 512 513 case "horizontal": 514 515 "Vessel Cross Section Area" 516 Across = (radius^2)*acos((radiusLevel)/radius)(radiusLevel)*sqrt((2*radius*LevelLevel^2)); 517 518 switch Heads 519 520 case "elliptical": 521 522 "Vessel Total Volume" 523 Vtotal = Vhead_elliptical + Vcylinder; 524 525 "Vessel Filled Volume" 526 Vfilled = 0.5236*Level^2*(1.5*DiameterLevel) + Across*Lenght; 527 528 case "hemispherical": 529 530 "Vessel Total Volume" 531 Vtotal = Vhead_hemispherical + Vcylinder; 532 533 "Vessel Filled Volume" 534 Vfilled = 1.0472*Level^2*(1.5*DiameterLevel) + Across*Lenght; 535 536 case "flat": 537 538 "Vessel Total Volume" 539 Vtotal = Vcylinder; 540 541 "Vessel Filled Volume" 542 Vfilled = Across*Lenght; 543 544 end 545 546 end 547 548 "Component Molar Balance" 549 diff(TotalHoldup)=Inlet.F*Inlet.z  OutletLiquid.F*OutletLiquid.z; 550 551 "Energy Balance" 552 diff(E) = Inlet.F*Inlet.h  OutletLiquid.F*OutletLiquid.h + InletQ; 431 553 432 554 "Energy Holdup" 433 E = sum( M)*Outlet.h;434 555 E = sum(TotalHoldup)*OutletLiquid.h; 556 435 557 "Mechanical Equilibrium" 436 Inlet.P = Outlet .P;437 558 Inlet.P = OutletLiquid.P; 559 438 560 "Liquid Volume" 439 vL = PP.LiquidVolume(Outlet.T, Outlet.P, Outlet.z); 440 441 "Composition" 442 M = Outlet.z*sum(M); 443 444 "Cylindrical Area" 445 Across = radius^2 * (asin(1)  asin((radiusLevel)/radius) ) + (Levelradius)*sqrt(Level*(2*radius  Level)+eps*'m^2'); 446 447 "Level of liquid phase" 448 L*Across = sum(M)*vL; 449 450 "Volume Filled of liquid phase" 451 Vfilled = L*Across; 561 vL = PP.LiquidVolume(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z); 562 563 "Molar Holdup" 564 TotalHoldup = OutletLiquid.z*sum(TotalHoldup); 565 566 "Liquid Level" 567 Vfilled = sum(TotalHoldup) * vL; 568 569 "Temperature indicator" 570 TI * 'K' = OutletLiquid.T; 571 572 "Pressure indicator" 573 PI * 'atm' = OutletLiquid.P; 574 575 "Level indicator" 576 LI*Vtotal= Vfilled; 452 577 453 578 end
Note: See TracChangeset
for help on using the changeset viewer.