Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • mso/eml/heat_exchangers/HeatExchangerDetailed.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 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    10 #       Basic Model for Detailed Shell and Tubes Heat Exchangers
    11 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     19#=====================================================================
     20#       Basic Model for Detailed Heat Exchangers
     21#=====================================================================
    1222
    1323Model HeatExchangerDetailed_Basic
    14        
     24
    1525PARAMETERS
    1626
    17 ext PP          as CalcObject   (Brief="External Physical Properties");
    18 ext NComp       as Integer      (Brief="Number of Components");
    19         HE              as CalcObject   (Brief="STHE Calculations",File="heatex");
    20         M(NComp)        as molweight    (Brief="Component Mol Weight");
     27ext PP      as CalcObject(Brief="External Physical Properties");
     28ext HE      as CalcObject(Brief="STHE Calculations",File="heatex.dll");
     29ext NComp   as Integer   (Brief="Number of Components");
     30  M(NComp)  as molweight (Brief="Component Mol Weight");
    2131       
    2232VARIABLES
    2333
    24 in  Inlet               as Inlet_Main_Stream;   
    25 out Outlet              as Outlet_Main_Stream; 
    26         Properties      as Main_Properties;             
    27         Details                 as Details_Main;
    28         Tubes                   as Tube_Side_Main;     
    29         Shell                   as Shell_Side_Main;
    30         Resistances     as Main_Resistances;
    31         Baffles         as Baffles_Main;
     34in  Inlet           as Inlet_Main_Stream;       # Hot and Cold Inlets
     35out Outlet      as Outlet_Main_Stream;  # Hot and Cold Outlets
     36        Properties  as Main_Properties;         # Hot and Cold Properties
     37        Details     as Details_Main;
     38        Tubes           as Tube_Side_Main;     
     39        Shell           as Shell_Side_Main;
     40        Resistances as Main_Resistances;
     41        Baffles     as Baffles_Main;
    3242
    3343SET
    34         M   = PP.MolecularWeight();
     44
     45M   = PP.MolecularWeight();
    3546
    3647EQUATIONS
    37 
    38 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    39 #                                               Properties                                                                      #
    40 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    4148
    4249"Hot Stream Average Temperature"
     
    6370        then   
    6471       
    65 "Cold Stream Average Heat Capacity"
     72"Heat Capacity Cold Stream"
    6673        Properties.Cold.Average.Cp      =       PP.LiquidCp(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
    67 
    68 "Cold Stream Inlet Heat Capacity"
    6974        Properties.Cold.Inlet.Cp        =       PP.LiquidCp(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
    70 
    71 "Cold Stream Outlet Heat Capacity"
    7275        Properties.Cold.Outlet.Cp       =       PP.LiquidCp(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    7376
    74 "Cold Stream Average Mass Density"
    75         Properties.Cold.Average.rho =   PP.LiquidDensity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
    76 
    77 "Cold Stream Inlet Mass Density"
     77"Mass Density Cold Stream"
     78        Properties.Cold.Average.rho     =       PP.LiquidDensity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
    7879        Properties.Cold.Inlet.rho       =       PP.LiquidDensity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
    79 
    80 "Cold Stream Outlet Mass Density"
    8180        Properties.Cold.Outlet.rho      =       PP.LiquidDensity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    8281
    83 "Cold Stream Average Viscosity"
    84         Properties.Cold.Average.Mu      =       PP.LiquidViscosity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
    85 
    86 "Cold Stream inlet Viscosity"
    87         Properties.Cold.Inlet.Mu        =       PP.LiquidViscosity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
    88        
    89 "Cold Stream Outlet Viscosity"
    90         Properties.Cold.Outlet.Mu       =       PP.LiquidViscosity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    91 
    92 "Cold Stream Average Conductivity"
    93         Properties.Cold.Average.K       =       PP.LiquidThermalConductivity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
    94 
    95 "Cold Stream Inlet Conductivity"       
    96         Properties.Cold.Inlet.K         =       PP.LiquidThermalConductivity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
    97 
    98 "Cold Stream Outlet Conductivity"
    99         Properties.Cold.Outlet.K        =       PP.LiquidThermalConductivity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    100 
    101 "Cold Stream Heat Capacity at Wall Temperature"
     82"Viscosity Cold Stream"
     83        Properties.Cold.Average.Mu =    PP.LiquidViscosity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
     84        Properties.Cold.Inlet.Mu =              PP.LiquidViscosity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
     85        Properties.Cold.Outlet.Mu =     PP.LiquidViscosity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
     86
     87"Conductivity Cold Stream"
     88        Properties.Cold.Average.K =     PP.LiquidThermalConductivity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
     89        Properties.Cold.Inlet.K =               PP.LiquidThermalConductivity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
     90        Properties.Cold.Outlet.K =              PP.LiquidThermalConductivity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
     91
     92"Heat Capacity Cold Stream"
    10293        Properties.Cold.Wall.Cp         =       PP.LiquidCp(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
    10394       
    104 "Cold Stream Viscosity at Wall Temperature"
    105         Properties.Cold.Wall.Mu         =       PP.LiquidViscosity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
    106 
    107 "Cold Stream Conductivity at Wall Temperature"
    108         Properties.Cold.Wall.K          =       PP.LiquidThermalConductivity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
     95"Viscosity Cold Stream"
     96        Properties.Cold.Wall.Mu =       PP.LiquidViscosity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
     97
     98"Conductivity Cold Stream"
     99        Properties.Cold.Wall.K =        PP.LiquidThermalConductivity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
    109100
    110101
    111102        else
    112103
    113 "Cold Stream Average Heat Capacity"
     104"Heat Capacity Cold Stream"
    114105        Properties.Cold.Average.Cp      =       PP.VapourCp(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
    115 
    116 "Cold Stream Inlet Heat Capacity"       
    117106        Properties.Cold.Inlet.Cp        =       PP.VapourCp(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
    118 
    119 "Cold Stream Outlet Heat Capacity"     
    120107        Properties.Cold.Outlet.Cp       =       PP.VapourCp(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    121108
    122 "Cold Stream Average Mass Density"
    123         Properties.Cold.Average.rho =   PP.VapourDensity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
    124 
    125 "Cold Stream Inlet Mass Density"
     109"Mass Density Cold Stream"
     110        Properties.Cold.Average.rho     =       PP.VapourDensity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
    126111        Properties.Cold.Inlet.rho       =       PP.VapourDensity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
    127 
    128 "Cold Stream Outlet Mass Density"       
    129112        Properties.Cold.Outlet.rho      =       PP.VapourDensity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    130113
    131 "Cold Stream Average Viscosity "
    132         Properties.Cold.Average.Mu      =       PP.VapourViscosity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
    133 
    134 "Cold Stream Inlet Viscosity " 
    135         Properties.Cold.Inlet.Mu        =       PP.VapourViscosity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
    136 
    137 "Cold Stream Outlet Viscosity "
    138         Properties.Cold.Outlet.Mu       =       PP.VapourViscosity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    139 
    140 "Cold Stream Average Conductivity "
    141         Properties.Cold.Average.K       =       PP.VapourThermalConductivity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
    142 
    143 "Cold Stream Inlet Conductivity "
    144         Properties.Cold.Inlet.K         =       PP.VapourThermalConductivity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
    145 
    146 "Cold Stream Outlet Conductivity "
    147         Properties.Cold.Outlet.K        =       PP.VapourThermalConductivity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    148        
    149 "Cold Stream Heat Capacity at Wall Temperature"
     114"Viscosity Cold Stream"
     115        Properties.Cold.Average.Mu =    PP.VapourViscosity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
     116        Properties.Cold.Inlet.Mu =              PP.VapourViscosity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
     117        Properties.Cold.Outlet.Mu =             PP.VapourViscosity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
     118
     119"Conductivity Cold Stream"
     120        Properties.Cold.Average.K =     PP.VapourThermalConductivity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
     121        Properties.Cold.Inlet.K =               PP.VapourThermalConductivity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
     122        Properties.Cold.Outlet.K =              PP.VapourThermalConductivity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
     123       
     124"Heat Capacity Cold Stream"
    150125        Properties.Cold.Wall.Cp         =       PP.VapourCp(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
    151126
    152127
    153 "Cold Stream Viscosity at Wall Temperature"
    154         Properties.Cold.Wall.Mu         =       PP.VapourViscosity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
    155 
    156 "Cold Stream Conductivity at Wall Temperature"
    157         Properties.Cold.Wall.K          =       PP.VapourThermalConductivity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
     128"Viscosity Cold Stream"
     129        Properties.Cold.Wall.Mu =       PP.VapourViscosity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
     130
     131"Conductivity Cold Stream"
     132        Properties.Cold.Wall.K =        PP.VapourThermalConductivity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
    158133       
    159134       
     
    181156
    182157"Conductivity Hot Stream"
    183         Properties.Hot.Average.K        =       PP.LiquidThermalConductivity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);   
     158        Properties.Hot.Average.K        =               PP.LiquidThermalConductivity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);   
    184159        Properties.Hot.Inlet.K  =               PP.LiquidThermalConductivity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);     
    185         Properties.Hot.Outlet.K         =       PP.LiquidThermalConductivity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);   
     160        Properties.Hot.Outlet.K         =               PP.LiquidThermalConductivity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);   
    186161
    187162"Heat Capacity Hot Stream"
    188         Properties.Hot.Wall.Cp          =       PP.LiquidCp(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
     163        Properties.Hot.Wall.Cp  =               PP.LiquidCp(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
    189164
    190165"Viscosity Hot Stream"
    191         Properties.Hot.Wall.Mu          =       PP.LiquidViscosity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);     
     166        Properties.Hot.Wall.Mu  =               PP.LiquidViscosity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);     
    192167
    193168"Conductivity Hot Stream"
    194         Properties.Hot.Wall.K           =       PP.LiquidThermalConductivity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);   
     169        Properties.Hot.Wall.K   =               PP.LiquidThermalConductivity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);   
    195170       
    196171
     
    213188
    214189"Conductivity Hot Stream"
    215         Properties.Hot.Average.K        =       PP.VapourThermalConductivity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);   
     190        Properties.Hot.Average.K        =               PP.VapourThermalConductivity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);   
    216191        Properties.Hot.Inlet.K  =               PP.VapourThermalConductivity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);     
    217         Properties.Hot.Outlet.K         =       PP.VapourThermalConductivity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);   
     192        Properties.Hot.Outlet.K         =               PP.VapourThermalConductivity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);   
    218193
    219194"Heat Capacity Hot Stream"
    220         Properties.Hot.Wall.Cp  =       PP.VapourCp(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
     195        Properties.Hot.Wall.Cp  =               PP.VapourCp(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
    221196
    222197"Viscosity Hot Stream"
    223         Properties.Hot.Wall.Mu  =       PP.VapourViscosity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
     198        Properties.Hot.Wall.Mu  =               PP.VapourViscosity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
    224199
    225200"Conductivity Hot Stream"
    226         Properties.Hot.Wall.K   =       PP.VapourThermalConductivity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);   
    227 
    228 
    229 end
    230 
    231 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    232 #                                       Thermal Details                                                                 #
    233 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    234 
     201        Properties.Hot.Wall.K   =               PP.VapourThermalConductivity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);   
     202
     203
     204end
     205
     206#=====================================================================
     207#       Thermal Details
     208#=====================================================================
    235209"Hot Stream Heat Capacity"
    236210        Details.Ch =Inlet.Hot.F*Properties.Hot.Average.Cp;
     
    239213        Details.Cc =Inlet.Cold.F*Properties.Cold.Average.Cp;
    240214       
    241 "Minimum Heat Capacity"
    242         Details.Cmin  = min([Details.Ch,Details.Cc]);
    243        
    244 "Maximum Heat Capacity"
    245         Details.Cmax  = max([Details.Ch,Details.Cc]);
    246 
    247215"Heat Capacity Ratio"
    248         Details.Cr    = Details.Cmin/Details.Cmax;
    249 
    250 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    251 #                                       Energy Balance
    252 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    253 
     216        [Details.Cmin,Details.Cmax,Details.Cr]  = HE.HeatCapacityRatio(Details.Ch,Details.Cc);
     217
     218#=====================================================================
     219#       Energy Balance
     220#=====================================================================
    254221"Energy Balance Hot Stream"
    255222        Details.Q = Inlet.Hot.F*(Inlet.Hot.h-Outlet.Hot.h);
     
    258225        Details.Q =-Inlet.Cold.F*(Inlet.Cold.h-Outlet.Cold.h);
    259226
    260 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    261 #                                       Material Balance
    262 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     227#=====================================================================
     228#       Material Balance
     229#=====================================================================
    263230"Flow Mass Inlet Cold Stream"
    264231        Properties.Cold.Inlet.Fw        =  sum(M*Inlet.Cold.z)*Inlet.Cold.F;
     
    279246        Inlet.Cold.F = Outlet.Cold.F;
    280247
    281 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    282 #                                       Constraints
    283 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     248#======================================
     249#       Constraints
     250#======================================
    284251"Hot Stream Molar Fraction Constraint"
    285252        Outlet.Hot.z=Inlet.Hot.z;
     
    293260"No Phase Change In Hot Stream"
    294261        Inlet.Hot.v=Outlet.Hot.v;
     262
    295263       
    296264end
     
    300268PARAMETERS
    301269
    302 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    303 #                               Basic  Parameters                                                                       #
    304 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    305 ext PP          as CalcObject   (Brief="External Physical Properties");
    306 side        as Integer          (Brief="Fluid Alocation Flag",Lower=0,Upper=1);
     270ext PP          as CalcObject;
     271ext     HE              as CalcObject   (Brief="STHE Calculations",File="heatex.dll");
     272side        as Integer          (Brief="Fluid Alocation",Lower=0,Upper=1);
    307273Pi                      as constant     (Brief="Pi Number",Default=3.14159265);
    308 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    309 #                               Shell Geometrical Parameters                                            #
    310 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     274
     275#=====================================================================
     276#       Shell Geometrical Parameters
     277#=====================================================================
    311278Tpass                   as Integer              (Brief="Number of Tube Passes",Lower=1);
    312279Nss                             as Integer              (Brief="Number of Sealing Strips pairs",Lower=1);
     
    317284Honozzle_Shell  as length               (Brief="Height Under Shell Outlet Nozzle",Lower=10e-6);
    318285Lcf                     as length               (Brief="Bundle-to-Shell Clearance",Lower=10e-8);
    319 
    320 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    321 #                               Tubes Geometrical Parameters                                            #
    322 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    323 Ntt                       as Integer            (Brief="Total Number of Tubes in Shell",Default=100,Lower=1);
    324 Pattern       as Integer                (Brief="Tube Layout Characteristic Angle",Lower=30);
    325 Ltube             as length                     (Brief="Effective Tube Length",Lower=0.1);
    326 pitch             as length                     (Brief="Tube Pitch",Lower=1e-8);
    327 Kwall             as conductivity       (Brief="Tube Wall Material Thermal Conductivity");
    328 Dotube            as length                     (Brief="Tube Outside Diameter",Lower=10e-6);
    329 Ditube            as length                     (Brief="Tube Inside Diameter",Lower=10e-6);
    330 Donozzle_Tube as length                 (Brief="Tube Outlet Nozzle Diameter",Lower=10e-6);
    331 Dinozzle_Tube as length                 (Brief="Tube Inlett Nozzle Diameter",Lower=10e-6);
    332 
    333 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    334 #                               Baffles Geometrical Parameters                                          #
    335 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    336 Bc     as Integer (Brief="Baffle Cut",Default=25,Lower=25);
    337 Nb     as Real    (Brief="Number of Baffles",Lower=1);
    338 Lcd    as length  (Brief="Baffle-to-Shell Clearance",Lower=10e-8);
    339 Ltd        as length  (Brief="Tube-to-Bafflehole Clearance",Lower=10e-8);
    340 
    341 SET
    342 
    343 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    344 #             Set Parameters for heatex Calculation                                     #
    345 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     286#=====================================================================
     287#       Tubes Geometrical Parameters
     288#=====================================================================
     289Ntt                             as Integer              (Brief="Total Number of Tubes in Shell",Default=100,Lower=1);
     290Pattern         as Integer              (Brief="Tube Layout Characteristic Angle",Lower=30);
     291Ltube                   as length               (Brief="Effective Tube Length",Lower=0.1);
     292pitch                   as length               (Brief="Tube Pitch",Lower=1e-8);
     293Kwall                   as conductivity (Brief="Tube Wall Material Thermal Conductivity");
     294Dotube                  as length               (Brief="Tube Outside Diameter",Lower=10e-6);
     295Ditube                  as length               (Brief="Tube Inside Diameter",Lower=10e-6);
     296Donozzle_Tube   as length               (Brief="Tube Outlet Nozzle Diameter",Lower=10e-6);
     297Dinozzle_Tube   as length               (Brief="Tube Inlett Nozzle Diameter",Lower=10e-6);
     298#=====================================================================
     299#       Baffles Geometrical Parameters
     300#=====================================================================
     301Bc                      as Integer              (Brief="Baffle Cut",Default=25,Lower=25);
     302Nb              as Real                 (Brief="Number of Baffles",Lower=1);
     303Lcd                     as length               (Brief="Baffle-to-Shell Clearance",Lower=10e-8);
     304Ltd                             as length               (Brief="Tube-to-Bafflehole Clearance",Lower=10e-8);
     305#=====================================================================
     306#=====================================================================
     307EQUATIONS
     308#=====================================================================
     309
     310"Shell Side Cross Flow Area"
     311        Shell.HeatTransfer.Sm = HE.CrossFlowArea(Baffles.Ls);
     312       
     313"Ji Factor"
     314        Shell.HeatTransfer.Ji = HE.JiFactor(Shell.HeatTransfer.Re);
     315
     316"Jc Factor"
     317        Shell.HeatTransfer.Jc = HE.JcFactor();
     318       
     319"Jl Factor"
     320        Shell.HeatTransfer.Jl = HE.JlFactor(Shell.HeatTransfer.Sm);
     321
     322"Jb Factor"
     323        Shell.HeatTransfer.Jb = HE.JbFactor(Shell.HeatTransfer.Re,Baffles.Ls,Shell.HeatTransfer.Sm);
     324
     325"Jr Factor"     
     326        Shell.HeatTransfer.Jr = HE.JrFactor(Shell.HeatTransfer.Re);
     327       
     328"Total J Factor"
     329        Shell.HeatTransfer.Jtotal=Shell.HeatTransfer.Jc*Shell.HeatTransfer.Jl*Shell.HeatTransfer.Jb*Shell.HeatTransfer.Jr*Shell.HeatTransfer.Js;
     330
     331#=====================================================================
     332#  Fluid Alocation
     333#=====================================================================
     334
     335if side equal 1 then
     336       
     337       
     338"Shell Side Phi correction"
     339        Shell.HeatTransfer.Phi = HE.PhiCorrection(Properties.Hot.Average.Mu,Properties.Hot.Wall.Mu);
     340       
     341"Tube Side Phi correction"
     342        Tubes.HeatTransfer.Phi  = HE.PhiCorrection(Properties.Cold.Average.Mu,Properties.Cold.Wall.Mu);
     343       
     344        else
     345       
     346
     347"Shell Side Phi correction"
     348        Shell.HeatTransfer.Phi = HE.PhiCorrection(Properties.Cold.Average.Mu,Properties.Cold.Wall.Mu);
     349       
     350"Tube Side Phi correction"
     351        Tubes.HeatTransfer.Phi  = HE.PhiCorrection(Properties.Hot.Average.Mu,Properties.Hot.Wall.Mu);
     352
     353end
     354
     355
     356if side equal 1
     357       
     358        then
     359       
     360"Wall Temperature"
     361#       Properties.Hot.Wall.Twall = HE.WallTemperature(Properties.Hot.Average.T,Properties.Cold.Average.T,Tubes.HeatTransfer.htube,Shell.HeatTransfer.hshell);
     362
     363#       Properties.Cold.Wall.Twall = HE.WallTemperature(Properties.Cold.Average.T,Properties.Hot.Average.T,Tubes.HeatTransfer.htube,Shell.HeatTransfer.hshell);
     364
     365Properties.Hot.Wall.Twall  = (Properties.Hot.Average.T+Properties.Cold.Average.T)/2;
     366
     367Properties.Cold.Wall.Twall  = (Properties.Hot.Average.T+Properties.Cold.Average.T)/2;
     368
     369"Tube Side Velocity"
     370        Tubes.HeatTransfer.Vtube  = HE.TubeVelocity(Properties.Cold.Inlet.Fw,Properties.Cold.Average.rho);
     371
     372"Tube Side Reynolds Number"
     373        Tubes.HeatTransfer.Re = HE.TubeReynoldsNumber(Properties.Cold.Average.rho,Tubes.HeatTransfer.Vtube,Properties.Cold.Average.Mu);
     374       
     375"Tube Side Prandtl Number"
     376        Tubes.HeatTransfer.PR = HE.PrandtlNumber(Properties.Cold.Average.K,Properties.Cold.Average.Cp,Properties.Cold.Average.Mw,Properties.Cold.Average.Mu);
     377
     378"Tube Side Prandtl Number at Wall Temperature"
     379        Tubes.HeatTransfer.PRw = HE.PrandtlNumber(Properties.Cold.Wall.K,Properties.Cold.Wall.Cp,Properties.Cold.Average.Mw,Properties.Cold.Wall.Mu);
     380
     381"Tube Side Film Coefficient"
     382        Tubes.HeatTransfer.htube= HE.TubeFilmCoeff(Tubes.HeatTransfer.Re,Tubes.HeatTransfer.PR,Properties.Cold.Average.K,Tubes.HeatTransfer.Phi);
     383       
     384"Shell Side Prandtl Number"
     385        Shell.HeatTransfer.PR=HE.PrandtlNumber(Properties.Hot.Average.K,Properties.Hot.Average.Cp,Properties.Hot.Average.Mw,Properties.Hot.Average.Mu);
     386
     387"Shell Side Prandtl Number at Wall Temperature"
     388        Shell.HeatTransfer.PRw = HE.PrandtlNumber(Properties.Hot.Wall.K,Properties.Hot.Wall.Cp,Properties.Hot.Average.Mw,Properties.Hot.Wall.Mu);       
     389
     390"Tube Side Pressure Drop"
     391        Tubes.PressureDrop.PdTube               = HE.DeltaPtube(Tubes.HeatTransfer.Re,Properties.Cold.Average.rho,Tubes.HeatTransfer.Vtube,Tubes.HeatTransfer.Phi);
     392
     393"Pressure Drop Tube Side Inlet Nozzle"
     394        Tubes.PressureDrop.Pdnozzle_in  = HE.DeltaPtubeNozzlein(Properties.Cold.Inlet.rho,Properties.Cold.Inlet.Fw);
     395
     396"Velocity Tube Side Inlet Nozzle"
     397        Tubes.PressureDrop.Vnozzle_in   = HE.TubeVelocityNozzlein(Properties.Cold.Inlet.rho,Properties.Cold.Inlet.Fw);
     398
     399"Pressure Drop Tube Side Outlet Nozzle"
     400        Tubes.PressureDrop.Pdnozzle_out = HE.DeltaPtubeNozzleout(Properties.Cold.Outlet.rho,Properties.Cold.Inlet.Fw);
     401
     402"Velocity Tube Side Outlet Nozzle"
     403        Tubes.PressureDrop.Vnozzle_out  = HE.TubeVelocityNozzleout(Properties.Cold.Outlet.rho,Properties.Cold.Inlet.Fw);
     404
     405"Shell Pressure Drop Inlet Nozzle"
     406        Shell.PressureDrop.Pdnozzle_in  = HE.DeltaPshellNozzleIn(Properties.Hot.Inlet.rho,Properties.Hot.Inlet.Fw);
     407
     408"Velocity Shell Side Inlet Nozzle"
     409        Shell.PressureDrop.Vnozzle_in   = HE.ShellVelocityNozzleIn(Properties.Hot.Inlet.rho,Properties.Hot.Inlet.Fw);
     410
     411"Shell Pressure Drop Outlet Nozzle"
     412        Shell.PressureDrop.Pdnozzle_out =HE.DeltaPshellNozzleOut(Properties.Hot.Outlet.rho,Properties.Hot.Inlet.Fw);
     413
     414"Velocity Shell Side Outlet Nozzle"
     415        Shell.PressureDrop.Vnozzle_out  =HE.ShellVelocityNozzleOut(Properties.Hot.Outlet.rho,Properties.Hot.Inlet.Fw);
     416
     417"Pressure Drop Hot Stream"
     418        Outlet.Hot.P  = Inlet.Hot.P- Shell.PressureDrop.Pdtotal;       
     419       
     420"Pressure Drop Cold Stream"
     421        Outlet.Cold.P  = Inlet.Cold.P - Tubes.PressureDrop.Pdtotal;
     422
     423
     424        else
     425
     426"Wall Temperature"
     427#       Properties.Cold.Wall.Twall = HE.WallTemperature(Properties.Cold.Average.T,Properties.Hot.Average.T,Tubes.HeatTransfer.htube,Shell.HeatTransfer.hshell);
     428
     429#       Properties.Hot.Wall.Twall = HE.WallTemperature(Properties.Hot.Average.T,Properties.Cold.Average.T,Tubes.HeatTransfer.htube,Shell.HeatTransfer.hshell);
     430
     431
     432Properties.Hot.Wall.Twall  = (Properties.Hot.Average.T+Properties.Cold.Average.T)/2;
     433
     434Properties.Cold.Wall.Twall  = (Properties.Hot.Average.T+Properties.Cold.Average.T)/2;
     435
     436"Tube Side Velocity"
     437        Tubes.HeatTransfer.Vtube=HE.TubeVelocity(Properties.Hot.Inlet.Fw,Properties.Hot.Average.rho);
     438
     439"Tube Side Reynolds Number"
     440        Tubes.HeatTransfer.Re=HE.TubeReynoldsNumber(Properties.Hot.Average.rho,Tubes.HeatTransfer.Vtube,Properties.Hot.Average.Mu);
     441       
     442"Tube Side Prandtl Number"
     443        Tubes.HeatTransfer.PR=HE.PrandtlNumber(Properties.Hot.Average.K,Properties.Hot.Average.Cp,Properties.Hot.Average.Mw,Properties.Hot.Average.Mu);
     444
     445"Tube Side Prandtl Number at Wall"
     446        Tubes.HeatTransfer.PRw=HE.PrandtlNumber(Properties.Hot.Wall.K,Properties.Hot.Wall.Cp,Properties.Hot.Average.Mw,Properties.Hot.Wall.Mu);
     447
     448"Tube Side Film Coefficient"
     449        Tubes.HeatTransfer.htube= HE.TubeFilmCoeff(Tubes.HeatTransfer.Re,Tubes.HeatTransfer.PR,Properties.Hot.Average.K,Tubes.HeatTransfer.Phi);
     450       
     451"Shell Side Prandtl Number"
     452        Shell.HeatTransfer.PR=HE.PrandtlNumber(Properties.Cold.Average.K,Properties.Cold.Average.Cp,Properties.Cold.Average.Mw,Properties.Cold.Average.Mu);
     453
     454"Shell Side Prandtl Number at Wall"
     455        Shell.HeatTransfer.PRw=HE.PrandtlNumber(Properties.Cold.Wall.K,Properties.Cold.Wall.Cp,Properties.Cold.Average.Mw,Properties.Cold.Wall.Mu);
     456
     457"Tube Side Pressure Drop"
     458        Tubes.PressureDrop.PdTube               = HE.DeltaPtube(Tubes.HeatTransfer.Re,Properties.Hot.Average.rho,Tubes.HeatTransfer.Vtube,Tubes.HeatTransfer.Phi);
     459
     460"Pressure Drop Tube Side Inlet Nozzle"
     461        Tubes.PressureDrop.Pdnozzle_in  = HE.DeltaPtubeNozzlein(Properties.Hot.Inlet.rho,Properties.Hot.Inlet.Fw);
     462
     463"Velocity Tube Side Inlet Nozzle"
     464        Tubes.PressureDrop.Vnozzle_in   = HE.TubeVelocityNozzlein(Properties.Hot.Inlet.rho,Properties.Hot.Inlet.Fw);
     465
     466"Pressure Drop Tube Side Outlet Nozzle"
     467        Tubes.PressureDrop.Pdnozzle_out = HE.DeltaPtubeNozzleout(Properties.Hot.Outlet.rho,Properties.Hot.Inlet.Fw);   
     468
     469"Velocity Tube Side Outlet Nozzle"
     470        Tubes.PressureDrop.Vnozzle_out  = HE.TubeVelocityNozzleout(Properties.Hot.Outlet.rho,Properties.Hot.Inlet.Fw); 
     471
     472"Shell Pressure Drop Inlet Nozzle"
     473        Shell.PressureDrop.Pdnozzle_in  = HE.DeltaPshellNozzleIn(Properties.Cold.Inlet.rho,Properties.Cold.Inlet.Fw);
     474
     475"Velocity Shell Side Inlet Nozzle"
     476        Shell.PressureDrop.Vnozzle_in   = HE.ShellVelocityNozzleIn(Properties.Cold.Inlet.rho,Properties.Cold.Inlet.Fw);
     477
     478"Shell Pressure Drop Outlet Nozzle"
     479        Shell.PressureDrop.Pdnozzle_out = HE.DeltaPshellNozzleOut(Properties.Cold.Outlet.rho,Properties.Cold.Inlet.Fw);
     480
     481"Velocity Shell Side Outlet Nozzle"
     482        Shell.PressureDrop.Vnozzle_out  = HE.ShellVelocityNozzleOut(Properties.Cold.Outlet.rho,Properties.Cold.Inlet.Fw);
     483
     484"Pressure Drop Hot Stream"
     485        Outlet.Hot.P  = Inlet.Hot.P- Tubes.PressureDrop.Pdtotal;       
     486       
     487"Pressure Drop Cold Stream"
     488        Outlet.Cold.P  = Inlet.Cold.P - Shell.PressureDrop.Pdtotal;
     489
     490
     491end
     492
     493#=====================================================================
     494
     495"Tube Resistance"       
     496        Resistances.Rtube*(Tubes.HeatTransfer.htube*Ditube) = Dotube;
     497       
     498"Wall Resistance"
     499        Resistances.Rwall=Dotube*ln(Dotube/Ditube)/(2*Kwall);
     500       
     501"Shell Resistance"
     502        Resistances.Rshell*(Shell.HeatTransfer.hshell)=1;
     503       
     504"Overall Heat Transfer Coefficient"
     505        Details.U=1/(Dotube/(Tubes.HeatTransfer.htube*Ditube)+(Dotube*ln(Dotube/Ditube)/(2*Kwall))+(1/(Shell.HeatTransfer.hshell)));
     506
     507"Exchange Surface Area"
     508        Details.A=Pi*Dotube*Ntt*Ltube;
     509
     510"Baffles Spacing"
     511        Ltube = Baffles.Lsi+Baffles.Lso+Baffles.Ls*(Nb-1);
     512       
     513       
     514
     515        SET
     516#=====================================================================
     517#  Set Parameters for heatex Calculation
     518#=====================================================================
    346519        Pi                              = 3.14159265;
    347520        HE.Tpass                        = Tpass;
     
    367540        side                            = HE.FluidAlocation();
    368541       
     542end
     543
     544Model Heatex_Detailed_NTU               as Heatex_Detailed
     545       
     546VARIABLES
     547
     548Eft                              as positive            (Brief="Effectiveness",Default=0.05,Lower=1e-8);
     549       
     550EQUATIONS       
     551Details.Q       = Eft*Details.Cmin*(Inlet.Hot.T-Inlet.Cold.T); 
     552       
     553end
     554
     555Model Heatex_Detailed_LMTD              as Heatex_Detailed
     556       
     557VARIABLES
     558LMTD            as temp_delta   (Brief="Logarithmic Mean Temperature Difference",Lower=5);
     559Fc                      as positive             (Brief="LMTD Correction Factor",Lower=0.7);
     560MTD                     as temp_delta   (Brief="Mean Temperature Difference",Lower=5);
     561
    369562EQUATIONS
    370 
    371 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    372 #                               Heat Transfer Correction Factors                                        #
    373 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    374 "Ji Factor"
    375         Shell.HeatTransfer.Ji = HE.JiFactor(Shell.HeatTransfer.Re);
    376 
    377 "Jc Factor"
    378         Shell.HeatTransfer.Jc = HE.JcFactor();
    379        
    380 "Jl Factor"
    381         Shell.HeatTransfer.Jl = HE.JlFactor(Shell.HeatTransfer.Sm);
    382 
    383 "Jb Factor"
    384         Shell.HeatTransfer.Jb = HE.JbFactor(Shell.HeatTransfer.Re,Baffles.Ls,Shell.HeatTransfer.Sm);
    385 
    386 "Jr Factor"     
    387         Shell.HeatTransfer.Jr = HE.JrFactor(Shell.HeatTransfer.Re);
    388        
    389 "Total J Factor"
    390         Shell.HeatTransfer.Jtotal =     Shell.HeatTransfer.Jc*Shell.HeatTransfer.Jl*Shell.HeatTransfer.Jb*Shell.HeatTransfer.Jr*Shell.HeatTransfer.Js;
    391 
    392 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    393 #                                        Nozzles rho-V^2                                                                #
    394 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    395 
    396 if side equal 1
    397        
    398         then
    399 
    400 "Shell Side inlet Nozzle rho-V^2"
    401         Shell.PressureDrop.RVsquare_in = Properties.Hot.Inlet.rho*(Shell.PressureDrop.Vnozzle_in)^2;
    402 
    403 "Shell Side Outlet Nozzle rho-V^2"
    404         Shell.PressureDrop.RVsquare_out = Properties.Hot.Outlet.rho*(Shell.PressureDrop.Vnozzle_out)^2;
    405        
    406         else
    407        
    408 "Shell Side inlet Nozzle rho-V^2"
    409         Shell.PressureDrop.RVsquare_in = Properties.Cold.Inlet.rho*(Shell.PressureDrop.Vnozzle_in)^2;
    410 
    411 "Shell Side Outlet Nozzle rho-V^2"
    412         Shell.PressureDrop.RVsquare_out = Properties.Cold.Outlet.rho*(Shell.PressureDrop.Vnozzle_out)^2;
    413 
    414 end
    415 
    416 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    417 #                                        Phi correction                                                                 #
    418 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    419 
    420 if side equal 1
    421        
    422         then
    423 
    424 "Shell Side Phi correction"
    425         Shell.HeatTransfer.Phi = HE.PhiCorrection(Properties.Hot.Average.Mu,Properties.Hot.Wall.Mu);
    426        
    427 "Tube Side Phi correction"
    428         Tubes.HeatTransfer.Phi  = HE.PhiCorrection(Properties.Cold.Average.Mu,Properties.Cold.Wall.Mu);
    429        
    430         else
    431        
    432 "Shell Side Phi correction"
    433         Shell.HeatTransfer.Phi = HE.PhiCorrection(Properties.Cold.Average.Mu,Properties.Cold.Wall.Mu);
    434        
    435 "Tube Side Phi correction"
    436         Tubes.HeatTransfer.Phi  = HE.PhiCorrection(Properties.Hot.Average.Mu,Properties.Hot.Wall.Mu);
    437 
    438 end
    439 
    440 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    441 #                                                                                                                                       #
    442 #                                                                                                                                       #
    443 #                                                                                                                                       #
    444 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    445 
    446 if side equal 1
    447        
    448         then
    449        
    450 "Hot Wall Temperature"
    451         Properties.Hot.Wall.Twall  = (Properties.Hot.Average.T+Properties.Cold.Average.T)/2;
    452 
    453 "ColdWall Temperature"
    454         Properties.Cold.Wall.Twall  = (Properties.Hot.Average.T+Properties.Cold.Average.T)/2;
    455 
    456 "Tube Side Velocity"
    457         Tubes.HeatTransfer.Vtube  = Properties.Cold.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Properties.Cold.Average.rho*Ntt);
    458 
    459 "Tube Side Reynolds Number"
    460         Tubes.HeatTransfer.Re     =     (Properties.Cold.Average.rho*Tubes.HeatTransfer.Vtube*Ditube)/Properties.Cold.Average.Mu;
    461        
    462 "Tube Side Prandtl Number"
    463         Tubes.HeatTransfer.PR = ((Properties.Cold.Average.Cp/Properties.Cold.Average.Mw)*Properties.Cold.Average.Mu)/Properties.Cold.Average.K;
    464 
    465 "Tube Side Prandtl Number at Wall Temperature"
    466         Tubes.HeatTransfer.PRw = ((Properties.Cold.Wall.Cp/Properties.Cold.Average.Mw)*Properties.Cold.Wall.Mu)/Properties.Cold.Wall.K;
    467 
    468 "Tube Side Film Coefficient"
    469         Tubes.HeatTransfer.htube= HE.TubeFilmCoeff(Tubes.HeatTransfer.Re,Tubes.HeatTransfer.PR,Properties.Cold.Average.K)*Tubes.HeatTransfer.Phi;
    470 
    471 "Shell Side Prandtl Number"
    472         Shell.HeatTransfer.PR = ((Properties.Hot.Average.Cp/Properties.Hot.Average.Mw)*Properties.Hot.Average.Mu)/Properties.Hot.Average.K;
    473 
    474 "Shell Side Prandtl Number at Wall Temperature"
    475         Shell.HeatTransfer.PRw = ((Properties.Hot.Wall.Cp/Properties.Hot.Average.Mw)*Properties.Hot.Wall.Mu)/Properties.Hot.Wall.K;
    476 
    477 "Tube Side Pressure Drop"
    478         Tubes.PressureDrop.PdTube               = HE.DeltaPtube(Tubes.HeatTransfer.Re,Properties.Cold.Average.rho,Tubes.HeatTransfer.Vtube,Tubes.HeatTransfer.Phi);
    479 
    480 "Pressure Drop Tube Side Inlet Nozzle"
    481         Tubes.PressureDrop.Pdnozzle_in  = HE.DeltaPtubeNozzlein(Properties.Cold.Inlet.rho,Properties.Cold.Inlet.Fw);
    482 
    483 "Velocity Tube Side Inlet Nozzle"
    484         Tubes.PressureDrop.Vnozzle_in   = HE.TubeVelocityNozzlein(Properties.Cold.Inlet.rho,Properties.Cold.Inlet.Fw);
    485 
    486 "Pressure Drop Tube Side Outlet Nozzle"
    487         Tubes.PressureDrop.Pdnozzle_out = HE.DeltaPtubeNozzleout(Properties.Cold.Outlet.rho,Properties.Cold.Inlet.Fw);
    488 
    489 "Velocity Tube Side Outlet Nozzle"
    490         Tubes.PressureDrop.Vnozzle_out  = HE.TubeVelocityNozzleout(Properties.Cold.Outlet.rho,Properties.Cold.Inlet.Fw);
    491 
    492 "Shell Pressure Drop Inlet Nozzle"
    493         Shell.PressureDrop.Pdnozzle_in  = HE.DeltaPshellNozzleIn(Properties.Hot.Inlet.rho,Properties.Hot.Inlet.Fw);
    494 
    495 "Velocity Shell Side Inlet Nozzle"
    496         Shell.PressureDrop.Vnozzle_in   = HE.ShellVelocityNozzleIn(Properties.Hot.Inlet.rho,Properties.Hot.Inlet.Fw);
    497 
    498 "Shell Pressure Drop Outlet Nozzle"
    499         Shell.PressureDrop.Pdnozzle_out =HE.DeltaPshellNozzleOut(Properties.Hot.Outlet.rho,Properties.Hot.Inlet.Fw);
    500 
    501 "Velocity Shell Side Outlet Nozzle"
    502         Shell.PressureDrop.Vnozzle_out  =HE.ShellVelocityNozzleOut(Properties.Hot.Outlet.rho,Properties.Hot.Inlet.Fw);
    503 
    504 "Pressure Drop Hot Stream"
    505         Outlet.Hot.P  = Inlet.Hot.P- Shell.PressureDrop.Pdtotal;       
    506        
    507 "Pressure Drop Cold Stream"
    508         Outlet.Cold.P  = Inlet.Cold.P - Tubes.PressureDrop.Pdtotal;
    509 
    510 
    511         else
    512 
    513 "Hot Wall Temperature"
    514         Properties.Hot.Wall.Twall  = (Properties.Hot.Average.T+Properties.Cold.Average.T)/2;
    515 
    516 "Cold Wall Temperature"
    517         Properties.Cold.Wall.Twall  = (Properties.Hot.Average.T+Properties.Cold.Average.T)/2;
    518 
    519 "Tube Side Velocity"
    520         Tubes.HeatTransfer.Vtube  = Properties.Hot.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Properties.Hot.Average.rho*Ntt);
    521 
    522 "Tube Side Reynolds Number"
    523         Tubes.HeatTransfer.Re=(Properties.Hot.Average.rho*Tubes.HeatTransfer.Vtube*Ditube)/Properties.Hot.Average.Mu;
    524 
    525 "Tube Side Prandtl Number"
    526         Tubes.HeatTransfer.PR = ((Properties.Hot.Average.Cp/Properties.Hot.Average.Mw)*Properties.Hot.Average.Mu)/Properties.Hot.Average.K;
    527 
    528 "Tube Side Prandtl Number at Wall"
    529         Tubes.HeatTransfer.PRw = ((Properties.Hot.Wall.Cp/Properties.Hot.Average.Mw)*Properties.Hot.Wall.Mu)/Properties.Hot.Wall.K;
    530 
    531 "Tube Side Film Coefficient"
    532         Tubes.HeatTransfer.htube= HE.TubeFilmCoeff(Tubes.HeatTransfer.Re,Tubes.HeatTransfer.PR,Properties.Hot.Average.K)*Tubes.HeatTransfer.Phi;
    533        
    534 "Shell Side Prandtl Number"
    535         Shell.HeatTransfer.PR = ((Properties.Cold.Average.Cp/Properties.Cold.Average.Mw)*Properties.Cold.Average.Mu)/Properties.Cold.Average.K;
    536 
    537 "Shell Side Prandtl Number at Wall"
    538         Shell.HeatTransfer.PRw=((Properties.Cold.Wall.Cp/Properties.Cold.Average.Mw)*Properties.Cold.Wall.Mu)/Properties.Cold.Wall.K;
    539 
    540 "Tube Side Pressure Drop"
    541         Tubes.PressureDrop.PdTube               = HE.DeltaPtube(Tubes.HeatTransfer.Re,Properties.Hot.Average.rho,Tubes.HeatTransfer.Vtube,Tubes.HeatTransfer.Phi);
    542 
    543 "Pressure Drop Tube Side Inlet Nozzle"
    544         Tubes.PressureDrop.Pdnozzle_in  = HE.DeltaPtubeNozzlein(Properties.Hot.Inlet.rho,Properties.Hot.Inlet.Fw);
    545 
    546 "Velocity Tube Side Inlet Nozzle"
    547         Tubes.PressureDrop.Vnozzle_in   = HE.TubeVelocityNozzlein(Properties.Hot.Inlet.rho,Properties.Hot.Inlet.Fw);
    548 
    549 "Pressure Drop Tube Side Outlet Nozzle"
    550         Tubes.PressureDrop.Pdnozzle_out = HE.DeltaPtubeNozzleout(Properties.Hot.Outlet.rho,Properties.Hot.Inlet.Fw);   
    551 
    552 "Velocity Tube Side Outlet Nozzle"
    553         Tubes.PressureDrop.Vnozzle_out  = HE.TubeVelocityNozzleout(Properties.Hot.Outlet.rho,Properties.Hot.Inlet.Fw); 
    554 
    555 "Shell Pressure Drop Inlet Nozzle"
    556         Shell.PressureDrop.Pdnozzle_in  = HE.DeltaPshellNozzleIn(Properties.Cold.Inlet.rho,Properties.Cold.Inlet.Fw);
    557 
    558 "Velocity Shell Side Inlet Nozzle"
    559         Shell.PressureDrop.Vnozzle_in   = HE.ShellVelocityNozzleIn(Properties.Cold.Inlet.rho,Properties.Cold.Inlet.Fw);
    560 
    561 "Shell Pressure Drop Outlet Nozzle"
    562         Shell.PressureDrop.Pdnozzle_out = HE.DeltaPshellNozzleOut(Properties.Cold.Outlet.rho,Properties.Cold.Inlet.Fw);
    563 
    564 "Velocity Shell Side Outlet Nozzle"
    565         Shell.PressureDrop.Vnozzle_out  = HE.ShellVelocityNozzleOut(Properties.Cold.Outlet.rho,Properties.Cold.Inlet.Fw);
    566 
    567 "Pressure Drop Hot Stream"
    568         Outlet.Hot.P  = Inlet.Hot.P- Tubes.PressureDrop.Pdtotal;       
    569        
    570 "Pressure Drop Cold Stream"
    571         Outlet.Cold.P  = Inlet.Cold.P - Shell.PressureDrop.Pdtotal;
    572 
    573 end
    574 
    575 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    576 #                                               Resistances                                                                     #
    577 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    578 
    579 "Tube Resistance"       
    580         Resistances.Rtube*(Tubes.HeatTransfer.htube*Ditube) = Dotube;
    581        
    582 "Wall Resistance"
    583         Resistances.Rwall=Dotube*ln(Dotube/Ditube)/(2*Kwall);
    584        
    585 "Shell Resistance"
    586         Resistances.Rshell*(Shell.HeatTransfer.hshell)=1;
    587 
    588 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    589 #                                                                                                                                       #
    590 #                                                                                                                                       #
    591 #                                                                                                                                       #
    592 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    593 
    594 "Shell Side Cross Flow Area"
    595         Shell.HeatTransfer.Sm = HE.CrossFlowArea(Baffles.Ls);
    596        
    597 "Overall Heat Transfer Coefficient"
    598         Details.U=1/(Dotube/(Tubes.HeatTransfer.htube*Ditube)+(Dotube*ln(Dotube/Ditube)/(2*Kwall))+(1/(Shell.HeatTransfer.hshell)));
    599 
    600 "Exchange Surface Area"
    601         Details.A=Pi*Dotube*Ntt*Ltube;
    602 
    603 "Baffles Spacing"
    604         Ltube = Baffles.Lsi+Baffles.Lso+Baffles.Ls*(Nb-1);
    605 
    606 end
    607 
    608 Model Heatex_Detailed_NTU               as Heatex_Detailed
    609        
    610 VARIABLES
    611 
    612 Eft                      as positive (Brief="Effectiveness",Default=0.05,Lower=1e-8);
    613        
    614 EQUATIONS
    615 "Duty"
    616         Details.Q       = Eft*Details.Cmin*(Inlet.Hot.T-Inlet.Cold.T); 
    617        
    618 end
    619 
    620 Model Heatex_Detailed_LMTD              as Heatex_Detailed
    621        
    622 VARIABLES
    623 DT0     as temp_delta   (Brief="Temperature Difference at Inlet",Lower=1);
    624 DTL             as temp_delta   (Brief="Temperature Difference at Outlet",Lower=1);
    625 LMTD    as temp_delta   (Brief="Logarithmic Mean Temperature Difference",Lower=5);
    626 Fc              as positive             (Brief="LMTD Correction Factor",Lower=0.4);
    627 MTD             as temp_delta   (Brief="Mean Temperature Difference",Lower=5);
    628 
    629 EQUATIONS
    630 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    631 #                       Log Mean Temperature Difference
    632 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    633 if abs(DT0 - DTL) > 0.05*max(abs([DT0,DTL]))
    634        
    635         then
    636 "Log Mean Temperature Difference"
    637         LMTD= (DT0-DTL)/ln(DT0/DTL);
    638 
    639         else
    640        
    641 if DT0*DTL equal 0
    642        
    643         then
    644 "Log Mean Temperature Difference"
    645         LMTD = 0.5*(DT0+DTL);
    646        
    647         else
    648 "Log Mean Temperature Difference"
    649         LMTD = 0.5*(DT0+DTL)*(1-(DT0-DTL)^2/(DT0*DTL)*(1+(DT0-DTL)^2/(DT0*DTL)/2)/12);
    650        
    651 end
    652        
    653 end
    654563
    655564"Exchange Surface Area"
     
    657566       
    658567"Mean Temperature Difference"   
    659         MTD = Fc*LMTD;
    660        
    661 end
     568        MTD   = Fc*LMTD;
     569       
     570end
     571
    662572
    663573Model E_Shell_NTU_Det                   as Heatex_Detailed_NTU
    664 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     574#=====================================================================
    665575#       Shell and Tubes Heat Exchanger with 1 shell pass - LMTD Method
    666 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     576#=====================================================================
    667577EQUATIONS
    668578
    669579"TEMA E Shell Effectiveness"
    670 #       Eft = 2*(1+Details.Cr+sqrt(1+Details.Cr^2)*((1+exp(-Details.NTU*sqrt(1+Details.Cr^2)))/(1-exp(-Details.NTU*sqrt(1+Details.Cr^2)))) )^-1;
    671         Eft = HE.EshellEffectiveness(Details.Cr,Details.NTU);
     580        Eft = 2*(1+Details.Cr+sqrt(1+Details.Cr^2)*((1+exp(-Details.NTU*sqrt(1+Details.Cr^2)))/(1-exp(-Details.NTU*sqrt(1+Details.Cr^2)))) )^-1;
    672581
    673582"Js Factor"     
     
    679588       
    680589"Shell Side Reynolds Number"
    681         Shell.HeatTransfer.Re=(Dotube*Properties.Hot.Inlet.Fw/Shell.HeatTransfer.Sm)/Properties.Hot.Average.Mu;
     590        Shell.HeatTransfer.Re=HE.ShellReynoldsNumber(Properties.Hot.Inlet.Fw,Shell.HeatTransfer.Sm,Properties.Hot.Average.Mu);
    682591
    683592"Shell Heat Transfer Coefficient"
    684         Shell.HeatTransfer.hshell=Shell.HeatTransfer.Ji*(Properties.Hot.Average.Cp/Properties.Hot.Average.Mw)*(Properties.Hot.Inlet.Fw/Shell.HeatTransfer.Sm)*(Shell.HeatTransfer.PR^(-2/3))*Shell.HeatTransfer.Jtotal*Shell.HeatTransfer.Phi;
     593        Shell.HeatTransfer.hshell=HE.ShellFilmCoeff(Shell.HeatTransfer.Ji,Properties.Hot.Average.Cp,Properties.Hot.Average.Mw,Properties.Hot.Inlet.Fw,Shell.HeatTransfer.Sm,Shell.HeatTransfer.PR,Shell.HeatTransfer.Jtotal,Shell.HeatTransfer.Phi);
    685594
    686595"Shell Pressure Drop Cross Flow"
     
    697606
    698607"Shell Side Reynolds Number"
    699         Shell.HeatTransfer.Re=(Dotube*Properties.Cold.Inlet.Fw/Shell.HeatTransfer.Sm)/Properties.Cold.Average.Mu;
     608        Shell.HeatTransfer.Re=HE.ShellReynoldsNumber(Properties.Cold.Inlet.Fw,Shell.HeatTransfer.Sm,Properties.Cold.Average.Mu);
    700609
    701610"Shell Heat Transfer Coefficient"
    702         Shell.HeatTransfer.hshell=Shell.HeatTransfer.Ji*(Properties.Cold.Average.Cp/Properties.Cold.Average.Mw)*(Properties.Cold.Inlet.Fw/Shell.HeatTransfer.Sm)*(Shell.HeatTransfer.PR^(-2/3))*Shell.HeatTransfer.Jtotal*Shell.HeatTransfer.Phi;
     611        Shell.HeatTransfer.hshell=HE.ShellFilmCoeff(Shell.HeatTransfer.Ji,Properties.Cold.Average.Cp,Properties.Cold.Average.Mw,Properties.Cold.Inlet.Fw,Shell.HeatTransfer.Sm,Shell.HeatTransfer.PR,Shell.HeatTransfer.Jtotal,Shell.HeatTransfer.Phi);
    703612
    704613"Shell Pressure Drop Cross Flow"
     
    714623end
    715624
     625
    716626end
    717627
    718628Model F_Shell_NTU_Det                   as Heatex_Detailed_NTU
    719 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     629#=====================================================================
    720630#       Shell and Tubes Heat Exchanger with 1 shell pass - LMTD Method
    721 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     631#=====================================================================
    722632VARIABLES
    723633
     
    740650       
    741651"Shell Side Reynolds Number"
    742         Shell.HeatTransfer.Re=(Dotube*Properties.Hot.Inlet.Fw/Shell.HeatTransfer.Sm)/Properties.Hot.Average.Mu;
     652        Shell.HeatTransfer.Re= HE.ShellReynoldsNumber(Properties.Hot.Inlet.Fw,Shell.HeatTransfer.Sm,Properties.Hot.Average.Mu);
    743653
    744654"Shell Heat Transfer Coefficient"
    745         Shell.HeatTransfer.hshell= Shell.HeatTransfer.Ji*(Properties.Hot.Average.Cp/Properties.Hot.Average.Mw)*(Properties.Hot.Inlet.Fw/Shell.HeatTransfer.Sm)*(Shell.HeatTransfer.PR^(-2/3))*Shell.HeatTransfer.Jtotal*Shell.HeatTransfer.Phi;
     655        Shell.HeatTransfer.hshell= HE.ShellFilmCoeff(Shell.HeatTransfer.Ji,Properties.Hot.Average.Cp,Properties.Hot.Average.Mw,Properties.Hot.Inlet.Fw,Shell.HeatTransfer.Sm,Shell.HeatTransfer.PR,Shell.HeatTransfer.Jtotal,Shell.HeatTransfer.Phi);
    746656
    747657"Shell Pressure Drop Cross Flow"
     
    758668
    759669"Shell Side Reynolds Number"
    760         Shell.HeatTransfer.Re=(Dotube*Properties.Cold.Inlet.Fw/Shell.HeatTransfer.Sm)/Properties.Cold.Average.Mu;
     670        Shell.HeatTransfer.Re=HE.ShellReynoldsNumber(Properties.Cold.Inlet.Fw,Shell.HeatTransfer.Sm,Properties.Cold.Average.Mu);
    761671
    762672"Shell Heat Transfer Coefficient"
    763         Shell.HeatTransfer.hshell=Shell.HeatTransfer.Ji*(Properties.Cold.Average.Cp/Properties.Cold.Average.Mw)*(Properties.Cold.Inlet.Fw/Shell.HeatTransfer.Sm)*(Shell.HeatTransfer.PR^(-2/3))*Shell.HeatTransfer.Jtotal*Shell.HeatTransfer.Phi;
     673        Shell.HeatTransfer.hshell=HE.ShellFilmCoeff(Shell.HeatTransfer.Ji,Properties.Cold.Average.Cp,Properties.Cold.Average.Mw,Properties.Cold.Inlet.Fw,Shell.HeatTransfer.Sm,Shell.HeatTransfer.PR,Shell.HeatTransfer.Jtotal,Shell.HeatTransfer.Phi);
    764674
    765675"Shell Pressure Drop Cross Flow"
     
    779689
    780690Model Multipass_NTU_Det         
    781 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     691#============================================================================
    782692#       Shell and Tubes Heat Exchanger In Series with 1 shell pass - LMTD Method
    783 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     693#============================================================================
    784694PARAMETERS
    785695
    786         Nshell          as Integer              (Brief="N Shell in Series",Default=2);
    787 ext PP                  as CalcObject   (Brief="External Physical Properties");
    788         HE                      as CalcObject   (Brief="heatex Calculations", File="heatex");
    789         side        as Integer          (Brief="Fluid Alocation",Lower=0,Upper=1);
    790         Pi                      as constant     (Brief="Pi Number",Default=3.14159265);
    791 
    792 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     696Nshell          as Integer              (Brief="N Shell in Series",Default=2);
     697ext     HE              as CalcObject   (Brief="STHE Calculations",File="heatex.dll");
     698ext PP          as CalcObject;
     699side        as Integer          (Brief="Fluid Alocation",Lower=0,Upper=1);
     700Pi                      as constant     (Brief="Pi Number",Default=3.14159265);
     701
     702#=====================================================================
    793703#       Shell Geometrical Parameters
    794 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     704#=====================================================================
    795705Tpass                   as Integer              (Brief="Number of Tube Passes",Lower=1);
    796706Nss                             as Integer              (Brief="Number of Sealing Strips pairs",Lower=1);
     
    801711Honozzle_Shell  as length               (Brief="Height Under Shell Outlet Nozzle",Lower=10e-6);
    802712Lcf                     as length               (Brief="Bundle-to-Shell Clearance",Lower=10e-8);
    803 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     713#=====================================================================
    804714#       Tubes Geometrical Parameters
    805 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     715#=====================================================================
    806716Ntt                             as Integer              (Brief="Total Number of Tubes in Shell",Default=100,Lower=1);
    807717Pattern         as Integer              (Brief="Tube Layout Characteristic Angle",Lower=30);
     
    813723Donozzle_Tube   as length               (Brief="Tube Outlet Nozzle Diameter",Lower=10e-6);
    814724Dinozzle_Tube   as length               (Brief="Tube Inlett Nozzle Diameter",Lower=10e-6);
    815 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     725#=====================================================================
    816726#       Baffles Geometrical Parameters
    817 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     727#=====================================================================
    818728Bc                      as Integer              (Brief="Baffle Cut",Default=25,Lower=25);
    819729Nb              as Real                 (Brief="Number of Baffles",Lower=1);
    820730Lcd                     as length               (Brief="Baffle-to-Shell Clearance",Lower=10e-8);
    821731Ltd                             as length               (Brief="Tube-to-Bafflehole Clearance",Lower=10e-8);
    822 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     732#=====================================================================
    823733VARIABLES
    824734
     
    829739
    830740Unity([1:Nshell-1]).Outlet.Hot  to Unity([2:Nshell]).Inlet.Hot;
    831 Unity([2:Nshell]).Outlet.Cold   to Unity([1:Nshell-1]).Inlet.Cold;
     741Unity([2:Nshell]).Outlet.Cold to Unity([1:Nshell-1]).Inlet.Cold;
    832742
    833743EQUATIONS
     
    839749
    840750"Ji Factor"
    841         Unity(i).Shell.HeatTransfer.Ji =HE.JiFactor(Unity(i).Shell.HeatTransfer.Re);
     751        Unity(i).Shell.HeatTransfer.Ji = HE.JiFactor(Unity(i).Shell.HeatTransfer.Re);
    842752
    843753"Jc Factor"
     
    856766        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;
    857767
    858 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     768
     769
     770#=====================================================================
    859771#  Fluid Alocation
    860 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     772#=====================================================================
    861773
    862774if side equal 1 then
     
    883795        then
    884796       
    885 "Hot Wall Temperature"
     797"Wall Temperature"
     798#       Unity(i).Tubes.HeatTransfer.Twall  = HE.WallTemperature(Unity(i).Properties.Hot.Average.T,Unity(i).Properties.Cold.Average.T,Unity(i).Tubes.HeatTransfer.htube,Unity(i).Shell.HeatTransfer.hshell);
    886799        Unity(i).Properties.Hot.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    887 
    888 "Cold Wall Temperature"
    889800        Unity(i).Properties.Cold.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    890801
    891802"Tube Side Velocity"
    892         Unity(i).Tubes.HeatTransfer.Vtube  = Unity(i).Properties.Cold.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Cold.Average.rho*Ntt);
     803        Unity(i).Tubes.HeatTransfer.Vtube  = HE.TubeVelocity(Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Properties.Cold.Average.rho);
    893804
    894805"Tube Side Reynolds Number"
    895         Unity(i).Tubes.HeatTransfer.Re=(Unity(i).Properties.Cold.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Cold.Average.Mu;
    896 
     806        Unity(i).Tubes.HeatTransfer.Re = HE.TubeReynoldsNumber(Unity(i).Properties.Cold.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Properties.Cold.Average.Mu);
     807       
    897808"Tube Side Prandtl Number"
    898         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;
     809        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);
    899810
    900811"Tube Side Prandtl Number at Wall Temperature"
    901         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;
     812        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);
     813
    902814
    903815"Tube Side Film Coefficient"
    904         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;
     816        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);
    905817       
    906818"Shell Side Prandtl Number"
    907         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
     819        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);   
    908820
    909821"Shell Side Prandtl Number at Wall Temperature"
    910         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;       
     822        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)
    911823
    912824"Tube Side Pressure Drop"
     
    946858        else
    947859
    948 "Hot Wall Temperature"
     860"Wall Temperature"
     861#       Unity(i).Tubes.HeatTransfer.Twall       =       HE.WallTemperature(Unity(i).Properties.Cold.Average.T,Unity(i).Properties.Hot.Average.T,Unity(i).Tubes.HeatTransfer.htube,Unity(i).Shell.HeatTransfer.hshell);
    949862        Unity(i).Properties.Hot.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    950 
    951 "Cold Wall Temperature"
    952863        Unity(i).Properties.Cold.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    953864
    954865"Tube Side Velocity"
    955         Unity(i).Tubes.HeatTransfer.Vtube  = Unity(i).Properties.Hot.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Hot.Average.rho*Ntt);
     866        Unity(i).Tubes.HeatTransfer.Vtube       =       HE.TubeVelocity(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Properties.Hot.Average.rho);
    956867
    957868"Tube Side Reynolds Number"
    958         Unity(i).Tubes.HeatTransfer.Re          =       (Unity(i).Properties.Hot.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Hot.Average.Mu;
     869        Unity(i).Tubes.HeatTransfer.Re          =       HE.TubeReynoldsNumber(Unity(i).Properties.Hot.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Properties.Hot.Average.Mu);
    959870       
    960871"Tube Side Prandtl Number"
    961         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;
     872        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);
    962873       
    963874"Tube Side Prandtl Number at Wall"
    964         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;
     875        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);
     876
    965877
    966878"Tube Side Film Coefficient"
    967         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;
     879        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);
    968880       
    969881"Shell Side Prandtl Number"
    970         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;
     882        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);
    971883       
    972884"Shell Side Prandtl Number at Wall"
    973         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;
     885        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);
     886
    974887
    975888"Tube Side Pressure Drop"
     
    1009922end
    1010923
    1011 if side equal 1
    1012        
    1013         then
    1014 
    1015 "Shell Side inlet Nozzle rho-V^2"
    1016         Unity(i).Shell.PressureDrop.RVsquare_in = Unity(i).Properties.Hot.Inlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_in)^2;
    1017 
    1018 "Shell Side Outlet Nozzle rho-V^2"
    1019         Unity(i).Shell.PressureDrop.RVsquare_out = Unity(i).Properties.Hot.Outlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_out)^2;
    1020        
    1021         else
    1022        
    1023 "Shell Side inlet Nozzle rho-V^2"
    1024         Unity(i).Shell.PressureDrop.RVsquare_in = Unity(i).Properties.Cold.Inlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_in)^2;
    1025 
    1026 "Shell Side Outlet Nozzle rho-V^2"
    1027         Unity(i).Shell.PressureDrop.RVsquare_out = Unity(i).Properties.Cold.Outlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_out)^2;
    1028 
    1029 end
    1030 
    1031924"Tube Resistance"       
    1032925        Unity(i).Resistances.Rtube*(Unity(i).Tubes.HeatTransfer.htube*Ditube) = Dotube;
     
    1046939"Baffles Spacing"
    1047940        Ltube = Unity(i).Baffles.Lsi+Unity(i).Baffles.Lso+Unity(i).Baffles.Ls*(Nb-1);
     941       
    1048942
    1049943"TEMA E Shell Effectiveness"
     
    1058952       
    1059953"Shell Side Reynolds Number"
    1060         Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Hot.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Hot.Average.Mu;
     954        Unity(i).Shell.HeatTransfer.Re=HE.ShellReynoldsNumber(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Hot.Average.Mu);
    1061955
    1062956"Shell Heat Transfer Coefficient"
    1063         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;
     957        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);
    1064958
    1065959"Shell Pressure Drop Cross Flow"
     
    1076970
    1077971"Shell Side Reynolds Number"
    1078         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);
    1079973
    1080974"Shell Heat Transfer Coefficient"
    1081         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;
     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);
    1082976
    1083977"Shell Pressure Drop Cross Flow"
     
    1093987end
    1094988
    1095 "Duty"
    1096989        Unity(i).Details.Q      = Eft(i)*Unity(i).Details.Cmin*(Unity(i).Inlet.Hot.T-Unity(i).Inlet.Cold.T);
    1097990
     
    1099992
    1100993        SET
    1101 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     994#=====================================================================
    1102995#  Set Parameters for heatex Calculation
    1103 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     996#=====================================================================
    1104997        Pi                              = 3.14159265;
    1105998        HE.Tpass                        = Tpass;
     
    11281021
    11291022Model E_Shell_LMTD_Det                  as Heatex_Detailed_LMTD
    1130 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     1023#=====================================================================
    11311024#       Shell and Tubes Heat Exchanger with 1 shell pass - LMTD Method
    1132 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     1025#=====================================================================
    11331026EQUATIONS
    11341027
     
    11361029        Fc = HE.EshellCorrectionFactor(Inlet.Hot.T,Outlet.Hot.T,Inlet.Cold.T,Outlet.Cold.T);
    11371030
    1138 "Temperature Difference at Inlet"
    1139         DT0 = Inlet.Hot.T - Outlet.Cold.T;
    1140 
    1141 "Temperature Difference at Outlet"
    1142         DTL = Outlet.Hot.T - Inlet.Cold.T;
    1143        
     1031"Counter Flow LMTD"
     1032        LMTD = HE.CounterLMTD(Inlet.Hot.T,Outlet.Hot.T,Inlet.Cold.T,Outlet.Cold.T);
     1033
    11441034"Js Factor"     
    11451035        Shell.HeatTransfer.Js = HE.JsFactor(Shell.HeatTransfer.Re,Baffles.Lsi,Baffles.Lso,Baffles.Ls);
     
    11501040       
    11511041"Shell Side Reynolds Number"
    1152         Shell.HeatTransfer.Re=(Dotube*Properties.Hot.Inlet.Fw/Shell.HeatTransfer.Sm)/Properties.Hot.Average.Mu;
     1042        Shell.HeatTransfer.Re=HE.ShellReynoldsNumber(Properties.Hot.Inlet.Fw,Shell.HeatTransfer.Sm,Properties.Hot.Average.Mu);
    11531043
    11541044"Shell Heat Transfer Coefficient"
    1155         Shell.HeatTransfer.hshell=Shell.HeatTransfer.Ji*(Properties.Hot.Average.Cp/Properties.Hot.Average.Mw)*(Properties.Hot.Inlet.Fw/Shell.HeatTransfer.Sm)*(Shell.HeatTransfer.PR^(-2/3))*Shell.HeatTransfer.Jtotal*Shell.HeatTransfer.Phi;
     1045        Shell.HeatTransfer.hshell=HE.ShellFilmCoeff(Shell.HeatTransfer.Ji,Properties.Hot.Average.Cp,Properties.Hot.Average.Mw,Properties.Hot.Inlet.Fw,Shell.HeatTransfer.Sm,Shell.HeatTransfer.PR,Shell.HeatTransfer.Jtotal,Shell.HeatTransfer.Phi);
    11561046
    11571047"Shell Pressure Drop Cross Flow"
     
    11681058
    11691059"Shell Side Reynolds Number"
    1170         Shell.HeatTransfer.Re=(Dotube*Properties.Cold.Inlet.Fw/Shell.HeatTransfer.Sm)/Properties.Cold.Average.Mu;
     1060        Shell.HeatTransfer.Re=HE.ShellReynoldsNumber(Properties.Cold.Inlet.Fw,Shell.HeatTransfer.Sm,Properties.Cold.Average.Mu);
    11711061
    11721062"Shell Heat Transfer Coefficient"
    1173         Shell.HeatTransfer.hshell=Shell.HeatTransfer.Ji*(Properties.Cold.Average.Cp/Properties.Cold.Average.Mw)*(Properties.Cold.Inlet.Fw/Shell.HeatTransfer.Sm)*(Shell.HeatTransfer.PR^(-2/3))*Shell.HeatTransfer.Jtotal*Shell.HeatTransfer.Phi;
     1063        Shell.HeatTransfer.hshell=HE.ShellFilmCoeff(Shell.HeatTransfer.Ji,Properties.Cold.Average.Cp,Properties.Cold.Average.Mw,Properties.Cold.Inlet.Fw,Shell.HeatTransfer.Sm,Shell.HeatTransfer.PR,Shell.HeatTransfer.Jtotal,Shell.HeatTransfer.Phi);
    11741064
    11751065"Shell Pressure Drop Cross Flow"
     
    11901080
    11911081Model F_Shell_LMTD_Det                  as Heatex_Detailed_LMTD
    1192 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     1082#=====================================================================
    11931083#       Shell and Tubes Heat Exchanger with 2 shell pass - LMTD Method
    1194 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     1084#=====================================================================
    11951085
    11961086EQUATIONS
     
    11991089        Fc = HE.FshellCorrectionFactor(Inlet.Hot.T,Outlet.Hot.T,Inlet.Cold.T,Outlet.Cold.T);
    12001090
    1201 "Temperature Difference at Inlet"
    1202         DT0 = Inlet.Hot.T - Outlet.Cold.T;
    1203 
    1204 "Temperature Difference at Outlet"
    1205         DTL = Outlet.Hot.T - Inlet.Cold.T;
    1206        
     1091"Counter Flow LMTD"
     1092        LMTD = HE.CounterLMTD(Inlet.Hot.T,Outlet.Hot.T,Inlet.Cold.T,Outlet.Cold.T);
     1093
    12071094"Js Factor"     
    12081095        Shell.HeatTransfer.Js = HE.JsFactor(Shell.HeatTransfer.Re,Baffles.Lsi,Baffles.Lso,Baffles.Ls);
     
    12131100       
    12141101"Shell Side Reynolds Number"
    1215         Shell.HeatTransfer.Re=(Dotube*Properties.Hot.Inlet.Fw/Shell.HeatTransfer.Sm)/Properties.Hot.Average.Mu;
     1102        Shell.HeatTransfer.Re=HE.ShellReynoldsNumber(Properties.Hot.Inlet.Fw,Shell.HeatTransfer.Sm,Properties.Hot.Average.Mu);
    12161103
    12171104"Shell Heat Transfer Coefficient"
    1218         Shell.HeatTransfer.hshell=Shell.HeatTransfer.Ji*(Properties.Hot.Average.Cp/Properties.Hot.Average.Mw)*(Properties.Hot.Inlet.Fw/Shell.HeatTransfer.Sm)*(Shell.HeatTransfer.PR^(-2/3))*Shell.HeatTransfer.Jtotal*Shell.HeatTransfer.Phi;
     1105        Shell.HeatTransfer.hshell=HE.ShellFilmCoeff(Shell.HeatTransfer.Ji,Properties.Hot.Average.Cp,Properties.Hot.Average.Mw,Properties.Hot.Inlet.Fw,Shell.HeatTransfer.Sm,Shell.HeatTransfer.PR,Shell.HeatTransfer.Jtotal,Shell.HeatTransfer.Phi);
    12191106
    12201107"Shell Pressure Drop Cross Flow"
     
    12311118
    12321119"Shell Side Reynolds Number"
    1233         Shell.HeatTransfer.Re=(Dotube*Properties.Cold.Inlet.Fw/Shell.HeatTransfer.Sm)/Properties.Cold.Average.Mu;
     1120        Shell.HeatTransfer.Re=HE.ShellReynoldsNumber(Properties.Cold.Inlet.Fw,Shell.HeatTransfer.Sm,Properties.Cold.Average.Mu);
    12341121
    12351122"Shell Heat Transfer Coefficient"
    1236         Shell.HeatTransfer.hshell=Shell.HeatTransfer.Ji*(Properties.Cold.Average.Cp/Properties.Cold.Average.Mw)*(Properties.Cold.Inlet.Fw/Shell.HeatTransfer.Sm)*(Shell.HeatTransfer.PR^(-2/3))*Shell.HeatTransfer.Jtotal*Shell.HeatTransfer.Phi;
     1123        Shell.HeatTransfer.hshell=HE.ShellFilmCoeff(Shell.HeatTransfer.Ji,Properties.Cold.Average.Cp,Properties.Cold.Average.Mw,Properties.Cold.Inlet.Fw,Shell.HeatTransfer.Sm,Shell.HeatTransfer.PR,Shell.HeatTransfer.Jtotal,Shell.HeatTransfer.Phi);
    12371124
    12381125"Shell Pressure Drop Cross Flow"
     
    12481135end
    12491136
     1137
     1138
    12501139end
    12511140
    12521141Model Multipass_LMTD_Det         
    1253 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     1142#============================================================================
    12541143#       Shell and Tubes Heat Exchanger In Series with 1 shell pass - LMTD Method
    1255 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     1144#============================================================================
    12561145PARAMETERS
    12571146
    1258 Nshell          as Integer              (Brief="N Shell in Series",Default=2);
    1259         HE              as CalcObject   (Brief="STHE Calculations",File="heatex");
    1260 ext PP          as CalcObject   (Brief="External Physical Properties");
     1147Nshell          as Integer      (Brief="N Shell in Series",Default=2);
     1148ext     HE              as CalcObject   (Brief="STHE Calculations",File="heatex.dll");
     1149ext PP          as CalcObject;
    12611150side        as Integer          (Brief="Fluid Alocation",Lower=0,Upper=1);
    12621151Pi                      as constant     (Brief="Pi Number",Default=3.14159265);
    12631152
    1264 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     1153#=====================================================================
    12651154#       Shell Geometrical Parameters
    1266 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     1155#=====================================================================
    12671156Tpass                   as Integer              (Brief="Number of Tube Passes",Lower=1);
    12681157Nss                             as Integer              (Brief="Number of Sealing Strips pairs",Lower=1);
     
    12731162Honozzle_Shell  as length               (Brief="Height Under Shell Outlet Nozzle",Lower=10e-6);
    12741163Lcf                     as length               (Brief="Bundle-to-Shell Clearance",Lower=10e-8);
    1275 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     1164#=====================================================================
    12761165#       Tubes Geometrical Parameters
    1277 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     1166#=====================================================================
    12781167Ntt                             as Integer              (Brief="Total Number of Tubes in Shell",Default=100,Lower=1);
    12791168Pattern         as Integer              (Brief="Tube Layout Characteristic Angle",Lower=30);
     
    12851174Donozzle_Tube   as length               (Brief="Tube Outlet Nozzle Diameter",Lower=10e-6);
    12861175Dinozzle_Tube   as length               (Brief="Tube Inlett Nozzle Diameter",Lower=10e-6);
    1287 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     1176#=====================================================================
    12881177#       Baffles Geometrical Parameters
    1289 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     1178#=====================================================================
    12901179Bc                      as Integer              (Brief="Baffle Cut",Default=25,Lower=25);
    12911180Nb              as Real                 (Brief="Number of Baffles",Lower=1);
    12921181Lcd                     as length               (Brief="Baffle-to-Shell Clearance",Lower=10e-8);
    12931182Ltd                             as length               (Brief="Tube-to-Bafflehole Clearance",Lower=10e-8);
    1294 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     1183#=====================================================================
    12951184VARIABLES
    12961185
     
    12981187Fc(Nshell)                      as positive             (Brief="LMTD Correction Factor",Lower=0.75);
    12991188MTD(Nshell)                     as temp_delta   (Brief="Mean Temperature Difference");
    1300 Unity(Nshell)           as HeatExchangerDetailed_Basic;
     1189
     1190Unity(Nshell) as HeatExchangerDetailed_Basic;
    13011191
    13021192CONNECTIONS
     
    13301220        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;
    13311221
    1332 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     1222
     1223
     1224#=====================================================================
    13331225#  Fluid Alocation
    1334 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     1226#=====================================================================
    13351227
    13361228if side equal 1 then
     
    13591251        then
    13601252       
    1361 "Cold Wall Temperature"
     1253"Wall Temperature"
     1254#       Tubes.HeatTransfer.Twall  = HE.WallTemperature(Properties.Hot.Average.T,Properties.Cold.Average.T,Tubes.HeatTransfer.htube,Shell.HeatTransfer.hshell);
     1255
     1256#       Tubes.HeatTransfer.Twall  = HE.WallTemperature(Properties.Hot.Average.T,Properties.Cold.Average.T,Tubes.HeatTransfer.htube,Shell.HeatTransfer.hshell);
     1257
     1258
    13621259        Unity(i).Properties.Cold.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    1363 
    1364 "Hot Wall Temperature" 
     1260       
    13651261        Unity(i).Properties.Hot.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    13661262
    13671263"Tube Side Velocity"
    1368         Unity(i).Tubes.HeatTransfer.Vtube  = Unity(i).Properties.Cold.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Cold.Average.rho*Ntt);
     1264        Unity(i).Tubes.HeatTransfer.Vtube  = HE.TubeVelocity(Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Properties.Cold.Average.rho);
    13691265
    13701266"Tube Side Reynolds Number"
    1371         Unity(i).Tubes.HeatTransfer.Re=(Unity(i).Properties.Cold.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Cold.Average.Mu;
    1372 
     1267        Unity(i).Tubes.HeatTransfer.Re = HE.TubeReynoldsNumber(Unity(i).Properties.Cold.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Properties.Cold.Average.Mu);
     1268       
    13731269"Tube Side Prandtl Number"
    1374         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;
     1270        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);
    13751271
    13761272"Tube Side Prandtl Number at Wall"
    1377         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;
     1273        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);
     1274
    13781275
    13791276"Tube Side Film Coefficient"
    1380         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;
     1277        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);
    13811278       
    13821279"Shell Side Prandtl Number"
    1383         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
     1280        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);   
    13841281
    13851282"Shell Side Prandtl Number at Wall"
    1386         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
     1283        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);   
    13871284
    13881285"Tube Side Pressure Drop"
     
    14221319        else
    14231320
    1424 "Cold Wall Temperature"
     1321"Wall Temperature"
     1322#       Tubes.HeatTransfer.Twall = HE.WallTemperature(Properties.Cold.Average.T,Properties.Hot.Average.T,Tubes.HeatTransfer.htube,Shell.HeatTransfer.hshell);
     1323
     1324#       Tubes.HeatTransfer.Twall = HE.WallTemperature(Properties.Cold.Average.T,Properties.Hot.Average.T,Tubes.HeatTransfer.htube,Shell.HeatTransfer.hshell);
     1325
    14251326        Unity(i).Properties.Cold.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    1426 
    1427 "Hot Wall Temperature"
     1327       
    14281328        Unity(i).Properties.Hot.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    14291329
     1330
     1331
    14301332"Tube Side Velocity"
    1431         Unity(i).Tubes.HeatTransfer.Vtube  = Unity(i).Properties.Hot.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Hot.Average.rho*Ntt);
     1333        Unity(i).Tubes.HeatTransfer.Vtube=HE.TubeVelocity(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Properties.Hot.Average.rho);
    14321334
    14331335"Tube Side Reynolds Number"
    1434         Unity(i).Tubes.HeatTransfer.Re=(Unity(i).Properties.Hot.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Hot.Average.Mu;
     1336        Unity(i).Tubes.HeatTransfer.Re=HE.TubeReynoldsNumber(Unity(i).Properties.Hot.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Properties.Hot.Average.Mu);
    14351337       
    14361338"Tube Side Prandtl Number"
    1437         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;
     1339        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);
    14381340
    14391341"Tube Side Prandtl Number at Wall"
    1440         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;
     1342        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);
    14411343
    14421344"Tube Side Film Coefficient"
    1443         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;
     1345        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);
    14441346       
    14451347"Shell Side Prandtl Number"
    1446         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;
     1348        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);
    14471349
    14481350"Shell Side Prandtl Number at Wall"
    1449         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;
     1351        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);
    14501352
    14511353"Tube Side Pressure Drop"
     
    14851387end
    14861388
    1487 if side equal 1
    1488        
    1489         then
    1490 
    1491 "Shell Side inlet Nozzle rho-V^2"
    1492         Unity(i).Shell.PressureDrop.RVsquare_in = Unity(i).Properties.Hot.Inlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_in)^2;
    1493 
    1494 "Shell Side Outlet Nozzle rho-V^2"
    1495         Unity(i).Shell.PressureDrop.RVsquare_out = Unity(i).Properties.Hot.Outlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_out)^2;
    1496        
    1497         else
    1498        
    1499 "Shell Side inlet Nozzle rho-V^2"
    1500         Unity(i).Shell.PressureDrop.RVsquare_in = Unity(i).Properties.Cold.Inlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_in)^2;
    1501 
    1502 "Shell Side Outlet Nozzle rho-V^2"
    1503         Unity(i).Shell.PressureDrop.RVsquare_out = Unity(i).Properties.Cold.Outlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_out)^2;
    1504 
    1505 end
    1506 
    15071389"Tube Resistance"       
    15081390        Unity(i).Resistances.Rtube*(Unity(i).Tubes.HeatTransfer.htube*Ditube) = Dotube;
     
    15371419       
    15381420"Shell Side Reynolds Number"
    1539         Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Hot.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Hot.Average.Mu;
     1421        Unity(i).Shell.HeatTransfer.Re=HE.ShellReynoldsNumber(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Hot.Average.Mu);
    15401422
    15411423"Shell Heat Transfer Coefficient"
    1542         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;
     1424        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);
    15431425
    15441426"Shell Pressure Drop Cross Flow"
     
    15551437
    15561438"Shell Side Reynolds Number"
    1557         Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Cold.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Cold.Average.Mu;
     1439        Unity(i).Shell.HeatTransfer.Re=HE.ShellReynoldsNumber(Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Cold.Average.Mu);
    15581440
    15591441"Shell Heat Transfer Coefficient"
    1560         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;
     1442        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);
    15611443
    15621444"Shell Pressure Drop Cross Flow"
     
    15811463
    15821464        SET
    1583 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     1465#=====================================================================
    15841466#  Set Parameters for heatex Calculation
    1585 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     1467#=====================================================================
    15861468        Pi                              = 3.14159265;
    15871469        HE.Tpass                        = Tpass;
Note: See TracChangeset for help on using the changeset viewer.