Ignore:
Timestamp:
Jan 12, 2007, 4:44:02 PM (15 years ago)
Author:
gerson bicca
Message:

modified some equations

File:
1 edited

Legend:

Unmodified
Added
Removed
  • mso/eml/heat_exchangers/HeatExchangerDetailed.mso

    r100 r110  
    359359Donozzle_Shell  as length               (Brief="Shell Outlet Nozzle Diameter",Lower=10e-6);
    360360Dinozzle_Shell  as length               (Brief="Shell Inlet Nozzle Diameter",Lower=10e-6);
     361Aonozzle_Shell  as area                 (Brief="Shell Outlet Nozzle Area",Lower=10e-6);
     362Ainozzle_Shell  as area                 (Brief="Shell Inlet Nozzle Area",Lower=10e-6);
     363Aeonozzle_Shell as area                 (Brief="Shell Outlet Escape Area Under Nozzle",Lower=10e-6);
     364Aeinozzle_Shell as area                 (Brief="Shell Inlet Escape Area Under Nozzle",Lower=10e-6);
    361365Hinozzle_Shell  as length               (Brief="Height Under Shell Inlet Nozzle",Lower=10e-6);
    362366Honozzle_Shell  as length               (Brief="Height Under Shell Outlet Nozzle",Lower=10e-6);
     
    374378Ditube            as length                     (Brief="Tube Inside Diameter",Lower=10e-6);
    375379Donozzle_Tube as length                 (Brief="Tube Outlet Nozzle Diameter",Lower=10e-6);
    376 Dinozzle_Tube as length                 (Brief="Tube Inlett Nozzle Diameter",Lower=10e-6);
     380Dinozzle_Tube as length                 (Brief="Tube Inlet Nozzle Diameter",Lower=10e-6);
     381Aonozzle_Tube as area                   (Brief="Tube Outlet Nozzle Area",Lower=10e-6);
     382Ainozzle_Tube as area                   (Brief="Tube Inlet Nozzle Area",Lower=10e-6);
     383Kinlet_Tube   as positive               (Brief="Tube Inlet Nozzle Pressure Loss Coeff",Default=1.1);
     384Koutlet_Tube  as positive               (Brief="Tube Outlet Nozzle Pressure Loss Coeff",Default=0.7);
    377385
    378386#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     
    412420        side                            = HE.FluidAlocation();
    413421       
     422#"Tube Side Inlet Nozzle Area"
     423        Ainozzle_Tube = (Pi*Dinozzle_Tube*Dinozzle_Tube)/4;
     424       
     425#"Tube Side Outlet Nozzle Area"
     426        Aonozzle_Tube = (Pi*Donozzle_Tube*Donozzle_Tube)/4;
     427       
     428#"Tube Inlet Nozzle Pressure Loss Coeff"
     429        Kinlet_Tube   = 1.1;
     430
     431#"Tube Outlet Nozzle Pressure Loss Coeff"
     432        Koutlet_Tube  = 0.7;
     433       
     434#"Shell Outlet Nozzle Area"
     435        Aonozzle_Shell  = (Pi*Donozzle_Shell*Donozzle_Shell)/4;
     436       
     437#"Shell Inlet Nozzle Area"
     438        Ainozzle_Shell  = (Pi*Dinozzle_Shell*Dinozzle_Shell)/4;
     439       
     440#"Shell Outlet Escape Area Under Nozzle"
     441        Aeonozzle_Shell = Pi*Donozzle_Shell*Honozzle_Shell + 0.6*Aonozzle_Shell*(1-Dotube/pitch);
     442       
     443#"Shell Inlet Escape Area Under Nozzle"
     444        Aeinozzle_Shell = Pi*Dinozzle_Shell*Hinozzle_Shell + 0.6*Ainozzle_Shell*(1-Dotube/pitch);
     445       
     446       
    414447EQUATIONS
    415448
     
    436469
    437470#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    438 #                                        Nozzles rho-V^2                                                                #
     471#                               Pressure Drop and Velocities                                    #
     472#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     473
     474if side equal 1
     475       
     476        then
     477       
     478"Tube Side Pressure Drop"
     479        Tubes.PressureDrop.PdTube               = HE.DeltaPtube(Tubes.HeatTransfer.Re,Properties.Cold.Average.rho,Tubes.HeatTransfer.Vtube,Tubes.HeatTransfer.Phi);
     480
     481"Pressure Drop Tube Side Inlet Nozzle"
     482        Tubes.PressureDrop.Pdnozzle_in  = 0.5*Kinlet_Tube*Properties.Cold.Inlet.rho*Tubes.PressureDrop.Vnozzle_in^2;
     483
     484"Velocity Tube Side Inlet Nozzle"
     485        Tubes.PressureDrop.Vnozzle_in   = Properties.Cold.Inlet.Fw/(Properties.Cold.Inlet.rho*Ainozzle_Tube);
     486
     487"Pressure Drop Tube Side Outlet Nozzle"
     488        Tubes.PressureDrop.Pdnozzle_out = 0.5*Koutlet_Tube*Properties.Cold.Outlet.rho*Tubes.PressureDrop.Vnozzle_out^2;
     489
     490"Velocity Tube Side Outlet Nozzle"
     491        Tubes.PressureDrop.Vnozzle_out  = Properties.Cold.Inlet.Fw/(Properties.Cold.Outlet.rho*Aonozzle_Tube);
     492
     493"Shell Pressure Drop Inlet Nozzle"
     494        Shell.PressureDrop.Pdnozzle_in  = (0.5*Properties.Hot.Inlet.Fw^2/Properties.Hot.Inlet.rho)*((1/Ainozzle_Shell^2)+(1/Aeinozzle_Shell^2));
     495
     496"Velocity Shell Side Inlet Nozzle"
     497        Shell.PressureDrop.Vnozzle_in   = Properties.Hot.Inlet.Fw/(Properties.Hot.Inlet.rho*Ainozzle_Shell);
     498
     499"Shell Pressure Drop Outlet Nozzle"
     500        Shell.PressureDrop.Pdnozzle_out = (0.5*Properties.Hot.Outlet.Fw^2/Properties.Hot.Outlet.rho)*((1/Ainozzle_Shell^2)+(1/Aeinozzle_Shell^2));
     501
     502"Velocity Shell Side Outlet Nozzle"
     503        Shell.PressureDrop.Vnozzle_out  = Properties.Hot.Outlet.Fw/(Properties.Hot.Outlet.rho*Aonozzle_Shell);
     504
     505"Pressure Drop Hot Stream"
     506        Outlet.Hot.P  = Inlet.Hot.P - Shell.PressureDrop.Pdtotal;       
     507       
     508"Pressure Drop Cold Stream"
     509        Outlet.Cold.P  = Inlet.Cold.P - Tubes.PressureDrop.Pdtotal;
     510
     511
     512        else
     513
     514"Tube Side Pressure Drop"
     515        Tubes.PressureDrop.PdTube               = HE.DeltaPtube(Tubes.HeatTransfer.Re,Properties.Hot.Average.rho,Tubes.HeatTransfer.Vtube,Tubes.HeatTransfer.Phi);
     516
     517"Pressure Drop Tube Side Inlet Nozzle"
     518        Tubes.PressureDrop.Pdnozzle_in  = 0.5*Kinlet_Tube*Properties.Hot.Inlet.rho*Tubes.PressureDrop.Vnozzle_in^2;
     519       
     520"Velocity Tube Side Inlet Nozzle"
     521        Tubes.PressureDrop.Vnozzle_in   = Properties.Hot.Inlet.Fw/(Properties.Hot.Inlet.rho*Ainozzle_Tube);
     522       
     523"Pressure Drop Tube Side Outlet Nozzle"
     524        Tubes.PressureDrop.Pdnozzle_out = 0.5*Koutlet_Tube*Properties.Hot.Outlet.rho*Tubes.PressureDrop.Vnozzle_out^2;
     525       
     526"Velocity Tube Side Outlet Nozzle"
     527        Tubes.PressureDrop.Vnozzle_out  = Properties.Hot.Inlet.Fw/(Properties.Hot.Outlet.rho*Aonozzle_Tube);   
     528
     529"Shell Pressure Drop Inlet Nozzle"
     530        Shell.PressureDrop.Pdnozzle_in  = (0.5*Properties.Cold.Inlet.Fw^2/Properties.Cold.Inlet.rho)*((1/Ainozzle_Shell^2)+(1/Aeinozzle_Shell^2));
     531
     532"Velocity Shell Side Inlet Nozzle"
     533        Shell.PressureDrop.Vnozzle_in   = Properties.Cold.Inlet.Fw/(Properties.Cold.Inlet.rho*Ainozzle_Shell);
     534
     535"Shell Pressure Drop Outlet Nozzle"
     536        Shell.PressureDrop.Pdnozzle_out = (0.5*Properties.Cold.Outlet.Fw^2/Properties.Cold.Outlet.rho)*((1/Ainozzle_Shell^2)+(1/Aeinozzle_Shell^2));
     537
     538"Velocity Shell Side Outlet Nozzle"
     539        Shell.PressureDrop.Vnozzle_out  = Properties.Cold.Outlet.Fw/(Properties.Cold.Outlet.rho*Ainozzle_Shell);
     540
     541"Pressure Drop Hot Stream"
     542        Outlet.Hot.P  = Inlet.Hot.P- Tubes.PressureDrop.Pdtotal;       
     543       
     544"Pressure Drop Cold Stream"
     545        Outlet.Cold.P  = Inlet.Cold.P - Shell.PressureDrop.Pdtotal;
     546
     547end
     548
     549#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     550#                               Nozzles rho-V^2                                                                 #
    439551#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    440552
     
    460572
    461573#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    462 #                                        Phi correction                                                                 #
     574#                               Phi correction                                                                  #
    463575#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    464576
     
    483595end
    484596
    485 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    486 #                                                                                                                                       #
    487 #                                                                                                                                       #
    488 #                                                                                                                                       #
     597#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#                                                                                                                                   #
     598#                               Heat Transfer                                                                           #                                                                                                                                       #
    489599#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    490600
     
    520630        Shell.HeatTransfer.PRw          = ((Properties.Hot.Wall.Cp/Properties.Hot.Average.Mw)*Properties.Hot.Wall.Mu)/Properties.Hot.Wall.K;
    521631
    522 "Tube Side Pressure Drop"
    523         Tubes.PressureDrop.PdTube               = HE.DeltaPtube(Tubes.HeatTransfer.Re,Properties.Cold.Average.rho,Tubes.HeatTransfer.Vtube,Tubes.HeatTransfer.Phi);
    524 
    525 "Pressure Drop Tube Side Inlet Nozzle"
    526         Tubes.PressureDrop.Pdnozzle_in  = HE.DeltaPtubeNozzlein(Properties.Cold.Inlet.rho,Properties.Cold.Inlet.Fw);
    527 
    528 "Velocity Tube Side Inlet Nozzle"
    529         Tubes.PressureDrop.Vnozzle_in   = HE.TubeVelocityNozzlein(Properties.Cold.Inlet.rho,Properties.Cold.Inlet.Fw);
    530 
    531 "Pressure Drop Tube Side Outlet Nozzle"
    532         Tubes.PressureDrop.Pdnozzle_out = HE.DeltaPtubeNozzleout(Properties.Cold.Outlet.rho,Properties.Cold.Inlet.Fw);
    533 
    534 "Velocity Tube Side Outlet Nozzle"
    535         Tubes.PressureDrop.Vnozzle_out  = HE.TubeVelocityNozzleout(Properties.Cold.Outlet.rho,Properties.Cold.Inlet.Fw);
    536 
    537 "Shell Pressure Drop Inlet Nozzle"
    538         Shell.PressureDrop.Pdnozzle_in  = HE.DeltaPshellNozzleIn(Properties.Hot.Inlet.rho,Properties.Hot.Inlet.Fw);
    539 
    540 "Velocity Shell Side Inlet Nozzle"
    541         Shell.PressureDrop.Vnozzle_in   = HE.ShellVelocityNozzleIn(Properties.Hot.Inlet.rho,Properties.Hot.Inlet.Fw);
    542 
    543 "Shell Pressure Drop Outlet Nozzle"
    544         Shell.PressureDrop.Pdnozzle_out = HE.DeltaPshellNozzleOut(Properties.Hot.Outlet.rho,Properties.Hot.Inlet.Fw);
    545 
    546 "Velocity Shell Side Outlet Nozzle"
    547         Shell.PressureDrop.Vnozzle_out  =HE.ShellVelocityNozzleOut(Properties.Hot.Outlet.rho,Properties.Hot.Inlet.Fw);
    548 
    549 "Pressure Drop Hot Stream"
    550         Outlet.Hot.P  = Inlet.Hot.P- Shell.PressureDrop.Pdtotal;       
    551        
    552 "Pressure Drop Cold Stream"
    553         Outlet.Cold.P  = Inlet.Cold.P - Tubes.PressureDrop.Pdtotal;
    554 
    555632
    556633        else
     
    563640
    564641"Tube Side Velocity"
    565         Tubes.HeatTransfer.Vtube  = Properties.Hot.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Properties.Hot.Average.rho*Ntt);
     642        Tubes.HeatTransfer.Vtube        =       Properties.Hot.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Properties.Hot.Average.rho*Ntt);
    566643
    567644"Tube Side Reynolds Number"
    568         Tubes.HeatTransfer.Re=(Properties.Hot.Average.rho*Tubes.HeatTransfer.Vtube*Ditube)/Properties.Hot.Average.Mu;
     645        Tubes.HeatTransfer.Re           =       (Properties.Hot.Average.rho*Tubes.HeatTransfer.Vtube*Ditube)/Properties.Hot.Average.Mu;
    569646
    570647"Tube Side Prandtl Number"
     
    583660        Shell.HeatTransfer.PRw=((Properties.Cold.Wall.Cp/Properties.Cold.Average.Mw)*Properties.Cold.Wall.Mu)/Properties.Cold.Wall.K;
    584661
    585 "Tube Side Pressure Drop"
    586         Tubes.PressureDrop.PdTube               = HE.DeltaPtube(Tubes.HeatTransfer.Re,Properties.Hot.Average.rho,Tubes.HeatTransfer.Vtube,Tubes.HeatTransfer.Phi);
    587 
    588 "Pressure Drop Tube Side Inlet Nozzle"
    589         Tubes.PressureDrop.Pdnozzle_in  = HE.DeltaPtubeNozzlein(Properties.Hot.Inlet.rho,Properties.Hot.Inlet.Fw);
    590 
    591 "Velocity Tube Side Inlet Nozzle"
    592         Tubes.PressureDrop.Vnozzle_in   = HE.TubeVelocityNozzlein(Properties.Hot.Inlet.rho,Properties.Hot.Inlet.Fw);
    593 
    594 "Pressure Drop Tube Side Outlet Nozzle"
    595         Tubes.PressureDrop.Pdnozzle_out = HE.DeltaPtubeNozzleout(Properties.Hot.Outlet.rho,Properties.Hot.Inlet.Fw);   
    596 
    597 "Velocity Tube Side Outlet Nozzle"
    598         Tubes.PressureDrop.Vnozzle_out  = HE.TubeVelocityNozzleout(Properties.Hot.Outlet.rho,Properties.Hot.Inlet.Fw); 
    599 
    600 "Shell Pressure Drop Inlet Nozzle"
    601         Shell.PressureDrop.Pdnozzle_in  = HE.DeltaPshellNozzleIn(Properties.Cold.Inlet.rho,Properties.Cold.Inlet.Fw);
    602 
    603 "Velocity Shell Side Inlet Nozzle"
    604         Shell.PressureDrop.Vnozzle_in   = HE.ShellVelocityNozzleIn(Properties.Cold.Inlet.rho,Properties.Cold.Inlet.Fw);
    605 
    606 "Shell Pressure Drop Outlet Nozzle"
    607         Shell.PressureDrop.Pdnozzle_out = HE.DeltaPshellNozzleOut(Properties.Cold.Outlet.rho,Properties.Cold.Inlet.Fw);
    608 
    609 "Velocity Shell Side Outlet Nozzle"
    610         Shell.PressureDrop.Vnozzle_out  = HE.ShellVelocityNozzleOut(Properties.Cold.Outlet.rho,Properties.Cold.Inlet.Fw);
    611 
    612 "Pressure Drop Hot Stream"
    613         Outlet.Hot.P  = Inlet.Hot.P- Tubes.PressureDrop.Pdtotal;       
    614        
    615 "Pressure Drop Cold Stream"
    616         Outlet.Cold.P  = Inlet.Cold.P - Shell.PressureDrop.Pdtotal;
    617 
    618 end
    619 
    620 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    621 #                                               Resistances                                                                     #
    622 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     662end
     663
    623664
    624665"Tube Resistance"       
     
    630671"Shell Resistance"
    631672        Resistances.Rshell*(Shell.HeatTransfer.hshell)=1;
    632 
    633 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    634 #                                                                                                                                       #
    635 #                                                                                                                                       #
    636 #                                                                                                                                       #
    637 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    638673
    639674"Shell Side Cross Flow Area"
     
    849884Hinozzle_Shell  as length               (Brief="Height Under Shell Inlet Nozzle",Lower=10e-6);
    850885Honozzle_Shell  as length               (Brief="Height Under Shell Outlet Nozzle",Lower=10e-6);
     886Aonozzle_Shell  as area                 (Brief="Shell Outlet Nozzle Area",Lower=10e-6);
     887Ainozzle_Shell  as area                 (Brief="Shell Inlet Nozzle Area",Lower=10e-6);
     888Aeonozzle_Shell as area                 (Brief="Shell Outlet Escape Area Under Nozzle",Lower=10e-6);
     889Aeinozzle_Shell as area                 (Brief="Shell Inlet Escape Area Under Nozzle",Lower=10e-6);
    851890Lcf                     as length               (Brief="Bundle-to-Shell Clearance",Lower=10e-8);
    852891#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     
    862901Donozzle_Tube   as length               (Brief="Tube Outlet Nozzle Diameter",Lower=10e-6);
    863902Dinozzle_Tube   as length               (Brief="Tube Inlett Nozzle Diameter",Lower=10e-6);
     903Aonozzle_Tube   as area                 (Brief="Tube Outlet Nozzle Area",Lower=10e-6);
     904Ainozzle_Tube   as area                 (Brief="Tube Inlet Nozzle Area",Lower=10e-6);
     905Kinlet_Tube     as positive             (Brief="Tube Inlet Nozzle Pressure Loss Coeff",Default=1.1);
     906Koutlet_Tube    as positive             (Brief="Tube Outlet Nozzle Pressure Loss Coeff",Default=0.7);
     907
    864908#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    865909#       Baffles Geometrical Parameters
     
    875919Unity(Nshell) as HeatExchangerDetailed_Basic;# "Shell in Series"
    876920
    877 CONNECTIONS
    878 
    879 Unity([1:Nshell-1]).Outlet.Hot  to Unity([2:Nshell]).Inlet.Hot;
    880 Unity([2:Nshell]).Outlet.Cold   to Unity([1:Nshell-1]).Inlet.Cold;
    881 
    882 EQUATIONS
    883 
    884 for i in [1:Nshell]
    885        
    886 "Shell Side Cross Flow Area"
    887         Unity(i).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(i).Baffles.Ls);
    888 
    889 "Ji Factor"
    890         Unity(i).Shell.HeatTransfer.Ji =HE.JiFactor(Unity(i).Shell.HeatTransfer.Re);
    891 
    892 "Jc Factor"
    893         Unity(i).Shell.HeatTransfer.Jc = HE.JcFactor();
    894        
    895 "Jl Factor"
    896         Unity(i).Shell.HeatTransfer.Jl = HE.JlFactor(Unity(i).Shell.HeatTransfer.Sm);
    897 
    898 "Jb Factor"
    899         Unity(i).Shell.HeatTransfer.Jb = HE.JbFactor(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Shell.HeatTransfer.Sm);
    900 
    901 "Jr Factor"     
    902         Unity(i).Shell.HeatTransfer.Jr = HE.JrFactor(Unity(i).Shell.HeatTransfer.Re);
    903        
    904 "Total J Factor"
    905         Unity(i).Shell.HeatTransfer.Jtotal=Unity(i).Shell.HeatTransfer.Jc*Unity(i).Shell.HeatTransfer.Jl*Unity(i).Shell.HeatTransfer.Jb*Unity(i).Shell.HeatTransfer.Jr*Unity(i).Shell.HeatTransfer.Js;
    906 
    907 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    908 #  Fluid Alocation
    909 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    910 
    911 if side equal 1 then
    912        
    913 "Shell Side Phi correction for viscosity"
    914         Unity(i).Shell.HeatTransfer.Phi = HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
    915        
    916 "Tube Side Phi correction for viscosity"
    917         Unity(i).Tubes.HeatTransfer.Phi  = HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
    918        
    919         else
    920        
    921 "Shell Side Phi correction for viscosity"
    922         Unity(i).Shell.HeatTransfer.Phi = HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
    923        
    924 "Tube Side Phi correction for viscosity"
    925         Unity(i).Tubes.HeatTransfer.Phi  = HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Average.Mu);
    926 
    927 end
    928 
    929 
    930 if side equal 1
    931        
    932         then
    933        
    934 "Hot Wall Temperature"
    935         Unity(i).Properties.Hot.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    936 
    937 "Cold Wall Temperature"
    938         Unity(i).Properties.Cold.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    939 
    940 "Tube Side Velocity"
    941         Unity(i).Tubes.HeatTransfer.Vtube  = Unity(i).Properties.Cold.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Cold.Average.rho*Ntt);
    942 
    943 "Tube Side Reynolds Number"
    944         Unity(i).Tubes.HeatTransfer.Re=(Unity(i).Properties.Cold.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Cold.Average.Mu;
    945 
    946 "Tube Side Prandtl Number"
    947         Unity(i).Tubes.HeatTransfer.PR = ((Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Average.Mu)/Unity(i).Properties.Cold.Average.K;
    948 
    949 "Tube Side Prandtl Number at Wall Temperature"
    950         Unity(i).Tubes.HeatTransfer.PRw = ((Unity(i).Properties.Cold.Wall.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Wall.Mu)/Unity(i).Properties.Cold.Wall.K;
    951 
    952 "Tube Side Film Coefficient"
    953         Unity(i).Tubes.HeatTransfer.htube= HE.TubeFilmCoeff(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Cold.Average.K)*Unity(i).Tubes.HeatTransfer.Phi;
    954        
    955 "Shell Side Prandtl Number"
    956         Unity(i).Shell.HeatTransfer.PR=((Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Average.Mu)/Unity(i).Properties.Hot.Average.K; 
    957 
    958 "Shell Side Prandtl Number at Wall Temperature"
    959         Unity(i).Shell.HeatTransfer.PRw = ((Unity(i).Properties.Hot.Wall.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Wall.Mu)/Unity(i).Properties.Hot.Wall.K;       
    960 
    961 "Tube Side Pressure Drop"
    962         Unity(i).Tubes.PressureDrop.PdTube              = HE.DeltaPtube(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Cold.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Tubes.HeatTransfer.Phi);
    963 
    964 "Pressure Drop Tube Side Inlet Nozzle"
    965         Unity(i).Tubes.PressureDrop.Pdnozzle_in = HE.DeltaPtubeNozzlein(Unity(i).Properties.Cold.Inlet.rho,Unity(i).Properties.Cold.Inlet.Fw);
    966 
    967 "Velocity Tube Side Inlet Nozzle"
    968         Unity(i).Tubes.PressureDrop.Vnozzle_in  = HE.TubeVelocityNozzlein(Unity(i).Properties.Cold.Inlet.rho,Unity(i).Properties.Cold.Inlet.Fw);
    969 
    970 "Pressure Drop Tube Side Outlet Nozzle"
    971         Unity(i).Tubes.PressureDrop.Pdnozzle_out        = HE.DeltaPtubeNozzleout(Unity(i).Properties.Cold.Outlet.rho,Unity(i).Properties.Cold.Inlet.Fw);
    972 
    973 "Velocity Tube Side Outlet Nozzle"
    974         Unity(i).Tubes.PressureDrop.Vnozzle_out = HE.TubeVelocityNozzleout(Unity(i).Properties.Cold.Outlet.rho,Unity(i).Properties.Cold.Inlet.Fw);
    975 
    976 "Shell Pressure Drop Inlet Nozzle"
    977         Unity(i).Shell.PressureDrop.Pdnozzle_in = HE.DeltaPshellNozzleIn(Unity(i).Properties.Hot.Inlet.rho,Unity(i).Properties.Hot.Inlet.Fw);
    978 
    979 "Velocity Shell Side Inlet Nozzle"
    980         Unity(i).Shell.PressureDrop.Vnozzle_in  = HE.ShellVelocityNozzleIn(Unity(i).Properties.Hot.Inlet.rho,Unity(i).Properties.Hot.Inlet.Fw);
    981 
    982 "Shell Pressure Drop Outlet Nozzle"
    983         Unity(i).Shell.PressureDrop.Pdnozzle_out        =HE.DeltaPshellNozzleOut(Unity(i).Properties.Hot.Outlet.rho,Unity(i).Properties.Hot.Inlet.Fw);
    984 
    985 "Velocity Shell Side Outlet Nozzle"
    986         Unity(i).Shell.PressureDrop.Vnozzle_out =HE.ShellVelocityNozzleOut(Unity(i).Properties.Hot.Outlet.rho,Unity(i).Properties.Hot.Inlet.Fw);
    987 
    988 "Pressure Drop Hot Stream"
    989         Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P- Unity(i).Shell.PressureDrop.Pdtotal;     
    990        
    991 "Pressure Drop Cold Stream"
    992         Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Tubes.PressureDrop.Pdtotal;
    993 
    994 
    995         else
    996 
    997 "Hot Wall Temperature"
    998         Unity(i).Properties.Hot.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    999 
    1000 "Cold Wall Temperature"
    1001         Unity(i).Properties.Cold.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    1002 
    1003 "Tube Side Velocity"
    1004         Unity(i).Tubes.HeatTransfer.Vtube  = Unity(i).Properties.Hot.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Hot.Average.rho*Ntt);
    1005 
    1006 "Tube Side Reynolds Number"
    1007         Unity(i).Tubes.HeatTransfer.Re          =       (Unity(i).Properties.Hot.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Hot.Average.Mu;
    1008        
    1009 "Tube Side Prandtl Number"
    1010         Unity(i).Tubes.HeatTransfer.PR          =       ((Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Average.Mu)/Unity(i).Properties.Hot.Average.K;
    1011        
    1012 "Tube Side Prandtl Number at Wall"
    1013         Unity(i).Tubes.HeatTransfer.PRw     =  ((Unity(i).Properties.Hot.Wall.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Wall.Mu)/Unity(i).Properties.Hot.Wall.K;
    1014 
    1015 "Tube Side Film Coefficient"
    1016         Unity(i).Tubes.HeatTransfer.htube       =       HE.TubeFilmCoeff(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Hot.Average.K)*Unity(i).Tubes.HeatTransfer.Phi;
    1017        
    1018 "Shell Side Prandtl Number"
    1019         Unity(i).Shell.HeatTransfer.PR          =       ((Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Average.Mu)/Unity(i).Properties.Cold.Average.K;
    1020        
    1021 "Shell Side Prandtl Number at Wall"
    1022         Unity(i).Shell.HeatTransfer.PRw     =   ((Unity(i).Properties.Cold.Wall.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Wall.Mu)/Unity(i).Properties.Cold.Wall.K;
    1023 
    1024 "Tube Side Pressure Drop"
    1025         Unity(i).Tubes.PressureDrop.PdTube      =       HE.DeltaPtube(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Hot.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Tubes.HeatTransfer.Phi);
    1026 
    1027 "Pressure Drop Tube Side Inlet Nozzle"
    1028         Unity(i).Tubes.PressureDrop.Pdnozzle_in = HE.DeltaPtubeNozzlein(Unity(i).Properties.Hot.Inlet.rho,Unity(i).Properties.Hot.Inlet.Fw);
    1029 
    1030 "Velocity Tube Side Inlet Nozzle"
    1031         Unity(i).Tubes.PressureDrop.Vnozzle_in  = HE.TubeVelocityNozzlein(Unity(i).Properties.Hot.Inlet.rho,Unity(i).Properties.Hot.Inlet.Fw);
    1032 
    1033 "Pressure Drop Tube Side Outlet Nozzle"
    1034         Unity(i).Tubes.PressureDrop.Pdnozzle_out        = HE.DeltaPtubeNozzleout(Unity(i).Properties.Hot.Outlet.rho,Unity(i).Properties.Hot.Inlet.Fw); 
    1035 
    1036 "Velocity Tube Side Outlet Nozzle"
    1037         Unity(i).Tubes.PressureDrop.Vnozzle_out = HE.TubeVelocityNozzleout(Unity(i).Properties.Hot.Outlet.rho,Unity(i).Properties.Hot.Inlet.Fw);       
    1038 
    1039 "Shell Pressure Drop Inlet Nozzle"
    1040         Unity(i).Shell.PressureDrop.Pdnozzle_in = HE.DeltaPshellNozzleIn(Unity(i).Properties.Cold.Inlet.rho,Unity(i).Properties.Cold.Inlet.Fw);
    1041 
    1042 "Velocity Shell Side Inlet Nozzle"
    1043         Unity(i).Shell.PressureDrop.Vnozzle_in  = HE.ShellVelocityNozzleIn(Unity(i).Properties.Cold.Inlet.rho,Unity(i).Properties.Cold.Inlet.Fw);
    1044 
    1045 "Shell Pressure Drop Outlet Nozzle"
    1046         Unity(i).Shell.PressureDrop.Pdnozzle_out = HE.DeltaPshellNozzleOut(Unity(i).Properties.Cold.Outlet.rho,Unity(i).Properties.Cold.Inlet.Fw);
    1047 
    1048 "Velocity Shell Side Outlet Nozzle"
    1049         Unity(i).Shell.PressureDrop.Vnozzle_out  = HE.ShellVelocityNozzleOut(Unity(i).Properties.Cold.Outlet.rho,Unity(i).Properties.Cold.Inlet.Fw);
    1050 
    1051 "Pressure Drop Hot Stream"
    1052         Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P- Unity(i).Tubes.PressureDrop.Pdtotal;     
    1053        
    1054 "Pressure Drop Cold Stream"
    1055         Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Shell.PressureDrop.Pdtotal;
    1056 
    1057 
    1058 end
    1059 
    1060 if side equal 1
    1061        
    1062         then
    1063 
    1064 "Shell Side inlet Nozzle rho-V^2"
    1065         Unity(i).Shell.PressureDrop.RVsquare_in = Unity(i).Properties.Hot.Inlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_in)^2;
    1066 
    1067 "Shell Side Outlet Nozzle rho-V^2"
    1068         Unity(i).Shell.PressureDrop.RVsquare_out = Unity(i).Properties.Hot.Outlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_out)^2;
    1069        
    1070         else
    1071        
    1072 "Shell Side inlet Nozzle rho-V^2"
    1073         Unity(i).Shell.PressureDrop.RVsquare_in = Unity(i).Properties.Cold.Inlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_in)^2;
    1074 
    1075 "Shell Side Outlet Nozzle rho-V^2"
    1076         Unity(i).Shell.PressureDrop.RVsquare_out = Unity(i).Properties.Cold.Outlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_out)^2;
    1077 
    1078 end
    1079 
    1080 "Tube Resistance"       
    1081         Unity(i).Resistances.Rtube*(Unity(i).Tubes.HeatTransfer.htube*Ditube) = Dotube;
    1082        
    1083 "Wall Resistance"
    1084         Unity(i).Resistances.Rwall=Dotube*ln(Dotube/Ditube)/(2*Kwall);
    1085        
    1086 "Shell Resistance"
    1087         Unity(i).Resistances.Rshell*(Unity(i).Shell.HeatTransfer.hshell)=1;
    1088        
    1089 "Overall Heat Transfer Coefficient Clean"
    1090         Unity(i).Details.Uc=1/(Dotube/(Unity(i).Tubes.HeatTransfer.htube*Ditube)+(Dotube*ln(Dotube/Ditube)/(2*Kwall))+(1/(Unity(i).Shell.HeatTransfer.hshell)));
    1091 
    1092 "Overall Heat Transfer Coefficient Dirty"
    1093         (1/Unity(i).Details.Ud)=(1/Unity(i).Details.Uc)+Unity(i).Resistances.Rfo+Unity(i).Resistances.Rfi*(Dotube/Ditube);
    1094 
    1095 "Exchange Surface Area"
    1096         Unity(i).Details.A=Pi*Dotube*Ntt*Ltube;
    1097 
    1098 "Baffles Spacing"
    1099         Ltube = Unity(i).Baffles.Lsi+Unity(i).Baffles.Lso+Unity(i).Baffles.Ls*(Nb-1);
    1100 
    1101 "TEMA E Shell Effectiveness"
    1102         Eft(i) = 2*(1+Unity(i).Details.Cr+sqrt(1+Unity(i).Details.Cr^2)*((1+exp(-Unity(i).Details.NTU*sqrt(1+Unity(i).Details.Cr^2)))/(1-exp(-Unity(i).Details.NTU*sqrt(1+Unity(i).Details.Cr^2)))) )^-1;
    1103 
    1104 "Js Factor"     
    1105         Unity(i).Shell.HeatTransfer.Js = HE.JsFactor(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Lsi,Unity(i).Baffles.Lso,Unity(i).Baffles.Ls);
    1106 
    1107 if side equal 1
    1108        
    1109         then
    1110        
    1111 "Shell Side Reynolds Number"
    1112         Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Hot.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Hot.Average.Mu;
    1113 
    1114 "Shell Heat Transfer Coefficient"
    1115         Unity(i).Shell.HeatTransfer.hshell=Unity(i).Shell.HeatTransfer.Ji*(Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*(Unity(i).Properties.Hot.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)*(Unity(i).Shell.HeatTransfer.PR^(-2/3))*Unity(i).Shell.HeatTransfer.Jtotal*Unity(i).Shell.HeatTransfer.Phi;
    1116 
    1117 "Shell Pressure Drop Cross Flow"
    1118         Unity(i).Shell.PressureDrop.PdCross             = HE.DeltaPcross(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Hot.Average.rho);
    1119 
    1120 "Shell Pressure Baffle Window"
    1121         Unity(i).Shell.PressureDrop.Pdwindow            = HE.DeltaPwindow(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Hot.Average.rho,Unity(i).Properties.Hot.Average.Mu,Unity(i).Baffles.Ls);
    1122 
    1123 "Shell Pressure End Zones"
    1124         Unity(i).Shell.PressureDrop.PdEndZones  = HE.DeltaPendZones(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Hot.Average.rho);
    1125 
    1126 
    1127         else
    1128 
    1129 "Shell Side Reynolds Number"
    1130         Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Cold.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Cold.Average.Mu;
    1131 
    1132 "Shell Heat Transfer Coefficient"
    1133         Unity(i).Shell.HeatTransfer.hshell=Unity(i).Shell.HeatTransfer.Ji*(Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*(Unity(i).Properties.Cold.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)*(Unity(i).Shell.HeatTransfer.PR^(-2/3))*Unity(i).Shell.HeatTransfer.Jtotal*Unity(i).Shell.HeatTransfer.Phi;
    1134 
    1135 "Shell Pressure Drop Cross Flow"
    1136         Unity(i).Shell.PressureDrop.PdCross      = HE.DeltaPcross(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Cold.Average.rho);
    1137 
    1138 "Shell Pressure Baffle Window"
    1139         Unity(i).Shell.PressureDrop.Pdwindow     = HE.DeltaPwindow(Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Cold.Average.rho,Unity(i).Properties.Cold.Average.Mu,Unity(i).Baffles.Ls);
    1140 
    1141 "Shell Pressure End Zones"
    1142         Unity(i).Shell.PressureDrop.PdEndZones  = HE.DeltaPendZones(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Cold.Average.rho);
    1143 
    1144 
    1145 end
    1146 
    1147 "Duty"
    1148         Unity(i).Details.Q      = Eft(i)*Unity(i).Details.Cmin*(Unity(i).Inlet.Hot.T-Unity(i).Inlet.Cold.T);
    1149 
    1150 end
    1151 
    1152         SET
     921SET
    1153922#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    1154923#  Set Parameters for heatex Calculation
     
    1176945        HE.Ltd                          = Ltd; 
    1177946        side                            = HE.FluidAlocation();
     947       
     948#"Tube Side Inlet Nozzle Area"
     949        Ainozzle_Tube = (Pi*Dinozzle_Tube*Dinozzle_Tube)/4;
     950       
     951#"Tube Side Outlet Nozzle Area"
     952        Aonozzle_Tube = (Pi*Donozzle_Tube*Donozzle_Tube)/4;
     953       
     954#"Tube Inlet Nozzle Pressure Loss Coeff"
     955        Kinlet_Tube   = 1.1;
     956
     957#"Tube Outlet Nozzle Pressure Loss Coeff"
     958        Koutlet_Tube  = 0.7;
     959       
     960#"Shell Outlet Nozzle Area"
     961        Aonozzle_Shell  = (Pi*Donozzle_Shell*Donozzle_Shell)/4;
     962       
     963#"Shell Inlet Nozzle Area"
     964        Ainozzle_Shell  = (Pi*Dinozzle_Shell*Dinozzle_Shell)/4;
     965       
     966#"Shell Outlet Escape Area Under Nozzle"
     967        Aeonozzle_Shell = Pi*Donozzle_Shell*Honozzle_Shell + 0.6*Aonozzle_Shell*(1-Dotube/pitch);
     968       
     969#"Shell Inlet Escape Area Under Nozzle"
     970        Aeinozzle_Shell = Pi*Dinozzle_Shell*Hinozzle_Shell + 0.6*Ainozzle_Shell*(1-Dotube/pitch);
     971       
     972CONNECTIONS
     973
     974Unity([1:Nshell-1]).Outlet.Hot  to Unity([2:Nshell]).Inlet.Hot;
     975Unity([2:Nshell]).Outlet.Cold   to Unity([1:Nshell-1]).Inlet.Cold;
     976
     977EQUATIONS
     978
     979for i in [1:Nshell]
     980       
     981"Shell Side Cross Flow Area"
     982        Unity(i).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(i).Baffles.Ls);
     983
     984"Ji Factor"
     985        Unity(i).Shell.HeatTransfer.Ji =HE.JiFactor(Unity(i).Shell.HeatTransfer.Re);
     986
     987"Jc Factor"
     988        Unity(i).Shell.HeatTransfer.Jc = HE.JcFactor();
     989       
     990"Jl Factor"
     991        Unity(i).Shell.HeatTransfer.Jl = HE.JlFactor(Unity(i).Shell.HeatTransfer.Sm);
     992
     993"Jb Factor"
     994        Unity(i).Shell.HeatTransfer.Jb = HE.JbFactor(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Shell.HeatTransfer.Sm);
     995
     996"Jr Factor"     
     997        Unity(i).Shell.HeatTransfer.Jr = HE.JrFactor(Unity(i).Shell.HeatTransfer.Re);
     998       
     999"Total J Factor"
     1000        Unity(i).Shell.HeatTransfer.Jtotal=Unity(i).Shell.HeatTransfer.Jc*Unity(i).Shell.HeatTransfer.Jl*Unity(i).Shell.HeatTransfer.Jb*Unity(i).Shell.HeatTransfer.Jr*Unity(i).Shell.HeatTransfer.Js;
     1001
     1002
     1003#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     1004#               Pressure Drop and Velocities                                   
     1005#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     1006
     1007if side equal 1
     1008       
     1009        then
     1010       
     1011"Tube Side Pressure Drop"
     1012        Unity(i).Tubes.PressureDrop.PdTube              = HE.DeltaPtube(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Cold.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Tubes.HeatTransfer.Phi);
     1013
     1014"Pressure Drop Tube Side Inlet Nozzle"
     1015        Unity(i).Tubes.PressureDrop.Pdnozzle_in = 0.5*Kinlet_Tube*Unity(i).Properties.Cold.Inlet.rho*Unity(i).Tubes.PressureDrop.Vnozzle_in^2;
     1016
     1017"Velocity Tube Side Inlet Nozzle"
     1018        Unity(i).Tubes.PressureDrop.Vnozzle_in  = Unity(i).Properties.Cold.Inlet.Fw/(Unity(i).Properties.Cold.Inlet.rho*Ainozzle_Tube);
     1019
     1020"Pressure Drop Tube Side Outlet Nozzle"
     1021        Unity(i).Tubes.PressureDrop.Pdnozzle_out        = 0.5*Koutlet_Tube*Unity(i).Properties.Cold.Outlet.rho*Unity(i).Tubes.PressureDrop.Vnozzle_out^2;
     1022
     1023"Velocity Tube Side Outlet Nozzle"
     1024        Unity(i).Tubes.PressureDrop.Vnozzle_out = Unity(i).Properties.Cold.Inlet.Fw/(Unity(i).Properties.Cold.Outlet.rho*Aonozzle_Tube);
     1025
     1026"Shell Pressure Drop Inlet Nozzle"
     1027        Unity(i).Shell.PressureDrop.Pdnozzle_in = (0.5*Unity(i).Properties.Hot.Inlet.Fw^2/Unity(i).Properties.Hot.Inlet.rho)*((1/Ainozzle_Shell^2)+(1/Aeinozzle_Shell^2));
     1028
     1029"Velocity Shell Side Inlet Nozzle"
     1030        Unity(i).Shell.PressureDrop.Vnozzle_in  = Unity(i).Properties.Hot.Inlet.Fw/(Unity(i).Properties.Hot.Inlet.rho*Ainozzle_Shell);
     1031
     1032"Shell Pressure Drop Outlet Nozzle"
     1033        Unity(i).Shell.PressureDrop.Pdnozzle_out        = (0.5*Unity(i).Properties.Hot.Outlet.Fw^2/Unity(i).Properties.Hot.Outlet.rho)*((1/Ainozzle_Shell^2)+(1/Aeinozzle_Shell^2));
     1034
     1035"Velocity Shell Side Outlet Nozzle"
     1036        Unity(i).Shell.PressureDrop.Vnozzle_out = Unity(i).Properties.Hot.Outlet.Fw/(Unity(i).Properties.Hot.Outlet.rho*Aonozzle_Shell);
     1037
     1038"Pressure Drop Hot Stream"
     1039        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P - Unity(i).Shell.PressureDrop.Pdtotal;   
     1040       
     1041"Pressure Drop Cold Stream"
     1042        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Tubes.PressureDrop.Pdtotal;
     1043
     1044
     1045        else
     1046
     1047"Tube Side Pressure Drop"
     1048        Unity(i).Tubes.PressureDrop.PdTube              = HE.DeltaPtube(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Hot.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Tubes.HeatTransfer.Phi);
     1049
     1050"Pressure Drop Tube Side Inlet Nozzle"
     1051        Unity(i).Tubes.PressureDrop.Pdnozzle_in = 0.5*Kinlet_Tube*Unity(i).Properties.Hot.Inlet.rho*Unity(i).Tubes.PressureDrop.Vnozzle_in^2;
     1052       
     1053"Velocity Tube Side Inlet Nozzle"
     1054        Unity(i).Tubes.PressureDrop.Vnozzle_in  = Unity(i).Properties.Hot.Inlet.Fw/(Unity(i).Properties.Hot.Inlet.rho*Ainozzle_Tube);
     1055       
     1056"Pressure Drop Tube Side Outlet Nozzle"
     1057        Unity(i).Tubes.PressureDrop.Pdnozzle_out        = 0.5*Koutlet_Tube*Unity(i).Properties.Hot.Outlet.rho*Unity(i).Tubes.PressureDrop.Vnozzle_out^2;
     1058       
     1059"Velocity Tube Side Outlet Nozzle"
     1060        Unity(i).Tubes.PressureDrop.Vnozzle_out = Unity(i).Properties.Hot.Inlet.Fw/(Unity(i).Properties.Hot.Outlet.rho*Aonozzle_Tube); 
     1061
     1062"Shell Pressure Drop Inlet Nozzle"
     1063        Unity(i).Shell.PressureDrop.Pdnozzle_in = (0.5*Unity(i).Properties.Cold.Inlet.Fw^2/Unity(i).Properties.Cold.Inlet.rho)*((1/Ainozzle_Shell^2)+(1/Aeinozzle_Shell^2));
     1064
     1065"Velocity Shell Side Inlet Nozzle"
     1066        Unity(i).Shell.PressureDrop.Vnozzle_in  = Unity(i).Properties.Cold.Inlet.Fw/(Unity(i).Properties.Cold.Inlet.rho*Ainozzle_Shell);
     1067
     1068"Shell Pressure Drop Outlet Nozzle"
     1069        Unity(i).Shell.PressureDrop.Pdnozzle_out = (0.5*Unity(i).Properties.Cold.Outlet.Fw^2/Unity(i).Properties.Cold.Outlet.rho)*((1/Ainozzle_Shell^2)+(1/Aeinozzle_Shell^2));
     1070
     1071"Velocity Shell Side Outlet Nozzle"
     1072        Unity(i).Shell.PressureDrop.Vnozzle_out  = Unity(i).Properties.Cold.Outlet.Fw/(Unity(i).Properties.Cold.Outlet.rho*Ainozzle_Shell);
     1073
     1074"Pressure Drop Hot Stream"
     1075        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P- Unity(i).Tubes.PressureDrop.Pdtotal;     
     1076       
     1077"Pressure Drop Cold Stream"
     1078        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Shell.PressureDrop.Pdtotal;
     1079
     1080end
     1081
     1082#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     1083#               Phi correction
     1084#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     1085
     1086if side equal 1 then
     1087       
     1088"Shell Side Phi correction for viscosity"
     1089        Unity(i).Shell.HeatTransfer.Phi = HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
     1090       
     1091"Tube Side Phi correction for viscosity"
     1092        Unity(i).Tubes.HeatTransfer.Phi  = HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
     1093       
     1094        else
     1095       
     1096"Shell Side Phi correction for viscosity"
     1097        Unity(i).Shell.HeatTransfer.Phi = HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
     1098       
     1099"Tube Side Phi correction for viscosity"
     1100        Unity(i).Tubes.HeatTransfer.Phi  = HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Average.Mu);
     1101
     1102end
     1103
     1104
     1105if side equal 1
     1106       
     1107        then
     1108
     1109"Shell Side inlet Nozzle rho-V^2"
     1110        Unity(i).Shell.PressureDrop.RVsquare_in = Unity(i).Properties.Hot.Inlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_in)^2;
     1111
     1112"Shell Side Outlet Nozzle rho-V^2"
     1113        Unity(i).Shell.PressureDrop.RVsquare_out = Unity(i).Properties.Hot.Outlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_out)^2;
     1114       
     1115        else
     1116       
     1117"Shell Side inlet Nozzle rho-V^2"
     1118        Unity(i).Shell.PressureDrop.RVsquare_in = Unity(i).Properties.Cold.Inlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_in)^2;
     1119
     1120"Shell Side Outlet Nozzle rho-V^2"
     1121        Unity(i).Shell.PressureDrop.RVsquare_out = Unity(i).Properties.Cold.Outlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_out)^2;
     1122
     1123end
     1124
     1125
     1126if side equal 1
     1127       
     1128        then
     1129       
     1130"Hot Wall Temperature"
     1131        Unity(i).Properties.Hot.Wall.Twall      = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
     1132
     1133"ColdWall Temperature"
     1134        Unity(i).Properties.Cold.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
     1135
     1136"Tube Side Velocity"
     1137        Unity(i).Tubes.HeatTransfer.Vtube       = Unity(i).Properties.Cold.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Cold.Average.rho*Ntt);
     1138
     1139"Tube Side Reynolds Number"
     1140        Unity(i).Tubes.HeatTransfer.Re          = (Unity(i).Properties.Cold.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Cold.Average.Mu;
     1141       
     1142"Tube Side Prandtl Number"
     1143        Unity(i).Tubes.HeatTransfer.PR          = ((Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Average.Mu)/Unity(i).Properties.Cold.Average.K;
     1144
     1145"Tube Side Prandtl Number at Wall Temperature"
     1146        Unity(i).Tubes.HeatTransfer.PRw                 = ((Unity(i).Properties.Cold.Wall.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Wall.Mu)/Unity(i).Properties.Cold.Wall.K;
     1147
     1148"Tube Side Film Coefficient"
     1149        Unity(i).Tubes.HeatTransfer.htube       = HE.TubeFilmCoeff(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Cold.Average.K)*Unity(i).Tubes.HeatTransfer.Phi;
     1150
     1151"Shell Side Prandtl Number"
     1152        Unity(i).Shell.HeatTransfer.PR          = ((Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Average.Mu)/Unity(i).Properties.Hot.Average.K;
     1153
     1154"Shell Side Prandtl Number at Wall Temperature"
     1155        Unity(i).Shell.HeatTransfer.PRw                 = ((Unity(i).Properties.Hot.Wall.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Wall.Mu)/Unity(i).Properties.Hot.Wall.K;
     1156
     1157
     1158        else
     1159
     1160"Hot Wall Temperature"
     1161        Unity(i).Properties.Hot.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
     1162
     1163"Cold Wall Temperature"
     1164        Unity(i).Properties.Cold.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
     1165
     1166"Tube Side Velocity"
     1167        Unity(i).Tubes.HeatTransfer.Vtube       =       Unity(i).Properties.Hot.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Hot.Average.rho*Ntt);
     1168
     1169"Tube Side Reynolds Number"
     1170        Unity(i).Tubes.HeatTransfer.Re          =       (Unity(i).Properties.Hot.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Hot.Average.Mu;
     1171
     1172"Tube Side Prandtl Number"
     1173        Unity(i).Tubes.HeatTransfer.PR = ((Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Average.Mu)/Unity(i).Properties.Hot.Average.K;
     1174
     1175"Tube Side Prandtl Number at Wall"
     1176        Unity(i).Tubes.HeatTransfer.PRw = ((Unity(i).Properties.Hot.Wall.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Wall.Mu)/Unity(i).Properties.Hot.Wall.K;
     1177
     1178"Tube Side Film Coefficient"
     1179        Unity(i).Tubes.HeatTransfer.htube= HE.TubeFilmCoeff(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Hot.Average.K)*Unity(i).Tubes.HeatTransfer.Phi;
     1180       
     1181"Shell Side Prandtl Number"
     1182        Unity(i).Shell.HeatTransfer.PR = ((Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Average.Mu)/Unity(i).Properties.Cold.Average.K;
     1183
     1184"Shell Side Prandtl Number at Wall"
     1185        Unity(i).Shell.HeatTransfer.PRw=((Unity(i).Properties.Cold.Wall.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Wall.Mu)/Unity(i).Properties.Cold.Wall.K;
     1186
     1187end
     1188
     1189"Tube Resistance"       
     1190        Unity(i).Resistances.Rtube*(Unity(i).Tubes.HeatTransfer.htube*Ditube) = Dotube;
     1191       
     1192"Wall Resistance"
     1193        Unity(i).Resistances.Rwall=Dotube*ln(Dotube/Ditube)/(2*Kwall);
     1194       
     1195"Shell Resistance"
     1196        Unity(i).Resistances.Rshell*(Unity(i).Shell.HeatTransfer.hshell)=1;
     1197       
     1198"Overall Heat Transfer Coefficient Clean"
     1199        Unity(i).Details.Uc=1/(Dotube/(Unity(i).Tubes.HeatTransfer.htube*Ditube)+(Dotube*ln(Dotube/Ditube)/(2*Kwall))+(1/(Unity(i).Shell.HeatTransfer.hshell)));
     1200
     1201"Overall Heat Transfer Coefficient Dirty"
     1202        (1/Unity(i).Details.Ud)=(1/Unity(i).Details.Uc)+Unity(i).Resistances.Rfo+Unity(i).Resistances.Rfi*(Dotube/Ditube);
     1203
     1204"Exchange Surface Area"
     1205        Unity(i).Details.A=Pi*Dotube*Ntt*Ltube;
     1206
     1207"Baffles Spacing"
     1208        Ltube = Unity(i).Baffles.Lsi+Unity(i).Baffles.Lso+Unity(i).Baffles.Ls*(Nb-1);
     1209
     1210"TEMA E Shell Effectiveness"
     1211        Eft(i) = 2*(1+Unity(i).Details.Cr+sqrt(1+Unity(i).Details.Cr^2)*((1+exp(-Unity(i).Details.NTU*sqrt(1+Unity(i).Details.Cr^2)))/(1-exp(-Unity(i).Details.NTU*sqrt(1+Unity(i).Details.Cr^2)))) )^-1;
     1212
     1213"Js Factor"     
     1214        Unity(i).Shell.HeatTransfer.Js = HE.JsFactor(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Lsi,Unity(i).Baffles.Lso,Unity(i).Baffles.Ls);
     1215
     1216
     1217if side equal 1
     1218       
     1219        then
     1220       
     1221"Shell Side Reynolds Number"
     1222        Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Hot.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Hot.Average.Mu;
     1223
     1224"Shell Heat Transfer Coefficient"
     1225        Unity(i).Shell.HeatTransfer.hshell=Unity(i).Shell.HeatTransfer.Ji*(Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*(Unity(i).Properties.Hot.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)*(Unity(i).Shell.HeatTransfer.PR^(-2/3))*Unity(i).Shell.HeatTransfer.Jtotal*Unity(i).Shell.HeatTransfer.Phi;
     1226
     1227"Shell Pressure Drop Cross Flow"
     1228        Unity(i).Shell.PressureDrop.PdCross             = HE.DeltaPcross(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Hot.Average.rho);
     1229
     1230"Shell Pressure Baffle Window"
     1231        Unity(i).Shell.PressureDrop.Pdwindow            = HE.DeltaPwindow(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Hot.Average.rho,Unity(i).Properties.Hot.Average.Mu,Unity(i).Baffles.Ls);
     1232
     1233"Shell Pressure End Zones"
     1234        Unity(i).Shell.PressureDrop.PdEndZones  = HE.DeltaPendZones(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Hot.Average.rho);
     1235
     1236
     1237        else
     1238
     1239"Shell Side Reynolds Number"
     1240        Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Cold.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Cold.Average.Mu;
     1241
     1242"Shell Heat Transfer Coefficient"
     1243        Unity(i).Shell.HeatTransfer.hshell=Unity(i).Shell.HeatTransfer.Ji*(Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*(Unity(i).Properties.Cold.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)*(Unity(i).Shell.HeatTransfer.PR^(-2/3))*Unity(i).Shell.HeatTransfer.Jtotal*Unity(i).Shell.HeatTransfer.Phi;
     1244
     1245"Shell Pressure Drop Cross Flow"
     1246        Unity(i).Shell.PressureDrop.PdCross      = HE.DeltaPcross(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Cold.Average.rho);
     1247
     1248"Shell Pressure Baffle Window"
     1249        Unity(i).Shell.PressureDrop.Pdwindow     = HE.DeltaPwindow(Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Cold.Average.rho,Unity(i).Properties.Cold.Average.Mu,Unity(i).Baffles.Ls);
     1250
     1251"Shell Pressure End Zones"
     1252        Unity(i).Shell.PressureDrop.PdEndZones  = HE.DeltaPendZones(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Cold.Average.rho);
     1253
     1254
     1255end
     1256
     1257"Duty"
     1258        Unity(i).Details.Q      = Eft(i)*Unity(i).Details.Cmin*(Unity(i).Inlet.Hot.T-Unity(i).Inlet.Cold.T);
     1259
     1260end
    11781261
    11791262end
     
    13241407Hinozzle_Shell  as length               (Brief="Height Under Shell Inlet Nozzle",Lower=10e-6);
    13251408Honozzle_Shell  as length               (Brief="Height Under Shell Outlet Nozzle",Lower=10e-6);
     1409Aonozzle_Shell  as area                 (Brief="Shell Outlet Nozzle Area",Lower=10e-6);
     1410Ainozzle_Shell  as area                 (Brief="Shell Inlet Nozzle Area",Lower=10e-6);
     1411Aeonozzle_Shell as area                 (Brief="Shell Outlet Escape Area Under Nozzle",Lower=10e-6);
     1412Aeinozzle_Shell as area                 (Brief="Shell Inlet Escape Area Under Nozzle",Lower=10e-6);
    13261413Lcf                     as length               (Brief="Bundle-to-Shell Clearance",Lower=10e-8);
    13271414#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     
    13371424Donozzle_Tube   as length               (Brief="Tube Outlet Nozzle Diameter",Lower=10e-6);
    13381425Dinozzle_Tube   as length               (Brief="Tube Inlett Nozzle Diameter",Lower=10e-6);
     1426Aonozzle_Tube   as area                 (Brief="Tube Outlet Nozzle Area",Lower=10e-6);
     1427Ainozzle_Tube   as area                 (Brief="Tube Inlet Nozzle Area",Lower=10e-6);
     1428Kinlet_Tube     as positive             (Brief="Tube Inlet Nozzle Pressure Loss Coeff",Default=1.1);
     1429Koutlet_Tube    as positive             (Brief="Tube Outlet Nozzle Pressure Loss Coeff",Default=0.7);
     1430
    13391431#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    13401432#       Baffles Geometrical Parameters
     
    13521444Unity(Nshell)           as HeatExchangerDetailed_Basic;
    13531445
    1354 CONNECTIONS
    1355 
    1356 Unity([1:Nshell-1]).Outlet.Hot  to Unity([2:Nshell]).Inlet.Hot;
    1357 Unity([2:Nshell]).Outlet.Cold to Unity([1:Nshell-1]).Inlet.Cold;
    1358 
    1359 EQUATIONS
    1360 
    1361 for i in [1:Nshell]
    1362        
    1363 "Shell Side Cross Flow Area"
    1364         Unity(i).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(i).Baffles.Ls);
    1365 
    1366 "Ji Factor"
    1367         Unity(i).Shell.HeatTransfer.Ji = HE.JiFactor(Unity(i).Shell.HeatTransfer.Re);
    1368 
    1369 "Jc Factor"
    1370         Unity(i).Shell.HeatTransfer.Jc = HE.JcFactor();
    1371        
    1372 "Jl Factor"
    1373         Unity(i).Shell.HeatTransfer.Jl = HE.JlFactor(Unity(i).Shell.HeatTransfer.Sm);
    1374 
    1375 "Jb Factor"
    1376         Unity(i).Shell.HeatTransfer.Jb = HE.JbFactor(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Shell.HeatTransfer.Sm);
    1377 
    1378 "Jr Factor"     
    1379         Unity(i).Shell.HeatTransfer.Jr = HE.JrFactor(Unity(i).Shell.HeatTransfer.Re);
    1380        
    1381 "Total J Factor"
    1382         Unity(i).Shell.HeatTransfer.Jtotal=Unity(i).Shell.HeatTransfer.Jc*Unity(i).Shell.HeatTransfer.Jl*Unity(i).Shell.HeatTransfer.Jb*Unity(i).Shell.HeatTransfer.Jr*Unity(i).Shell.HeatTransfer.Js;
    1383 
    1384 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    1385 #  Fluid Alocation
    1386 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    1387 
    1388 if side equal 1 then
    1389        
    1390        
    1391 "Shell Side Phi correction for viscosity"
    1392         Unity(i).Shell.HeatTransfer.Phi = HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
    1393        
    1394 "Tube Side Phi correction for viscosity"
    1395         Unity(i).Tubes.HeatTransfer.Phi  = HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
    1396        
    1397         else
    1398        
    1399        
    1400 "Shell Side Phi correction for viscosity"
    1401         Unity(i).Shell.HeatTransfer.Phi = HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
    1402        
    1403 "Tube Side Phi correction for viscosity"
    1404         Unity(i).Tubes.HeatTransfer.Phi  = HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
    1405 
    1406 end
    1407 
    1408 
    1409 if side equal 1
    1410        
    1411         then
    1412        
    1413 "Cold Wall Temperature"
    1414         Unity(i).Properties.Cold.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    1415 
    1416 "Hot Wall Temperature" 
    1417         Unity(i).Properties.Hot.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    1418 
    1419 "Tube Side Velocity"
    1420         Unity(i).Tubes.HeatTransfer.Vtube  = Unity(i).Properties.Cold.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Cold.Average.rho*Ntt);
    1421 
    1422 "Tube Side Reynolds Number"
    1423         Unity(i).Tubes.HeatTransfer.Re=(Unity(i).Properties.Cold.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Cold.Average.Mu;
    1424 
    1425 "Tube Side Prandtl Number"
    1426         Unity(i).Tubes.HeatTransfer.PR = ((Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Average.Mu)/Unity(i).Properties.Cold.Average.K;
    1427 
    1428 "Tube Side Prandtl Number at Wall"
    1429         Unity(i).Tubes.HeatTransfer.PRw = ((Unity(i).Properties.Cold.Wall.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Wall.Mu)/Unity(i).Properties.Cold.Wall.K;
    1430 
    1431 "Tube Side Film Coefficient"
    1432         Unity(i).Tubes.HeatTransfer.htube= HE.TubeFilmCoeff(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Cold.Average.K)*Unity(i).Tubes.HeatTransfer.Phi;
    1433        
    1434 "Shell Side Prandtl Number"
    1435         Unity(i).Shell.HeatTransfer.PR=((Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Average.Mu)/Unity(i).Properties.Hot.Average.K; 
    1436 
    1437 "Shell Side Prandtl Number at Wall"
    1438         Unity(i).Shell.HeatTransfer.PRw=((Unity(i).Properties.Hot.Wall.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Wall.Mu)/Unity(i).Properties.Hot.Wall.K; 
    1439 
    1440 "Tube Side Pressure Drop"
    1441         Unity(i).Tubes.PressureDrop.PdTube              = HE.DeltaPtube(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Cold.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Tubes.HeatTransfer.Phi);
    1442 
    1443 "Pressure Drop Tube Side Inlet Nozzle"
    1444         Unity(i).Tubes.PressureDrop.Pdnozzle_in = HE.DeltaPtubeNozzlein(Unity(i).Properties.Cold.Inlet.rho,Unity(i).Properties.Cold.Inlet.Fw);
    1445 
    1446 "Velocity Tube Side Inlet Nozzle"
    1447         Unity(i).Tubes.PressureDrop.Vnozzle_in  = HE.TubeVelocityNozzlein(Unity(i).Properties.Cold.Inlet.rho,Unity(i).Properties.Cold.Inlet.Fw);
    1448 
    1449 "Pressure Drop Tube Side Outlet Nozzle"
    1450         Unity(i).Tubes.PressureDrop.Pdnozzle_out        = HE.DeltaPtubeNozzleout(Unity(i).Properties.Cold.Outlet.rho,Unity(i).Properties.Cold.Inlet.Fw);
    1451 
    1452 "Velocity Tube Side Outlet Nozzle"
    1453         Unity(i).Tubes.PressureDrop.Vnozzle_out = HE.TubeVelocityNozzleout(Unity(i).Properties.Cold.Outlet.rho,Unity(i).Properties.Cold.Inlet.Fw);
    1454 
    1455 "Shell Pressure Drop Inlet Nozzle"
    1456         Unity(i).Shell.PressureDrop.Pdnozzle_in = HE.DeltaPshellNozzleIn(Unity(i).Properties.Hot.Inlet.rho,Unity(i).Properties.Hot.Inlet.Fw);
    1457 
    1458 "Velocity Shell Side Inlet Nozzle"
    1459         Unity(i).Shell.PressureDrop.Vnozzle_in  = HE.ShellVelocityNozzleIn(Unity(i).Properties.Hot.Inlet.rho,Unity(i).Properties.Hot.Inlet.Fw);
    1460 
    1461 "Shell Pressure Drop Outlet Nozzle"
    1462         Unity(i).Shell.PressureDrop.Pdnozzle_out        =HE.DeltaPshellNozzleOut(Unity(i).Properties.Hot.Outlet.rho,Unity(i).Properties.Hot.Inlet.Fw);
    1463 
    1464 "Velocity Shell Side Outlet Nozzle"
    1465         Unity(i).Shell.PressureDrop.Vnozzle_out =HE.ShellVelocityNozzleOut(Unity(i).Properties.Hot.Outlet.rho,Unity(i).Properties.Hot.Inlet.Fw);
    1466 
    1467 "Pressure Drop Hot Stream"
    1468         Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P- Unity(i).Shell.PressureDrop.Pdtotal;     
    1469        
    1470 "Pressure Drop Cold Stream"
    1471         Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Tubes.PressureDrop.Pdtotal;
    1472 
    1473 
    1474         else
    1475 
    1476 "Cold Wall Temperature"
    1477         Unity(i).Properties.Cold.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    1478 
    1479 "Hot Wall Temperature"
    1480         Unity(i).Properties.Hot.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    1481 
    1482 "Tube Side Velocity"
    1483         Unity(i).Tubes.HeatTransfer.Vtube  = Unity(i).Properties.Hot.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Hot.Average.rho*Ntt);
    1484 
    1485 "Tube Side Reynolds Number"
    1486         Unity(i).Tubes.HeatTransfer.Re=(Unity(i).Properties.Hot.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Hot.Average.Mu;
    1487        
    1488 "Tube Side Prandtl Number"
    1489         Unity(i).Tubes.HeatTransfer.PR=((Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Average.Mu)/Unity(i).Properties.Hot.Average.K;
    1490 
    1491 "Tube Side Prandtl Number at Wall"
    1492         Unity(i).Tubes.HeatTransfer.PRw=((Unity(i).Properties.Hot.Wall.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Wall.Mu)/Unity(i).Properties.Hot.Wall.K;
    1493 
    1494 "Tube Side Film Coefficient"
    1495         Unity(i).Tubes.HeatTransfer.htube= HE.TubeFilmCoeff(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Hot.Average.K)*Unity(i).Tubes.HeatTransfer.Phi;
    1496        
    1497 "Shell Side Prandtl Number"
    1498         Unity(i).Shell.HeatTransfer.PR=((Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Average.Mu)/Unity(i).Properties.Cold.Average.K;
    1499 
    1500 "Shell Side Prandtl Number at Wall"
    1501         Unity(i).Shell.HeatTransfer.PRw=((Unity(i).Properties.Cold.Wall.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Wall.Mu)/Unity(i).Properties.Cold.Wall.K;
    1502 
    1503 "Tube Side Pressure Drop"
    1504         Unity(i).Tubes.PressureDrop.PdTube              = HE.DeltaPtube(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Hot.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Tubes.HeatTransfer.Phi);
    1505 
    1506 "Pressure Drop Tube Side Inlet Nozzle"
    1507         Unity(i).Tubes.PressureDrop.Pdnozzle_in = HE.DeltaPtubeNozzlein(Unity(i).Properties.Hot.Inlet.rho,Unity(i).Properties.Hot.Inlet.Fw);
    1508 
    1509 "Velocity Tube Side Inlet Nozzle"
    1510         Unity(i).Tubes.PressureDrop.Vnozzle_in  = HE.TubeVelocityNozzlein(Unity(i).Properties.Hot.Inlet.rho,Unity(i).Properties.Hot.Inlet.Fw);
    1511 
    1512 "Pressure Drop Tube Side Outlet Nozzle"
    1513         Unity(i).Tubes.PressureDrop.Pdnozzle_out        = HE.DeltaPtubeNozzleout(Unity(i).Properties.Hot.Outlet.rho,Unity(i).Properties.Hot.Inlet.Fw); 
    1514 
    1515 "Velocity Tube Side Outlet Nozzle"
    1516         Unity(i).Tubes.PressureDrop.Vnozzle_out = HE.TubeVelocityNozzleout(Unity(i).Properties.Hot.Outlet.rho,Unity(i).Properties.Hot.Inlet.Fw);       
    1517 
    1518 "Shell Pressure Drop Inlet Nozzle"
    1519         Unity(i).Shell.PressureDrop.Pdnozzle_in = HE.DeltaPshellNozzleIn(Unity(i).Properties.Cold.Inlet.rho,Unity(i).Properties.Cold.Inlet.Fw);
    1520 
    1521 "Velocity Shell Side Inlet Nozzle"
    1522         Unity(i).Shell.PressureDrop.Vnozzle_in  = HE.ShellVelocityNozzleIn(Unity(i).Properties.Cold.Inlet.rho,Unity(i).Properties.Cold.Inlet.Fw);
    1523 
    1524 "Shell Pressure Drop Outlet Nozzle"
    1525         Unity(i).Shell.PressureDrop.Pdnozzle_out = HE.DeltaPshellNozzleOut(Unity(i).Properties.Cold.Outlet.rho,Unity(i).Properties.Cold.Inlet.Fw);
    1526 
    1527 "Velocity Shell Side Outlet Nozzle"
    1528         Unity(i).Shell.PressureDrop.Vnozzle_out  = HE.ShellVelocityNozzleOut(Unity(i).Properties.Cold.Outlet.rho,Unity(i).Properties.Cold.Inlet.Fw);
    1529 
    1530 "Pressure Drop Hot Stream"
    1531         Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P- Unity(i).Tubes.PressureDrop.Pdtotal;     
    1532        
    1533 "Pressure Drop Cold Stream"
    1534         Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Shell.PressureDrop.Pdtotal;
    1535 
    1536 
    1537 end
    1538 
    1539 if side equal 1
    1540        
    1541         then
    1542 
    1543 "Shell Side inlet Nozzle rho-V^2"
    1544         Unity(i).Shell.PressureDrop.RVsquare_in = Unity(i).Properties.Hot.Inlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_in)^2;
    1545 
    1546 "Shell Side Outlet Nozzle rho-V^2"
    1547         Unity(i).Shell.PressureDrop.RVsquare_out = Unity(i).Properties.Hot.Outlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_out)^2;
    1548        
    1549         else
    1550        
    1551 "Shell Side inlet Nozzle rho-V^2"
    1552         Unity(i).Shell.PressureDrop.RVsquare_in = Unity(i).Properties.Cold.Inlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_in)^2;
    1553 
    1554 "Shell Side Outlet Nozzle rho-V^2"
    1555         Unity(i).Shell.PressureDrop.RVsquare_out = Unity(i).Properties.Cold.Outlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_out)^2;
    1556 
    1557 end
    1558 
    1559 "Tube Resistance"       
    1560         Unity(i).Resistances.Rtube*(Unity(i).Tubes.HeatTransfer.htube*Ditube) = Dotube;
    1561        
    1562 "Wall Resistance"
    1563         Unity(i).Resistances.Rwall=Dotube*ln(Dotube/Ditube)/(2*Kwall);
    1564        
    1565 "Shell Resistance"
    1566         Unity(i).Resistances.Rshell*(Unity(i).Shell.HeatTransfer.hshell)=1;
    1567        
    1568 "Overall Heat Transfer Coefficient Clean"
    1569         Unity(i).Details.Uc*(Dotube/(Unity(i).Tubes.HeatTransfer.htube*Ditube)+(Dotube*ln(Dotube/Ditube)/(2*Kwall))+(1/(Unity(i).Shell.HeatTransfer.hshell)))=1;
    1570 
    1571 "Overall Heat Transfer Coefficient Dirty"
    1572         (1/Unity(i).Details.Ud)=(1/Unity(i).Details.Uc)+Unity(i).Resistances.Rfo+Unity(i).Resistances.Rfi*(Dotube/Ditube);
    1573 
    1574 "Exchange Surface Area"
    1575         Unity(i).Details.A=Pi*Dotube*Ntt*Ltube;
    1576 
    1577 "Baffles Spacing"
    1578         Ltube = Unity(i).Baffles.Lsi+Unity(i).Baffles.Lso+Unity(i).Baffles.Ls*(Nb-1);
    1579        
    1580 "LMTD Correction Factor"
    1581         Fc(i) = HE.EshellCorrectionFactor(Unity(i).Inlet.Hot.T,Unity(i).Outlet.Hot.T,Unity(i).Inlet.Cold.T,Unity(i).Outlet.Cold.T);
    1582 
    1583 "Counter Flow LMTD"
    1584         LMTD(i) = HE.CounterLMTD(Unity(i).Inlet.Hot.T,Unity(i).Outlet.Hot.T,Unity(i).Inlet.Cold.T,Unity(i).Outlet.Cold.T);
    1585 
    1586 "Js Factor"     
    1587         Unity(i).Shell.HeatTransfer.Js = HE.JsFactor(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Lsi,Unity(i).Baffles.Lso,Unity(i).Baffles.Ls);
    1588 
    1589 if side equal 1
    1590        
    1591         then
    1592        
    1593 "Shell Side Reynolds Number"
    1594         Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Hot.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Hot.Average.Mu;
    1595 
    1596 "Shell Heat Transfer Coefficient"
    1597         Unity(i).Shell.HeatTransfer.hshell=Unity(i).Shell.HeatTransfer.Ji*(Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*(Unity(i).Properties.Hot.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)*(Unity(i).Shell.HeatTransfer.PR^(-2/3))*Unity(i).Shell.HeatTransfer.Jtotal*Unity(i).Shell.HeatTransfer.Phi;
    1598 
    1599 "Shell Pressure Drop Cross Flow"
    1600         Unity(i).Shell.PressureDrop.PdCross             = HE.DeltaPcross(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Hot.Average.rho);
    1601 
    1602 "Shell Pressure Baffle Window"
    1603         Unity(i).Shell.PressureDrop.Pdwindow            = HE.DeltaPwindow(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Hot.Average.rho,Unity(i).Properties.Hot.Average.Mu,Unity(i).Baffles.Ls);
    1604 
    1605 "Shell Pressure End Zones"
    1606         Unity(i).Shell.PressureDrop.PdEndZones  = HE.DeltaPendZones(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Hot.Average.rho);
    1607 
    1608 
    1609         else
    1610 
    1611 "Shell Side Reynolds Number"
    1612         Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Cold.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Cold.Average.Mu;
    1613 
    1614 "Shell Heat Transfer Coefficient"
    1615         Unity(i).Shell.HeatTransfer.hshell=Unity(i).Shell.HeatTransfer.Ji*(Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*(Unity(i).Properties.Cold.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)*(Unity(i).Shell.HeatTransfer.PR^(-2/3))*Unity(i).Shell.HeatTransfer.Jtotal*Unity(i).Shell.HeatTransfer.Phi;
    1616 
    1617 "Shell Pressure Drop Cross Flow"
    1618         Unity(i).Shell.PressureDrop.PdCross      = HE.DeltaPcross(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Cold.Average.rho);
    1619 
    1620 "Shell Pressure Baffle Window"
    1621         Unity(i).Shell.PressureDrop.Pdwindow     = HE.DeltaPwindow(Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Cold.Average.rho,Unity(i).Properties.Cold.Average.Mu,Unity(i).Baffles.Ls);
    1622 
    1623 "Shell Pressure End Zones"
    1624         Unity(i).Shell.PressureDrop.PdEndZones  = HE.DeltaPendZones(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Cold.Average.rho);
    1625 
    1626 
    1627 end
    1628 
    1629 "Exchange Surface Area"
    1630         Unity(i).Details.Q   = Unity(i).Details.Ud*Pi*Dotube*Ntt*Ltube*Fc(i)*LMTD(i);
    1631        
    1632 "Mean Temperature Difference"   
    1633         MTD(i)   = Fc(i)*LMTD(i);
    1634 
    1635 end
    1636 
    1637         SET
     1446SET
    16381447#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    16391448#  Set Parameters for heatex Calculation
     
    16611470        HE.Ltd                          = Ltd; 
    16621471        side                            = HE.FluidAlocation();
    1663 
    1664 end
    1665 
     1472       
     1473#"Tube Side Inlet Nozzle Area"
     1474        Ainozzle_Tube = (Pi*Dinozzle_Tube*Dinozzle_Tube)/4;
     1475       
     1476#"Tube Side Outlet Nozzle Area"
     1477        Aonozzle_Tube = (Pi*Donozzle_Tube*Donozzle_Tube)/4;
     1478       
     1479#"Tube Inlet Nozzle Pressure Loss Coeff"
     1480        Kinlet_Tube   = 1.1;
     1481
     1482#"Tube Outlet Nozzle Pressure Loss Coeff"
     1483        Koutlet_Tube  = 0.7;
     1484       
     1485#"Shell Outlet Nozzle Area"
     1486        Aonozzle_Shell  = (Pi*Donozzle_Shell*Donozzle_Shell)/4;
     1487       
     1488#"Shell Inlet Nozzle Area"
     1489        Ainozzle_Shell  = (Pi*Dinozzle_Shell*Dinozzle_Shell)/4;
     1490       
     1491#"Shell Outlet Escape Area Under Nozzle"
     1492        Aeonozzle_Shell = Pi*Donozzle_Shell*Honozzle_Shell + 0.6*Aonozzle_Shell*(1-Dotube/pitch);
     1493       
     1494#"Shell Inlet Escape Area Under Nozzle"
     1495        Aeinozzle_Shell = Pi*Dinozzle_Shell*Hinozzle_Shell + 0.6*Ainozzle_Shell*(1-Dotube/pitch);
     1496       
     1497CONNECTIONS
     1498
     1499Unity([1:Nshell-1]).Outlet.Hot  to Unity([2:Nshell]).Inlet.Hot;
     1500Unity([2:Nshell]).Outlet.Cold to Unity([1:Nshell-1]).Inlet.Cold;
     1501
     1502EQUATIONS
     1503
     1504for i in [1:Nshell]
     1505       
     1506"Shell Side Cross Flow Area"
     1507        Unity(i).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(i).Baffles.Ls);
     1508
     1509"Ji Factor"
     1510        Unity(i).Shell.HeatTransfer.Ji = HE.JiFactor(Unity(i).Shell.HeatTransfer.Re);
     1511
     1512"Jc Factor"
     1513        Unity(i).Shell.HeatTransfer.Jc = HE.JcFactor();
     1514       
     1515"Jl Factor"
     1516        Unity(i).Shell.HeatTransfer.Jl = HE.JlFactor(Unity(i).Shell.HeatTransfer.Sm);
     1517
     1518"Jb Factor"
     1519        Unity(i).Shell.HeatTransfer.Jb = HE.JbFactor(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Shell.HeatTransfer.Sm);
     1520
     1521"Jr Factor"     
     1522        Unity(i).Shell.HeatTransfer.Jr = HE.JrFactor(Unity(i).Shell.HeatTransfer.Re);
     1523       
     1524"Total J Factor"
     1525        Unity(i).Shell.HeatTransfer.Jtotal=Unity(i).Shell.HeatTransfer.Jc*Unity(i).Shell.HeatTransfer.Jl*Unity(i).Shell.HeatTransfer.Jb*Unity(i).Shell.HeatTransfer.Jr*Unity(i).Shell.HeatTransfer.Js;
     1526
     1527if side equal 1
     1528       
     1529        then
     1530       
     1531"Tube Side Pressure Drop"
     1532        Unity(i).Tubes.PressureDrop.PdTube              = HE.DeltaPtube(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Cold.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Tubes.HeatTransfer.Phi);
     1533
     1534"Pressure Drop Tube Side Inlet Nozzle"
     1535        Unity(i).Tubes.PressureDrop.Pdnozzle_in = 0.5*Kinlet_Tube*Unity(i).Properties.Cold.Inlet.rho*Unity(i).Tubes.PressureDrop.Vnozzle_in^2;
     1536
     1537"Velocity Tube Side Inlet Nozzle"
     1538        Unity(i).Tubes.PressureDrop.Vnozzle_in  = Unity(i).Properties.Cold.Inlet.Fw/(Unity(i).Properties.Cold.Inlet.rho*Ainozzle_Tube);
     1539
     1540"Pressure Drop Tube Side Outlet Nozzle"
     1541        Unity(i).Tubes.PressureDrop.Pdnozzle_out        = 0.5*Koutlet_Tube*Unity(i).Properties.Cold.Outlet.rho*Unity(i).Tubes.PressureDrop.Vnozzle_out^2;
     1542
     1543"Velocity Tube Side Outlet Nozzle"
     1544        Unity(i).Tubes.PressureDrop.Vnozzle_out = Unity(i).Properties.Cold.Inlet.Fw/(Unity(i).Properties.Cold.Outlet.rho*Aonozzle_Tube);
     1545
     1546"Shell Pressure Drop Inlet Nozzle"
     1547        Unity(i).Shell.PressureDrop.Pdnozzle_in = (0.5*Unity(i).Properties.Hot.Inlet.Fw^2/Unity(i).Properties.Hot.Inlet.rho)*((1/Ainozzle_Shell^2)+(1/Aeinozzle_Shell^2));
     1548
     1549"Velocity Shell Side Inlet Nozzle"
     1550        Unity(i).Shell.PressureDrop.Vnozzle_in  = Unity(i).Properties.Hot.Inlet.Fw/(Unity(i).Properties.Hot.Inlet.rho*Ainozzle_Shell);
     1551
     1552"Shell Pressure Drop Outlet Nozzle"
     1553        Unity(i).Shell.PressureDrop.Pdnozzle_out        = (0.5*Unity(i).Properties.Hot.Outlet.Fw^2/Unity(i).Properties.Hot.Outlet.rho)*((1/Ainozzle_Shell^2)+(1/Aeinozzle_Shell^2));
     1554
     1555"Velocity Shell Side Outlet Nozzle"
     1556        Unity(i).Shell.PressureDrop.Vnozzle_out = Unity(i).Properties.Hot.Outlet.Fw/(Unity(i).Properties.Hot.Outlet.rho*Aonozzle_Shell);
     1557
     1558"Pressure Drop Hot Stream"
     1559        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P - Unity(i).Shell.PressureDrop.Pdtotal;   
     1560       
     1561"Pressure Drop Cold Stream"
     1562        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Tubes.PressureDrop.Pdtotal;
     1563
     1564
     1565        else
     1566
     1567"Tube Side Pressure Drop"
     1568        Unity(i).Tubes.PressureDrop.PdTube              = HE.DeltaPtube(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Hot.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Tubes.HeatTransfer.Phi);
     1569
     1570"Pressure Drop Tube Side Inlet Nozzle"
     1571        Unity(i).Tubes.PressureDrop.Pdnozzle_in = 0.5*Kinlet_Tube*Unity(i).Properties.Hot.Inlet.rho*Unity(i).Tubes.PressureDrop.Vnozzle_in^2;
     1572       
     1573"Velocity Tube Side Inlet Nozzle"
     1574        Unity(i).Tubes.PressureDrop.Vnozzle_in  = Unity(i).Properties.Hot.Inlet.Fw/(Unity(i).Properties.Hot.Inlet.rho*Ainozzle_Tube);
     1575       
     1576"Pressure Drop Tube Side Outlet Nozzle"
     1577        Unity(i).Tubes.PressureDrop.Pdnozzle_out        = 0.5*Koutlet_Tube*Unity(i).Properties.Hot.Outlet.rho*Unity(i).Tubes.PressureDrop.Vnozzle_out^2;
     1578       
     1579"Velocity Tube Side Outlet Nozzle"
     1580        Unity(i).Tubes.PressureDrop.Vnozzle_out = Unity(i).Properties.Hot.Inlet.Fw/(Unity(i).Properties.Hot.Outlet.rho*Aonozzle_Tube); 
     1581
     1582"Shell Pressure Drop Inlet Nozzle"
     1583        Unity(i).Shell.PressureDrop.Pdnozzle_in = (0.5*Unity(i).Properties.Cold.Inlet.Fw^2/Unity(i).Properties.Cold.Inlet.rho)*((1/Ainozzle_Shell^2)+(1/Aeinozzle_Shell^2));
     1584
     1585"Velocity Shell Side Inlet Nozzle"
     1586        Unity(i).Shell.PressureDrop.Vnozzle_in  = Unity(i).Properties.Cold.Inlet.Fw/(Unity(i).Properties.Cold.Inlet.rho*Ainozzle_Shell);
     1587
     1588"Shell Pressure Drop Outlet Nozzle"
     1589        Unity(i).Shell.PressureDrop.Pdnozzle_out = (0.5*Unity(i).Properties.Cold.Outlet.Fw^2/Unity(i).Properties.Cold.Outlet.rho)*((1/Ainozzle_Shell^2)+(1/Aeinozzle_Shell^2));
     1590
     1591"Velocity Shell Side Outlet Nozzle"
     1592        Unity(i).Shell.PressureDrop.Vnozzle_out  = Unity(i).Properties.Cold.Outlet.Fw/(Unity(i).Properties.Cold.Outlet.rho*Ainozzle_Shell);
     1593
     1594"Pressure Drop Hot Stream"
     1595        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P- Unity(i).Tubes.PressureDrop.Pdtotal;     
     1596       
     1597"Pressure Drop Cold Stream"
     1598        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Shell.PressureDrop.Pdtotal;
     1599
     1600end
     1601
     1602
     1603if side equal 1 then
     1604       
     1605       
     1606"Shell Side Phi correction for viscosity"
     1607        Unity(i).Shell.HeatTransfer.Phi = HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
     1608       
     1609"Tube Side Phi correction for viscosity"
     1610        Unity(i).Tubes.HeatTransfer.Phi  = HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
     1611       
     1612        else
     1613       
     1614       
     1615"Shell Side Phi correction for viscosity"
     1616        Unity(i).Shell.HeatTransfer.Phi = HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
     1617       
     1618"Tube Side Phi correction for viscosity"
     1619        Unity(i).Tubes.HeatTransfer.Phi  = HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
     1620
     1621end
     1622
     1623
     1624if side equal 1
     1625       
     1626        then
     1627
     1628"Shell Side inlet Nozzle rho-V^2"
     1629        Unity(i).Shell.PressureDrop.RVsquare_in = Unity(i).Properties.Hot.Inlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_in)^2;
     1630
     1631"Shell Side Outlet Nozzle rho-V^2"
     1632        Unity(i).Shell.PressureDrop.RVsquare_out = Unity(i).Properties.Hot.Outlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_out)^2;
     1633       
     1634        else
     1635       
     1636"Shell Side inlet Nozzle rho-V^2"
     1637        Unity(i).Shell.PressureDrop.RVsquare_in = Unity(i).Properties.Cold.Inlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_in)^2;
     1638
     1639"Shell Side Outlet Nozzle rho-V^2"
     1640        Unity(i).Shell.PressureDrop.RVsquare_out = Unity(i).Properties.Cold.Outlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_out)^2;
     1641
     1642end
     1643
     1644if side equal 1
     1645       
     1646        then
     1647       
     1648"Hot Wall Temperature"
     1649        Unity(i).Properties.Hot.Wall.Twall      = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
     1650
     1651"ColdWall Temperature"
     1652        Unity(i).Properties.Cold.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
     1653
     1654"Tube Side Velocity"
     1655        Unity(i).Tubes.HeatTransfer.Vtube       = Unity(i).Properties.Cold.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Cold.Average.rho*Ntt);
     1656
     1657"Tube Side Reynolds Number"
     1658        Unity(i).Tubes.HeatTransfer.Re          = (Unity(i).Properties.Cold.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Cold.Average.Mu;
     1659       
     1660"Tube Side Prandtl Number"
     1661        Unity(i).Tubes.HeatTransfer.PR          = ((Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Average.Mu)/Unity(i).Properties.Cold.Average.K;
     1662
     1663"Tube Side Prandtl Number at Wall Temperature"
     1664        Unity(i).Tubes.HeatTransfer.PRw                 = ((Unity(i).Properties.Cold.Wall.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Wall.Mu)/Unity(i).Properties.Cold.Wall.K;
     1665
     1666"Tube Side Film Coefficient"
     1667        Unity(i).Tubes.HeatTransfer.htube       = HE.TubeFilmCoeff(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Cold.Average.K)*Unity(i).Tubes.HeatTransfer.Phi;
     1668
     1669"Shell Side Prandtl Number"
     1670        Unity(i).Shell.HeatTransfer.PR          = ((Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Average.Mu)/Unity(i).Properties.Hot.Average.K;
     1671
     1672"Shell Side Prandtl Number at Wall Temperature"
     1673        Unity(i).Shell.HeatTransfer.PRw                 = ((Unity(i).Properties.Hot.Wall.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Wall.Mu)/Unity(i).Properties.Hot.Wall.K;
     1674
     1675
     1676        else
     1677
     1678"Hot Wall Temperature"
     1679        Unity(i).Properties.Hot.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
     1680
     1681"Cold Wall Temperature"
     1682        Unity(i).Properties.Cold.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
     1683
     1684"Tube Side Velocity"
     1685        Unity(i).Tubes.HeatTransfer.Vtube       =       Unity(i).Properties.Hot.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Hot.Average.rho*Ntt);
     1686
     1687"Tube Side Reynolds Number"
     1688        Unity(i).Tubes.HeatTransfer.Re          =       (Unity(i).Properties.Hot.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Hot.Average.Mu;
     1689
     1690"Tube Side Prandtl Number"
     1691        Unity(i).Tubes.HeatTransfer.PR = ((Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Average.Mu)/Unity(i).Properties.Hot.Average.K;
     1692
     1693"Tube Side Prandtl Number at Wall"
     1694        Unity(i).Tubes.HeatTransfer.PRw = ((Unity(i).Properties.Hot.Wall.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Wall.Mu)/Unity(i).Properties.Hot.Wall.K;
     1695
     1696"Tube Side Film Coefficient"
     1697        Unity(i).Tubes.HeatTransfer.htube= HE.TubeFilmCoeff(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Hot.Average.K)*Unity(i).Tubes.HeatTransfer.Phi;
     1698       
     1699"Shell Side Prandtl Number"
     1700        Unity(i).Shell.HeatTransfer.PR = ((Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Average.Mu)/Unity(i).Properties.Cold.Average.K;
     1701
     1702"Shell Side Prandtl Number at Wall"
     1703        Unity(i).Shell.HeatTransfer.PRw=((Unity(i).Properties.Cold.Wall.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Wall.Mu)/Unity(i).Properties.Cold.Wall.K;
     1704
     1705end
     1706
     1707
     1708"Tube Resistance"       
     1709        Unity(i).Resistances.Rtube*(Unity(i).Tubes.HeatTransfer.htube*Ditube) = Dotube;
     1710       
     1711"Wall Resistance"
     1712        Unity(i).Resistances.Rwall=Dotube*ln(Dotube/Ditube)/(2*Kwall);
     1713       
     1714"Shell Resistance"
     1715        Unity(i).Resistances.Rshell*(Unity(i).Shell.HeatTransfer.hshell)=1;
     1716       
     1717"Overall Heat Transfer Coefficient Clean"
     1718        Unity(i).Details.Uc*(Dotube/(Unity(i).Tubes.HeatTransfer.htube*Ditube)+(Dotube*ln(Dotube/Ditube)/(2*Kwall))+(1/(Unity(i).Shell.HeatTransfer.hshell)))=1;
     1719
     1720"Overall Heat Transfer Coefficient Dirty"
     1721        (1/Unity(i).Details.Ud)=(1/Unity(i).Details.Uc)+Unity(i).Resistances.Rfo+Unity(i).Resistances.Rfi*(Dotube/Ditube);
     1722
     1723"Exchange Surface Area"
     1724        Unity(i).Details.A=Pi*Dotube*Ntt*Ltube;
     1725
     1726"Baffles Spacing"
     1727        Ltube = Unity(i).Baffles.Lsi+Unity(i).Baffles.Lso+Unity(i).Baffles.Ls*(Nb-1);
     1728       
     1729"LMTD Correction Factor"
     1730        Fc(i) = HE.EshellCorrectionFactor(Unity(i).Inlet.Hot.T,Unity(i).Outlet.Hot.T,Unity(i).Inlet.Cold.T,Unity(i).Outlet.Cold.T);
     1731
     1732"Counter Flow LMTD"
     1733        LMTD(i) = HE.CounterLMTD(Unity(i).Inlet.Hot.T,Unity(i).Outlet.Hot.T,Unity(i).Inlet.Cold.T,Unity(i).Outlet.Cold.T);
     1734
     1735"Js Factor"     
     1736        Unity(i).Shell.HeatTransfer.Js = HE.JsFactor(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Lsi,Unity(i).Baffles.Lso,Unity(i).Baffles.Ls);
     1737
     1738if side equal 1
     1739       
     1740        then
     1741       
     1742"Shell Side Reynolds Number"
     1743        Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Hot.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Hot.Average.Mu;
     1744
     1745"Shell Heat Transfer Coefficient"
     1746        Unity(i).Shell.HeatTransfer.hshell=Unity(i).Shell.HeatTransfer.Ji*(Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*(Unity(i).Properties.Hot.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)*(Unity(i).Shell.HeatTransfer.PR^(-2/3))*Unity(i).Shell.HeatTransfer.Jtotal*Unity(i).Shell.HeatTransfer.Phi;
     1747
     1748"Shell Pressure Drop Cross Flow"
     1749        Unity(i).Shell.PressureDrop.PdCross             = HE.DeltaPcross(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Hot.Average.rho);
     1750
     1751"Shell Pressure Baffle Window"
     1752        Unity(i).Shell.PressureDrop.Pdwindow            = HE.DeltaPwindow(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Hot.Average.rho,Unity(i).Properties.Hot.Average.Mu,Unity(i).Baffles.Ls);
     1753
     1754"Shell Pressure End Zones"
     1755        Unity(i).Shell.PressureDrop.PdEndZones  = HE.DeltaPendZones(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Hot.Average.rho);
     1756
     1757
     1758        else
     1759
     1760"Shell Side Reynolds Number"
     1761        Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Cold.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Cold.Average.Mu;
     1762
     1763"Shell Heat Transfer Coefficient"
     1764        Unity(i).Shell.HeatTransfer.hshell=Unity(i).Shell.HeatTransfer.Ji*(Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*(Unity(i).Properties.Cold.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)*(Unity(i).Shell.HeatTransfer.PR^(-2/3))*Unity(i).Shell.HeatTransfer.Jtotal*Unity(i).Shell.HeatTransfer.Phi;
     1765
     1766"Shell Pressure Drop Cross Flow"
     1767        Unity(i).Shell.PressureDrop.PdCross      = HE.DeltaPcross(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Cold.Average.rho);
     1768
     1769"Shell Pressure Baffle Window"
     1770        Unity(i).Shell.PressureDrop.Pdwindow     = HE.DeltaPwindow(Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Cold.Average.rho,Unity(i).Properties.Cold.Average.Mu,Unity(i).Baffles.Ls);
     1771
     1772"Shell Pressure End Zones"
     1773        Unity(i).Shell.PressureDrop.PdEndZones  = HE.DeltaPendZones(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Cold.Average.rho);
     1774
     1775
     1776end
     1777
     1778
     1779"Exchange Surface Area"
     1780        Unity(i).Details.Q   = Unity(i).Details.Ud*Pi*Dotube*Ntt*Ltube*Fc(i)*LMTD(i);
     1781       
     1782"Mean Temperature Difference"   
     1783        MTD(i)   = Fc(i)*LMTD(i);
     1784
     1785end
     1786
     1787
     1788end
     1789
Note: See TracChangeset for help on using the changeset viewer.