- Timestamp:
- Nov 13, 2009, 5:18:17 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gui/eml/stage_separators/condenser.mso
r884 r893 1 <<<<<<< .mine 1 2 #*------------------------------------------------------------------- 2 3 * EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC. … … 459 460 460 461 PARAMETERS 462 outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); 463 outer NComp as Integer (Brief = "Number of Components"); 464 465 Pdrop as press_delta (Brief="Pressure Drop in the condenser",Default=0, Symbol="\Delta _P"); 466 #Fake_Temperature as temperature (Brief="Fake temperature", Symbol = "T_{fake}"); 467 468 469 VARIABLES 470 in InletVapour as stream (Brief="Vapour inlet stream", PosX=0.16, PosY=0, Symbol="_{in}^{Vapour}"); 471 out OutletLiquid as stream (Brief="Liquid outlet stream", PosX=0.53, PosY=1, Symbol="_{out}^{Liquid}"); 472 #in InletQ as power (Brief="Heat Duty", PosX=1, PosY=0.08, Symbol="Q_{in}",Protected=true); 473 T_sub as temperature (Brief="Condensate temperature (subcooled)", Symbol = "T_{sub}"); 474 #SubcoolingDegree as temp_delta (Brief="Subcooling Degree", Symbol = "\Delta _{sub}"); 475 CondenserDuty as power (Brief="Calculated condenser duty for desired subcooling", Protected = true, Symbol = "Q_{cond}"); 476 477 out TI as control_signal (Brief="Temperature Indicator of Condenser", Protected = true, PosX=0.50, PosY=0); 478 out PI as control_signal (Brief="Pressure Indicator of Condenser", Protected = true, PosX=0.32, PosY=0); 479 480 EQUATIONS 481 482 "Molar Flow Balance" 483 InletVapour.F = OutletLiquid.F; 484 485 "Molar Composition Balance" 486 InletVapour.z = OutletLiquid.z; 487 488 #"Energy Balance" 489 #InletVapour.F*InletVapour.h + InletQ = OutletLiquid.F*OutletLiquid.h; 490 491 "Pressure Drop" 492 OutletLiquid.P = InletVapour.P - Pdrop; 493 494 "Subcooled Temperature" 495 OutletLiquid.T = T_sub; 496 497 #"Degree of subcooling" 498 # SubcoolingDegree = InletVapour.T - T_sub; 499 500 "Liquid enthalpy" 501 OutletLiquid.h = PP.LiquidEnthalpy(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z); 502 503 "Condenser Duty" 504 CondenserDuty = OutletLiquid.F*OutletLiquid.h - InletVapour.F*InletVapour.h; 505 506 "Vapourisation Fraction" 507 OutletLiquid.v = 0; 508 509 "Temperature indicator" 510 TI * 'K' = OutletLiquid.T; 511 512 "Pressure indicator" 513 PI * 'atm' = OutletLiquid.P; 514 515 end 516 517 518 ======= 519 #*------------------------------------------------------------------- 520 * EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC. 521 * 522 * This LIBRARY is free software; you can distribute it and/or modify 523 * it under the therms of the ALSOC FREE LICENSE as available at 524 * http://www.enq.ufrgs.br/alsoc. 525 * 526 * EMSO Copyright (C) 2004 - 2007 ALSOC, original code 527 * from http://www.rps.eng.br Copyright (C) 2002-2004. 528 * All rights reserved. 529 * 530 * EMSO is distributed under the therms of the ALSOC LICENSE as 531 * available at http://www.enq.ufrgs.br/alsoc. 532 * 533 *---------------------------------------------------------------------- 534 * Author: Paula B. Staudt 535 * $Id: condenser.mso 555 2008-07-18 19:01:13Z rafael $ 536 *--------------------------------------------------------------------*# 537 538 using "tank"; 539 540 Model condenserSteady 541 542 ATTRIBUTES 543 Pallete = true; 544 Icon = "icon/CondenserSteady"; 545 Brief = "Model of a Steady State condenser with no thermodynamics equilibrium."; 546 Info = 547 "== ASSUMPTIONS == 548 * perfect mixing of both phases; 549 * no thermodynamics equilibrium. 550 551 == SET == 552 * the pressure drop in the condenser; 553 554 == SPECIFY == 555 * the InletVapour stream; 556 * the InletQ (the model requires an energy stream, also you can use a controller for setting the heat duty using the heat_flow model). 557 558 == OPTIONAL == 559 * the condenser model has two control ports 560 ** TI OutletLiquid Temperature Indicator; 561 ** PI OutletLiquid Pressure Indicator; 562 "; 563 564 PARAMETERS 565 outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); 566 outer NComp as Integer (Brief = "Number of Components"); 567 568 Pdrop as press_delta (Brief="Pressure Drop in the condenser",Default=0, Symbol="\Delta _P"); 569 570 VARIABLES 571 in InletVapour as stream (Brief="Vapour inlet stream", PosX=0.16, PosY=0, Symbol="_{in}^{Vapour}"); 572 out OutletLiquid as liquid_stream (Brief="Liquid outlet stream", PosX=0.53, PosY=1, Symbol="_{out}^{Liquid}"); 573 in InletQ as power (Brief="Heat Duty", PosX=1, PosY=0.08, Symbol="Q_{in}",Protected=true); 574 575 Tbubble as temperature (Brief ="Bubble Temperature",Protected=true, Symbol ="T_{bubble}"); 576 Deg_Subcooled as temp_delta (Brief ="Degrees subcooled",Symbol ="\Delta T_{subcooled}"); 577 578 out TI as control_signal (Brief="Temperature Indicator of Condenser", Protected = true, PosX=0.50, PosY=0); 579 out PI as control_signal (Brief="Pressure Indicator of Condenser", Protected = true, PosX=0.32, PosY=0); 580 581 EQUATIONS 582 583 "Molar Flow Balance" 584 InletVapour.F = OutletLiquid.F; 585 586 "Molar Composition Balance" 587 InletVapour.z = OutletLiquid.z; 588 589 "Energy Balance" 590 InletVapour.F*InletVapour.h + InletQ = OutletLiquid.F*OutletLiquid.h; 591 592 "Pressure Drop" 593 OutletLiquid.P = InletVapour.P - Pdrop; 594 595 "Bubble Temperature" 596 Tbubble = PP.BubbleT(OutletLiquid.P,OutletLiquid.z); 597 598 "Temperature" 599 OutletLiquid.T = Tbubble-Deg_Subcooled; 600 601 "Temperature indicator" 602 TI * 'K' = OutletLiquid.T; 603 604 "Pressure indicator" 605 PI * 'atm' = OutletLiquid.P; 606 607 end 608 609 Model condenserSteady_fakeH 610 611 ATTRIBUTES 612 Pallete = true; 613 Icon = "icon/CondenserSteady"; 614 Brief = "Model of a Steady State condenser with fake calculation of outlet conditions."; 615 Info = 616 "Model of a Steady State condenser with fake calculation of output temperature, but with a real 617 calculation of the output stream enthalpy. 618 619 == ASSUMPTIONS == 620 * perfect mixing of both phases; 621 * no thermodynamics equilibrium. 622 623 == SET == 624 * the fake Outlet temperature ; 625 * the pressure drop in the condenser; 626 627 == SPECIFY == 628 * the InletVapour stream; 629 * the InletQ (the model requires an energy stream, also you can use a controller for setting the heat duty using the heat_flow model). 630 631 == OPTIONAL == 632 * the condenser model has two control ports 633 ** TI OutletLiquid Temperature Indicator; 634 ** PI OutletLiquid Pressure Indicator; 635 "; 636 637 PARAMETERS 638 outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); 639 outer NComp as Integer (Brief = "Number of Components"); 640 641 Pdrop as press_delta (Brief="Pressure Drop in the condenser",Default=0, Symbol="\Delta _P"); 642 Fake_Temperature as temperature (Brief="Fake temperature", Symbol = "T_{fake}"); 643 644 645 VARIABLES 646 in InletVapour as stream (Brief="Vapour inlet stream", PosX=0.16, PosY=0, Symbol="_{in}^{Vapour}"); 647 out OutletLiquid as stream (Brief="Liquid outlet stream", PosX=0.53, PosY=1, Symbol="_{out}^{Liquid}"); 648 in InletQ as power (Brief="Heat Duty", PosX=1, PosY=0.08, Symbol="Q_{in}",Protected=true); 649 650 out TI as control_signal (Brief="Temperature Indicator of Condenser", Protected = true, PosX=0.50, PosY=0); 651 out PI as control_signal (Brief="Pressure Indicator of Condenser", Protected = true, PosX=0.32, PosY=0); 652 653 EQUATIONS 654 655 "Molar Flow Balance" 656 InletVapour.F = OutletLiquid.F; 657 658 "Molar Composition Balance" 659 InletVapour.z = OutletLiquid.z; 660 661 "Energy Balance" 662 InletVapour.F*InletVapour.h + InletQ = OutletLiquid.F*OutletLiquid.h; 663 664 "Pressure Drop" 665 OutletLiquid.P = InletVapour.P - Pdrop; 666 667 "Fake Temperature" 668 OutletLiquid.T = Fake_Temperature; 669 670 "Vapourisation Fraction" 671 OutletLiquid.v = 0; 672 673 "Temperature indicator" 674 TI * 'K' = OutletLiquid.T; 675 676 "Pressure indicator" 677 PI * 'atm' = OutletLiquid.P; 678 679 end 680 681 Model condenserReact 682 ATTRIBUTES 683 Pallete = false; 684 Icon = "icon/Condenser"; 685 Brief = "Model of a Condenser with reaction in liquid phase."; 686 Info = 687 "== Assumptions == 688 * perfect mixing of both phases; 689 * thermodynamics equilibrium; 690 * the reaction only takes place in liquid phase. 691 692 == Specify == 693 * the reaction related variables; 694 * the inlet stream; 695 * the outlet flows: OutletVapour.F and OutletLiquid.F; 696 * the heat supply. 697 698 == Initial Conditions == 699 * the condenser temperature (OutletLiquid.T); 700 * the condenser liquid level (Level); 701 * (NoComps - 1) OutletLiquid (OR OutletVapour) compositions. 702 "; 703 704 PARAMETERS 705 outer PP as Plugin(Type="PP"); 706 outer NComp as Integer; 707 708 V as volume (Brief="Condenser total volume"); 709 Across as area (Brief="Cross Section Area of reboiler"); 710 711 stoic(NComp) as Real (Brief="Stoichiometric matrix"); 712 Hr as energy_mol; 713 Initial_Level as length (Brief="Initial Level of liquid phase"); 714 Initial_Temperature as temperature (Brief="Initial Temperature of Condenser"); 715 Initial_Composition(NComp) as fraction (Brief="Initial Liquid Composition"); 716 717 VARIABLES 718 719 in InletVapour as stream (Brief="Vapour inlet stream", PosX=0.1164, PosY=0, Symbol="_{inV}"); 720 out OutletLiquid as liquid_stream (Brief="Liquid outlet stream", PosX=0.4513, PosY=1, Symbol="_{outL}"); 721 out OutletVapour as vapour_stream (Brief="Vapour outlet stream", PosX=0.4723, PosY=0, Symbol="_{outV}"); 722 InletQ as power (Brief="Cold supplied", PosX=1, PosY=0.6311, Symbol="_{in}"); 723 724 M(NComp) as mol (Brief="Molar Holdup in the tray"); 725 ML as mol (Brief="Molar liquid holdup"); 726 MV as mol (Brief="Molar vapour holdup"); 727 E as energy (Brief="Total Energy Holdup on tray"); 728 vL as volume_mol (Brief="Liquid Molar Volume"); 729 vV as volume_mol (Brief="Vapour Molar volume"); 730 Level as length (Brief="Level of liquid phase"); 731 Vol as volume; 732 r3 as reaction_mol (Brief="Reaction Rates", DisplayUnit = 'mol/l/s'); 733 C(NComp) as conc_mol (Brief="Molar concentration", Lower = -1); 734 735 INITIAL 736 737 Level = Initial_Level; 738 OutletLiquid.T = Initial_Temperature; 739 OutletLiquid.z(1:NComp-1) = Initial_Composition(1:NComp-1)/sum(Initial_Composition); 740 741 EQUATIONS 742 "Molar Concentration" 743 OutletLiquid.z = vL * C; 744 745 "Reaction" 746 r3 = exp(-7150*'K'/OutletLiquid.T)*(4.85e4*C(1)*C(2) - 1.23e4*C(3)*C(4)) * 'l/mol/s'; 747 748 "Component Molar Balance" 749 diff(M) = InletVapour.F*InletVapour.z - OutletLiquid.F*OutletLiquid.z - OutletVapour.F*OutletVapour.z + stoic*r3*ML*vL; 750 751 "Energy Balance" 752 diff(E) = InletVapour.F*InletVapour.h - OutletLiquid.F*OutletLiquid.h- OutletVapour.F*OutletVapour.h + InletQ + Hr * r3 * ML*vL; 753 754 "Molar Holdup" 755 M = ML*OutletLiquid.z + MV*OutletVapour.z; 756 757 "Energy Holdup" 758 E = ML*OutletLiquid.h + MV*OutletVapour.h - OutletVapour.P*V; 759 760 "Mol fraction normalisation" 761 sum(OutletLiquid.z)=1.0; 762 763 "Liquid Volume" 764 vL = PP.LiquidVolume(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z); 765 766 "Vapour Volume" 767 vV = PP.VapourVolume(OutletVapour.T, OutletVapour.P, OutletVapour.z); 768 769 "Thermal Equilibrium" 770 OutletLiquid.T = OutletVapour.T; 771 772 "Mechanical Equilibrium" 773 OutletVapour.P = OutletLiquid.P; 774 775 "Geometry Constraint" 776 V = ML*vL + MV*vV; 777 778 Vol = ML*vL; 779 780 "Level of liquid phase" 781 Level = ML*vL/Across; 782 783 "Chemical Equilibrium" 784 PP.LiquidFugacityCoefficient(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z)*OutletLiquid.z = 785 PP.VapourFugacityCoefficient(OutletVapour.T, OutletVapour.P, OutletVapour.z)*OutletVapour.z; 786 787 sum(OutletLiquid.z)=sum(OutletVapour.z); 788 789 end 790 791 Model condenser 792 793 ATTRIBUTES 794 Pallete = true; 795 Icon = "icon/Condenser"; 796 Brief = "Model of a dynamic condenser with control."; 797 Info = 798 "== ASSUMPTIONS == 799 * perfect mixing of both phases; 800 * thermodynamics equilibrium. 801 802 == SPECIFY == 803 * the InletVapour stream; 804 * the outlet flows: OutletVapour.F and OutletLiquid.F; 805 * the InletQ (the model requires an energy stream, also you can use a controller for setting the heat duty using the heat_flow model). 806 807 == OPTIONAL == 808 * the condenser model has three control ports 809 ** TI OutletLiquid Temperature Indicator; 810 ** PI OutletLiquid Pressure Indicator; 811 ** LI Level Indicator of Condenser; 812 813 == INITIAL CONDITIONS == 814 * Initial_Temperature : the condenser temperature (OutletLiquid.T); 815 * Levelpercent_Initial : the condenser liquid level in percent (LI); 816 * Initial_Composition : (NoComps) OutletLiquid compositions. 817 "; 818 819 PARAMETERS 820 outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); 821 outer NComp as Integer (Brief="Number of Components"); 822 823 Mw(NComp) as molweight (Brief = "Component Mol Weight",Hidden=true); 824 low_flow as flow_mol (Brief = "Low Flow",Default = 1E-6, Hidden=true); 825 zero_flow as flow_mol (Brief = "No Flow",Default = 0, Hidden=true); 826 KfConst as area (Brief="Constant for K factor pressure drop", Default = 1, Hidden=true); 827 828 VapourFlow as Switcher (Brief="Vapour Flow", Valid = ["on", "off"], Default = "on",Hidden=true); 829 830 Kfactor as positive (Brief="K factor for pressure drop", Lower = 1E-8, Default = 1E-3); 831 832 Levelpercent_Initial as positive (Brief="Initial liquid height in Percent", Default = 0.70); 833 Initial_Temperature as temperature (Brief="Initial Temperature of Condenser"); 834 Initial_Composition(NComp) as positive (Brief="Initial Liquid Composition", Lower=1E-6); 835 836 VARIABLES 837 838 Geometry as VesselVolume (Brief="Vessel Geometry", Symbol=" "); 839 840 in InletVapour as stream (Brief="Vapour inlet stream", PosX=0.13, PosY=0, Symbol="_{in}^{Vapour}"); 841 out OutletLiquid as liquid_stream (Brief="Liquid outlet stream", PosX=0.35, PosY=1, Symbol="_{out}^{Liquid}"); 842 out OutletVapour as vapour_stream (Brief="Vapour outlet stream", PosX=0.54, PosY=0, Symbol="_{out}^{Vapour}"); 843 in InletQ as power (Brief="Heat supplied", Protected = true, PosX=1, PosY=0.08, Symbol="Q_{in}"); 844 845 out TI as control_signal (Brief="Temperature Indicator of Condenser", Protected = true, PosX=0.33, PosY=0); 846 out LI as control_signal (Brief="Level Indicator of Condenser", Protected = true, PosX=0.43, PosY=0); 847 out PI as control_signal (Brief="Pressure Indicator of Condenser", Protected = true, PosX=0.25, PosY=0); 848 849 M(NComp) as mol (Brief="Molar Holdup in the tray", Protected = true); 850 ML as mol (Brief="Molar liquid holdup", Protected = true); 851 MV as mol (Brief="Molar vapour holdup", Protected = true); 852 E as energy (Brief="Total Energy Holdup on tray", Protected = true); 853 vL as volume_mol (Brief="Liquid Molar Volume", Protected = true); 854 vV as volume_mol (Brief="Vapour Molar volume", Protected = true); 855 rho as dens_mass (Brief ="Inlet Vapour Mass Density",Hidden=true, Symbol ="\rho"); 856 Pdrop as press_delta (Brief = "Pressure Drop", DisplayUnit = 'kPa', Symbol ="\Delta P", Protected=true); 857 858 SET 859 Mw = PP.MolecularWeight(); 860 low_flow = 1E-6 * 'kmol/h'; 861 zero_flow = 0 * 'kmol/h'; 862 KfConst = 1*'m^2'; 863 864 INITIAL 865 866 "Initial level Percent" 867 LI = Levelpercent_Initial; 868 869 "Initial Temperature" 870 OutletLiquid.T = Initial_Temperature; 871 872 "Initial Composition" 873 OutletLiquid.z(1:NComp-1) = Initial_Composition(1:NComp-1)/sum(Initial_Composition); 874 875 EQUATIONS 876 877 switch VapourFlow 878 879 case "on": 880 InletVapour.F*sum(Mw*InletVapour.z) = Kfactor *sqrt(Pdrop*rho)*KfConst; 881 882 when InletVapour.F < low_flow switchto "off"; 883 884 case "off": 885 InletVapour.F = zero_flow; 886 887 when InletVapour.P > OutletLiquid.P switchto "on"; 888 889 end 890 891 "Component Molar Balance" 892 diff(M) = InletVapour.F*InletVapour.z - OutletLiquid.F*OutletLiquid.z- OutletVapour.F*OutletVapour.z; 893 894 "Energy Balance" 895 diff(E) = InletVapour.F*InletVapour.h - OutletLiquid.F*OutletLiquid.h- OutletVapour.F*OutletVapour.h + InletQ; 896 897 "Molar Holdup" 898 M = ML*OutletLiquid.z + MV*OutletVapour.z; 899 900 "Energy Holdup" 901 E = ML*OutletLiquid.h + MV*OutletVapour.h - OutletVapour.P*Geometry.Vtotal; 902 903 "Mol fraction normalisation" 904 sum(OutletLiquid.z)=1.0; 905 906 "Mol fraction Constraint" 907 sum(OutletLiquid.z)=sum(OutletVapour.z); 908 909 "Liquid Volume" 910 vL = PP.LiquidVolume(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z); 911 912 "Vapour Volume" 913 vV = PP.VapourVolume(OutletVapour.T, OutletVapour.P, OutletVapour.z); 914 915 "Inlet Vapour Density" 916 rho = PP.VapourDensity(InletVapour.T, InletVapour.P, InletVapour.z); 917 918 "Chemical Equilibrium" 919 PP.LiquidFugacityCoefficient(OutletLiquid.T, OutletLiquid.P, OutletLiquid.z)*OutletLiquid.z = 920 PP.VapourFugacityCoefficient(OutletVapour.T, OutletVapour.P, OutletVapour.z)*OutletVapour.z; 921 922 "Thermal Equilibrium" 923 OutletLiquid.T = OutletVapour.T; 924 925 "Mechanical Equilibrium" 926 OutletVapour.P = OutletLiquid.P; 927 928 "Pressure Drop" 929 OutletLiquid.P = InletVapour.P - Pdrop; 930 931 "Geometry Constraint" 932 Geometry.Vtotal = ML*vL + MV*vV; 933 934 "Liquid Level" 935 ML * vL = Geometry.Vfilled; 936 937 "Temperature indicator" 938 TI * 'K' = OutletLiquid.T; 939 940 "Pressure indicator" 941 PI * 'atm' = OutletLiquid.P; 942 943 "Level indicator" 944 LI*Geometry.Vtotal= Geometry.Vfilled; 945 946 end 947 948 949 Model condenserSubcooled 950 951 ATTRIBUTES 952 Pallete = true; 953 Icon = "icon/CondenserSteady"; 954 Brief = "Model of a Steady State total condenser with specified temperature outlet conditions."; 955 Info = 956 "A simple model of a simple Steady State total condenser with specified temperature (or subcooling degree), with a real 957 calculation of the output stream enthalpy. 958 959 == ASSUMPTIONS == 960 * perfect mixing of both phases; 961 * saturated vapour at the Inlet. 962 * no thermodynamics equilibrium. 963 964 == SET == 965 * the fake Outlet temperature ; 966 * the pressure drop in the condenser; 967 968 == SPECIFY == 969 * the InletVapour stream; 970 * the subcooled temperature OR the the degree of subcooling. 971 972 == OPTIONAL == 973 * the condenser model has two control ports 974 ** TI OutletLiquid Temperature Indicator; 975 ** PI OutletLiquid Pressure Indicator; 976 "; 977 978 PARAMETERS 461 979 outer PP as Plugin (Brief = "External Physical Properties", Type="PP"); 462 980 outer NComp as Integer (Brief = "Number of Components"); … … 556 1074 out OutletLiquid as stream (Brief="Liquid outlet stream", PosX=0.53, PosY=1, Symbol="_{out}^{Liquid}"); 557 1075 #in InletQ as power (Brief="Heat Duty", PosX=1, PosY=0.08, Symbol="Q_{in}",Protected=true); 558 SubcoolingDegree as temp_delta (Brief="Subcooling Degree", Symbol = "\Delta _{sub}");1076 #SubcoolingDegree as temp_delta (Brief="Subcooling Degree", Symbol = "\Delta _{sub}"); 559 1077 T_sub as temperature (Brief="Condensate temperature (subcooled)", Symbol = "T_{sub}"); 560 1078 Tbubble as temperature (Brief="Bubble point at the condenser conditions", Protected = true, Symbol = "T_{b}"); … … 584 1102 Tbubble = PP.BubbleT(OutletLiquid.P,OutletLiquid.z); 585 1103 586 "Degree of subcooling"587 SubcoolingDegree = Tbubble - T_sub;1104 #"Degree of subcooling" 1105 # SubcoolingDegree = Tbubble - T_sub; 588 1106 589 1107 "Liquid enthalpy" … … 604 1122 end 605 1123 1124 >>>>>>> .r891
Note: See TracChangeset
for help on using the changeset viewer.