Ignore:
File:
1 edited

Legend:

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

    r45 r1  
    1 
    2 #--------------------------------------------------------------------
    3 # Author: Gerson Balbueno Bicca
    4 # $Id$
    5 #--------------------------------------------------------------------
     1 #*--------------------------------------------------------------------*
     2*
     3*
     4*
     5*
     6*
     7*
     8*               
     9*                                               
     10*
     11*
     12*----------------------------------------------------------------------
     13* Author: Gerson Balbueno Bicca
     14* $Id$
     15*--------------------------------------------------------------------*#
    616
    717using "HEX_Engine";
    818
    9 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     19#=====================================================================
    1020#       Basic Model for Discretized Heat Exchangers
    11 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     21#=====================================================================
    1222
    1323Model HeatExchangerDiscretized_Basic
     
    1626
    1727ext PP      as CalcObject(Brief="External Physical Properties");
    18         HE          as CalcObject(Brief="STHE Calculations",File="heatex");
     28ext HE      as CalcObject(Brief="STHE Calculations",File="heatex.dll");
    1929ext NComp   as Integer   (Brief="Number of Components");
    2030  M(NComp)  as molweight (Brief="Component Mol Weight");
     
    2636        Properties  as Main_Properties;         # Hot and Cold Properties
    2737        Details     as Details_Main;
    28         Tubes           as Tube_Side_Main;     
    29         Shell           as Shell_Side_Main;
     38        Tubes           as Tube_Side_Main_Disc;
     39        Shell           as Shell_Side_Main_Disc;
    3040        Resistances as Main_Resistances;
    3141        Baffles     as Baffles_Main;
     
    194204end
    195205
    196 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     206#=====================================================================
    197207#       Thermal Details
    198 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     208#=====================================================================
    199209"Hot Stream Heat Capacity"
    200210        Details.Ch =Inlet.Hot.F*Properties.Hot.Average.Cp;
     
    203213        Details.Cc =Inlet.Cold.F*Properties.Cold.Average.Cp;
    204214       
    205 "Minimum Heat Capacity"
    206         Details.Cmin  = min([Details.Ch,Details.Cc]);
    207 
    208 "Maximum Heat Capacity"
    209         Details.Cmax  = max([Details.Ch,Details.Cc]);
    210 
    211215"Heat Capacity Ratio"
    212         Details.Cr    = Details.Cmin/Details.Cmax;
    213        
    214 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     216        [Details.Cmin,Details.Cmax,Details.Cr]  = HE.HeatCapacityRatio(Details.Ch,Details.Cc);
     217
     218#=====================================================================
    215219#       Energy Balance
    216 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     220#=====================================================================
    217221"Energy Balance Hot Stream"
    218222        Details.Q = Inlet.Hot.F*(Inlet.Hot.h-Outlet.Hot.h);
     
    221225        Details.Q =-Inlet.Cold.F*(Inlet.Cold.h-Outlet.Cold.h);
    222226
    223 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     227#=====================================================================
    224228#       Material Balance
    225 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     229#=====================================================================
    226230"Flow Mass Inlet Cold Stream"
    227231        Properties.Cold.Inlet.Fw        =  sum(M*Inlet.Cold.z)*Inlet.Cold.F;
     
    242246        Inlet.Cold.F = Outlet.Cold.F;
    243247
    244 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     248#======================================
    245249#       Constraints
    246 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     250#======================================
    247251"Hot Stream Molar Fraction Constraint"
    248252        Outlet.Hot.z=Inlet.Hot.z;
     
    260264end
    261265
     266Model Heatex_Discretized_LMTD           as HeatExchangerDiscretized_Basic
     267       
     268VARIABLES
     269LMTD            as temp_delta   (Brief="Logarithmic Mean Temperature Difference",Lower=5);
     270Fc                      as positive             (Brief="LMTD Correction Factor",Lower=0.1);
     271MTD                     as temp_delta   (Brief="Mean Temperature Difference",Lower=5);
     272
     273EQUATIONS
     274
     275"Exchange Surface Area"
     276        Details.Q   = Details.U*Details.A*MTD;
     277       
     278"Mean Temperature Difference"   
     279        MTD   = Fc*LMTD;
     280       
     281"LMTD Correction Factor"
     282        Fc = HE.EshellCorrectionFactor(Inlet.Hot.T,Outlet.Hot.T,Inlet.Cold.T,Outlet.Cold.T);
     283
     284"LMTD"
     285        LMTD = HE.CounterLMTD(Inlet.Hot.T,Outlet.Hot.T,Inlet.Cold.T,Outlet.Cold.T);
     286
     287end
     288
    262289Model Heatex_Discretized_NTU            as HeatExchangerDiscretized_Basic
    263290       
     
    272299
    273300"TEMA E Shell Effectiveness"
    274         Eft = HE.EshellEffectiveness(Details.Cr,Details.NTU);
    275        
    276 end
    277 
    278 Model Heatex_Discretized_LMTD           as HeatExchangerDiscretized_Basic
    279        
     301#       Eft = HE.EshellEffectiveness(Details.Cr,Details.NTU);
     302       
     303        Eft = 0.10;
     304       
     305end
     306
     307Model Profiles
     308
     309PARAMETERS
     310
     311Zones                   as Integer;
     312
    280313VARIABLES
    281 DT0     as temp_delta   (Brief="Temperature Difference at Inlet",Lower=1);
    282 DTL             as temp_delta   (Brief="Temperature Difference at Outlet",Lower=1);
    283 LMTD    as temp_delta   (Brief="Logarithmic Mean Temperature Difference",Lower=5);
    284 Fc              as positive             (Brief="LMTD Correction Factor",Lower=0.5);
    285 MTD             as temp_delta   (Brief="Mean Temperature Difference",Lower=1);
    286 
    287 EQUATIONS
    288 "Exchange Surface Area"
    289         Details.Q   = Details.U*Details.A*MTD;
    290        
    291 "Mean Temperature Difference"   
    292         MTD   = Fc*LMTD;
    293        
    294 #"LMTD Correction Factor"
    295 #       Fc = HE.EshellCorrectionFactor(Inlet.Hot.T,Outlet.Hot.T,Inlet.Cold.T,Outlet.Cold.T);
    296 
    297 "Temperature Difference at Inlet"
    298         DT0 = Inlet.Hot.T - Outlet.Cold.T;
    299 
    300 "Temperature Difference at Outlet"
    301         DTL = Outlet.Hot.T - Inlet.Cold.T;
    302 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    303 #                       Log Mean Temperature Difference
    304 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    305 if abs(DT0 - DTL) > 0.05*max(abs([DT0,DTL]))
    306        
    307         then
    308 "Log Mean Temperature Difference"
    309         LMTD= (DT0-DTL)/ln(DT0/DTL);
    310 
    311         else
    312        
    313 if DT0*DTL equal 0
    314        
    315         then
    316 "Log Mean Temperature Difference"
    317         LMTD = 0.5*(DT0+DTL);
    318        
    319         else
    320 "Log Mean Temperature Difference"
    321         LMTD = 0.5*(DT0+DTL)*(1-(DT0-DTL)^2/(DT0*DTL)*(1+(DT0-DTL)^2/(DT0*DTL)/2)/12);
    322        
    323 end
    324        
    325 end
    326 
    327        
    328 end
    329 
    330 Model Profiles
    331 
     314
     315Lz(Zones)        as length;
     316Lpos(Zones)      as length;
     317Area                    as area;
     318Q                       as power;
     319PdropShellTotal as pressure;
     320PdropTubesTotal as pressure;
     321PdropWinTotal   as pressure;
     322PdropCrossTotal as pressure;
     323PdropEndsTotal  as pressure;
     324Uaverage                as heat_trans_coeff (Brief="Overall Heat Transfer Coefficient",Default=1,Lower=1e-6,Upper=1e10);
     325hshellaverage   as heat_trans_coeff     (Brief="Shell Side Film Coefficient",Default=1,Lower=1e-12, Upper=1e6);
     326htubeaverage    as heat_trans_coeff     (Brief="Shell Side Film Coefficient",Default=1,Lower=1e-12, Upper=1e6);
     327Thot(Zones)      as temperature(Lower = 70, Upper = 500);
     328Tcold(Zones)     as temperature(Lower = 70, Upper = 500);
     329Phot(Zones)      as pressure(Lower = 0.8, Upper = 30);
     330Pcold(Zones)     as pressure(Lower = 0.8, Upper = 30);
     331
     332end
     333
     334
     335Model E_Shell_LMTD_Disc         
     336#============================================================================
     337#       Shell and Tubes Heat Exchanger In Series with 1 shell pass - LMTD Method
     338#============================================================================
    332339PARAMETERS
    333340
    334 Zones   as Integer(Brief="Number of Zones");
    335 
    336 VARIABLES
    337 
    338 Lz(Zones)               as length                       (Brief="Zone Tube Length");
    339 Area                            as area                         (Brief="Area Total");
    340 Q                               as power                        (Brief="Total Duty");
    341 PdropTubesNozzle        as pressure                     (Brief="Total Tube Nozzles Pressure Drop");
    342 PdropTubes                      as pressure                     (Brief="Total Tube Pressure Drop");
    343 PdropWin                        as pressure                     (Brief="Total Shell Side Window Pressure Drop");
    344 PdropCross                      as pressure                     (Brief="Total Shell Side Cross Flow Pressure Drop");
    345 PdropEnds                       as pressure                     (Brief="Total Shell Side Ends Pressure Drop");
    346 PdropShellNozzle        as pressure                     (Brief="Total Shell Side Nozzles Pressure Drop");
    347 PdropShell                      as pressure                     (Brief="Total Shell Side Pressure Drop");
    348 Uaverage                        as heat_trans_coeff (Brief="Average Overall Heat Transfer Coefficient",Default=1,Lower=1e-6,Upper=1e10);
    349 hshellaverage           as heat_trans_coeff     (Brief="Average Shell Side Film Coefficient",Default=1,Lower=1e-12, Upper=1e6);
    350 htubeaverage            as heat_trans_coeff     (Brief="Average Tube Side Film Coefficient",Default=1,Lower=1e-12, Upper=1e6);
    351 Thot(Zones)             as temperature          (Brief="Hot Temperature",Lower = 300, Upper = 500);
    352 Tcold(Zones)            as temperature          (Brief="Cold Temperature",Lower = 300, Upper = 500);
    353 Phot(Zones)             as pressure                     (Brief="Hot Pressure",Lower = 0.8, Upper = 30);
    354 Pcold(Zones)            as pressure                     (Brief="Cold Pressure",Lower = 0.8, Upper = 30);
    355 
    356 end
    357 
    358 Model E_Shell_NTU_Disc           
    359 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    360 #       Shell and Tubes Heat Exchanger with 1 shell pass - NTU Method
    361 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    362 PARAMETERS
    363 
    364         HE      as CalcObject   (Brief="STHE Calculations",File="heatex");
    365 ext PP  as CalcObject   (Brief="External Physical Properties");
    366 side    as Integer              (Brief="Fluid Alocation",Lower=0,Upper=1);
    367 Pi              as constant     (Brief="Pi Number",Default=3.14159265);
    368 
    369 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     341ext     HE              as CalcObject   (Brief="STHE Calculations",File="heatex.dll");
     342ext PP          as CalcObject;
     343side            as Integer              (Brief="Fluid Alocation",Lower=0,Upper=1);
     344Pi                      as constant     (Brief="Pi Number",Default=3.14159265);
     345
     346#=====================================================================
    370347#       Shell Geometrical Parameters
    371 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     348#=====================================================================
    372349Tpass                   as Integer              (Brief="Number of Tube Passes",Lower=1);
    373350Nss                             as Integer              (Brief="Number of Sealing Strips pairs",Lower=1);
     
    378355Honozzle_Shell  as length               (Brief="Height Under Shell Outlet Nozzle",Lower=10e-6);
    379356Lcf                     as length               (Brief="Bundle-to-Shell Clearance",Lower=10e-8);
    380 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     357#=====================================================================
    381358#       Tubes Geometrical Parameters
    382 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     359#=====================================================================
    383360Ntt                             as Integer              (Brief="Total Number of Tubes in Shell",Default=100,Lower=1);
    384361Pattern         as Integer              (Brief="Tube Layout Characteristic Angle",Lower=30);
     
    390367Donozzle_Tube   as length               (Brief="Tube Outlet Nozzle Diameter",Lower=10e-6);
    391368Dinozzle_Tube   as length               (Brief="Tube Inlett Nozzle Diameter",Lower=10e-6);
    392 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     369#=====================================================================
    393370#       Baffles Geometrical Parameters
    394 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     371#=====================================================================
    395372Bc                      as Integer              (Brief="Baffle Cut",Default=25,Lower=25);
    396373Nb              as Integer              (Brief="Number of Baffles",Default=4);
    397374Lcd                     as length               (Brief="Baffle-to-Shell Clearance",Lower=10e-8);
    398375Ltd                             as length               (Brief="Tube-to-Bafflehole Clearance",Lower=10e-8);
    399 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     376#=====================================================================
    400377VARIABLES
    401378
    402 Unity(Nb+1)     as Heatex_Discretized_NTU;
     379PdropNozzles    as Pdrop_Nozzles_Main;
     380Unity(Nb+1)     as Heatex_Discretized_LMTD;
    403381Sumary          as Profiles;
    404382
     
    410388EQUATIONS
    411389
    412 "Hot Temperatures"
    413         Sumary.Thot     = Unity.Outlet.Hot.T;
    414        
    415 "Cold Temperatures"
    416         Sumary.Tcold    = Unity.Outlet.Cold.T ;
    417 
    418 "Hot Pressures"
    419         Sumary.Phot     = Unity.Outlet.Hot.P ;
    420        
    421 "Cold Pressures"
    422         Sumary.Pcold    = Unity.Outlet.Cold.P ;
    423 
    424 "Average Shell Side Film Coefficient"
    425         Sumary.hshellaverage            = sum(Unity.Shell.HeatTransfer.hshell)/Sumary.Zones;
    426 
    427 "Average Tube Side Film Coefficient"
    428         Sumary.htubeaverage             = sum(Unity.Tubes.HeatTransfer.htube)/Sumary.Zones;
    429 
    430 "Average Overall Heat Transfer Coefficient"
    431         Sumary.Uaverage                 = sum(Unity.Details.U)/Sumary.Zones;
    432 
    433 "Area Total"
    434         Sumary.Area                             = sum(Unity.Details.A);
    435 
    436 "Duty Total"
    437         Sumary.Q                                = sum(Unity.Details.Q);
    438 
    439 "Length Inlet zone"
    440         Sumary.Lz(1)                            = Unity(1).Baffles.Lsi;
    441 
    442 "Length Outlet zone"
    443         Sumary.Lz(Nb+1)                         = Unity(1).Baffles.Lso;
    444 
    445 "Total Shell Side Pressure Drop"
    446         Sumary.PdropShell                       = sum(Unity.Shell.PressureDrop.Pdtotal);
    447 
    448 "Total Tube Side Pressure Drop"
    449         Sumary.PdropTubes                       = sum(Unity.Tubes.PressureDrop.Pdtotal);
    450 
    451 "Total Tube Side Nozzles Pressure Drop"
    452         Sumary.PdropTubesNozzle         = sum(Unity.Tubes.PressureDrop.Pdnozzle_in + Unity.Tubes.PressureDrop.Pdnozzle_out);
    453 
    454 "Total Shell Side Nozzles Pressure Drop"
    455         Sumary.PdropShellNozzle         = sum(Unity.Shell.PressureDrop.Pdnozzle_in + Unity.Shell.PressureDrop.Pdnozzle_out);
    456 
    457 "Total Shell Side Window Pressure Drop"
    458         Sumary.PdropWin                         = sum(Unity.Shell.PressureDrop.Pdwindow);
    459 
    460 "Total Shell Side Cross Flow Pressure Drop"
    461         Sumary.PdropCross                       = sum(Unity.Shell.PressureDrop.PdCross);
    462 
    463 "Total Shell Side Ends Pressure Drop"
    464         Sumary.PdropEnds                        = sum(Unity.Shell.PressureDrop.PdEndZones);
     390"Outlet Hot Temperature"
     391        Sumary.Thot                 = Unity.Outlet.Hot.T ;
     392       
     393"Outlet Cold Temperature"
     394        Sumary.Tcold            = Unity.Outlet.Cold.T ;
     395Sumary.Phot                 = Unity.Outlet.Hot.P ;
     396Sumary.Pcold                = Unity.Outlet.Cold.P ;
     397
     398Sumary.hshellaverage = sum(Unity.Shell.HeatTransfer.hshell)/Sumary.Zones;
     399Sumary.htubeaverage  = sum(Unity.Tubes.HeatTransfer.htube)/Sumary.Zones;
     400Sumary.Uaverage     = sum(Unity.Details.U)/Sumary.Zones;
     401Sumary.Area             = sum(Unity.Details.A);
     402Sumary.Q                = sum(Unity.Details.Q);
     403
     404Sumary.PdropShellTotal = sum(Unity.Shell.PressureDrop.Pdtotal)+PdropNozzles.Shell.Pdnozzle_in + PdropNozzles.Shell.Pdnozzle_out;
     405Sumary.PdropTubesTotal = sum(Unity.Tubes.PressureDrop.Pdtotal)+PdropNozzles.Tubes.Pdnozzle_in + PdropNozzles.Tubes.Pdnozzle_out;
     406Sumary.PdropWinTotal    = sum(Unity.Shell.PressureDrop.Pdwindow);
     407Sumary.PdropCrossTotal = sum(Unity.Shell.PressureDrop.PdCross);
     408Sumary.PdropEndsTotal   = sum(Unity.Shell.PressureDrop.PdEndZones);
     409
     410Sumary.Lz(1)    = Unity(1).Baffles.Lsi;
    465411
    466412"Shell Side Cross Flow Area"
     
    469415"Shell Side Cross Flow Area"
    470416        Unity(Nb+1).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(Nb+1).Baffles.Lso);
    471 
     417       
     418Sumary.Lz(Nb+1) = Unity(1).Baffles.Lso;
    472419
    473420if side equal 1
    474421       
    475422        then
    476        
    477 "Shell Side inlet Nozzle rho-V^2"
    478         Unity(1).Shell.PressureDrop.RVsquare_in = Unity(1).Properties.Hot.Inlet.rho*(Unity(1).Shell.PressureDrop.Vnozzle_in)^2;
    479 
    480 "Shell Side Outlet Nozzle rho-V^2"
    481         Unity(Nb+1).Shell.PressureDrop.RVsquare_out = Unity(Nb+1).Properties.Hot.Outlet.rho*(Unity(Nb+1).Shell.PressureDrop.Vnozzle_out)^2;
    482 
    483 "Shell Pressure End Zones"
    484         Unity(1).Shell.PressureDrop.PdEndZones          =       HE.DeltaPendZonesIncremental(Unity(1).Shell.HeatTransfer.Re,Unity(1).Baffles.Ls,Unity(1).Baffles.Lso,
    485         Unity(1).Baffles.Lsi,Unity(1).Properties.Hot.Inlet.Fw,Unity(1).Shell.HeatTransfer.Phi,Unity(1).Properties.Hot.Average.rho);
    486 
    487 "Shell Pressure End Zones"
    488         Unity(Nb+1).Shell.PressureDrop.PdEndZones       =       HE.DeltaPendZonesIncremental(Unity(Nb+1).Shell.HeatTransfer.Re,Unity(Nb+1).Baffles.Ls,Unity(Nb+1).Baffles.Lso,
    489         Unity(Nb+1).Baffles.Lsi,Unity(Nb+1).Properties.Hot.Inlet.Fw,Unity(Nb+1).Shell.HeatTransfer.Phi,Unity(Nb+1).Properties.Hot.Average.rho);
     423
     424"Pressure Drop Hot Stream"
     425        Unity(1).Outlet.Hot.P  = Unity(1).Inlet.Hot.P - Unity(1).Shell.PressureDrop.Pdtotal - PdropNozzles.Shell.Pdnozzle_in;   
     426        Unity(Nb+1).Outlet.Hot.P  = Unity(Nb+1).Inlet.Hot.P - Unity(Nb+1).Shell.PressureDrop.Pdtotal - PdropNozzles.Shell.Pdnozzle_out;
     427
     428"Pressure Drop Cold Stream"
     429        Unity(1).Outlet.Cold.P  = Unity(1).Inlet.Cold.P - Unity(1).Tubes.PressureDrop.Pdtotal - PdropNozzles.Tubes.Pdnozzle_in;
     430        Unity(Nb+1).Outlet.Cold.P  = Unity(Nb+1).Inlet.Cold.P - Unity(Nb+1).Tubes.PressureDrop.Pdtotal - PdropNozzles.Tubes.Pdnozzle_out;
    490431
    491432"Pressure Drop Tube Side Inlet Nozzle"
    492         Unity(1).Tubes.PressureDrop.Pdnozzle_in = HE.DeltaPtubeNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
     433        PdropNozzles.Tubes.Pdnozzle_in  = HE.DeltaPtubeNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
    493434
    494435"Velocity Tube Side Inlet Nozzle"
    495         Unity(1).Tubes.PressureDrop.Vnozzle_in  = HE.TubeVelocityNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
     436        PdropNozzles.Tubes.Vnozzle_in   = HE.TubeVelocityNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
    496437
    497438"Pressure Drop Tube Side Outlet Nozzle"
    498         Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_out     = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
     439        PdropNozzles.Tubes.Pdnozzle_out = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
    499440
    500441"Velocity Tube Side Outlet Nozzle"
    501         Unity(Nb+1).Tubes.PressureDrop.Vnozzle_out      = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
     442        PdropNozzles.Tubes.Vnozzle_out  = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
    502443
    503444"Shell Pressure Drop Inlet Nozzle"
    504         Unity(1).Shell.PressureDrop.Pdnozzle_in = HE.DeltaPshellNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
     445        PdropNozzles.Shell.Pdnozzle_in  = HE.DeltaPshellNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
    505446
    506447"Velocity Shell Side Inlet Nozzle"
    507         Unity(1).Shell.PressureDrop.Vnozzle_in  = HE.ShellVelocityNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
     448        PdropNozzles.Shell.Vnozzle_in   = HE.ShellVelocityNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
    508449
    509450"Shell Pressure Drop Outlet Nozzle"
    510         Unity(Nb+1).Shell.PressureDrop.Pdnozzle_out     =HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
     451        PdropNozzles.Shell.Pdnozzle_out =HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
    511452
    512453"Velocity Shell Side Outlet Nozzle"
    513         Unity(Nb+1).Shell.PressureDrop.Vnozzle_out      =HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
    514        
     454        PdropNozzles.Shell.Vnozzle_out  =HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
     455
    515456
    516457        else
    517458       
    518 "Shell Side inlet Nozzle rho-V^2"
    519         Unity(1).Shell.PressureDrop.RVsquare_in = Unity(1).Properties.Cold.Inlet.rho*(Unity(1).Shell.PressureDrop.Vnozzle_in)^2;
    520 
    521 "Shell Side Outlet Nozzle rho-V^2"
    522         Unity(Nb+1).Shell.PressureDrop.RVsquare_out = Unity(Nb+1).Properties.Cold.Outlet.rho*(Unity(Nb+1).Shell.PressureDrop.Vnozzle_out)^2;
    523 
    524 "Shell Pressure End Zones"
    525         Unity(1).Shell.PressureDrop.PdEndZones          =       HE.DeltaPendZonesIncremental(Unity(1).Shell.HeatTransfer.Re,Unity(1).Baffles.Ls,Unity(1).Baffles.Lso,
    526         Unity(1).Baffles.Lsi,Unity(1).Properties.Cold.Inlet.Fw,Unity(1).Shell.HeatTransfer.Phi,Unity(1).Properties.Cold.Average.rho);
    527 
    528 "Shell Pressure End Zones"
    529         Unity(Nb+1).Shell.PressureDrop.PdEndZones       =       HE.DeltaPendZonesIncremental(Unity(Nb+1).Shell.HeatTransfer.Re,Unity(Nb+1).Baffles.Ls,Unity(Nb+1).Baffles.Lso,
    530         Unity(Nb+1).Baffles.Lsi,Unity(Nb+1).Properties.Cold.Inlet.Fw,Unity(Nb+1).Shell.HeatTransfer.Phi,Unity(Nb+1).Properties.Cold.Average.rho);
    531 
     459"Pressure Drop Hot Stream"
     460        Unity(1).Outlet.Hot.P  = Unity(1).Inlet.Hot.P- Unity(1).Tubes.PressureDrop.Pdtotal - PdropNozzles.Tubes.Pdnozzle_in;   
     461        Unity(Nb+1).Outlet.Hot.P  = Unity(Nb+1).Inlet.Hot.P- Unity(Nb+1).Tubes.PressureDrop.Pdtotal - PdropNozzles.Tubes.Pdnozzle_out; 
     462       
     463"Pressure Drop Cold Stream"
     464        Unity(1).Outlet.Cold.P  = Unity(1).Inlet.Cold.P - Unity(1).Shell.PressureDrop.Pdtotal- PdropNozzles.Shell.Pdnozzle_in;
     465        Unity(Nb+1).Outlet.Cold.P  = Unity(Nb+1).Inlet.Cold.P - Unity(Nb+1).Shell.PressureDrop.Pdtotal- PdropNozzles.Shell.Pdnozzle_out;
    532466
    533467"Pressure Drop Tube Side Inlet Nozzle"
    534         Unity(1).Tubes.PressureDrop.Pdnozzle_in = HE.DeltaPtubeNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
     468        PdropNozzles.Tubes.Pdnozzle_in  = HE.DeltaPtubeNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
    535469
    536470"Velocity Tube Side Inlet Nozzle"
    537         Unity(1).Tubes.PressureDrop.Vnozzle_in  = HE.TubeVelocityNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
     471        PdropNozzles.Tubes.Vnozzle_in   = HE.TubeVelocityNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
    538472
    539473"Pressure Drop Tube Side Outlet Nozzle"
    540         Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_out     = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);   
     474        PdropNozzles.Tubes.Pdnozzle_out = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);   
    541475
    542476"Velocity Tube Side Outlet Nozzle"
    543         Unity(Nb+1).Tubes.PressureDrop.Vnozzle_out      = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw); 
     477        PdropNozzles.Tubes.Vnozzle_out  = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw); 
    544478
    545479"Shell Pressure Drop Inlet Nozzle"
    546         Unity(1).Shell.PressureDrop.Pdnozzle_in = HE.DeltaPshellNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
     480        PdropNozzles.Shell.Pdnozzle_in  = HE.DeltaPshellNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
    547481
    548482"Velocity Shell Side Inlet Nozzle"
    549         Unity(1).Shell.PressureDrop.Vnozzle_in  = HE.ShellVelocityNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
     483        PdropNozzles.Shell.Vnozzle_in   = HE.ShellVelocityNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
    550484
    551485"Shell Pressure Drop Outlet Nozzle"
    552         Unity(Nb+1).Shell.PressureDrop.Pdnozzle_out = HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
     486        PdropNozzles.Shell.Pdnozzle_out = HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
    553487
    554488"Velocity Shell Side Outlet Nozzle"
    555         Unity(Nb+1).Shell.PressureDrop.Vnozzle_out  = HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
    556 
     489        PdropNozzles.Shell.Vnozzle_out  = HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
    557490
    558491end
     
    561494for i in [2:Nb]
    562495
    563 "Pressure Drop Tube Side Inlet Nozzle"
    564         Unity(i).Tubes.PressureDrop.Pdnozzle_in = 0;
    565 
    566 "Velocity Tube Side Inlet Nozzle"
    567         Unity(i).Tubes.PressureDrop.Vnozzle_in  = 0;
    568 
    569 "Pressure Drop Tube Side Outlet Nozzle"
    570         Unity(i).Tubes.PressureDrop.Pdnozzle_out        = 0;   
    571 
    572 "Velocity Tube Side Outlet Nozzle"
    573         Unity(i).Tubes.PressureDrop.Vnozzle_out = 0;   
    574 
    575 "Shell Pressure Drop Inlet Nozzle"
    576         Unity(i).Shell.PressureDrop.Pdnozzle_in = 0;
    577 
    578 "Velocity Shell Side Inlet Nozzle"
    579         Unity(i).Shell.PressureDrop.Vnozzle_in  = 0;
    580 
    581 "Shell Pressure Drop Outlet Nozzle"
    582         Unity(i).Shell.PressureDrop.Pdnozzle_out = 0;
    583 
    584 "Velocity Shell Side Outlet Nozzle"
    585         Unity(i).Shell.PressureDrop.Vnozzle_out  = 0;
    586 
    587 "Shell Pressure End Zones"
    588         Unity(i).Shell.PressureDrop.PdEndZones          =       0;
    589        
    590 "Shell Side Outlet Nozzle rho-V^2"
    591         Unity(i).Shell.PressureDrop.RVsquare_out = 0;
    592        
    593 "Shell Side inlet Nozzle rho-V^2"
    594         Unity(i).Shell.PressureDrop.RVsquare_in = 0;
    595 
    596496if side equal 1
    597497       
    598498        then
    599499       
    600 "Shell Pressure Drop Cross Flow"
    601         Unity(i).Shell.PressureDrop.PdCross             =       HE.DeltaPcrossIncremental(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);
     500"Pressure Drop Hot Stream"
     501        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P - Unity(i).Shell.PressureDrop.Pdtotal;   
     502
     503"Pressure Drop Cold Stream"
     504        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Tubes.PressureDrop.Pdtotal;
    602505
    603506
    604507        else
    605508
    606 "Shell Pressure Drop Cross Flow"
    607         Unity(i).Shell.PressureDrop.PdCross     =       HE.DeltaPcrossIncremental(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);
    608 
    609 
    610 end
    611 
    612 "Zone Length"
     509"Pressure Drop Hot Stream"
     510        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P- Unity(i).Tubes.PressureDrop.Pdtotal;     
     511       
     512"Pressure Drop Cold Stream"
     513        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Shell.PressureDrop.Pdtotal;
     514
     515
     516end
     517
     518"Position for discretization"
    613519        Sumary.Lz(i) = Unity(1).Baffles.Ls;
    614520
    615521"Shell Side Cross Flow Area"
    616522        Unity(i).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(i).Baffles.Ls);
    617        
     523
    618524end
    619525
     
    621527for i in [1:Nb+1]
    622528       
     529"Js Factor"     
     530        Unity(i).Shell.HeatTransfer.Js = HE.JsFactor(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Lsi,Unity(i).Baffles.Lso,Unity(i).Baffles.Ls);
     531
     532"Position for discretization"
     533        Sumary.Lpos(i)                                                  =       sum(Sumary.Lz([1:i]));
     534       
     535"Ji Factor"
     536        Unity(i).Shell.HeatTransfer.Ji          =       HE.JiFactor(Unity(i).Shell.HeatTransfer.Re);
     537
     538"Jc Factor"
     539        Unity(i).Shell.HeatTransfer.Jc          =       HE.JcFactor();
     540       
     541"Jl Factor"
     542        Unity(i).Shell.HeatTransfer.Jl          =       HE.JlFactor(Unity(i).Shell.HeatTransfer.Sm);
     543
     544"Jb Factor"
     545        Unity(i).Shell.HeatTransfer.Jb          =       HE.JbFactor(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Shell.HeatTransfer.Sm);
     546
     547"Jr Factor"     
     548        Unity(i).Shell.HeatTransfer.Jr          =       HE.JrFactor(Unity(i).Shell.HeatTransfer.Re);
     549       
     550"Total J Factor"
     551        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;
     552
    623553if side equal 1
    624554       
    625         then
    626 "Pressure Drop Hot Stream"
    627         Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P - Unity(i).Shell.PressureDrop.Pdtotal;   
    628 
    629 "Pressure Drop Cold Stream"
    630         Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Tubes.PressureDrop.Pdtotal;
    631        
     555then
     556
    632557"Shell Side Reynolds Number"
    633         Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Hot.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Hot.Average.Mu;
     558        Unity(i).Shell.HeatTransfer.Re                  = HE.ShellReynoldsNumber(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Hot.Average.Mu);
    634559
    635560"Shell Heat Transfer Coefficient"
    636         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;
    637 
     561        Unity(i).Shell.HeatTransfer.hshell              = HE.ShellFilmCoeff(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,Unity(i).Shell.HeatTransfer.Jtotal,Unity(i).Shell.HeatTransfer.Phi);
     562
     563"Shell Pressure Drop Cross Flow"
     564        Unity(i).Shell.PressureDrop.PdCross     = HE.DeltaPcrossIncremental(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);
    638565
    639566"Shell Pressure Baffle Window"
    640         Unity(i).Shell.PressureDrop.Pdwindow            =       HE.DeltaPwindowIncremental(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);
    641 
    642 "Hot Wall Temperature"
    643         Unity(i).Properties.Hot.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    644 
    645 "Cold Wall Temperature"
    646         Unity(i).Properties.Cold.Wall.Twall =   (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
     567        Unity(i).Shell.PressureDrop.Pdwindow    = HE.DeltaPwindowIncremental(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);
     568
     569"Shell Pressure End Zones"
     570        Unity(i).Shell.PressureDrop.PdEndZones  = HE.DeltaPendZonesIncremental(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);
     571
     572#       Tubes.HeatTransfer.Twall                                = HE.WallTemperature(Properties.Hot.Average.T,Properties.Cold.Average.T,Tubes.HeatTransfer.htube,Shell.HeatTransfer.hshell);
     573
     574"Wall Temperature for Cold Side"
     575        Unity(i).Properties.Cold.Wall.Twall     =       (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
     576       
     577"Wall Temperature for Hot Side"
     578        Unity(i).Properties.Hot.Wall.Twall      =       (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    647579
    648580"Tube Side Velocity"
    649         Unity(i).Tubes.HeatTransfer.Vtube  = Unity(i).Properties.Cold.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Cold.Average.rho*Ntt);
     581        Unity(i).Tubes.HeatTransfer.Vtube               =       HE.TubeVelocity(Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Properties.Cold.Average.rho);
    650582
    651583"Tube Side Reynolds Number"
    652         Unity(i).Tubes.HeatTransfer.Re          =       (Unity(i).Properties.Cold.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Cold.Average.Mu;
     584        Unity(i).Tubes.HeatTransfer.Re                  =       HE.TubeReynoldsNumber(Unity(i).Properties.Cold.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Properties.Cold.Average.Mu);
    653585       
    654586"Tube Side Prandtl Number"
    655         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;
     587        Unity(i).Tubes.HeatTransfer.PR                  =       HE.PrandtlNumber(Unity(i).Properties.Cold.Average.K,Unity(i).Properties.Cold.Average.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Average.Mu);
    656588
    657589"Tube Side Prandtl Number at Wall"
    658         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;
     590        Unity(i).Tubes.HeatTransfer.PRw                 =       HE.PrandtlNumber(Unity(i).Properties.Cold.Wall.K,Unity(i).Properties.Cold.Wall.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Wall.Mu);
    659591
    660592"Tube Side Film Coefficient"
    661         Unity(i).Tubes.HeatTransfer.htube       =       HE.TubeFilmCoeffIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Cold.Average.K,Sumary.Lz(i))*Unity(i).Tubes.HeatTransfer.Phi;
     593        Unity(i).Tubes.HeatTransfer.htube               =       HE.TubeFilmCoeffIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Cold.Average.K,
     594        Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lpos(i));
    662595       
    663596"Shell Side Prandtl Number"
    664         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;
     597        Unity(i).Shell.HeatTransfer.PR                  =       HE.PrandtlNumber(Unity(i).Properties.Hot.Average.K,Unity(i).Properties.Hot.Average.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Average.Mu);   
    665598
    666599"Shell Side Prandtl Number at Wall"
    667         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
     600        Unity(i).Shell.HeatTransfer.PRw                 =       HE.PrandtlNumber(Unity(i).Properties.Hot.Wall.K,Unity(i).Properties.Hot.Wall.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Wall.Mu);   
    668601
    669602"Tube Side Pressure Drop"
    670         Unity(i).Tubes.PressureDrop.PdTube      =       HE.DeltaPtubeIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Cold.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,
     603        Unity(i).Tubes.PressureDrop.PdTube              =       HE.DeltaPtubeIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Cold.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,
    671604        Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lz(i));
    672605       
    673606"Shell Side Phi correction for viscosity"
    674         Unity(i).Shell.HeatTransfer.Phi         =       HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
     607        Unity(i).Shell.HeatTransfer.Phi                 =       HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
    675608       
    676609"Tube Side Phi correction for viscosity"
    677         Unity(i).Tubes.HeatTransfer.Phi         =       HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
     610        Unity(i).Tubes.HeatTransfer.Phi                 =       HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
    678611       
    679612        else
    680 
    681 "Pressure Drop Hot Stream"
    682         Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P- Unity(i).Tubes.PressureDrop.Pdtotal;     
    683        
    684 "Pressure Drop Cold Stream"
    685         Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Shell.PressureDrop.Pdtotal;
    686613       
    687614"Shell Side Reynolds Number"
    688         Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Cold.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Cold.Average.Mu;
     615        Unity(i).Shell.HeatTransfer.Re                  =       HE.ShellReynoldsNumber(Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Cold.Average.Mu);
    689616
    690617"Shell Heat Transfer Coefficient"
    691         Unity(i).Shell.HeatTransfer.hshell      =Unity(i).Shell.HeatTransfer.Ji*(Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*
    692         (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;
    693 
     618        Unity(i).Shell.HeatTransfer.hshell       = HE.ShellFilmCoeff(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,Unity(i).Shell.HeatTransfer.Jtotal,Unity(i).Shell.HeatTransfer.Phi);
     619
     620"Shell Pressure Drop Cross Flow"
     621        Unity(i).Shell.PressureDrop.PdCross      = HE.DeltaPcrossIncremental(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);
    694622
    695623"Shell Pressure Baffle Window"
    696         Unity(i).Shell.PressureDrop.Pdwindow    =       HE.DeltaPwindowIncremental(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);
    697 
    698 "Hot Wall Temperature"
    699         Unity(i).Properties.Hot.Wall.Twall      =       (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    700 
    701 "Cold Wall Temperature"
    702         Unity(i).Properties.Cold.Wall.Twall     =       (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
     624        Unity(i).Shell.PressureDrop.Pdwindow     = HE.DeltaPwindowIncremental(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);
     625
     626"Shell Pressure End Zones"
     627        Unity(i).Shell.PressureDrop.PdEndZones  = HE.DeltaPendZonesIncremental(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);
     628
     629#       Tubes.HeatTransfer.Twall                                = HE.WallTemperature(Properties.Cold.Average.T,Properties.Hot.Average.T,Tubes.HeatTransfer.htube,Shell.HeatTransfer.hshell);
     630
     631"Wall Temperature for Cold Side"
     632        Unity(i).Properties.Cold.Wall.Twall     = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
     633       
     634"Wall Temperature for Hot Side"
     635        Unity(i).Properties.Hot.Wall.Twall      =  (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    703636
    704637"Tube Side Velocity"
    705         Unity(i).Tubes.HeatTransfer.Vtube               = Unity(i).Properties.Hot.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Hot.Average.rho*Ntt);
     638        Unity(i).Tubes.HeatTransfer.Vtube       =  HE.TubeVelocity(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Properties.Hot.Average.rho);
    706639
    707640"Tube Side Reynolds Number"
    708         Unity(i).Tubes.HeatTransfer.Re                  =       (Unity(i).Properties.Hot.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Hot.Average.Mu;
     641        Unity(i).Tubes.HeatTransfer.Re          =  HE.TubeReynoldsNumber(Unity(i).Properties.Hot.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Properties.Hot.Average.Mu);
    709642       
    710643"Tube Side Prandtl Number"
    711         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;
    712        
     644        Unity(i).Tubes.HeatTransfer.PR          =  HE.PrandtlNumber(Unity(i).Properties.Hot.Average.K,Unity(i).Properties.Hot.Average.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Average.Mu);
     645
    713646"Tube Side Prandtl Number at Wall"
    714         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;
    715        
     647        Unity(i).Tubes.HeatTransfer.PRw         =       HE.PrandtlNumber(Unity(i).Properties.Hot.Wall.K,Unity(i).Properties.Hot.Wall.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Wall.Mu);
     648
    716649"Tube Side Film Coefficient"
    717         Unity(i).Tubes.HeatTransfer.htube               =       HE.TubeFilmCoeffIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Hot.Average.K,Sumary.Lz(i))*Unity(i).Tubes.HeatTransfer.Phi;
     650        Unity(i).Tubes.HeatTransfer.htube               =       HE.TubeFilmCoeffIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Hot.Average.K,
     651        Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lpos(i));
    718652       
    719653"Shell Side Prandtl Number"
    720         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;
     654        Unity(i).Shell.HeatTransfer.PR                  =       HE.PrandtlNumber(Unity(i).Properties.Cold.Average.K,Unity(i).Properties.Cold.Average.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Average.Mu);
    721655
    722656"Shell Side Prandtl Number at Wall"
    723         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;
     657        Unity(i).Shell.HeatTransfer.PRw                 =       HE.PrandtlNumber(Unity(i).Properties.Cold.Wall.K,Unity(i).Properties.Cold.Wall.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Wall.Mu);
     658
    724659
    725660"Tube Side Pressure Drop"
    726         Unity(i).Tubes.PressureDrop.PdTube              =       HE.DeltaPtubeIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Hot.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,
     661        Unity(i).Tubes.PressureDrop.PdTube              =       HE.DeltaPtubeIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Hot.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,
    727662        Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lz(i));
    728663
     
    754689       
    755690
    756 "Js Factor"     
    757         Unity(i).Shell.HeatTransfer.Js                  =       1;
    758        
    759 "Ji Factor"
    760         Unity(i).Shell.HeatTransfer.Ji                  =       HE.JiFactor(Unity(i).Shell.HeatTransfer.Re);
    761 
    762 "Jc Factor"
    763         Unity(i).Shell.HeatTransfer.Jc                  =       HE.JcFactor();
    764        
    765 "Jl Factor"
    766         Unity(i).Shell.HeatTransfer.Jl                  =       HE.JlFactor(Unity(i).Shell.HeatTransfer.Sm);
    767 
    768 "Jb Factor"
    769         Unity(i).Shell.HeatTransfer.Jb                  =       HE.JbFactor(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Shell.HeatTransfer.Sm);
    770 
    771 "Jr Factor"     
    772         Unity(i).Shell.HeatTransfer.Jr                  =       HE.JrFactor(Unity(i).Shell.HeatTransfer.Re);
    773        
    774 "Total J Factor"
    775         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;
    776 end
    777 
    778 
    779 "Velocity Tube Side Inlet Nozzle"
    780         Unity(Nb+1).Tubes.PressureDrop.Vnozzle_in       = 0;
    781 
    782 "Velocity Tube Side Outlet Nozzle"
    783         Unity(1).Tubes.PressureDrop.Vnozzle_out = 0;
    784        
    785 "Tube Pressure Drop Inlet Nozzle"
    786         Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_in      = 0;
    787 
    788 "Tube Pressure Drop Outlet Nozzle"
    789         Unity(1).Tubes.PressureDrop.Pdnozzle_out        = 0;
    790 
    791 "Velocity Shell Side Inlet Nozzle"
    792         Unity(Nb+1).Shell.PressureDrop.Vnozzle_in       = 0;
    793 
    794 "Velocity Shell Side Outlet Nozzle"
    795         Unity(1).Shell.PressureDrop.Vnozzle_out = 0;
    796        
    797 "Shell Pressure Drop Inlet Nozzle"
    798         Unity(Nb+1).Shell.PressureDrop.Pdnozzle_in      = 0;
    799        
    800 "Shell Pressure Drop Outlet Nozzle"
    801         Unity(1).Shell.PressureDrop.Pdnozzle_out        = 0;
    802 
    803 "Shell Cross Flow Pressure Drop"
    804         Unity(1).Shell.PressureDrop.PdCross             = 0;
    805        
    806 "Shell Cross Flow Pressure Drop"
    807         Unity(Nb+1).Shell.PressureDrop.PdCross          = 0;
    808        
    809 "Shell Side Outlet Nozzle rho-V^2"
    810         Unity(1).Shell.PressureDrop.RVsquare_out = 0;
    811        
    812 "Shell Side inlet Nozzle rho-V^2"
    813         Unity(Nb+1).Shell.PressureDrop.RVsquare_in = 0;
     691end
    814692
    815693SET
    816 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    817 #  Set Parameters for heatex Calculation
    818 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     694#=====================================================================
     695#  Set Parameters for External Object Calculation - HE
     696#=====================================================================
    819697        Sumary.Zones        = Nb+1;
    820698        Pi                              = 3.14159265;
     
    841719end
    842720
    843 Model E_Shell_LMTD_Disc         
    844 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    845 #       Shell and Tubes Heat Exchanger with 1 shell pass - LMTD Method
    846 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     721Model E_Shell_NTU_Disc           
     722#============================================================================
     723#       Shell and Tubes Heat Exchanger In Series with 1 shell pass - LMTD Method
     724#============================================================================
    847725PARAMETERS
    848726
    849         HE      as CalcObject   (Brief="STHE Calculations",File="heatex");
    850 ext PP  as CalcObject   (Brief="External Physical Properties");
     727ext     HE              as CalcObject   (Brief="STHE Calculations",File="heatex.dll");
     728ext PP          as CalcObject;
    851729side    as Integer              (Brief="Fluid Alocation",Lower=0,Upper=1);
    852 Pi              as constant     (Brief="Pi Number",Default=3.14159265);
    853 
    854 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     730Pi                      as constant     (Brief="Pi Number",Default=3.14159265);
     731
     732#=====================================================================
    855733#       Shell Geometrical Parameters
    856 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     734#=====================================================================
    857735Tpass                   as Integer              (Brief="Number of Tube Passes",Lower=1);
    858736Nss                             as Integer              (Brief="Number of Sealing Strips pairs",Lower=1);
     
    863741Honozzle_Shell  as length               (Brief="Height Under Shell Outlet Nozzle",Lower=10e-6);
    864742Lcf                     as length               (Brief="Bundle-to-Shell Clearance",Lower=10e-8);
    865 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     743#=====================================================================
    866744#       Tubes Geometrical Parameters
    867 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     745#=====================================================================
    868746Ntt                             as Integer              (Brief="Total Number of Tubes in Shell",Default=100,Lower=1);
    869747Pattern         as Integer              (Brief="Tube Layout Characteristic Angle",Lower=30);
     
    875753Donozzle_Tube   as length               (Brief="Tube Outlet Nozzle Diameter",Lower=10e-6);
    876754Dinozzle_Tube   as length               (Brief="Tube Inlett Nozzle Diameter",Lower=10e-6);
    877 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     755#=====================================================================
    878756#       Baffles Geometrical Parameters
    879 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     757#=====================================================================
    880758Bc                      as Integer              (Brief="Baffle Cut",Default=25,Lower=25);
    881759Nb              as Integer              (Brief="Number of Baffles",Default=4);
    882760Lcd                     as length               (Brief="Baffle-to-Shell Clearance",Lower=10e-8);
    883761Ltd                             as length               (Brief="Tube-to-Bafflehole Clearance",Lower=10e-8);
    884 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     762#=====================================================================
    885763VARIABLES
    886764
    887 Unity(Nb+1)     as Heatex_Discretized_LMTD;
     765PdropNozzles    as Pdrop_Nozzles_Main;
     766Unity(Nb+1)     as Heatex_Discretized_NTU;
    888767Sumary          as Profiles;
    889768
    890769CONNECTIONS
    891770
    892 Unity([1:Nb]).Outlet.Hot        to Unity([2:Nb+1]).Inlet.Hot;
     771Unity([1:Nb]).Outlet.Hot  to Unity([2:Nb+1]).Inlet.Hot;
    893772Unity([2:Nb+1]).Outlet.Cold to Unity([1:Nb]).Inlet.Cold;
    894773
    895774EQUATIONS
    896775
    897 "Hot Temperatures"
    898         Sumary.Thot     = Unity.Outlet.Hot.T;
    899        
    900 "Cold Temperatures"
    901         Sumary.Tcold    = Unity.Outlet.Cold.T ;
    902 
    903 "Hot Pressures"
    904         Sumary.Phot     = Unity.Outlet.Hot.P ;
    905        
    906 "Cold Pressures"
    907         Sumary.Pcold    = Unity.Outlet.Cold.P ;
    908 
    909 "Average Shell Side Film Coefficient"
    910         Sumary.hshellaverage            = sum(Unity.Shell.HeatTransfer.hshell)/Sumary.Zones;
    911 
    912 "Average Tube Side Film Coefficient"
    913         Sumary.htubeaverage             = sum(Unity.Tubes.HeatTransfer.htube)/Sumary.Zones;
    914 
    915 "Average Overall Heat Transfer Coefficient"
    916         Sumary.Uaverage                 = sum(Unity.Details.U)/Sumary.Zones;
    917 
    918 "Area Total"
    919         Sumary.Area                             = sum(Unity.Details.A);
    920 
    921 "Duty Total"
    922         Sumary.Q                                = sum(Unity.Details.Q);
    923 
    924 "Length Inlet zone"
    925         Sumary.Lz(1)                            = Unity(1).Baffles.Lsi;
    926 
    927 "Length Outlet zone"
    928         Sumary.Lz(Nb+1)                         = Unity(1).Baffles.Lso;
    929 
    930 "Total Shell Side Pressure Drop"
    931         Sumary.PdropShell                       = sum(Unity.Shell.PressureDrop.Pdtotal);
    932 
    933 "Total Tube Side Pressure Drop"
    934         Sumary.PdropTubes                       = sum(Unity.Tubes.PressureDrop.Pdtotal);
    935 
    936 "Total Tube Side Nozzles Pressure Drop"
    937         Sumary.PdropTubesNozzle         = sum(Unity.Tubes.PressureDrop.Pdnozzle_in + Unity.Tubes.PressureDrop.Pdnozzle_out);
    938 
    939 "Total Shell Side Nozzles Pressure Drop"
    940         Sumary.PdropShellNozzle         = sum(Unity.Shell.PressureDrop.Pdnozzle_in + Unity.Shell.PressureDrop.Pdnozzle_out);
    941 
    942 "Total Shell Side Window Pressure Drop"
    943         Sumary.PdropWin                         = sum(Unity.Shell.PressureDrop.Pdwindow);
    944 
    945 "Total Shell Side Cross Flow Pressure Drop"
    946         Sumary.PdropCross                       = sum(Unity.Shell.PressureDrop.PdCross);
    947 
    948 "Total Shell Side Ends Pressure Drop"
    949         Sumary.PdropEnds                        = sum(Unity.Shell.PressureDrop.PdEndZones);
     776Sumary.Thot     = Unity.Outlet.Hot.T ;
     777Sumary.Tcold                = Unity.Outlet.Cold.T ;
     778Sumary.Phot                 = Unity.Outlet.Hot.P ;
     779Sumary.Pcold                = Unity.Outlet.Cold.P ;
     780
     781Sumary.hshellaverage            = sum(Unity.Shell.HeatTransfer.hshell)/Sumary.Zones;
     782Sumary.htubeaverage             = sum(Unity.Tubes.HeatTransfer.htube)/Sumary.Zones;
     783Sumary.Uaverage                 = sum(Unity.Details.U)/Sumary.Zones;
     784Sumary.Area             = sum(Unity.Details.A);
     785Sumary.Q                = sum(Unity.Details.Q);
     786Sumary.Lz(1)                    = Unity(1).Baffles.Lsi;
     787Sumary.Lz(Nb+1)                 = Unity(1).Baffles.Lso;
     788Sumary.PdropShellTotal = sum(Unity.Shell.PressureDrop.Pdtotal)+PdropNozzles.Shell.Pdnozzle_in + PdropNozzles.Shell.Pdnozzle_out;
     789Sumary.PdropTubesTotal = sum(Unity.Tubes.PressureDrop.Pdtotal)+PdropNozzles.Tubes.Pdnozzle_in + PdropNozzles.Tubes.Pdnozzle_out;
     790Sumary.PdropWinTotal    = sum(Unity.Shell.PressureDrop.Pdwindow);
     791Sumary.PdropCrossTotal = sum(Unity.Shell.PressureDrop.PdCross);
     792Sumary.PdropEndsTotal   = sum(Unity.Shell.PressureDrop.PdEndZones);
    950793
    951794"Shell Side Cross Flow Area"
     
    955798        Unity(Nb+1).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(Nb+1).Baffles.Lso);
    956799
    957 "LMTD Correction Factor"
    958         Unity.Fc = HE.EshellCorrectionFactor(Unity(1).Inlet.Hot.T,Unity(Nb+1).Outlet.Hot.T,Unity(Nb+1).Inlet.Cold.T,Unity(1).Outlet.Cold.T);
    959800
    960801if side equal 1
    961802       
    962803        then
    963 
    964 "Shell Side inlet Nozzle rho-V^2"
    965         Unity(1).Shell.PressureDrop.RVsquare_in = Unity(1).Properties.Hot.Inlet.rho*(Unity(1).Shell.PressureDrop.Vnozzle_in)^2;
    966 
    967 "Shell Side Outlet Nozzle rho-V^2"
    968         Unity(Nb+1).Shell.PressureDrop.RVsquare_out = Unity(Nb+1).Properties.Hot.Outlet.rho*(Unity(Nb+1).Shell.PressureDrop.Vnozzle_out)^2;
    969 
    970 "Shell Pressure End Zones"
    971         Unity(1).Shell.PressureDrop.PdEndZones          =       HE.DeltaPendZonesIncremental(Unity(1).Shell.HeatTransfer.Re,Unity(1).Baffles.Ls,Unity(1).Baffles.Lso,
    972         Unity(1).Baffles.Lsi,Unity(1).Properties.Hot.Inlet.Fw,Unity(1).Shell.HeatTransfer.Phi,Unity(1).Properties.Hot.Average.rho);
    973 
    974 "Shell Pressure End Zones"
    975         Unity(Nb+1).Shell.PressureDrop.PdEndZones       =       HE.DeltaPendZonesIncremental(Unity(Nb+1).Shell.HeatTransfer.Re,Unity(Nb+1).Baffles.Ls,Unity(Nb+1).Baffles.Lso,
    976         Unity(Nb+1).Baffles.Lsi,Unity(Nb+1).Properties.Hot.Inlet.Fw,Unity(Nb+1).Shell.HeatTransfer.Phi,Unity(Nb+1).Properties.Hot.Average.rho);
    977 
     804       
    978805"Pressure Drop Tube Side Inlet Nozzle"
    979         Unity(1).Tubes.PressureDrop.Pdnozzle_in = HE.DeltaPtubeNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
     806        PdropNozzles.Tubes.Pdnozzle_in  = HE.DeltaPtubeNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
    980807
    981808"Velocity Tube Side Inlet Nozzle"
    982         Unity(1).Tubes.PressureDrop.Vnozzle_in  = HE.TubeVelocityNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
     809        PdropNozzles.Tubes.Vnozzle_in   = HE.TubeVelocityNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
    983810
    984811"Pressure Drop Tube Side Outlet Nozzle"
    985         Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_out     = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
     812        PdropNozzles.Tubes.Pdnozzle_out = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
    986813
    987814"Velocity Tube Side Outlet Nozzle"
    988         Unity(Nb+1).Tubes.PressureDrop.Vnozzle_out      = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
     815        PdropNozzles.Tubes.Vnozzle_out  = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
    989816
    990817"Shell Pressure Drop Inlet Nozzle"
    991         Unity(1).Shell.PressureDrop.Pdnozzle_in = HE.DeltaPshellNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
     818        PdropNozzles.Shell.Pdnozzle_in  = HE.DeltaPshellNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
    992819
    993820"Velocity Shell Side Inlet Nozzle"
    994         Unity(1).Shell.PressureDrop.Vnozzle_in  = HE.ShellVelocityNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
     821        PdropNozzles.Shell.Vnozzle_in   = HE.ShellVelocityNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
    995822
    996823"Shell Pressure Drop Outlet Nozzle"
    997         Unity(Nb+1).Shell.PressureDrop.Pdnozzle_out     =HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
     824        PdropNozzles.Shell.Pdnozzle_out =HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
    998825
    999826"Velocity Shell Side Outlet Nozzle"
    1000         Unity(Nb+1).Shell.PressureDrop.Vnozzle_out      =HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
    1001        
     827        PdropNozzles.Shell.Vnozzle_out  =HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
     828       
     829"Pressure Drop Hot Stream"
     830        Unity(1).Outlet.Hot.P  = Unity(1).Inlet.Hot.P - Unity(1).Shell.PressureDrop.Pdtotal - PdropNozzles.Shell.Pdnozzle_in;   
     831        Unity(Nb+1).Outlet.Hot.P  = Unity(Nb+1).Inlet.Hot.P - Unity(Nb+1).Shell.PressureDrop.Pdtotal - PdropNozzles.Shell.Pdnozzle_out;
     832
     833"Pressure Drop Cold Stream"
     834        Unity(1).Outlet.Cold.P  = Unity(1).Inlet.Cold.P - Unity(1).Tubes.PressureDrop.Pdtotal - PdropNozzles.Tubes.Pdnozzle_in;
     835        Unity(Nb+1).Outlet.Cold.P  = Unity(Nb+1).Inlet.Cold.P - Unity(Nb+1).Tubes.PressureDrop.Pdtotal - PdropNozzles.Tubes.Pdnozzle_out;
     836
    1002837
    1003838        else
    1004839
    1005 "Shell Side inlet Nozzle rho-V^2"
    1006         Unity(1).Shell.PressureDrop.RVsquare_in = Unity(1).Properties.Cold.Inlet.rho*(Unity(1).Shell.PressureDrop.Vnozzle_in)^2;
    1007 
    1008 "Shell Side Outlet Nozzle rho-V^2"
    1009         Unity(Nb+1).Shell.PressureDrop.RVsquare_out = Unity(Nb+1).Properties.Cold.Outlet.rho*(Unity(Nb+1).Shell.PressureDrop.Vnozzle_out)^2;
    1010 
    1011 "Shell Pressure End Zones"
    1012         Unity(1).Shell.PressureDrop.PdEndZones          =       HE.DeltaPendZonesIncremental(Unity(1).Shell.HeatTransfer.Re,Unity(1).Baffles.Ls,Unity(1).Baffles.Lso,
    1013         Unity(1).Baffles.Lsi,Unity(1).Properties.Cold.Inlet.Fw,Unity(1).Shell.HeatTransfer.Phi,Unity(1).Properties.Cold.Average.rho);
    1014 
    1015 "Shell Pressure End Zones"
    1016         Unity(Nb+1).Shell.PressureDrop.PdEndZones       =       HE.DeltaPendZonesIncremental(Unity(Nb+1).Shell.HeatTransfer.Re,Unity(Nb+1).Baffles.Ls,Unity(Nb+1).Baffles.Lso,
    1017         Unity(Nb+1).Baffles.Lsi,Unity(Nb+1).Properties.Cold.Inlet.Fw,Unity(Nb+1).Shell.HeatTransfer.Phi,Unity(Nb+1).Properties.Cold.Average.rho);
    1018 
    1019 
    1020840"Pressure Drop Tube Side Inlet Nozzle"
    1021         Unity(1).Tubes.PressureDrop.Pdnozzle_in = HE.DeltaPtubeNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
     841        PdropNozzles.Tubes.Pdnozzle_in  = HE.DeltaPtubeNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
    1022842
    1023843"Velocity Tube Side Inlet Nozzle"
    1024         Unity(1).Tubes.PressureDrop.Vnozzle_in  = HE.TubeVelocityNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
     844        PdropNozzles.Tubes.Vnozzle_in   = HE.TubeVelocityNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
    1025845
    1026846"Pressure Drop Tube Side Outlet Nozzle"
    1027         Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_out     = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);   
     847        PdropNozzles.Tubes.Pdnozzle_out = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);   
    1028848
    1029849"Velocity Tube Side Outlet Nozzle"
    1030         Unity(Nb+1).Tubes.PressureDrop.Vnozzle_out      = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw); 
     850        PdropNozzles.Tubes.Vnozzle_out  = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw); 
    1031851
    1032852"Shell Pressure Drop Inlet Nozzle"
    1033         Unity(1).Shell.PressureDrop.Pdnozzle_in = HE.DeltaPshellNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
     853        PdropNozzles.Shell.Pdnozzle_in  = HE.DeltaPshellNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
    1034854
    1035855"Velocity Shell Side Inlet Nozzle"
    1036         Unity(1).Shell.PressureDrop.Vnozzle_in  = HE.ShellVelocityNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
     856        PdropNozzles.Shell.Vnozzle_in   = HE.ShellVelocityNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
    1037857
    1038858"Shell Pressure Drop Outlet Nozzle"
    1039         Unity(Nb+1).Shell.PressureDrop.Pdnozzle_out = HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
     859        PdropNozzles.Shell.Pdnozzle_out = HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
    1040860
    1041861"Velocity Shell Side Outlet Nozzle"
    1042         Unity(Nb+1).Shell.PressureDrop.Vnozzle_out  = HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
     862        PdropNozzles.Shell.Vnozzle_out  = HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
     863
     864"Pressure Drop Hot Stream"
     865        Unity(1).Outlet.Hot.P  = Unity(1).Inlet.Hot.P- Unity(1).Tubes.PressureDrop.Pdtotal - PdropNozzles.Tubes.Pdnozzle_in;   
     866        Unity(Nb+1).Outlet.Hot.P  = Unity(Nb+1).Inlet.Hot.P- Unity(Nb+1).Tubes.PressureDrop.Pdtotal - PdropNozzles.Tubes.Pdnozzle_out; 
     867       
     868"Pressure Drop Cold Stream"
     869        Unity(1).Outlet.Cold.P  = Unity(1).Inlet.Cold.P - Unity(1).Shell.PressureDrop.Pdtotal- PdropNozzles.Shell.Pdnozzle_in;
     870        Unity(Nb+1).Outlet.Cold.P  = Unity(Nb+1).Inlet.Cold.P - Unity(Nb+1).Shell.PressureDrop.Pdtotal- PdropNozzles.Shell.Pdnozzle_out;
    1043871
    1044872
     
    1048876for i in [2:Nb]
    1049877
    1050 "Pressure Drop Tube Side Inlet Nozzle"
    1051         Unity(i).Tubes.PressureDrop.Pdnozzle_in = 0;
    1052 
    1053 "Velocity Tube Side Inlet Nozzle"
    1054         Unity(i).Tubes.PressureDrop.Vnozzle_in  = 0;
    1055 
    1056 "Pressure Drop Tube Side Outlet Nozzle"
    1057         Unity(i).Tubes.PressureDrop.Pdnozzle_out        = 0;   
    1058 
    1059 "Velocity Tube Side Outlet Nozzle"
    1060         Unity(i).Tubes.PressureDrop.Vnozzle_out = 0;   
    1061 
    1062 "Shell Pressure Drop Inlet Nozzle"
    1063         Unity(i).Shell.PressureDrop.Pdnozzle_in = 0;
    1064 
    1065 "Velocity Shell Side Inlet Nozzle"
    1066         Unity(i).Shell.PressureDrop.Vnozzle_in  = 0;
    1067 
    1068 "Shell Pressure Drop Outlet Nozzle"
    1069         Unity(i).Shell.PressureDrop.Pdnozzle_out = 0;
    1070 
    1071 "Velocity Shell Side Outlet Nozzle"
    1072         Unity(i).Shell.PressureDrop.Vnozzle_out  = 0;
    1073 
    1074 "Shell Pressure End Zones"
    1075         Unity(i).Shell.PressureDrop.PdEndZones          =       0;
    1076 
    1077 "Shell Side Outlet Nozzle rho-V^2"
    1078         Unity(i).Shell.PressureDrop.RVsquare_out = 0;
    1079        
    1080 "Shell Side inlet Nozzle rho-V^2"
    1081         Unity(i).Shell.PressureDrop.RVsquare_in = 0;
    1082        
     878
    1083879if side equal 1
    1084880       
    1085881        then
    1086882       
     883"Pressure Drop Hot Stream"
     884        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P - Unity(i).Shell.PressureDrop.Pdtotal;   
     885
     886"Pressure Drop Cold Stream"
     887        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Tubes.PressureDrop.Pdtotal;
     888
     889
     890        else
     891
     892"Pressure Drop Hot Stream"
     893        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P- Unity(i).Tubes.PressureDrop.Pdtotal;     
     894       
     895"Pressure Drop Cold Stream"
     896        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Shell.PressureDrop.Pdtotal;
     897
     898
     899end
     900
     901Sumary.Lz(i) = Unity(1).Baffles.Ls;
     902
     903"Shell Side Cross Flow Area"
     904        Unity(i).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(i).Baffles.Ls);
     905       
     906end
     907
     908
     909for i in [1:Nb+1]
     910       
     911if side equal 1
     912       
     913        then
     914
     915"Shell Side Reynolds Number"
     916        Unity(i).Shell.HeatTransfer.Re                          =       HE.ShellReynoldsNumber(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Hot.Average.Mu);
     917
     918"Shell Heat Transfer Coefficient"
     919        Unity(i).Shell.HeatTransfer.hshell                      =       HE.ShellFilmCoeff(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,Unity(i).Shell.HeatTransfer.Jtotal,Unity(i).Shell.HeatTransfer.Phi);
     920
    1087921"Shell Pressure Drop Cross Flow"
    1088922        Unity(i).Shell.PressureDrop.PdCross             =       HE.DeltaPcrossIncremental(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);
    1089923
    1090 
    1091         else
    1092 
    1093 "Shell Pressure Drop Cross Flow"
    1094         Unity(i).Shell.PressureDrop.PdCross     =       HE.DeltaPcrossIncremental(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);
    1095 
    1096 
    1097 end
    1098 
    1099 "Zone Length"
    1100         Sumary.Lz(i) = Unity(1).Baffles.Ls;
    1101 
    1102 "Shell Side Cross Flow Area"
    1103         Unity(i).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(i).Baffles.Ls);
    1104        
    1105 end
    1106 
    1107 
    1108 for i in [1:Nb+1]
    1109 
    1110 
    1111 if side equal 1
    1112        
    1113         then
    1114 "Pressure Drop Hot Stream"
    1115         Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P - Unity(i).Shell.PressureDrop.Pdtotal;   
    1116 
    1117 "Pressure Drop Cold Stream"
    1118         Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Tubes.PressureDrop.Pdtotal;
    1119        
    1120 "Shell Side Reynolds Number"
    1121         Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Hot.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Hot.Average.Mu;
    1122 
    1123 "Shell Heat Transfer Coefficient"
    1124         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;
    1125 
    1126924"Shell Pressure Baffle Window"
    1127925        Unity(i).Shell.PressureDrop.Pdwindow            =       HE.DeltaPwindowIncremental(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);
    1128926
    1129 "Hot Wall Temperature"
     927"Shell Pressure End Zones"
     928        Unity(i).Shell.PressureDrop.PdEndZones          =       HE.DeltaPendZonesIncremental(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);
     929
     930"Wall Temperature"
     931#       Tubes.HeatTransfer.Twall  = HE.WallTemperature(Properties.Hot.Average.T,Properties.Cold.Average.T,Tubes.HeatTransfer.htube,Shell.HeatTransfer.hshell);
     932       
    1130933        Unity(i).Properties.Hot.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    1131934       
    1132 "Cold Wall Temperature"
    1133935        Unity(i).Properties.Cold.Wall.Twall =   (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    1134936
    1135937"Tube Side Velocity"
    1136         Unity(i).Tubes.HeatTransfer.Vtube       =       Unity(i).Properties.Cold.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Cold.Average.rho*Ntt);
     938        Unity(i).Tubes.HeatTransfer.Vtube       =       HE.TubeVelocity(Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Properties.Cold.Average.rho);
    1137939
    1138940"Tube Side Reynolds Number"
    1139         Unity(i).Tubes.HeatTransfer.Re          =       (Unity(i).Properties.Cold.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Cold.Average.Mu;
     941        Unity(i).Tubes.HeatTransfer.Re          =       HE.TubeReynoldsNumber(Unity(i).Properties.Cold.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Properties.Cold.Average.Mu);
    1140942       
    1141943"Tube Side Prandtl Number"
    1142         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;
     944        Unity(i).Tubes.HeatTransfer.PR          =       HE.PrandtlNumber(Unity(i).Properties.Cold.Average.K,Unity(i).Properties.Cold.Average.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Average.Mu);
    1143945
    1144946"Tube Side Prandtl Number at Wall"
    1145         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;
     947        Unity(i).Tubes.HeatTransfer.PRw         =       HE.PrandtlNumber(Unity(i).Properties.Cold.Wall.K,Unity(i).Properties.Cold.Wall.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Wall.Mu);
    1146948
    1147949"Tube Side Film Coefficient"
    1148         Unity(i).Tubes.HeatTransfer.htube       =       HE.TubeFilmCoeffIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Cold.Average.K,Sumary.Lz(i))*Unity(i).Tubes.HeatTransfer.Phi;
     950        Unity(i).Tubes.HeatTransfer.htube       =       HE.TubeFilmCoeffIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Cold.Average.K,
     951        Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lpos(i));
    1149952       
    1150953"Shell Side Prandtl Number"
    1151         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;
     954        Unity(i).Shell.HeatTransfer.PR          =       HE.PrandtlNumber(Unity(i).Properties.Hot.Average.K,Unity(i).Properties.Hot.Average.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Average.Mu);   
    1152955
    1153956"Shell Side Prandtl Number at Wall"
    1154         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
     957        Unity(i).Shell.HeatTransfer.PRw         =       HE.PrandtlNumber(Unity(i).Properties.Hot.Wall.K,Unity(i).Properties.Hot.Wall.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Wall.Mu);   
    1155958
    1156959"Tube Side Pressure Drop"
     
    1166969        else
    1167970
    1168 "Pressure Drop Hot Stream"
    1169         Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P- Unity(i).Tubes.PressureDrop.Pdtotal;     
    1170        
    1171 "Pressure Drop Cold Stream"
    1172         Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Shell.PressureDrop.Pdtotal;
    1173        
    1174971"Shell Side Reynolds Number"
    1175         Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Cold.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Cold.Average.Mu;
     972        Unity(i).Shell.HeatTransfer.Re                  =       HE.ShellReynoldsNumber(Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Cold.Average.Mu);
    1176973
    1177974"Shell Heat Transfer Coefficient"
    1178         Unity(i).Shell.HeatTransfer.hshell      =Unity(i).Shell.HeatTransfer.Ji*(Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*
    1179         (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;
    1180 
     975        Unity(i).Shell.HeatTransfer.hshell              =       HE.ShellFilmCoeff(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,Unity(i).Shell.HeatTransfer.Jtotal,Unity(i).Shell.HeatTransfer.Phi);
     976
     977"Shell Pressure Drop Cross Flow"
     978        Unity(i).Shell.PressureDrop.PdCross     =       HE.DeltaPcrossIncremental(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);
    1181979
    1182980"Shell Pressure Baffle Window"
    1183981        Unity(i).Shell.PressureDrop.Pdwindow    =       HE.DeltaPwindowIncremental(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);
    1184982
    1185 
    1186 "Hot Wall Temperature"
     983"Shell Pressure End Zones"
     984        Unity(i).Shell.PressureDrop.PdEndZones  =       HE.DeltaPendZonesIncremental(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);
     985
     986"Wall Temperature"
     987#       Tubes.HeatTransfer.Twall = HE.WallTemperature(Properties.Cold.Average.T,Properties.Hot.Average.T,Tubes.HeatTransfer.htube,Shell.HeatTransfer.hshell);
     988       
    1187989        Unity(i).Properties.Hot.Wall.Twall      =       (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    1188990       
    1189 "Cold Wall Temperature"
    1190991        Unity(i).Properties.Cold.Wall.Twall     =       (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    1191992
    1192993"Tube Side Velocity"
    1193         Unity(i).Tubes.HeatTransfer.Vtube               = Unity(i).Properties.Hot.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Hot.Average.rho*Ntt);
     994        Unity(i).Tubes.HeatTransfer.Vtube               =       HE.TubeVelocity(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Properties.Hot.Average.rho);
    1194995
    1195996"Tube Side Reynolds Number"
    1196         Unity(i).Tubes.HeatTransfer.Re                  =       (Unity(i).Properties.Hot.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Hot.Average.Mu;
     997        Unity(i).Tubes.HeatTransfer.Re                  =       HE.TubeReynoldsNumber(Unity(i).Properties.Hot.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Properties.Hot.Average.Mu);
    1197998       
    1198999"Tube Side Prandtl Number"
    1199         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;
     1000        Unity(i).Tubes.HeatTransfer.PR                  =       HE.PrandtlNumber(Unity(i).Properties.Hot.Average.K,Unity(i).Properties.Hot.Average.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Average.Mu);
    12001001       
    12011002"Tube Side Prandtl Number at Wall"
    1202         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;
     1003        Unity(i).Tubes.HeatTransfer.PRw                 =       HE.PrandtlNumber(Unity(i).Properties.Hot.Wall.K,Unity(i).Properties.Hot.Wall.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Wall.Mu);
    12031004       
    12041005       
    12051006"Tube Side Film Coefficient"
    1206         Unity(i).Tubes.HeatTransfer.htube               =       HE.TubeFilmCoeffIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Hot.Average.K,Sumary.Lz(i))*Unity(i).Tubes.HeatTransfer.Phi;
     1007        Unity(i).Tubes.HeatTransfer.htube               =       HE.TubeFilmCoeffIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Hot.Average.K,
     1008        Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lpos(i));
    12071009       
    12081010"Shell Side Prandtl Number"
    1209         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;
     1011        Unity(i).Shell.HeatTransfer.PR                  =       HE.PrandtlNumber(Unity(i).Properties.Cold.Average.K,Unity(i).Properties.Cold.Average.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Average.Mu);
    12101012
    12111013"Shell Side Prandtl Number at Wall"
    1212         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;
     1014        Unity(i).Shell.HeatTransfer.PRw                 =       HE.PrandtlNumber(Unity(i).Properties.Cold.Wall.K,Unity(i).Properties.Cold.Wall.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Wall.Mu);
    12131015
    12141016"Tube Side Pressure Drop"
     
    12241026end
    12251027
     1028"Position for discretization"
     1029        Sumary.Lpos(i)                                                  =       sum(Sumary.Lz([1:i]));
     1030
    12261031"Tube Resistance"       
    12271032        Unity(i).Resistances.Rtube*(Unity(i).Tubes.HeatTransfer.htube*Ditube) = Dotube;
     
    12411046"Baffles Spacing"
    12421047        Ltube = Unity(i).Baffles.Lsi+Unity(i).Baffles.Lso+Unity(i).Baffles.Ls*(Nb-1);
     1048       
    12431049
    12441050"Js Factor"     
    1245         Unity(i).Shell.HeatTransfer.Js                  =       1;
     1051        Unity(i).Shell.HeatTransfer.Js                  =       HE.JsFactor(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Lsi,Unity(i).Baffles.Lso,Unity(i).Baffles.Ls);
    12461052
    12471053"Ji Factor"
     
    12621068"Total J Factor"
    12631069        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;
    1264 end
    1265 
    1266 "Velocity Tube Side Inlet Nozzle"
    1267         Unity(Nb+1).Tubes.PressureDrop.Vnozzle_in       = 0;
    1268 
    1269 "Velocity Tube Side Outlet Nozzle"
    1270         Unity(1).Tubes.PressureDrop.Vnozzle_out = 0;
    1271        
    1272 "Tube Pressure Drop Inlet Nozzle"
    1273         Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_in      = 0;
    1274 
    1275 "Tube Pressure Drop Outlet Nozzle"
    1276         Unity(1).Tubes.PressureDrop.Pdnozzle_out        = 0;
    1277 
    1278 "Velocity Shell Side Inlet Nozzle"
    1279         Unity(Nb+1).Shell.PressureDrop.Vnozzle_in       = 0;
    1280 
    1281 "Velocity Shell Side Outlet Nozzle"
    1282         Unity(1).Shell.PressureDrop.Vnozzle_out = 0;
    1283        
    1284 "Shell Pressure Drop Inlet Nozzle"
    1285         Unity(Nb+1).Shell.PressureDrop.Pdnozzle_in      = 0;
    1286        
    1287 "Shell Pressure Drop Outlet Nozzle"
    1288         Unity(1).Shell.PressureDrop.Pdnozzle_out        = 0;
    1289 
    1290 "Shell Cross Flow Pressure Drop"
    1291         Unity(1).Shell.PressureDrop.PdCross             = 0;
    1292        
    1293 "Shell Cross Flow Pressure Drop"
    1294         Unity(Nb+1).Shell.PressureDrop.PdCross          = 0;
    1295        
    1296 "Shell Side Outlet Nozzle rho-V^2"
    1297         Unity(1).Shell.PressureDrop.RVsquare_out = 0;
    1298        
    1299 "Shell Side inlet Nozzle rho-V^2"
    1300         Unity(Nb+1).Shell.PressureDrop.RVsquare_in = 0;
     1070
     1071end
     1072
    13011073
    13021074SET
    1303 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     1075#=====================================================================
    13041076#  Set Parameters for heatex Calculation
    1305 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     1077#=====================================================================
    13061078        Sumary.Zones        = Nb+1;
    13071079        Pi                              = 3.14159265;
Note: See TracChangeset for help on using the changeset viewer.