Changes in / [20:30]


Ignore:
Location:
/mso
Files:
32 added
8 deleted
17 edited

Legend:

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

    r20 r30  
    11#*--------------------------------------------------------------------*
    2 *
     2*                       Heat Exchangers Abstract Models
     3*--------------------------------------------------------------------
     4*       - Inlet_Main_Stream     : Inlet Streams
     5*--------------------------------------------------------------------
     6*                                       - Hot   : Inlet Hot Stream
     7*                                       - Cold  : Inlet Cold Stream
     8*--------------------------------------------------------------------
     9*       - Outlet_Main_Stream    : Outlet Streams
     10*--------------------------------------------------------------------
     11*                                       - Hot   : Outlet Hot Stream
     12*                                       - Cold  : Outlet Cold Stream
     13*--------------------------------------------------------------------
     14*       - Main_Properties               : Physical Properties for Hot and Cold Side
     15*--------------------------------------------------------------------
     16*               Physical_Properties
     17*                       Properties_In_Out       :       Inlet/Outlet Physical Properties
     18*                       Properties_Average      :       Average Physical Properties
     19*                       Properties_Wall         :       Physical Properties at Wall Temperature
     20*--------------------------------------------------------------------
     21*       - Tube_Side_Main        : Tube Side Main Variables
     22*----------------------------------------------------------------------
     23*                       Tube_Pdrop                      : Tube Side Pressure Drop
     24*                       Tube_Heat_Transfer      : Tube Side Heat Transfer
     25*----------------------------------------------------------------------
     26*       - Shell_Side_Main       : Shell Side Main Variables
     27*----------------------------------------------------------------------
     28*                       Shell_Pdrop                     : Shell Side Pressure Drop
     29*                       Shell_Heat_Transfer     : Shell Side Heat Transfer
     30*----------------------------------------------------------------------
     31*       - Baffles_Main  : Baffles Spacing
     32*----------------------------------------------------------------------
     33*       - Main_Resistances      : Thermal Resistances
     34*----------------------------------------------------------------------
     35*       - Details_Main  : Heat Exchanger Thermal Details
     36*----------------------------------------------------------------------
     37*       - Main_Pdrop : Heat Exchanger Pressure Drop (Simplified)
     38*               Basic_Pdrop     : Hot and Cold Side Pressure Drop
    339*----------------------------------------------------------------------
    440* Author: Gerson Balbueno Bicca
     
    642*--------------------------------------------------------------------*#
    743
    8 #using "streamspetroil";
    944using "streams";
    10 #=====================================================================
    11 # Hot and Cold Streams
    12 #=====================================================================
    1345
    1446Model Inlet_Main_Stream
     
    1749#===================================================================== 
    1850VARIABLES
    19 Hot     as stream;# Inlet Hot Stream
    20 Cold    as stream;# Inlet Cold Stream
    21        
     51Hot     as stream; # Inlet Hot Stream
     52Cold    as stream; # Inlet Cold Stream
    2253end
    2354
     
    2758#===================================================================== 
    2859VARIABLES
    29 Hot     as stream_therm;# Outlet Hot Stream
    30 Cold    as stream_therm;# Outlet Cold Stream
    31        
     60Hot     as stream_therm;  # Outlet Hot Stream
     61Cold    as stream_therm;  # Outlet Cold Stream
    3262end
    3363
     
    4171#===================================================================== 
    4272VARIABLES
    43 
    44 Mw              as molweight    (Brief="Average Mol Weight",Default=75, Lower=1, Upper=1e8);
    45 T               as temperature  (Brief="Average  Temperature",Lower=50);
    46 P               as pressure             (Brief="Average  Pressure",Default=1, Lower=1e-10, Upper=30);
    47 rho             as dens_mass    (Brief="Stream Density" ,Default=1000, Lower=1e-3, Upper=5e5);
    48 Mu              as viscosity    (Brief="Stream Viscosity",Lower=0.0001);
    49 Cp              as cp_mol               (Brief="Stream Molar Heat Capacity", Upper=10e10);
    50 K               as conductivity (Brief="Stream Thermal Conductivity", Default=1.0, Lower=1e-5, Upper=500);
    51 
     73Mw              as molweight            (Brief="Average Mol Weight",Default=75, Lower=1, Upper=1e8);
     74T               as temperature          (Brief="Average  Temperature",Lower=50);
     75P               as pressure                     (Brief="Average  Pressure",Default=1, Lower=1e-10, Upper=30);
     76rho             as dens_mass            (Brief="Stream Density" ,Default=1000, Lower=1e-3, Upper=5e5);
     77Mu              as viscosity            (Brief="Stream Viscosity",Lower=0.0001);
     78Cp              as cp_mol                       (Brief="Stream Molar Heat Capacity", Upper=10e10);
     79K               as conductivity         (Brief="Stream Thermal Conductivity", Default=1.0, Lower=1e-5, Upper=500);
    5280end
    5381
     
    5785#===================================================================== 
    5886VARIABLES
    59 
    60 Fw              as flow_mass    (Brief="Inlet Stream Mass Flow");
     87Fw              as flow_mass    (Brief="Stream Mass Flow");
    6188rho             as dens_mass    (Brief="Stream Density" ,Default=1000, Lower=1e-3, Upper=5e5);
    6289Mu              as viscosity    (Brief="Stream Viscosity",Default=1, Lower=1e-5, Upper=1e5);
    6390Cp              as cp_mol               (Brief="Stream Molar Heat Capacity", Upper=10e10);
    6491K               as conductivity (Brief="Stream Thermal Conductivity", Default=1.0, Lower=1e-5, Upper=500);
    65 
    6692end
    6793
     
    7197#===================================================================== 
    7298VARIABLES
    73 
    7499Mu              as viscosity    (Brief="Stream Viscosity",Default=1, Lower=1e-5, Upper=1e5);
    75100Cp              as cp_mol               (Brief="Stream Molar Heat Capacity", Upper=10e10);
    76101K               as conductivity (Brief="Stream Thermal Conductivity", Default=1.0, Lower=1e-5, Upper=500);
    77 Twall   as temperature  (Brief="Tube Wall Temperature",Lower=50);
    78 
     102Twall   as temperature  (Brief="Wall Temperature",Lower=50);
    79103end
    80104
     
    84108#===================================================================== 
    85109VARIABLES
    86 
    87 Inlet   as Properties_In_Out;   # Properties at Inlet Stream
    88 Average as Properties_Average;  # Properties at Average Temperature
    89 Outlet  as Properties_In_Out;   # Properties at Outlet Stream
    90 Wall    as Properties_Wall;             # Properties at Wall Temperature
    91 
     110Inlet           as Properties_In_Out;           # Properties at Inlet Stream
     111Average         as Properties_Average;      # Properties at Average Temperature
     112Outlet          as Properties_In_Out;           # Properties at Outlet Stream
     113Wall            as Properties_Wall;                     # Properties at Wall Temperature
    92114end
    93115
     
    97119#===================================================================== 
    98120VARIABLES
    99 
    100 Hot  as Physical_Properties;# Hot Stream
    101 Cold as Physical_Properties;# Cold Stream
    102        
     121Hot  as Physical_Properties; # Hot Stream
     122Cold as Physical_Properties; # Cold Stream
    103123end
    104124
    105125Model Tube_Pdrop
    106126#=====================================================================
    107 #       Pressure Drop block
    108 #===================================================================== 
    109 VARIABLES
    110 
    111 PdTube                  as press_delta(Default=0.01, Lower=1e-10);
    112 Pdtotal                 as press_delta(Default=0.01, Lower=1e-10);
    113 Pdnozzle_in     as press_delta(Default=0.01, Lower=1e-10);
    114 Pdnozzle_out    as press_delta(Default=0.01, Lower=1e-10);
    115 Vnozzle_in      as velocity       (Default=1, Upper=1e5, Lower=1e-10);
    116 Vnozzle_out     as velocity       (Default=1, Upper=1e5, Lower=1e-10);
     127#       Tube Side Pressure Drop block
     128#===================================================================== 
     129VARIABLES
     130
     131PdTube                  as press_delta  (Brief="Tube Pressure Drop",Default=0.01, Lower=1e-10);
     132Pdtotal                 as press_delta  (Brief="Total Pressure Drop",Default=0.01, Lower=1e-10);
     133Pdnozzle_in     as press_delta  (Brief="Inlet Nozzle Pressure Drop",Default=0.01, Lower=0);
     134Pdnozzle_out    as press_delta  (Brief="Outlet Nozzle Pressure Drop",Default=0.01, Lower=0);
     135Vnozzle_in      as velocity             (Brief="Inlet Nozzle Velocity",Default=1, Upper=1e5, Lower=0);
     136Vnozzle_out     as velocity             (Brief="Outlet Nozzle Velocity",Default=1, Upper=1e5, Lower=0);
    117137
    118138EQUATIONS
    119 
    120 Pdtotal = PdTube + Pdnozzle_in + Pdnozzle_out;
    121 
    122 end
    123 
    124 Model Tube_Pdrop_Nozzles
    125 #=====================================================================
    126 #       Pressure Drop block
    127 #===================================================================== 
    128 VARIABLES
    129 
    130 Pdnozzle_in     as press_delta(Default=0.01, Lower=1e-10);
    131 Pdnozzle_out    as press_delta(Default=0.01, Lower=1e-10);
    132 Vnozzle_in      as velocity       (Default=1, Upper=1e5, Lower=1e-10);
    133 Vnozzle_out     as velocity       (Default=1, Upper=1e5, Lower=1e-10);
    134 
    135 end
    136 
    137 Model Tube_Pdrop_Disc
    138 #=====================================================================
    139 #       Pressure Drop block
    140 #===================================================================== 
    141 VARIABLES
    142 
    143 PdTube                  as press_delta(Default=0.01, Lower=1e-10);
    144 Pdtotal                 as press_delta(Default=0.01, Lower=1e-10);
    145 
    146 EQUATIONS
    147 
    148 Pdtotal = PdTube;
     139"Total Pressure Drop"
     140        Pdtotal = PdTube + Pdnozzle_in + Pdnozzle_out;
    149141
    150142end
     
    152144Model Tube_Heat_Transfer
    153145#=====================================================================
    154 #       Pressure Drop block
     146#       Tube Side Heat Transfer Block
    155147#===================================================================== 
    156148VARIABLES
     
    158150htube           as heat_trans_coeff     (Brief="Tube Side Film Coefficient",Default=1,Lower=1e-12, Upper=1e6);
    159151PR                      as positive                     (Brief="Tube Side Prandtl Number",Default=0.5,Lower=1e-8);
    160 PRw             as positive                     (Brief="Tube Side Prandtl Number",Default=0.5,Lower=1e-8);
     152PRw             as positive                     (Brief="Tube Side Prandtl Number at Wall Temperature",Default=0.5,Lower=1e-8);
    161153Phi             as positive                     (Brief="Phi Correction",Default=1,Lower=1e-3);
    162154Vtube           as velocity                     (Brief="Tube Side Velocity",Lower=1e-8);
    163 
    164 
    165155end
    166156
    167157Model Shell_Pdrop
    168158#=====================================================================
    169 #       Pressure Drop block
    170 #===================================================================== 
    171 VARIABLES
    172 
    173 PdCross                 as press_delta(Default=0.01, Lower=1e-10);
    174 PdEndZones      as press_delta(Default=0.01, Lower=1e-10);
    175 Pdwindow                as press_delta(Default=0.01, Lower=1e-10);
    176 Pdtotal                 as press_delta(Default=0.01, Lower=1e-10);
    177 Pdnozzle_in     as press_delta(Default=0.01, Lower=1e-10);
    178 Pdnozzle_out    as press_delta(Default=0.01, Lower=1e-10);
    179 Vnozzle_in      as velocity(Default=1, Upper=1e5, Lower=1e-10);
    180 Vnozzle_out     as velocity(Default=1, Upper=1e5, Lower=1e-10);
     159#       Shell Side Pressure Drop block
     160#===================================================================== 
     161VARIABLES
     162PdCross                 as press_delta  (Brief="Cross Flow Pressure Drop",Default=0.01, Lower=0);
     163PdEndZones      as press_delta  (Brief="End Zones Pressure Drop",Default=0.01, Lower=0);
     164Pdwindow                as press_delta  (Brief="Window Pressure Drop",Default=0.01, Lower=1e-10);
     165Pdtotal                 as press_delta  (Brief="Total Pressure Drop",Default=0.01, Lower=0);
     166Pdnozzle_in     as press_delta  (Brief="Inlet Nozzle Pressure Drop",Default=0.01, Lower=0);
     167Pdnozzle_out    as press_delta  (Brief="Outlet Nozzle Pressure Drop",Default=0.01, Lower=0);
     168Vnozzle_in      as velocity             (Brief="Inlet Nozzle Velocity",Default=1, Upper=1e5, Lower=0);
     169Vnozzle_out     as velocity             (Brief="Outlet Nozzle Velocity",Default=1, Upper=1e5, Lower=0);
     170RVsquare_in     as flux_mass    (Brief="Inlet Nozzle rho-V^2");
     171RVsquare_out    as flux_mass    (Brief="Outlet Nozzle rho-V^2");
    181172
    182173EQUATIONS
    183174
    184 Pdtotal = PdCross + PdEndZones + Pdnozzle_in + Pdnozzle_out + Pdwindow;
    185 
    186 end
    187 
    188 Model Shell_Pdrop_Nozzles
    189 #=====================================================================
    190 #       Pressure Drop block
    191 #===================================================================== 
    192 VARIABLES
    193 
    194 Pdnozzle_in     as press_delta(Default=0.01, Lower=1e-10);
    195 Pdnozzle_out    as press_delta(Default=0.01, Lower=1e-10);
    196 Vnozzle_in      as velocity(Default=1, Upper=1e5, Lower=1e-10);
    197 Vnozzle_out     as velocity(Default=1, Upper=1e5, Lower=1e-10);
    198 
    199 end
    200 
    201 Model Shell_Pdrop_Disc
    202 #=====================================================================
    203 #       Pressure Drop block
    204 #===================================================================== 
    205 VARIABLES
    206 
    207 PdCross                 as press_delta(Default=0.01, Lower=1e-10);
    208 PdEndZones      as press_delta(Default=0.01, Lower=1e-10);
    209 Pdwindow                as press_delta(Default=0.01, Lower=1e-10);
    210 Pdtotal                 as press_delta(Default=0.01, Lower=1e-10);
    211 
    212 EQUATIONS
    213 
    214 Pdtotal = PdCross + PdEndZones + Pdwindow;
     175"Shell Side Total Pressure Drop"
     176        Pdtotal = PdCross + PdEndZones + Pdnozzle_in + Pdnozzle_out + Pdwindow;
    215177
    216178end
     
    218180Model Shell_Heat_Transfer
    219181#=====================================================================
    220 #      
     182# Shell Side Heat Transfer Block       
    221183#===================================================================== 
    222184VARIABLES
    223185Re                      as positive                     (Brief="Shell Side Reynolds Number",Default=100,Lower=1);
    224186PR                      as positive                     (Brief="Shell Side Prandtl Number",Default=0.7,Lower=1e-6);
    225 PRw                     as positive                     (Brief="Shell Side Prandtl Number",Default=0.5,Lower=1e-8);
     187PRw             as positive                     (Brief="Shell Side Prandtl Number",Default=0.5,Lower=1e-8);
    226188hshell          as heat_trans_coeff     (Brief="Shell Side Film Coefficient",Default=1,Lower=1e-12, Upper=1e6);
    227189Phi             as positive                     (Brief="Phi Correction",Default=1,Lower=1e-3);
     
    237199end
    238200
    239 Model Tube_Side_Main
    240 #=====================================================================
    241 #       Tube Side Main Variables
    242 #===================================================================== 
    243 VARIABLES
    244 PressureDrop    as Tube_Pdrop;
    245 HeatTransfer    as Tube_Heat_Transfer;
    246 end
    247 
    248 Model Tube_Side_Main_Disc
    249 #=====================================================================
    250 #       Tube Side Main Variables
    251 #===================================================================== 
    252 VARIABLES
    253 PressureDrop    as Tube_Pdrop_Disc;
    254 HeatTransfer    as Tube_Heat_Transfer;
    255 end
    256 
    257 Model Shell_Side_Main
    258 #=====================================================================
    259 #       Shell Side Main Variables
    260 #===================================================================== 
    261 VARIABLES
    262 PressureDrop    as Shell_Pdrop;
    263 HeatTransfer    as Shell_Heat_Transfer;
    264 end
    265 
    266 Model Shell_Side_Main_Disc
    267 #=====================================================================
    268 #       Shell Side Main Variables
    269 #===================================================================== 
    270 VARIABLES
    271 PressureDrop    as Shell_Pdrop_Disc;
    272 HeatTransfer    as Shell_Heat_Transfer;
    273 end
    274 
    275 Model Pdrop_Nozzles_Main
    276 #=====================================================================
    277 #       Tube Side Main Variables
    278 #===================================================================== 
    279 VARIABLES
    280 
    281 Tubes   as Tube_Pdrop_Nozzles;
    282 Shell   as Shell_Pdrop_Nozzles;
    283 
    284 end
    285 
    286201Model Baffles_Main
    287202#=====================================================================
    288 #       Baffles Main Variables
     203#       Baffles Spacing
    289204#=====================================================================
    290205VARIABLES
     
    301216VARIABLES
    302217
    303 Rtube                   as positive(Unit="m^2*K/kW",Lower=1e-6);
    304 Rwall                   as positive(Unit="m^2*K/kW",Lower=1e-6);
    305 Rshell                  as positive(Unit="m^2*K/kW",Lower=1e-6);
    306 #pctRtube        as percent(Lower=1e-6);
    307 #pctRwall        as percent(Lower=1e-6);
    308 #pctRshell       as percent(Lower=1e-6);
    309 
    310 #EQUATIONS
    311 
    312 #pctRtube       = 100*Rtube/(Rtube+Rwall+Rshell);
    313 #pctRwall       = 100*Rwall/(Rtube+Rwall+Rshell);
    314 #pctRshell      = 100*Rshell/(Rtube+Rwall+Rshell);
     218Rtube   as positive     (Brief="Tube Resistance",Unit="m^2*K/kW",Lower=1e-6);
     219Rwall   as positive     (Brief="Wall Resistance",Unit="m^2*K/kW",Lower=1e-6);
     220Rshell  as positive     (Brief="Shell Resistance",Unit="m^2*K/kW",Lower=1e-6);
    315221
    316222end
     
    326232Ch      as positive                     (Brief="Hot Stream Heat Capacity",Lower=1e-3,Default=1e3,Unit="W/K");
    327233Cc      as positive                     (Brief="Cold Stream Heat Capacity",Lower=1e-3,Default=1e3,Unit="W/K");
    328 Cr      as positive             (Default=0.5,Lower=1e-6);
     234Cr      as positive             (Brief="Heat Capacity Ratio",Default=0.5,Lower=1e-6);
    329235Cmin    as positive             (Brief="Minimum Heat Capacity",Lower=1e-10,Default=1e3,Unit="W/K");
    330236Cmax    as positive             (Brief="Maximum Heat Capacity",Lower=1e-10,Default=1e3,Unit="W/K");
    331 NTU             as positive                     (Brief="Number of Units Transference",Default=0.05,Lower=1e-10);
    332 
     237NTU             as positive                     (Brief="Number of Units Transference",Default=0.05,Lower=1e-10);
    333238
    334239EQUATIONS
    335 
    336240"Number of Units Transference"
    337241        NTU*Cmin = U*A;
    338        
     242end
     243
     244Model Tube_Side_Main
     245#=====================================================================
     246#       Tube Side Main Variables
     247#===================================================================== 
     248VARIABLES
     249PressureDrop    as Tube_Pdrop;                  #Tube Side Pressure Drop
     250HeatTransfer    as Tube_Heat_Transfer;  #Tube Side Heat Transfer
     251end
     252
     253Model Shell_Side_Main
     254#=====================================================================
     255#       Shell Side Main Variables
     256#===================================================================== 
     257VARIABLES
     258PressureDrop    as Shell_Pdrop;                 # Shell Side Pressure Drop
     259HeatTransfer    as Shell_Heat_Transfer; # Shell Side Heat Transfer
    339260end
    340261
     
    344265#===================================================================== 
    345266VARIABLES
    346 
    347 Pdrop           as press_delta  (Brief="Pressure Drop",Default=0.01, Lower=0);
    348 FPdrop          as Real                 (Brief="Pressure Drop : Fraction of Inlet",Lower=0,Upper=0.8);
    349 
     267Pdrop   as press_delta  (Brief="Pressure Drop",Default=0.01, Lower=0);
     268FPdrop  as Real                 (Brief="Pressure Drop : Fraction of Inlet",Lower=0,Upper=0.8);
    350269end
    351270
     
    355274#===================================================================== 
    356275VARIABLES
    357 Hot  as Basic_Pdrop;# Hot Stream
    358 Cold as Basic_Pdrop;# Cold Stream
    359 
     276Hot     as Basic_Pdrop;# Hot Stream
     277Cold    as Basic_Pdrop;# Cold Stream
    360278end     
    361 
  • /mso/eml/heat_exchangers/HeatExchangerDetailed.mso

    r20 r30  
    1  #*--------------------------------------------------------------------*
    2 *
    3 *
    4 *
    5 *
    6 *
    7 *
    8 *               
    9 *                                               
    10 *
    11 *
    12 *----------------------------------------------------------------------
    13 * Author: Gerson Balbueno Bicca
    14 * $Id$
    15 *--------------------------------------------------------------------*#
     1 
     2#--------------------------------------------------------------------
     3# Author: Gerson Balbueno Bicca
     4# $Id$
     5#--------------------------------------------------------------------
    166
    177using "HEX_Engine";
    188
    19 #=====================================================================
     9#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    2010#       Basic Model for Detailed Heat Exchangers
    21 #=====================================================================
     11#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    2212
    2313Model HeatExchangerDetailed_Basic
    24 
     14       
    2515PARAMETERS
    2616
    27 ext PP      as CalcObject(Brief="External Physical Properties");
    28 ext HE      as CalcObject(Brief="STHE Calculations",File="heatex.dll");
    29 ext NComp   as Integer   (Brief="Number of Components");
    30   M(NComp)  as molweight (Brief="Component Mol Weight");
     17ext PP          as CalcObject   (Brief="External Physical Properties");
     18ext HE          as CalcObject   (Brief="STHE Calculations",     File="heatex");
     19ext NComp       as Integer      (Brief="Number of Components");
     20  M(NComp)      as molweight    (Brief="Component Mol Weight");
    3121       
    3222VARIABLES
    33 
    34 in  Inlet           as Inlet_Main_Stream;       # Hot and Cold Inlets
    35 out 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;
     23in  Inlet               as Inlet_Main_Stream;   
     24out Outlet              as Outlet_Main_Stream; 
     25        Properties      as Main_Properties;             
     26        Details                 as Details_Main;
     27        Tubes                   as Tube_Side_Main;     
     28        Shell                   as Shell_Side_Main;
     29        Resistances     as Main_Resistances;
     30        Baffles         as Baffles_Main;
    4231
    4332SET
    44 
    45 M   = PP.MolecularWeight();
     33        M   = PP.MolecularWeight();
    4634
    4735EQUATIONS
    4836
    49 "Hot Stream Average Temperature"
     37#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     38#                                               Properties                                                                      #
     39#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     40
     41"HotStream Stream Average Temperature"
    5042        Properties.Hot.Average.T = 0.5*Inlet.Hot.T + 0.5*Outlet.Hot.T;
    5143       
     
    5345        Properties.Cold.Average.T = 0.5*Inlet.Cold.T + 0.5*Outlet.Cold.T;
    5446       
    55 "Hot Stream Average Pressure"
     47"HotStream Stream Average Pressure"
    5648        Properties.Hot.Average.P = 0.5*Inlet.Hot.P+0.5*Outlet.Hot.P;
    5749       
     
    7668
    7769"Mass Density Cold Stream"
    78         Properties.Cold.Average.rho     =       PP.LiquidDensity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
     70        Properties.Cold.Average.rho =   PP.LiquidDensity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
    7971        Properties.Cold.Inlet.rho       =       PP.LiquidDensity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
    8072        Properties.Cold.Outlet.rho      =       PP.LiquidDensity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    8173
    8274"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);
     75        Properties.Cold.Average.Mu      =       PP.LiquidViscosity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
     76        Properties.Cold.Inlet.Mu        =       PP.LiquidViscosity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
     77        Properties.Cold.Outlet.Mu       =       PP.LiquidViscosity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    8678
    8779"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);
     80        Properties.Cold.Average.K       =       PP.LiquidThermalConductivity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
     81        Properties.Cold.Inlet.K         =       PP.LiquidThermalConductivity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
     82        Properties.Cold.Outlet.K        =       PP.LiquidThermalConductivity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    9183
    9284"Heat Capacity Cold Stream"
     
    9486       
    9587"Viscosity Cold Stream"
    96         Properties.Cold.Wall.Mu =       PP.LiquidViscosity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
     88        Properties.Cold.Wall.Mu         =       PP.LiquidViscosity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
    9789
    9890"Conductivity Cold Stream"
    99         Properties.Cold.Wall.K =        PP.LiquidThermalConductivity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
     91        Properties.Cold.Wall.K          =       PP.LiquidThermalConductivity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
    10092
    10193
     
    108100
    109101"Mass Density Cold Stream"
    110         Properties.Cold.Average.rho     =       PP.VapourDensity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
     102        Properties.Cold.Average.rho =   PP.VapourDensity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
    111103        Properties.Cold.Inlet.rho       =       PP.VapourDensity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
    112104        Properties.Cold.Outlet.rho      =       PP.VapourDensity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    113105
    114106"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);
     107        Properties.Cold.Average.Mu      =       PP.VapourViscosity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
     108        Properties.Cold.Inlet.Mu        =       PP.VapourViscosity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
     109        Properties.Cold.Outlet.Mu       =       PP.VapourViscosity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    118110
    119111"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);
     112        Properties.Cold.Average.K       =       PP.VapourThermalConductivity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
     113        Properties.Cold.Inlet.K         =       PP.VapourThermalConductivity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
     114        Properties.Cold.Outlet.K        =       PP.VapourThermalConductivity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    123115       
    124116"Heat Capacity Cold Stream"
     
    127119
    128120"Viscosity Cold Stream"
    129         Properties.Cold.Wall.Mu =       PP.VapourViscosity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
     121        Properties.Cold.Wall.Mu         =       PP.VapourViscosity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
    130122
    131123"Conductivity Cold Stream"
    132         Properties.Cold.Wall.K =        PP.VapourThermalConductivity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
     124        Properties.Cold.Wall.K          =       PP.VapourThermalConductivity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
    133125       
    134126       
     
    156148
    157149"Conductivity Hot Stream"
    158         Properties.Hot.Average.K        =               PP.LiquidThermalConductivity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);   
     150        Properties.Hot.Average.K        =       PP.LiquidThermalConductivity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);   
    159151        Properties.Hot.Inlet.K  =               PP.LiquidThermalConductivity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);     
    160         Properties.Hot.Outlet.K         =               PP.LiquidThermalConductivity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);   
     152        Properties.Hot.Outlet.K         =       PP.LiquidThermalConductivity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);   
    161153
    162154"Heat Capacity Hot Stream"
    163         Properties.Hot.Wall.Cp  =               PP.LiquidCp(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
     155        Properties.Hot.Wall.Cp          =       PP.LiquidCp(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
    164156
    165157"Viscosity Hot Stream"
    166         Properties.Hot.Wall.Mu  =               PP.LiquidViscosity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);     
     158        Properties.Hot.Wall.Mu          =       PP.LiquidViscosity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);     
    167159
    168160"Conductivity Hot Stream"
    169         Properties.Hot.Wall.K   =               PP.LiquidThermalConductivity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);   
     161        Properties.Hot.Wall.K           =       PP.LiquidThermalConductivity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);   
    170162       
    171163
     
    188180
    189181"Conductivity Hot Stream"
    190         Properties.Hot.Average.K        =               PP.VapourThermalConductivity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);   
     182        Properties.Hot.Average.K        =       PP.VapourThermalConductivity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);   
    191183        Properties.Hot.Inlet.K  =               PP.VapourThermalConductivity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);     
    192         Properties.Hot.Outlet.K         =               PP.VapourThermalConductivity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);   
     184        Properties.Hot.Outlet.K         =       PP.VapourThermalConductivity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);   
    193185
    194186"Heat Capacity Hot Stream"
    195         Properties.Hot.Wall.Cp  =               PP.VapourCp(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
     187        Properties.Hot.Wall.Cp  =       PP.VapourCp(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
    196188
    197189"Viscosity Hot Stream"
    198         Properties.Hot.Wall.Mu  =               PP.VapourViscosity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
     190        Properties.Hot.Wall.Mu  =       PP.VapourViscosity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
    199191
    200192"Conductivity Hot Stream"
    201         Properties.Hot.Wall.K   =               PP.VapourThermalConductivity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);   
    202 
    203 
    204 end
    205 
    206 #=====================================================================
    207 #       Thermal Details
    208 #=====================================================================
     193        Properties.Hot.Wall.K   =       PP.VapourThermalConductivity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);   
     194
     195
     196end
     197
     198#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     199#                                       Thermal Details                                                                 #
     200#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     201
    209202"Hot Stream Heat Capacity"
    210203        Details.Ch =Inlet.Hot.F*Properties.Hot.Average.Cp;
     
    213206        Details.Cc =Inlet.Cold.F*Properties.Cold.Average.Cp;
    214207       
     208"Minimum Heat Capacity"
     209        Details.Cmin  = min([Details.Ch,Details.Cc]);
     210       
     211"Maximum Heat Capacity"
     212        Details.Cmax  = max([Details.Ch,Details.Cc]);
     213
    215214"Heat Capacity Ratio"
    216         [Details.Cmin,Details.Cmax,Details.Cr]  = HE.HeatCapacityRatio(Details.Ch,Details.Cc);
    217 
    218 #=====================================================================
    219 #       Energy Balance
    220 #=====================================================================
     215        Details.Cr    = Details.Cmin/Details.Cmax;
     216
     217#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     218#                                       Energy Balance
     219#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     220
    221221"Energy Balance Hot Stream"
    222222        Details.Q = Inlet.Hot.F*(Inlet.Hot.h-Outlet.Hot.h);
     
    225225        Details.Q =-Inlet.Cold.F*(Inlet.Cold.h-Outlet.Cold.h);
    226226
    227 #=====================================================================
    228 #       Material Balance
    229 #=====================================================================
     227#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     228#                                       Material Balance
     229#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    230230"Flow Mass Inlet Cold Stream"
    231231        Properties.Cold.Inlet.Fw        =  sum(M*Inlet.Cold.z)*Inlet.Cold.F;
     
    246246        Inlet.Cold.F = Outlet.Cold.F;
    247247
    248 #======================================
    249 #       Constraints
    250 #======================================
     248#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     249#                                       Constraints
     250#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    251251"Hot Stream Molar Fraction Constraint"
    252252        Outlet.Hot.z=Inlet.Hot.z;
     
    260260"No Phase Change In Hot Stream"
    261261        Inlet.Hot.v=Outlet.Hot.v;
    262 
    263262       
    264263end
     
    268267PARAMETERS
    269268
    270 ext PP          as CalcObject;
    271 ext     HE              as CalcObject   (Brief="STHE Calculations",File="heatex.dll");
    272 side        as Integer          (Brief="Fluid Alocation",Lower=0,Upper=1);
     269#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     270#                               Basic  Parameters                                                                       #
     271#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     272ext PP          as CalcObject   (Brief="External Physical Properties");
     273ext     HE              as CalcObject   (Brief="STHE Calculations",File="heatex");
     274side        as Integer          (Brief="Fluid Alocation Flag",Lower=0,Upper=1);
    273275Pi                      as constant     (Brief="Pi Number",Default=3.14159265);
    274276
    275 #=====================================================================
    276 #       Shell Geometrical Parameters
    277 #=====================================================================
     277#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     278#                               Shell Geometrical Parameters                                            #
     279#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    278280Tpass                   as Integer              (Brief="Number of Tube Passes",Lower=1);
    279281Nss                             as Integer              (Brief="Number of Sealing Strips pairs",Lower=1);
     
    284286Honozzle_Shell  as length               (Brief="Height Under Shell Outlet Nozzle",Lower=10e-6);
    285287Lcf                     as length               (Brief="Bundle-to-Shell Clearance",Lower=10e-8);
    286 #=====================================================================
    287 #       Tubes Geometrical Parameters
    288 #=====================================================================
    289 Ntt                             as Integer              (Brief="Total Number of Tubes in Shell",Default=100,Lower=1);
    290 Pattern         as Integer              (Brief="Tube Layout Characteristic Angle",Lower=30);
    291 Ltube                   as length               (Brief="Effective Tube Length",Lower=0.1);
    292 pitch                   as length               (Brief="Tube Pitch",Lower=1e-8);
    293 Kwall                   as conductivity (Brief="Tube Wall Material Thermal Conductivity");
    294 Dotube                  as length               (Brief="Tube Outside Diameter",Lower=10e-6);
    295 Ditube                  as length               (Brief="Tube Inside Diameter",Lower=10e-6);
    296 Donozzle_Tube   as length               (Brief="Tube Outlet Nozzle Diameter",Lower=10e-6);
    297 Dinozzle_Tube   as length               (Brief="Tube Inlett Nozzle Diameter",Lower=10e-6);
    298 #=====================================================================
    299 #       Baffles Geometrical Parameters
    300 #=====================================================================
    301 Bc                      as Integer              (Brief="Baffle Cut",Default=25,Lower=25);
    302 Nb              as Real                 (Brief="Number of Baffles",Lower=1);
    303 Lcd                     as length               (Brief="Baffle-to-Shell Clearance",Lower=10e-8);
    304 Ltd                             as length               (Brief="Tube-to-Bafflehole Clearance",Lower=10e-8);
    305 #=====================================================================
    306 #=====================================================================
    307 EQUATIONS
    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 
    335 if 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 
    353 end
    354 
    355 
    356 if 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 
    365 Properties.Hot.Wall.Twall  = (Properties.Hot.Average.T+Properties.Cold.Average.T)/2;
    366 
    367 Properties.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 
    432 Properties.Hot.Wall.Twall  = (Properties.Hot.Average.T+Properties.Cold.Average.T)/2;
    433 
    434 Properties.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 
    491 end
    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 #=====================================================================
     288
     289#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     290#                               Tubes Geometrical Parameters                                            #
     291#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     292Ntt                       as Integer            (Brief="Total Number of Tubes in Shell",Default=100,Lower=1);
     293Pattern       as Integer                (Brief="Tube Layout Characteristic Angle",Lower=30);
     294Ltube             as length                     (Brief="Effective Tube Length",Lower=0.1);
     295pitch             as length                     (Brief="Tube Pitch",Lower=1e-8);
     296Kwall             as conductivity       (Brief="Tube Wall Material Thermal Conductivity");
     297Dotube            as length                     (Brief="Tube Outside Diameter",Lower=10e-6);
     298Ditube            as length                     (Brief="Tube Inside Diameter",Lower=10e-6);
     299Donozzle_Tube as length                 (Brief="Tube Outlet Nozzle Diameter",Lower=10e-6);
     300Dinozzle_Tube as length                 (Brief="Tube Inlett Nozzle Diameter",Lower=10e-6);
     301
     302#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     303#                               Baffles Geometrical Parameters                                          #
     304#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     305Bc     as Integer (Brief="Baffle Cut",Default=25,Lower=25);
     306Nb     as Real    (Brief="Number of Baffles",Lower=1);
     307Lcd    as length  (Brief="Baffle-to-Shell Clearance",Lower=10e-8);
     308Ltd        as length  (Brief="Tube-to-Bafflehole Clearance",Lower=10e-8);
     309
     310SET
     311
     312#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     313#             Set Parameters for heatex Calculation                                     #
     314#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    519315        Pi                              = 3.14159265;
    520316        HE.Tpass                        = Tpass;
     
    540336        side                            = HE.FluidAlocation();
    541337       
     338EQUATIONS
     339
     340#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     341#                               Heat Transfer Correction Factors                                        #
     342#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     343"Ji Factor"
     344        Shell.HeatTransfer.Ji = HE.JiFactor(Shell.HeatTransfer.Re);
     345
     346"Jc Factor"
     347        Shell.HeatTransfer.Jc = HE.JcFactor();
     348       
     349"Jl Factor"
     350        Shell.HeatTransfer.Jl = HE.JlFactor(Shell.HeatTransfer.Sm);
     351
     352"Jb Factor"
     353        Shell.HeatTransfer.Jb = HE.JbFactor(Shell.HeatTransfer.Re,Baffles.Ls,Shell.HeatTransfer.Sm);
     354
     355"Jr Factor"     
     356        Shell.HeatTransfer.Jr = HE.JrFactor(Shell.HeatTransfer.Re);
     357       
     358"Total J Factor"
     359        Shell.HeatTransfer.Jtotal =     Shell.HeatTransfer.Jc*Shell.HeatTransfer.Jl*Shell.HeatTransfer.Jb*Shell.HeatTransfer.Jr*Shell.HeatTransfer.Js;
     360
     361#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     362#                                        Nozzles rho-V^2                                                                #
     363#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     364
     365if side equal 1
     366       
     367        then
     368
     369"Shell Side inlet Nozzle rho-V^2"
     370        Shell.PressureDrop.RVsquare_in = Properties.Hot.Inlet.rho*(Shell.PressureDrop.Vnozzle_in)^2;
     371
     372"Shell Side Outlet Nozzle rho-V^2"
     373        Shell.PressureDrop.RVsquare_out = Properties.Hot.Outlet.rho*(Shell.PressureDrop.Vnozzle_out)^2;
     374       
     375        else
     376       
     377"Shell Side inlet Nozzle rho-V^2"
     378        Shell.PressureDrop.RVsquare_in = Properties.Cold.Inlet.rho*(Shell.PressureDrop.Vnozzle_in)^2;
     379
     380"Shell Side Outlet Nozzle rho-V^2"
     381        Shell.PressureDrop.RVsquare_out = Properties.Cold.Outlet.rho*(Shell.PressureDrop.Vnozzle_out)^2;
     382
     383end
     384
     385#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     386#                                        Phi correction                                                                 #
     387#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     388
     389if side equal 1
     390       
     391        then
     392
     393"Shell Side Phi correction"
     394        Shell.HeatTransfer.Phi = HE.PhiCorrection(Properties.Hot.Average.Mu,Properties.Hot.Wall.Mu);
     395       
     396"Tube Side Phi correction"
     397        Tubes.HeatTransfer.Phi  = HE.PhiCorrection(Properties.Cold.Average.Mu,Properties.Cold.Wall.Mu);
     398       
     399        else
     400       
     401"Shell Side Phi correction"
     402        Shell.HeatTransfer.Phi = HE.PhiCorrection(Properties.Cold.Average.Mu,Properties.Cold.Wall.Mu);
     403       
     404"Tube Side Phi correction"
     405        Tubes.HeatTransfer.Phi  = HE.PhiCorrection(Properties.Hot.Average.Mu,Properties.Hot.Wall.Mu);
     406
     407end
     408
     409#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     410#                                                                                                                                       #
     411#                                                                                                                                       #
     412#                                                                                                                                       #
     413#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     414
     415if side equal 1
     416       
     417        then
     418       
     419"Wall Temperature"
     420#       Properties.Hot.Wall.Twall = HE.WallTemperature(Properties.Hot.Average.T,Properties.Cold.Average.T,Tubes.HeatTransfer.htube,Shell.HeatTransfer.hshell);
     421
     422#       Properties.Cold.Wall.Twall = HE.WallTemperature(Properties.Cold.Average.T,Properties.Hot.Average.T,Tubes.HeatTransfer.htube,Shell.HeatTransfer.hshell);
     423
     424Properties.Hot.Wall.Twall  = (Properties.Hot.Average.T+Properties.Cold.Average.T)/2;
     425
     426Properties.Cold.Wall.Twall  = (Properties.Hot.Average.T+Properties.Cold.Average.T)/2;
     427
     428"Tube Side Velocity"
     429        Tubes.HeatTransfer.Vtube  = HE.TubeVelocity(Properties.Cold.Inlet.Fw,Properties.Cold.Average.rho);
     430
     431"Tube Side Reynolds Number"
     432        Tubes.HeatTransfer.Re = HE.TubeReynoldsNumber(Properties.Cold.Average.rho,Tubes.HeatTransfer.Vtube,Properties.Cold.Average.Mu);
     433       
     434"Tube Side Prandtl Number"
     435        Tubes.HeatTransfer.PR = HE.PrandtlNumber(Properties.Cold.Average.K,Properties.Cold.Average.Cp,Properties.Cold.Average.Mw,Properties.Cold.Average.Mu);
     436
     437"Tube Side Prandtl Number at Wall Temperature"
     438        Tubes.HeatTransfer.PRw = HE.PrandtlNumber(Properties.Cold.Wall.K,Properties.Cold.Wall.Cp,Properties.Cold.Average.Mw,Properties.Cold.Wall.Mu);
     439
     440"Tube Side Film Coefficient"
     441        Tubes.HeatTransfer.htube= HE.TubeFilmCoeff(Tubes.HeatTransfer.Re,Tubes.HeatTransfer.PR,Properties.Cold.Average.K,Tubes.HeatTransfer.Phi);
     442       
     443"Shell Side Prandtl Number"
     444        Shell.HeatTransfer.PR=HE.PrandtlNumber(Properties.Hot.Average.K,Properties.Hot.Average.Cp,Properties.Hot.Average.Mw,Properties.Hot.Average.Mu);
     445
     446"Shell Side Prandtl Number at Wall Temperature"
     447        Shell.HeatTransfer.PRw = HE.PrandtlNumber(Properties.Hot.Wall.K,Properties.Hot.Wall.Cp,Properties.Hot.Average.Mw,Properties.Hot.Wall.Mu);       
     448
     449"Tube Side Pressure Drop"
     450        Tubes.PressureDrop.PdTube               = HE.DeltaPtube(Tubes.HeatTransfer.Re,Properties.Cold.Average.rho,Tubes.HeatTransfer.Vtube,Tubes.HeatTransfer.Phi);
     451
     452"Pressure Drop Tube Side Inlet Nozzle"
     453        Tubes.PressureDrop.Pdnozzle_in  = HE.DeltaPtubeNozzlein(Properties.Cold.Inlet.rho,Properties.Cold.Inlet.Fw);
     454
     455"Velocity Tube Side Inlet Nozzle"
     456        Tubes.PressureDrop.Vnozzle_in   = HE.TubeVelocityNozzlein(Properties.Cold.Inlet.rho,Properties.Cold.Inlet.Fw);
     457
     458"Pressure Drop Tube Side Outlet Nozzle"
     459        Tubes.PressureDrop.Pdnozzle_out = HE.DeltaPtubeNozzleout(Properties.Cold.Outlet.rho,Properties.Cold.Inlet.Fw);
     460
     461"Velocity Tube Side Outlet Nozzle"
     462        Tubes.PressureDrop.Vnozzle_out  = HE.TubeVelocityNozzleout(Properties.Cold.Outlet.rho,Properties.Cold.Inlet.Fw);
     463
     464"Shell Pressure Drop Inlet Nozzle"
     465        Shell.PressureDrop.Pdnozzle_in  = HE.DeltaPshellNozzleIn(Properties.Hot.Inlet.rho,Properties.Hot.Inlet.Fw);
     466
     467"Velocity Shell Side Inlet Nozzle"
     468        Shell.PressureDrop.Vnozzle_in   = HE.ShellVelocityNozzleIn(Properties.Hot.Inlet.rho,Properties.Hot.Inlet.Fw);
     469
     470"Shell Pressure Drop Outlet Nozzle"
     471        Shell.PressureDrop.Pdnozzle_out =HE.DeltaPshellNozzleOut(Properties.Hot.Outlet.rho,Properties.Hot.Inlet.Fw);
     472
     473"Velocity Shell Side Outlet Nozzle"
     474        Shell.PressureDrop.Vnozzle_out  =HE.ShellVelocityNozzleOut(Properties.Hot.Outlet.rho,Properties.Hot.Inlet.Fw);
     475
     476"Pressure Drop Hot Stream"
     477        Outlet.Hot.P  = Inlet.Hot.P- Shell.PressureDrop.Pdtotal;       
     478       
     479"Pressure Drop Cold Stream"
     480        Outlet.Cold.P  = Inlet.Cold.P - Tubes.PressureDrop.Pdtotal;
     481
     482
     483        else
     484
     485"Wall Temperature"
     486#       Properties.Cold.Wall.Twall = HE.WallTemperature(Properties.Cold.Average.T,Properties.Hot.Average.T,Tubes.HeatTransfer.htube,Shell.HeatTransfer.hshell);
     487
     488#       Properties.Hot.Wall.Twall = HE.WallTemperature(Properties.Hot.Average.T,Properties.Cold.Average.T,Tubes.HeatTransfer.htube,Shell.HeatTransfer.hshell);
     489
     490
     491Properties.Hot.Wall.Twall  = (Properties.Hot.Average.T+Properties.Cold.Average.T)/2;
     492
     493Properties.Cold.Wall.Twall  = (Properties.Hot.Average.T+Properties.Cold.Average.T)/2;
     494
     495"Tube Side Velocity"
     496        Tubes.HeatTransfer.Vtube=HE.TubeVelocity(Properties.Hot.Inlet.Fw,Properties.Hot.Average.rho);
     497
     498"Tube Side Reynolds Number"
     499        Tubes.HeatTransfer.Re=HE.TubeReynoldsNumber(Properties.Hot.Average.rho,Tubes.HeatTransfer.Vtube,Properties.Hot.Average.Mu);
     500       
     501"Tube Side Prandtl Number"
     502        Tubes.HeatTransfer.PR=HE.PrandtlNumber(Properties.Hot.Average.K,Properties.Hot.Average.Cp,Properties.Hot.Average.Mw,Properties.Hot.Average.Mu);
     503
     504"Tube Side Prandtl Number at Wall"
     505        Tubes.HeatTransfer.PRw=HE.PrandtlNumber(Properties.Hot.Wall.K,Properties.Hot.Wall.Cp,Properties.Hot.Average.Mw,Properties.Hot.Wall.Mu);
     506
     507"Tube Side Film Coefficient"
     508        Tubes.HeatTransfer.htube= HE.TubeFilmCoeff(Tubes.HeatTransfer.Re,Tubes.HeatTransfer.PR,Properties.Hot.Average.K,Tubes.HeatTransfer.Phi);
     509       
     510"Shell Side Prandtl Number"
     511        Shell.HeatTransfer.PR=HE.PrandtlNumber(Properties.Cold.Average.K,Properties.Cold.Average.Cp,Properties.Cold.Average.Mw,Properties.Cold.Average.Mu);
     512
     513"Shell Side Prandtl Number at Wall"
     514        Shell.HeatTransfer.PRw=HE.PrandtlNumber(Properties.Cold.Wall.K,Properties.Cold.Wall.Cp,Properties.Cold.Average.Mw,Properties.Cold.Wall.Mu);
     515
     516"Tube Side Pressure Drop"
     517        Tubes.PressureDrop.PdTube               = HE.DeltaPtube(Tubes.HeatTransfer.Re,Properties.Hot.Average.rho,Tubes.HeatTransfer.Vtube,Tubes.HeatTransfer.Phi);
     518
     519"Pressure Drop Tube Side Inlet Nozzle"
     520        Tubes.PressureDrop.Pdnozzle_in  = HE.DeltaPtubeNozzlein(Properties.Hot.Inlet.rho,Properties.Hot.Inlet.Fw);
     521
     522"Velocity Tube Side Inlet Nozzle"
     523        Tubes.PressureDrop.Vnozzle_in   = HE.TubeVelocityNozzlein(Properties.Hot.Inlet.rho,Properties.Hot.Inlet.Fw);
     524
     525"Pressure Drop Tube Side Outlet Nozzle"
     526        Tubes.PressureDrop.Pdnozzle_out = HE.DeltaPtubeNozzleout(Properties.Hot.Outlet.rho,Properties.Hot.Inlet.Fw);   
     527
     528"Velocity Tube Side Outlet Nozzle"
     529        Tubes.PressureDrop.Vnozzle_out  = HE.TubeVelocityNozzleout(Properties.Hot.Outlet.rho,Properties.Hot.Inlet.Fw); 
     530
     531"Shell Pressure Drop Inlet Nozzle"
     532        Shell.PressureDrop.Pdnozzle_in  = HE.DeltaPshellNozzleIn(Properties.Cold.Inlet.rho,Properties.Cold.Inlet.Fw);
     533
     534"Velocity Shell Side Inlet Nozzle"
     535        Shell.PressureDrop.Vnozzle_in   = HE.ShellVelocityNozzleIn(Properties.Cold.Inlet.rho,Properties.Cold.Inlet.Fw);
     536
     537"Shell Pressure Drop Outlet Nozzle"
     538        Shell.PressureDrop.Pdnozzle_out = HE.DeltaPshellNozzleOut(Properties.Cold.Outlet.rho,Properties.Cold.Inlet.Fw);
     539
     540"Velocity Shell Side Outlet Nozzle"
     541        Shell.PressureDrop.Vnozzle_out  = HE.ShellVelocityNozzleOut(Properties.Cold.Outlet.rho,Properties.Cold.Inlet.Fw);
     542
     543"Pressure Drop Hot Stream"
     544        Outlet.Hot.P  = Inlet.Hot.P- Tubes.PressureDrop.Pdtotal;       
     545       
     546"Pressure Drop Cold Stream"
     547        Outlet.Cold.P  = Inlet.Cold.P - Shell.PressureDrop.Pdtotal;
     548
     549
     550end
     551
     552#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     553#                                               Resistances                                                                     #
     554#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     555
     556"Tube Resistance"       
     557        Resistances.Rtube*(Tubes.HeatTransfer.htube*Ditube) = Dotube;
     558       
     559"Wall Resistance"
     560        Resistances.Rwall=Dotube*ln(Dotube/Ditube)/(2*Kwall);
     561       
     562"Shell Resistance"
     563        Resistances.Rshell*(Shell.HeatTransfer.hshell)=1;
     564
     565#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     566#                                                                                                                                       #
     567#                                                                                                                                       #
     568#                                                                                                                                       #
     569#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     570
     571"Shell Side Cross Flow Area"
     572        Shell.HeatTransfer.Sm = HE.CrossFlowArea(Baffles.Ls);
     573       
     574"Overall Heat Transfer Coefficient"
     575        Details.U=1/(Dotube/(Tubes.HeatTransfer.htube*Ditube)+(Dotube*ln(Dotube/Ditube)/(2*Kwall))+(1/(Shell.HeatTransfer.hshell)));
     576
     577"Exchange Surface Area"
     578        Details.A=Pi*Dotube*Ntt*Ltube;
     579
     580"Baffles Spacing"
     581        Ltube = Baffles.Lsi+Baffles.Lso+Baffles.Ls*(Nb-1);
     582
    542583end
    543584
     
    546587VARIABLES
    547588
    548 Eft                              as positive            (Brief="Effectiveness",Default=0.05,Lower=1e-8);
    549        
    550 EQUATIONS       
    551 Details.Q       = Eft*Details.Cmin*(Inlet.Hot.T-Inlet.Cold.T); 
     589Eft                      as positive (Brief="Effectiveness",Default=0.05,Lower=1e-8);
     590       
     591EQUATIONS
     592"Duty"
     593        Details.Q       = Eft*Details.Cmin*(Inlet.Hot.T-Inlet.Cold.T); 
    552594       
    553595end
     
    557599VARIABLES
    558600LMTD            as temp_delta   (Brief="Logarithmic Mean Temperature Difference",Lower=5);
    559 Fc                      as positive             (Brief="LMTD Correction Factor",Lower=0.7);
     601Fc                      as positive             (Brief="LMTD Correction Factor",Lower=0.4);
    560602MTD                     as temp_delta   (Brief="Mean Temperature Difference",Lower=5);
    561603
     
    570612end
    571613
    572 
    573614Model E_Shell_NTU_Det                   as Heatex_Detailed_NTU
    574 #=====================================================================
     615#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    575616#       Shell and Tubes Heat Exchanger with 1 shell pass - LMTD Method
    576 #=====================================================================
     617#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    577618EQUATIONS
    578619
    579620"TEMA E Shell Effectiveness"
    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;
     621#       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;
     622        Eft = HE.EshellEffectiveness(Details.Cr,Details.NTU);
    581623
    582624"Js Factor"     
     
    623665end
    624666
    625 
    626667end
    627668
    628669Model F_Shell_NTU_Det                   as Heatex_Detailed_NTU
    629 #=====================================================================
     670#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    630671#       Shell and Tubes Heat Exchanger with 1 shell pass - LMTD Method
    631 #=====================================================================
     672#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    632673VARIABLES
    633674
     
    689730
    690731Model Multipass_NTU_Det         
    691 #============================================================================
     732#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    692733#       Shell and Tubes Heat Exchanger In Series with 1 shell pass - LMTD Method
    693 #============================================================================
     734#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    694735PARAMETERS
    695736
    696737Nshell          as Integer              (Brief="N Shell in Series",Default=2);
    697738ext     HE              as CalcObject   (Brief="STHE Calculations",File="heatex.dll");
    698 ext PP          as CalcObject;
     739ext PP          as CalcObject   (Brief="External Physical Properties");
    699740side        as Integer          (Brief="Fluid Alocation",Lower=0,Upper=1);
    700741Pi                      as constant     (Brief="Pi Number",Default=3.14159265);
    701742
    702 #=====================================================================
     743#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    703744#       Shell Geometrical Parameters
    704 #=====================================================================
     745#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    705746Tpass                   as Integer              (Brief="Number of Tube Passes",Lower=1);
    706747Nss                             as Integer              (Brief="Number of Sealing Strips pairs",Lower=1);
     
    711752Honozzle_Shell  as length               (Brief="Height Under Shell Outlet Nozzle",Lower=10e-6);
    712753Lcf                     as length               (Brief="Bundle-to-Shell Clearance",Lower=10e-8);
    713 #=====================================================================
     754#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    714755#       Tubes Geometrical Parameters
    715 #=====================================================================
     756#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    716757Ntt                             as Integer              (Brief="Total Number of Tubes in Shell",Default=100,Lower=1);
    717758Pattern         as Integer              (Brief="Tube Layout Characteristic Angle",Lower=30);
     
    723764Donozzle_Tube   as length               (Brief="Tube Outlet Nozzle Diameter",Lower=10e-6);
    724765Dinozzle_Tube   as length               (Brief="Tube Inlett Nozzle Diameter",Lower=10e-6);
    725 #=====================================================================
     766#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    726767#       Baffles Geometrical Parameters
    727 #=====================================================================
     768#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    728769Bc                      as Integer              (Brief="Baffle Cut",Default=25,Lower=25);
    729770Nb              as Real                 (Brief="Number of Baffles",Lower=1);
    730771Lcd                     as length               (Brief="Baffle-to-Shell Clearance",Lower=10e-8);
    731772Ltd                             as length               (Brief="Tube-to-Bafflehole Clearance",Lower=10e-8);
    732 #=====================================================================
     773#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    733774VARIABLES
    734775
     
    766807        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;
    767808
    768 
    769 
    770 #=====================================================================
     809#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    771810#  Fluid Alocation
    772 #=====================================================================
     811#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    773812
    774813if side equal 1 then
     
    795834        then
    796835       
    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);
     836"Hot Wall Temperature"
    799837        Unity(i).Properties.Hot.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
     838
     839"Cold Wall Temperature"
    800840        Unity(i).Properties.Cold.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    801841
     
    812852        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);
    813853
    814 
    815854"Tube Side Film Coefficient"
    816855        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);
     
    858897        else
    859898
    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);
     899"Hot Wall Temperature"
    862900        Unity(i).Properties.Hot.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
     901
     902"Cold Wall Temperature"
    863903        Unity(i).Properties.Cold.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    864904
     
    875915        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);
    876916
    877 
    878917"Tube Side Film Coefficient"
    879918        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);
     
    885924        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);
    886925
    887 
    888926"Tube Side Pressure Drop"
    889927        Unity(i).Tubes.PressureDrop.PdTube      =       HE.DeltaPtube(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Hot.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Tubes.HeatTransfer.Phi);
     
    922960end
    923961
     962if side equal 1
     963       
     964        then
     965
     966"Shell Side inlet Nozzle rho-V^2"
     967        Unity(i).Shell.PressureDrop.RVsquare_in = Unity(i).Properties.Hot.Inlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_in)^2;
     968
     969"Shell Side Outlet Nozzle rho-V^2"
     970        Unity(i).Shell.PressureDrop.RVsquare_out = Unity(i).Properties.Hot.Outlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_out)^2;
     971       
     972        else
     973       
     974"Shell Side inlet Nozzle rho-V^2"
     975        Unity(i).Shell.PressureDrop.RVsquare_in = Unity(i).Properties.Cold.Inlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_in)^2;
     976
     977"Shell Side Outlet Nozzle rho-V^2"
     978        Unity(i).Shell.PressureDrop.RVsquare_out = Unity(i).Properties.Cold.Outlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_out)^2;
     979
     980end
     981
    924982"Tube Resistance"       
    925983        Unity(i).Resistances.Rtube*(Unity(i).Tubes.HeatTransfer.htube*Ditube) = Dotube;
     
    939997"Baffles Spacing"
    940998        Ltube = Unity(i).Baffles.Lsi+Unity(i).Baffles.Lso+Unity(i).Baffles.Ls*(Nb-1);
    941        
    942999
    9431000"TEMA E Shell Effectiveness"
     
    9871044end
    9881045
     1046"Duty"
    9891047        Unity(i).Details.Q      = Eft(i)*Unity(i).Details.Cmin*(Unity(i).Inlet.Hot.T-Unity(i).Inlet.Cold.T);
    9901048
     
    9921050
    9931051        SET
    994 #=====================================================================
     1052#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    9951053#  Set Parameters for heatex Calculation
    996 #=====================================================================
     1054#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    9971055        Pi                              = 3.14159265;
    9981056        HE.Tpass                        = Tpass;
     
    10211079
    10221080Model E_Shell_LMTD_Det                  as Heatex_Detailed_LMTD
    1023 #=====================================================================
     1081#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    10241082#       Shell and Tubes Heat Exchanger with 1 shell pass - LMTD Method
    1025 #=====================================================================
     1083#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    10261084EQUATIONS
    10271085
     
    10801138
    10811139Model F_Shell_LMTD_Det                  as Heatex_Detailed_LMTD
    1082 #=====================================================================
     1140#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    10831141#       Shell and Tubes Heat Exchanger with 2 shell pass - LMTD Method
    1084 #=====================================================================
     1142#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    10851143
    10861144EQUATIONS
     
    11401198
    11411199Model Multipass_LMTD_Det         
    1142 #============================================================================
     1200#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    11431201#       Shell and Tubes Heat Exchanger In Series with 1 shell pass - LMTD Method
    1144 #============================================================================
     1202#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    11451203PARAMETERS
    11461204
    1147 Nshell          as Integer      (Brief="N Shell in Series",Default=2);
     1205Nshell          as Integer              (Brief="N Shell in Series",Default=2);
    11481206ext     HE              as CalcObject   (Brief="STHE Calculations",File="heatex.dll");
    1149 ext PP          as CalcObject;
     1207ext PP          as CalcObject   (Brief="External Physical Properties");
    11501208side        as Integer          (Brief="Fluid Alocation",Lower=0,Upper=1);
    11511209Pi                      as constant     (Brief="Pi Number",Default=3.14159265);
    11521210
    1153 #=====================================================================
     1211#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    11541212#       Shell Geometrical Parameters
    1155 #=====================================================================
     1213#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    11561214Tpass                   as Integer              (Brief="Number of Tube Passes",Lower=1);
    11571215Nss                             as Integer              (Brief="Number of Sealing Strips pairs",Lower=1);
     
    11621220Honozzle_Shell  as length               (Brief="Height Under Shell Outlet Nozzle",Lower=10e-6);
    11631221Lcf                     as length               (Brief="Bundle-to-Shell Clearance",Lower=10e-8);
    1164 #=====================================================================
     1222#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    11651223#       Tubes Geometrical Parameters
    1166 #=====================================================================
     1224#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    11671225Ntt                             as Integer              (Brief="Total Number of Tubes in Shell",Default=100,Lower=1);
    11681226Pattern         as Integer              (Brief="Tube Layout Characteristic Angle",Lower=30);
     
    11741232Donozzle_Tube   as length               (Brief="Tube Outlet Nozzle Diameter",Lower=10e-6);
    11751233Dinozzle_Tube   as length               (Brief="Tube Inlett Nozzle Diameter",Lower=10e-6);
    1176 #=====================================================================
     1234#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    11771235#       Baffles Geometrical Parameters
    1178 #=====================================================================
     1236#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    11791237Bc                      as Integer              (Brief="Baffle Cut",Default=25,Lower=25);
    11801238Nb              as Real                 (Brief="Number of Baffles",Lower=1);
    11811239Lcd                     as length               (Brief="Baffle-to-Shell Clearance",Lower=10e-8);
    11821240Ltd                             as length               (Brief="Tube-to-Bafflehole Clearance",Lower=10e-8);
    1183 #=====================================================================
     1241#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    11841242VARIABLES
    11851243
     
    11871245Fc(Nshell)                      as positive             (Brief="LMTD Correction Factor",Lower=0.75);
    11881246MTD(Nshell)                     as temp_delta   (Brief="Mean Temperature Difference");
    1189 
    1190 Unity(Nshell) as HeatExchangerDetailed_Basic;
     1247Unity(Nshell)           as HeatExchangerDetailed_Basic;
    11911248
    11921249CONNECTIONS
     
    12201277        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;
    12211278
    1222 
    1223 
    1224 #=====================================================================
     1279#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    12251280#  Fluid Alocation
    1226 #=====================================================================
     1281#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    12271282
    12281283if side equal 1 then
     
    12511306        then
    12521307       
    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 
     1308"Cold Wall Temperature"
    12591309        Unity(i).Properties.Cold.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    1260        
     1310
     1311"Hot Wall Temperature" 
    12611312        Unity(i).Properties.Hot.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    12621313
     
    12731324        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);
    12741325
    1275 
    12761326"Tube Side Film Coefficient"
    12771327        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);
     
    13191369        else
    13201370
    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 
     1371"Cold Wall Temperature"
    13261372        Unity(i).Properties.Cold.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    1327        
     1373
     1374"Hot Wall Temperature"
    13281375        Unity(i).Properties.Hot.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    1329 
    1330 
    13311376
    13321377"Tube Side Velocity"
     
    14631508
    14641509        SET
    1465 #=====================================================================
     1510#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    14661511#  Set Parameters for heatex Calculation
    1467 #=====================================================================
     1512#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    14681513        Pi                              = 3.14159265;
    14691514        HE.Tpass                        = Tpass;
  • /mso/eml/heat_exchangers/HeatExchangerDiscretized.mso

    r20 r30  
    1  #*--------------------------------------------------------------------*
    2 *
    3 *
    4 *
    5 *
    6 *
    7 *
    8 *               
    9 *                                               
    10 *
    11 *
    12 *----------------------------------------------------------------------
    13 * Author: Gerson Balbueno Bicca
    14 * $Id$
    15 *--------------------------------------------------------------------*#
     1
     2#--------------------------------------------------------------------
     3# Author: Gerson Balbueno Bicca
     4# $Id$
     5#--------------------------------------------------------------------
    166
    177using "HEX_Engine";
    188
    19 #=====================================================================
     9#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    2010#       Basic Model for Discretized Heat Exchangers
    21 #=====================================================================
     11#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    2212
    2313Model HeatExchangerDiscretized_Basic
     
    2616
    2717ext PP      as CalcObject(Brief="External Physical Properties");
    28 ext HE      as CalcObject(Brief="STHE Calculations",File="heatex.dll");
     18ext HE      as CalcObject(Brief="STHE Calculations",File="heatex");
    2919ext NComp   as Integer   (Brief="Number of Components");
    3020  M(NComp)  as molweight (Brief="Component Mol Weight");
     
    3626        Properties  as Main_Properties;         # Hot and Cold Properties
    3727        Details     as Details_Main;
    38         Tubes           as Tube_Side_Main_Disc;
    39         Shell           as Shell_Side_Main_Disc;
     28        Tubes           as Tube_Side_Main;     
     29        Shell           as Shell_Side_Main;
    4030        Resistances as Main_Resistances;
    4131        Baffles     as Baffles_Main;
     
    204194end
    205195
    206 #=====================================================================
     196#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    207197#       Thermal Details
    208 #=====================================================================
     198#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    209199"Hot Stream Heat Capacity"
    210200        Details.Ch =Inlet.Hot.F*Properties.Hot.Average.Cp;
     
    213203        Details.Cc =Inlet.Cold.F*Properties.Cold.Average.Cp;
    214204       
     205"Minimum Heat Capacity"
     206        Details.Cmin  = min([Details.Ch,Details.Cc]);
     207
     208"Maximum Heat Capacity"
     209        Details.Cmax  = max([Details.Ch,Details.Cc]);
     210
    215211"Heat Capacity Ratio"
    216         [Details.Cmin,Details.Cmax,Details.Cr]  = HE.HeatCapacityRatio(Details.Ch,Details.Cc);
    217 
    218 #=====================================================================
     212        Details.Cr    = Details.Cmin/Details.Cmax;
     213       
     214#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    219215#       Energy Balance
    220 #=====================================================================
     216#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    221217"Energy Balance Hot Stream"
    222218        Details.Q = Inlet.Hot.F*(Inlet.Hot.h-Outlet.Hot.h);
     
    225221        Details.Q =-Inlet.Cold.F*(Inlet.Cold.h-Outlet.Cold.h);
    226222
    227 #=====================================================================
     223#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    228224#       Material Balance
    229 #=====================================================================
     225#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    230226"Flow Mass Inlet Cold Stream"
    231227        Properties.Cold.Inlet.Fw        =  sum(M*Inlet.Cold.z)*Inlet.Cold.F;
     
    246242        Inlet.Cold.F = Outlet.Cold.F;
    247243
    248 #======================================
     244#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    249245#       Constraints
    250 #======================================
     246#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    251247"Hot Stream Molar Fraction Constraint"
    252248        Outlet.Hot.z=Inlet.Hot.z;
     
    264260end
    265261
     262Model Heatex_Discretized_NTU            as HeatExchangerDiscretized_Basic
     263       
     264VARIABLES
     265
     266Eft             as positive (Brief="Effectiveness",Default=0.05,Lower=1e-8);
     267       
     268EQUATIONS
     269
     270"Exchange Surface Area"
     271        Details.Q       = Eft*Details.Cmin*(Inlet.Hot.T-Inlet.Cold.T); 
     272
     273"TEMA E Shell Effectiveness"
     274        Eft = HE.EshellEffectiveness(Details.Cr,Details.NTU);
     275       
     276end
     277
    266278Model Heatex_Discretized_LMTD           as HeatExchangerDiscretized_Basic
    267279       
    268280VARIABLES
    269281LMTD            as temp_delta   (Brief="Logarithmic Mean Temperature Difference",Lower=5);
    270 Fc                      as positive             (Brief="LMTD Correction Factor",Lower=0.1);
    271 MTD                     as temp_delta   (Brief="Mean Temperature Difference",Lower=5);
     282Fc                      as positive             (Brief="LMTD Correction Factor",Lower=0.5);
     283MTD                     as temp_delta   (Brief="Mean Temperature Difference",Lower=1);
    272284
    273285EQUATIONS
    274 
    275286"Exchange Surface Area"
    276287        Details.Q   = Details.U*Details.A*MTD;
     
    287298end
    288299
    289 Model Heatex_Discretized_NTU            as HeatExchangerDiscretized_Basic
    290        
     300Model Profiles
     301
     302PARAMETERS
     303
     304Zones   as Integer(Brief="Number of Zones");
     305
    291306VARIABLES
    292307
    293 Eft             as positive (Brief="Effectiveness",Default=0.05,Lower=1e-8);
    294        
    295 EQUATIONS
    296 
    297 "Exchange Surface Area"
    298         Details.Q       = Eft*Details.Cmin*(Inlet.Hot.T-Inlet.Cold.T); 
    299 
    300 "TEMA E Shell Effectiveness"
    301 #       Eft = HE.EshellEffectiveness(Details.Cr,Details.NTU);
    302        
    303         Eft = 0.10;
    304        
    305 end
    306 
    307 Model Profiles
    308 
     308Lz(Zones)               as length                       (Brief="Zone Tube Length");
     309Area                            as area                         (Brief="Area Total");
     310Q                               as power                        (Brief="Total Duty");
     311PdropTubesNozzle        as pressure                     (Brief="Total Tube Nozzles Pressure Drop");
     312PdropTubes                      as pressure                     (Brief="Total Tube Pressure Drop");
     313PdropWin                        as pressure                     (Brief="Total Shell Side Window Pressure Drop");
     314PdropCross                      as pressure                     (Brief="Total Shell Side Cross Flow Pressure Drop");
     315PdropEnds                       as pressure                     (Brief="Total Shell Side Ends Pressure Drop");
     316PdropShellNozzle        as pressure                     (Brief="Total Shell Side Nozzles Pressure Drop");
     317PdropShell                      as pressure                     (Brief="Total Shell Side Pressure Drop");
     318Uaverage                        as heat_trans_coeff (Brief="Average Overall Heat Transfer Coefficient",Default=1,Lower=1e-6,Upper=1e10);
     319hshellaverage           as heat_trans_coeff     (Brief="Average Shell Side Film Coefficient",Default=1,Lower=1e-12, Upper=1e6);
     320htubeaverage            as heat_trans_coeff     (Brief="Average Tube Side Film Coefficient",Default=1,Lower=1e-12, Upper=1e6);
     321Thot(Zones)             as temperature          (Brief="Hot Temperature",Lower = 300, Upper = 500);
     322Tcold(Zones)            as temperature          (Brief="Cold Temperature",Lower = 300, Upper = 500);
     323Phot(Zones)             as pressure                     (Brief="Hot Pressure",Lower = 0.8, Upper = 30);
     324Pcold(Zones)            as pressure                     (Brief="Cold Pressure",Lower = 0.8, Upper = 30);
     325
     326end
     327
     328Model E_Shell_NTU_Disc           
     329#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     330#       Shell and Tubes Heat Exchanger with 1 shell pass - NTU Method
     331#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    309332PARAMETERS
    310333
    311 Zones                   as Integer;
    312 
    313 VARIABLES
    314 
    315 Lz(Zones)        as length;
    316 Lpos(Zones)      as length;
    317 Area                    as area;
    318 Q                       as power;
    319 PdropShellTotal as pressure;
    320 PdropTubesTotal as pressure;
    321 PdropWinTotal   as pressure;
    322 PdropCrossTotal as pressure;
    323 PdropEndsTotal  as pressure;
    324 Uaverage                as heat_trans_coeff (Brief="Overall Heat Transfer Coefficient",Default=1,Lower=1e-6,Upper=1e10);
    325 hshellaverage   as heat_trans_coeff     (Brief="Shell Side Film Coefficient",Default=1,Lower=1e-12, Upper=1e6);
    326 htubeaverage    as heat_trans_coeff     (Brief="Shell Side Film Coefficient",Default=1,Lower=1e-12, Upper=1e6);
    327 Thot(Zones)      as temperature(Lower = 70, Upper = 500);
    328 Tcold(Zones)     as temperature(Lower = 70, Upper = 500);
    329 Phot(Zones)      as pressure(Lower = 0.8, Upper = 30);
    330 Pcold(Zones)     as pressure(Lower = 0.8, Upper = 30);
    331 
    332 end
    333 
    334 
    335 Model E_Shell_LMTD_Disc         
    336 #============================================================================
    337 #       Shell and Tubes Heat Exchanger In Series with 1 shell pass - LMTD Method
    338 #============================================================================
    339 PARAMETERS
    340 
    341 ext     HE              as CalcObject   (Brief="STHE Calculations",File="heatex.dll");
    342 ext PP          as CalcObject;
    343 side            as Integer              (Brief="Fluid Alocation",Lower=0,Upper=1);
    344 Pi                      as constant     (Brief="Pi Number",Default=3.14159265);
    345 
    346 #=====================================================================
     334ext     HE      as CalcObject   (Brief="STHE Calculations",File="heatex.dll");
     335ext PP  as CalcObject   (Brief="External Physical Properties");
     336side    as Integer              (Brief="Fluid Alocation",Lower=0,Upper=1);
     337Pi              as constant     (Brief="Pi Number",Default=3.14159265);
     338
     339#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    347340#       Shell Geometrical Parameters
    348 #=====================================================================
     341#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    349342Tpass                   as Integer              (Brief="Number of Tube Passes",Lower=1);
    350343Nss                             as Integer              (Brief="Number of Sealing Strips pairs",Lower=1);
     
    355348Honozzle_Shell  as length               (Brief="Height Under Shell Outlet Nozzle",Lower=10e-6);
    356349Lcf                     as length               (Brief="Bundle-to-Shell Clearance",Lower=10e-8);
    357 #=====================================================================
     350#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    358351#       Tubes Geometrical Parameters
    359 #=====================================================================
     352#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    360353Ntt                             as Integer              (Brief="Total Number of Tubes in Shell",Default=100,Lower=1);
    361354Pattern         as Integer              (Brief="Tube Layout Characteristic Angle",Lower=30);
     
    367360Donozzle_Tube   as length               (Brief="Tube Outlet Nozzle Diameter",Lower=10e-6);
    368361Dinozzle_Tube   as length               (Brief="Tube Inlett Nozzle Diameter",Lower=10e-6);
    369 #=====================================================================
     362#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    370363#       Baffles Geometrical Parameters
    371 #=====================================================================
     364#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    372365Bc                      as Integer              (Brief="Baffle Cut",Default=25,Lower=25);
    373366Nb              as Integer              (Brief="Number of Baffles",Default=4);
    374367Lcd                     as length               (Brief="Baffle-to-Shell Clearance",Lower=10e-8);
    375368Ltd                             as length               (Brief="Tube-to-Bafflehole Clearance",Lower=10e-8);
    376 #=====================================================================
     369#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    377370VARIABLES
    378371
    379 PdropNozzles    as Pdrop_Nozzles_Main;
    380 Unity(Nb+1)     as Heatex_Discretized_LMTD;
     372Unity(Nb+1)     as Heatex_Discretized_NTU;
    381373Sumary          as Profiles;
    382374
     
    388380EQUATIONS
    389381
    390 "Outlet Hot Temperature"
    391         Sumary.Thot                 = Unity.Outlet.Hot.T ;
    392        
    393 "Outlet Cold Temperature"
    394         Sumary.Tcold            = Unity.Outlet.Cold.T ;
    395 Sumary.Phot                 = Unity.Outlet.Hot.P ;
    396 Sumary.Pcold                = Unity.Outlet.Cold.P ;
    397 
    398 Sumary.hshellaverage = sum(Unity.Shell.HeatTransfer.hshell)/Sumary.Zones;
    399 Sumary.htubeaverage  = sum(Unity.Tubes.HeatTransfer.htube)/Sumary.Zones;
    400 Sumary.Uaverage     = sum(Unity.Details.U)/Sumary.Zones;
    401 Sumary.Area             = sum(Unity.Details.A);
    402 Sumary.Q                = sum(Unity.Details.Q);
    403 
    404 Sumary.PdropShellTotal = sum(Unity.Shell.PressureDrop.Pdtotal)+PdropNozzles.Shell.Pdnozzle_in + PdropNozzles.Shell.Pdnozzle_out;
    405 Sumary.PdropTubesTotal = sum(Unity.Tubes.PressureDrop.Pdtotal)+PdropNozzles.Tubes.Pdnozzle_in + PdropNozzles.Tubes.Pdnozzle_out;
    406 Sumary.PdropWinTotal    = sum(Unity.Shell.PressureDrop.Pdwindow);
    407 Sumary.PdropCrossTotal = sum(Unity.Shell.PressureDrop.PdCross);
    408 Sumary.PdropEndsTotal   = sum(Unity.Shell.PressureDrop.PdEndZones);
    409 
    410 Sumary.Lz(1)    = Unity(1).Baffles.Lsi;
     382"Hot Temperatures"
     383        Sumary.Thot     = Unity.Outlet.Hot.T;
     384       
     385"Cold Temperatures"
     386        Sumary.Tcold    = Unity.Outlet.Cold.T ;
     387
     388"Hot Pressures"
     389        Sumary.Phot     = Unity.Outlet.Hot.P ;
     390       
     391"Cold Pressures"
     392        Sumary.Pcold    = Unity.Outlet.Cold.P ;
     393
     394"Average Shell Side Film Coefficient"
     395        Sumary.hshellaverage            = sum(Unity.Shell.HeatTransfer.hshell)/Sumary.Zones;
     396
     397"Average Tube Side Film Coefficient"
     398        Sumary.htubeaverage             = sum(Unity.Tubes.HeatTransfer.htube)/Sumary.Zones;
     399
     400"Average Overall Heat Transfer Coefficient"
     401        Sumary.Uaverage                 = sum(Unity.Details.U)/Sumary.Zones;
     402
     403"Area Total"
     404        Sumary.Area                             = sum(Unity.Details.A);
     405
     406"Duty Total"
     407        Sumary.Q                                = sum(Unity.Details.Q);
     408
     409"Length Inlet zone"
     410        Sumary.Lz(1)                            = Unity(1).Baffles.Lsi;
     411
     412"Length Outlet zone"
     413        Sumary.Lz(Nb+1)                         = Unity(1).Baffles.Lso;
     414
     415"Total Shell Side Pressure Drop"
     416        Sumary.PdropShell                       = sum(Unity.Shell.PressureDrop.Pdtotal);
     417
     418"Total Tube Side Pressure Drop"
     419        Sumary.PdropTubes                       = sum(Unity.Tubes.PressureDrop.Pdtotal);
     420
     421"Total Tube Side Nozzles Pressure Drop"
     422        Sumary.PdropTubesNozzle         = sum(Unity.Tubes.PressureDrop.Pdnozzle_in + Unity.Tubes.PressureDrop.Pdnozzle_out);
     423
     424"Total Shell Side Nozzles Pressure Drop"
     425        Sumary.PdropShellNozzle         = sum(Unity.Shell.PressureDrop.Pdnozzle_in + Unity.Shell.PressureDrop.Pdnozzle_out);
     426
     427"Total Shell Side Window Pressure Drop"
     428        Sumary.PdropWin                         = sum(Unity.Shell.PressureDrop.Pdwindow);
     429
     430"Total Shell Side Cross Flow Pressure Drop"
     431        Sumary.PdropCross                       = sum(Unity.Shell.PressureDrop.PdCross);
     432
     433"Total Shell Side Ends Pressure Drop"
     434        Sumary.PdropEnds                        = sum(Unity.Shell.PressureDrop.PdEndZones);
    411435
    412436"Shell Side Cross Flow Area"
     
    415439"Shell Side Cross Flow Area"
    416440        Unity(Nb+1).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(Nb+1).Baffles.Lso);
    417        
    418 Sumary.Lz(Nb+1) = Unity(1).Baffles.Lso;
     441
    419442
    420443if side equal 1
    421444       
    422445        then
    423 
    424 "Pressure Drop Hot Stream"
    425         Unity(1).Outlet.Hot.P  = Unity(1).Inlet.Hot.P - Unity(1).Shell.PressureDrop.Pdtotal - PdropNozzles.Shell.Pdnozzle_in;   
    426         Unity(Nb+1).Outlet.Hot.P  = Unity(Nb+1).Inlet.Hot.P - Unity(Nb+1).Shell.PressureDrop.Pdtotal - PdropNozzles.Shell.Pdnozzle_out;
    427 
    428 "Pressure Drop Cold Stream"
    429         Unity(1).Outlet.Cold.P  = Unity(1).Inlet.Cold.P - Unity(1).Tubes.PressureDrop.Pdtotal - PdropNozzles.Tubes.Pdnozzle_in;
    430         Unity(Nb+1).Outlet.Cold.P  = Unity(Nb+1).Inlet.Cold.P - Unity(Nb+1).Tubes.PressureDrop.Pdtotal - PdropNozzles.Tubes.Pdnozzle_out;
     446       
     447"Shell Side inlet Nozzle rho-V^2"
     448        Unity(1).Shell.PressureDrop.RVsquare_in = Unity(1).Properties.Hot.Inlet.rho*(Unity(1).Shell.PressureDrop.Vnozzle_in)^2;
     449
     450"Shell Side Outlet Nozzle rho-V^2"
     451        Unity(Nb+1).Shell.PressureDrop.RVsquare_out = Unity(Nb+1).Properties.Hot.Outlet.rho*(Unity(Nb+1).Shell.PressureDrop.Vnozzle_out)^2;
     452
     453"Shell Pressure End Zones"
     454        Unity(1).Shell.PressureDrop.PdEndZones          =       HE.DeltaPendZonesIncremental(Unity(1).Shell.HeatTransfer.Re,Unity(1).Baffles.Ls,Unity(1).Baffles.Lso,
     455        Unity(1).Baffles.Lsi,Unity(1).Properties.Hot.Inlet.Fw,Unity(1).Shell.HeatTransfer.Phi,Unity(1).Properties.Hot.Average.rho);
     456
     457"Shell Pressure End Zones"
     458        Unity(Nb+1).Shell.PressureDrop.PdEndZones       =       HE.DeltaPendZonesIncremental(Unity(Nb+1).Shell.HeatTransfer.Re,Unity(Nb+1).Baffles.Ls,Unity(Nb+1).Baffles.Lso,
     459        Unity(Nb+1).Baffles.Lsi,Unity(Nb+1).Properties.Hot.Inlet.Fw,Unity(Nb+1).Shell.HeatTransfer.Phi,Unity(Nb+1).Properties.Hot.Average.rho);
    431460
    432461"Pressure Drop Tube Side Inlet Nozzle"
    433         PdropNozzles.Tubes.Pdnozzle_in  = HE.DeltaPtubeNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
     462        Unity(1).Tubes.PressureDrop.Pdnozzle_in = HE.DeltaPtubeNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
    434463
    435464"Velocity Tube Side Inlet Nozzle"
    436         PdropNozzles.Tubes.Vnozzle_in   = HE.TubeVelocityNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
     465        Unity(1).Tubes.PressureDrop.Vnozzle_in  = HE.TubeVelocityNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
    437466
    438467"Pressure Drop Tube Side Outlet Nozzle"
    439         PdropNozzles.Tubes.Pdnozzle_out = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
     468        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_out     = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
    440469
    441470"Velocity Tube Side Outlet Nozzle"
    442         PdropNozzles.Tubes.Vnozzle_out  = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
     471        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_out      = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
    443472
    444473"Shell Pressure Drop Inlet Nozzle"
    445         PdropNozzles.Shell.Pdnozzle_in  = HE.DeltaPshellNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
     474        Unity(1).Shell.PressureDrop.Pdnozzle_in = HE.DeltaPshellNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
    446475
    447476"Velocity Shell Side Inlet Nozzle"
    448         PdropNozzles.Shell.Vnozzle_in   = HE.ShellVelocityNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
     477        Unity(1).Shell.PressureDrop.Vnozzle_in  = HE.ShellVelocityNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
    449478
    450479"Shell Pressure Drop Outlet Nozzle"
    451         PdropNozzles.Shell.Pdnozzle_out =HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
     480        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_out     =HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
    452481
    453482"Velocity Shell Side Outlet Nozzle"
    454         PdropNozzles.Shell.Vnozzle_out  =HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
    455 
     483        Unity(Nb+1).Shell.PressureDrop.Vnozzle_out      =HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
     484       
    456485
    457486        else
    458487       
    459 "Pressure Drop Hot Stream"
    460         Unity(1).Outlet.Hot.P  = Unity(1).Inlet.Hot.P- Unity(1).Tubes.PressureDrop.Pdtotal - PdropNozzles.Tubes.Pdnozzle_in;   
    461         Unity(Nb+1).Outlet.Hot.P  = Unity(Nb+1).Inlet.Hot.P- Unity(Nb+1).Tubes.PressureDrop.Pdtotal - PdropNozzles.Tubes.Pdnozzle_out; 
    462        
    463 "Pressure Drop Cold Stream"
    464         Unity(1).Outlet.Cold.P  = Unity(1).Inlet.Cold.P - Unity(1).Shell.PressureDrop.Pdtotal- PdropNozzles.Shell.Pdnozzle_in;
    465         Unity(Nb+1).Outlet.Cold.P  = Unity(Nb+1).Inlet.Cold.P - Unity(Nb+1).Shell.PressureDrop.Pdtotal- PdropNozzles.Shell.Pdnozzle_out;
     488"Shell Side inlet Nozzle rho-V^2"
     489        Unity(1).Shell.PressureDrop.RVsquare_in = Unity(1).Properties.Cold.Inlet.rho*(Unity(1).Shell.PressureDrop.Vnozzle_in)^2;
     490
     491"Shell Side Outlet Nozzle rho-V^2"
     492        Unity(Nb+1).Shell.PressureDrop.RVsquare_out = Unity(Nb+1).Properties.Cold.Outlet.rho*(Unity(Nb+1).Shell.PressureDrop.Vnozzle_out)^2;
     493
     494"Shell Pressure End Zones"
     495        Unity(1).Shell.PressureDrop.PdEndZones          =       HE.DeltaPendZonesIncremental(Unity(1).Shell.HeatTransfer.Re,Unity(1).Baffles.Ls,Unity(1).Baffles.Lso,
     496        Unity(1).Baffles.Lsi,Unity(1).Properties.Cold.Inlet.Fw,Unity(1).Shell.HeatTransfer.Phi,Unity(1).Properties.Cold.Average.rho);
     497
     498"Shell Pressure End Zones"
     499        Unity(Nb+1).Shell.PressureDrop.PdEndZones       =       HE.DeltaPendZonesIncremental(Unity(Nb+1).Shell.HeatTransfer.Re,Unity(Nb+1).Baffles.Ls,Unity(Nb+1).Baffles.Lso,
     500        Unity(Nb+1).Baffles.Lsi,Unity(Nb+1).Properties.Cold.Inlet.Fw,Unity(Nb+1).Shell.HeatTransfer.Phi,Unity(Nb+1).Properties.Cold.Average.rho);
     501
    466502
    467503"Pressure Drop Tube Side Inlet Nozzle"
    468         PdropNozzles.Tubes.Pdnozzle_in  = HE.DeltaPtubeNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
     504        Unity(1).Tubes.PressureDrop.Pdnozzle_in = HE.DeltaPtubeNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
    469505
    470506"Velocity Tube Side Inlet Nozzle"
    471         PdropNozzles.Tubes.Vnozzle_in   = HE.TubeVelocityNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
     507        Unity(1).Tubes.PressureDrop.Vnozzle_in  = HE.TubeVelocityNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
    472508
    473509"Pressure Drop Tube Side Outlet Nozzle"
    474         PdropNozzles.Tubes.Pdnozzle_out = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);   
     510        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_out     = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);   
    475511
    476512"Velocity Tube Side Outlet Nozzle"
    477         PdropNozzles.Tubes.Vnozzle_out  = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw); 
     513        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_out      = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw); 
    478514
    479515"Shell Pressure Drop Inlet Nozzle"
    480         PdropNozzles.Shell.Pdnozzle_in  = HE.DeltaPshellNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
     516        Unity(1).Shell.PressureDrop.Pdnozzle_in = HE.DeltaPshellNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
    481517
    482518"Velocity Shell Side Inlet Nozzle"
    483         PdropNozzles.Shell.Vnozzle_in   = HE.ShellVelocityNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
     519        Unity(1).Shell.PressureDrop.Vnozzle_in  = HE.ShellVelocityNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
    484520
    485521"Shell Pressure Drop Outlet Nozzle"
    486         PdropNozzles.Shell.Pdnozzle_out = HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
     522        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_out = HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
    487523
    488524"Velocity Shell Side Outlet Nozzle"
    489         PdropNozzles.Shell.Vnozzle_out  = HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
     525        Unity(Nb+1).Shell.PressureDrop.Vnozzle_out  = HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
     526
    490527
    491528end
     
    494531for i in [2:Nb]
    495532
     533"Pressure Drop Tube Side Inlet Nozzle"
     534        Unity(i).Tubes.PressureDrop.Pdnozzle_in = 0;
     535
     536"Velocity Tube Side Inlet Nozzle"
     537        Unity(i).Tubes.PressureDrop.Vnozzle_in  = 0;
     538
     539"Pressure Drop Tube Side Outlet Nozzle"
     540        Unity(i).Tubes.PressureDrop.Pdnozzle_out        = 0;   
     541
     542"Velocity Tube Side Outlet Nozzle"
     543        Unity(i).Tubes.PressureDrop.Vnozzle_out = 0;   
     544
     545"Shell Pressure Drop Inlet Nozzle"
     546        Unity(i).Shell.PressureDrop.Pdnozzle_in = 0;
     547
     548"Velocity Shell Side Inlet Nozzle"
     549        Unity(i).Shell.PressureDrop.Vnozzle_in  = 0;
     550
     551"Shell Pressure Drop Outlet Nozzle"
     552        Unity(i).Shell.PressureDrop.Pdnozzle_out = 0;
     553
     554"Velocity Shell Side Outlet Nozzle"
     555        Unity(i).Shell.PressureDrop.Vnozzle_out  = 0;
     556
     557"Shell Pressure End Zones"
     558        Unity(i).Shell.PressureDrop.PdEndZones          =       0;
     559       
     560"Shell Side Outlet Nozzle rho-V^2"
     561        Unity(i).Shell.PressureDrop.RVsquare_out = 0;
     562       
     563"Shell Side inlet Nozzle rho-V^2"
     564        Unity(i).Shell.PressureDrop.RVsquare_in = 0;
     565
    496566if side equal 1
    497567       
    498568        then
    499569       
     570"Shell Pressure Drop Cross Flow"
     571        Unity(i).Shell.PressureDrop.PdCross             =       HE.DeltaPcrossIncremental(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Hot.Average.rho);
     572
     573
     574        else
     575
     576"Shell Pressure Drop Cross Flow"
     577        Unity(i).Shell.PressureDrop.PdCross     =       HE.DeltaPcrossIncremental(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Cold.Average.rho);
     578
     579
     580end
     581
     582"Zone Length"
     583        Sumary.Lz(i) = Unity(1).Baffles.Ls;
     584
     585"Shell Side Cross Flow Area"
     586        Unity(i).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(i).Baffles.Ls);
     587       
     588end
     589
     590
     591for i in [1:Nb+1]
     592       
     593if side equal 1
     594       
     595        then
    500596"Pressure Drop Hot Stream"
    501597        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P - Unity(i).Shell.PressureDrop.Pdtotal;   
     
    503599"Pressure Drop Cold Stream"
    504600        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Tubes.PressureDrop.Pdtotal;
    505 
    506 
     601       
     602"Shell Side Reynolds Number"
     603        Unity(i).Shell.HeatTransfer.Re                          =       HE.ShellReynoldsNumber(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Hot.Average.Mu);
     604
     605"Shell Heat Transfer Coefficient"
     606        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);
     607
     608
     609"Shell Pressure Baffle Window"
     610        Unity(i).Shell.PressureDrop.Pdwindow            =       HE.DeltaPwindowIncremental(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Hot.Average.rho,Unity(i).Properties.Hot.Average.Mu,Unity(i).Baffles.Ls);
     611
     612"Hot Wall Temperature"
     613        Unity(i).Properties.Hot.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
     614
     615"Cold Wall Temperature"
     616        Unity(i).Properties.Cold.Wall.Twall =   (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
     617
     618"Tube Side Velocity"
     619        Unity(i).Tubes.HeatTransfer.Vtube       =       HE.TubeVelocity(Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Properties.Cold.Average.rho);
     620
     621"Tube Side Reynolds Number"
     622        Unity(i).Tubes.HeatTransfer.Re          =       HE.TubeReynoldsNumber(Unity(i).Properties.Cold.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Properties.Cold.Average.Mu);
     623       
     624"Tube Side Prandtl Number"
     625        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);
     626
     627"Tube Side Prandtl Number at Wall"
     628        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);
     629
     630"Tube Side Film Coefficient"
     631        Unity(i).Tubes.HeatTransfer.htube       =       HE.TubeFilmCoeffIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Cold.Average.K,
     632        Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lz(i));
     633       
     634"Shell Side Prandtl Number"
     635        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);   
     636
     637"Shell Side Prandtl Number at Wall"
     638        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);   
     639
     640"Tube Side Pressure Drop"
     641        Unity(i).Tubes.PressureDrop.PdTube      =       HE.DeltaPtubeIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Cold.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,
     642        Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lz(i));
     643       
     644"Shell Side Phi correction for viscosity"
     645        Unity(i).Shell.HeatTransfer.Phi         =       HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
     646       
     647"Tube Side Phi correction for viscosity"
     648        Unity(i).Tubes.HeatTransfer.Phi         =       HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
     649       
    507650        else
    508651
     
    512655"Pressure Drop Cold Stream"
    513656        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Shell.PressureDrop.Pdtotal;
    514 
    515 
    516 end
    517 
    518 "Position for discretization"
    519         Sumary.Lz(i) = Unity(1).Baffles.Ls;
    520 
    521 "Shell Side Cross Flow Area"
    522         Unity(i).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(i).Baffles.Ls);
    523 
    524 end
    525 
    526 
    527 for i in [1:Nb+1]
    528        
    529 "Js Factor"     
    530         Unity(i).Shell.HeatTransfer.Js = HE.JsFactor(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Lsi,Unity(i).Baffles.Lso,Unity(i).Baffles.Ls);
    531 
    532 "Position for discretization"
    533         Sumary.Lpos(i)                                                  =       sum(Sumary.Lz([1:i]));
    534        
    535 "Ji Factor"
    536         Unity(i).Shell.HeatTransfer.Ji          =       HE.JiFactor(Unity(i).Shell.HeatTransfer.Re);
    537 
    538 "Jc Factor"
    539         Unity(i).Shell.HeatTransfer.Jc          =       HE.JcFactor();
    540        
    541 "Jl Factor"
    542         Unity(i).Shell.HeatTransfer.Jl          =       HE.JlFactor(Unity(i).Shell.HeatTransfer.Sm);
    543 
    544 "Jb Factor"
    545         Unity(i).Shell.HeatTransfer.Jb          =       HE.JbFactor(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Shell.HeatTransfer.Sm);
    546 
    547 "Jr Factor"     
    548         Unity(i).Shell.HeatTransfer.Jr          =       HE.JrFactor(Unity(i).Shell.HeatTransfer.Re);
    549        
    550 "Total J Factor"
    551         Unity(i).Shell.HeatTransfer.Jtotal      =       Unity(i).Shell.HeatTransfer.Jc*Unity(i).Shell.HeatTransfer.Jl*Unity(i).Shell.HeatTransfer.Jb*Unity(i).Shell.HeatTransfer.Jr*Unity(i).Shell.HeatTransfer.Js;
    552 
    553 if side equal 1
    554        
    555 then
    556 
    557 "Shell Side Reynolds Number"
    558         Unity(i).Shell.HeatTransfer.Re                  = HE.ShellReynoldsNumber(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Hot.Average.Mu);
    559 
    560 "Shell Heat Transfer Coefficient"
    561         Unity(i).Shell.HeatTransfer.hshell              = HE.ShellFilmCoeff(Unity(i).Shell.HeatTransfer.Ji,Unity(i).Properties.Hot.Average.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Shell.HeatTransfer.PR,Unity(i).Shell.HeatTransfer.Jtotal,Unity(i).Shell.HeatTransfer.Phi);
    562 
    563 "Shell Pressure Drop Cross Flow"
    564         Unity(i).Shell.PressureDrop.PdCross     = HE.DeltaPcrossIncremental(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Hot.Average.rho);
    565 
    566 "Shell Pressure Baffle Window"
    567         Unity(i).Shell.PressureDrop.Pdwindow    = HE.DeltaPwindowIncremental(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Hot.Average.rho,Unity(i).Properties.Hot.Average.Mu,Unity(i).Baffles.Ls);
    568 
    569 "Shell Pressure End Zones"
    570         Unity(i).Shell.PressureDrop.PdEndZones  = HE.DeltaPendZonesIncremental(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Hot.Average.rho);
    571 
    572 #       Tubes.HeatTransfer.Twall                                = HE.WallTemperature(Properties.Hot.Average.T,Properties.Cold.Average.T,Tubes.HeatTransfer.htube,Shell.HeatTransfer.hshell);
    573 
    574 "Wall Temperature for Cold Side"
    575         Unity(i).Properties.Cold.Wall.Twall     =       (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    576        
    577 "Wall Temperature for Hot Side"
    578         Unity(i).Properties.Hot.Wall.Twall      =       (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    579 
    580 "Tube Side Velocity"
    581         Unity(i).Tubes.HeatTransfer.Vtube               =       HE.TubeVelocity(Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Properties.Cold.Average.rho);
    582 
    583 "Tube Side Reynolds Number"
    584         Unity(i).Tubes.HeatTransfer.Re                  =       HE.TubeReynoldsNumber(Unity(i).Properties.Cold.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Properties.Cold.Average.Mu);
    585        
    586 "Tube Side Prandtl Number"
    587         Unity(i).Tubes.HeatTransfer.PR                  =       HE.PrandtlNumber(Unity(i).Properties.Cold.Average.K,Unity(i).Properties.Cold.Average.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Average.Mu);
    588 
    589 "Tube Side Prandtl Number at Wall"
    590         Unity(i).Tubes.HeatTransfer.PRw                 =       HE.PrandtlNumber(Unity(i).Properties.Cold.Wall.K,Unity(i).Properties.Cold.Wall.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Wall.Mu);
    591 
    592 "Tube Side Film Coefficient"
    593         Unity(i).Tubes.HeatTransfer.htube               =       HE.TubeFilmCoeffIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Cold.Average.K,
    594         Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lpos(i));
    595        
    596 "Shell Side Prandtl Number"
    597         Unity(i).Shell.HeatTransfer.PR                  =       HE.PrandtlNumber(Unity(i).Properties.Hot.Average.K,Unity(i).Properties.Hot.Average.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Average.Mu);   
    598 
    599 "Shell Side Prandtl Number at Wall"
    600         Unity(i).Shell.HeatTransfer.PRw                 =       HE.PrandtlNumber(Unity(i).Properties.Hot.Wall.K,Unity(i).Properties.Hot.Wall.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Wall.Mu);   
    601 
    602 "Tube Side Pressure Drop"
    603         Unity(i).Tubes.PressureDrop.PdTube              =       HE.DeltaPtubeIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Cold.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,
    604         Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lz(i));
    605        
    606 "Shell Side Phi correction for viscosity"
    607         Unity(i).Shell.HeatTransfer.Phi                 =       HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
    608        
    609 "Tube Side Phi correction for viscosity"
    610         Unity(i).Tubes.HeatTransfer.Phi                 =       HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
    611        
    612         else
    613657       
    614658"Shell Side Reynolds Number"
     
    616660
    617661"Shell Heat Transfer Coefficient"
    618         Unity(i).Shell.HeatTransfer.hshell       = HE.ShellFilmCoeff(Unity(i).Shell.HeatTransfer.Ji,Unity(i).Properties.Cold.Average.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Shell.HeatTransfer.PR,Unity(i).Shell.HeatTransfer.Jtotal,Unity(i).Shell.HeatTransfer.Phi);
    619 
    620 "Shell Pressure Drop Cross Flow"
    621         Unity(i).Shell.PressureDrop.PdCross      = HE.DeltaPcrossIncremental(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Cold.Average.rho);
     662        Unity(i).Shell.HeatTransfer.hshell              =       HE.ShellFilmCoeff(Unity(i).Shell.HeatTransfer.Ji,Unity(i).Properties.Cold.Average.Cp,Unity(i).Properties.Cold.Average.Mw,
     663        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);
     664
    622665
    623666"Shell Pressure Baffle Window"
    624         Unity(i).Shell.PressureDrop.Pdwindow     = HE.DeltaPwindowIncremental(Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Cold.Average.rho,Unity(i).Properties.Cold.Average.Mu,Unity(i).Baffles.Ls);
    625 
    626 "Shell Pressure End Zones"
    627         Unity(i).Shell.PressureDrop.PdEndZones  = HE.DeltaPendZonesIncremental(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Cold.Average.rho);
    628 
    629 #       Tubes.HeatTransfer.Twall                                = HE.WallTemperature(Properties.Cold.Average.T,Properties.Hot.Average.T,Tubes.HeatTransfer.htube,Shell.HeatTransfer.hshell);
    630 
    631 "Wall Temperature for Cold Side"
    632         Unity(i).Properties.Cold.Wall.Twall     = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    633        
    634 "Wall Temperature for Hot Side"
    635         Unity(i).Properties.Hot.Wall.Twall      =  (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
     667        Unity(i).Shell.PressureDrop.Pdwindow    =       HE.DeltaPwindowIncremental(Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Cold.Average.rho,Unity(i).Properties.Cold.Average.Mu,Unity(i).Baffles.Ls);
     668
     669
     670"Hot Wall Temperature"
     671        Unity(i).Properties.Hot.Wall.Twall      =       (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
     672
     673"Cold Wall Temperature"
     674        Unity(i).Properties.Cold.Wall.Twall     =       (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    636675
    637676"Tube Side Velocity"
    638         Unity(i).Tubes.HeatTransfer.Vtube       =  HE.TubeVelocity(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Properties.Hot.Average.rho);
     677        Unity(i).Tubes.HeatTransfer.Vtube               =       HE.TubeVelocity(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Properties.Hot.Average.rho);
    639678
    640679"Tube Side Reynolds Number"
    641         Unity(i).Tubes.HeatTransfer.Re          =  HE.TubeReynoldsNumber(Unity(i).Properties.Hot.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Properties.Hot.Average.Mu);
     680        Unity(i).Tubes.HeatTransfer.Re                  =       HE.TubeReynoldsNumber(Unity(i).Properties.Hot.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Properties.Hot.Average.Mu);
    642681       
    643682"Tube Side Prandtl Number"
    644         Unity(i).Tubes.HeatTransfer.PR          =  HE.PrandtlNumber(Unity(i).Properties.Hot.Average.K,Unity(i).Properties.Hot.Average.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Average.Mu);
    645 
     683        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);
     684       
    646685"Tube Side Prandtl Number at Wall"
    647         Unity(i).Tubes.HeatTransfer.PRw         =       HE.PrandtlNumber(Unity(i).Properties.Hot.Wall.K,Unity(i).Properties.Hot.Wall.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Wall.Mu);
    648 
     686        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);
     687       
     688       
    649689"Tube Side Film Coefficient"
    650690        Unity(i).Tubes.HeatTransfer.htube               =       HE.TubeFilmCoeffIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Hot.Average.K,
    651         Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lpos(i));
     691        Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lz(i));
    652692       
    653693"Shell Side Prandtl Number"
     
    657697        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);
    658698
    659 
    660699"Tube Side Pressure Drop"
    661         Unity(i).Tubes.PressureDrop.PdTube              =       HE.DeltaPtubeIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Hot.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,
     700        Unity(i).Tubes.PressureDrop.PdTube              =       HE.DeltaPtubeIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Hot.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,
    662701        Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lz(i));
    663702
     
    689728       
    690729
    691 end
     730"Js Factor"     
     731        Unity(i).Shell.HeatTransfer.Js                  =       1;
     732       
     733"Ji Factor"
     734        Unity(i).Shell.HeatTransfer.Ji                  =       HE.JiFactor(Unity(i).Shell.HeatTransfer.Re);
     735
     736"Jc Factor"
     737        Unity(i).Shell.HeatTransfer.Jc                  =       HE.JcFactor();
     738       
     739"Jl Factor"
     740        Unity(i).Shell.HeatTransfer.Jl                  =       HE.JlFactor(Unity(i).Shell.HeatTransfer.Sm);
     741
     742"Jb Factor"
     743        Unity(i).Shell.HeatTransfer.Jb                  =       HE.JbFactor(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Shell.HeatTransfer.Sm);
     744
     745"Jr Factor"     
     746        Unity(i).Shell.HeatTransfer.Jr                  =       HE.JrFactor(Unity(i).Shell.HeatTransfer.Re);
     747       
     748"Total J Factor"
     749        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;
     750end
     751
     752
     753"Velocity Tube Side Inlet Nozzle"
     754        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_in       = 0;
     755
     756"Velocity Tube Side Outlet Nozzle"
     757        Unity(1).Tubes.PressureDrop.Vnozzle_out = 0;
     758       
     759"Tube Pressure Drop Inlet Nozzle"
     760        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_in      = 0;
     761
     762"Tube Pressure Drop Outlet Nozzle"
     763        Unity(1).Tubes.PressureDrop.Pdnozzle_out        = 0;
     764
     765"Velocity Shell Side Inlet Nozzle"
     766        Unity(Nb+1).Shell.PressureDrop.Vnozzle_in       = 0;
     767
     768"Velocity Shell Side Outlet Nozzle"
     769        Unity(1).Shell.PressureDrop.Vnozzle_out = 0;
     770       
     771"Shell Pressure Drop Inlet Nozzle"
     772        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_in      = 0;
     773       
     774"Shell Pressure Drop Outlet Nozzle"
     775        Unity(1).Shell.PressureDrop.Pdnozzle_out        = 0;
     776
     777"Shell Cross Flow Pressure Drop"
     778        Unity(1).Shell.PressureDrop.PdCross             = 0;
     779       
     780"Shell Cross Flow Pressure Drop"
     781        Unity(Nb+1).Shell.PressureDrop.PdCross          = 0;
     782       
     783"Shell Side Outlet Nozzle rho-V^2"
     784        Unity(1).Shell.PressureDrop.RVsquare_out = 0;
     785       
     786"Shell Side inlet Nozzle rho-V^2"
     787        Unity(Nb+1).Shell.PressureDrop.RVsquare_in = 0;
    692788
    693789SET
    694 #=====================================================================
    695 #  Set Parameters for External Object Calculation - HE
    696 #=====================================================================
     790#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     791#  Set Parameters for heatex Calculation
     792#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    697793        Sumary.Zones        = Nb+1;
    698794        Pi                              = 3.14159265;
     
    719815end
    720816
    721 Model E_Shell_NTU_Disc           
    722 #============================================================================
    723 #       Shell and Tubes Heat Exchanger In Series with 1 shell pass - LMTD Method
    724 #============================================================================
     817Model E_Shell_LMTD_Disc         
     818#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     819#       Shell and Tubes Heat Exchanger with 1 shell pass - LMTD Method
     820#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    725821PARAMETERS
    726822
    727 ext     HE              as CalcObject   (Brief="STHE Calculations",File="heatex.dll");
    728 ext PP          as CalcObject;
     823ext     HE      as CalcObject   (Brief="STHE Calculations",File="heatex.dll");
     824ext PP  as CalcObject   (Brief="External Physical Properties");
    729825side    as Integer              (Brief="Fluid Alocation",Lower=0,Upper=1);
    730 Pi                      as constant     (Brief="Pi Number",Default=3.14159265);
    731 
    732 #=====================================================================
     826Pi              as constant     (Brief="Pi Number",Default=3.14159265);
     827
     828#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    733829#       Shell Geometrical Parameters
    734 #=====================================================================
     830#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    735831Tpass                   as Integer              (Brief="Number of Tube Passes",Lower=1);
    736832Nss                             as Integer              (Brief="Number of Sealing Strips pairs",Lower=1);
     
    741837Honozzle_Shell  as length               (Brief="Height Under Shell Outlet Nozzle",Lower=10e-6);
    742838Lcf                     as length               (Brief="Bundle-to-Shell Clearance",Lower=10e-8);
    743 #=====================================================================
     839#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    744840#       Tubes Geometrical Parameters
    745 #=====================================================================
     841#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    746842Ntt                             as Integer              (Brief="Total Number of Tubes in Shell",Default=100,Lower=1);
    747843Pattern         as Integer              (Brief="Tube Layout Characteristic Angle",Lower=30);
     
    753849Donozzle_Tube   as length               (Brief="Tube Outlet Nozzle Diameter",Lower=10e-6);
    754850Dinozzle_Tube   as length               (Brief="Tube Inlett Nozzle Diameter",Lower=10e-6);
    755 #=====================================================================
     851#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    756852#       Baffles Geometrical Parameters
    757 #=====================================================================
     853#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    758854Bc                      as Integer              (Brief="Baffle Cut",Default=25,Lower=25);
    759855Nb              as Integer              (Brief="Number of Baffles",Default=4);
    760856Lcd                     as length               (Brief="Baffle-to-Shell Clearance",Lower=10e-8);
    761857Ltd                             as length               (Brief="Tube-to-Bafflehole Clearance",Lower=10e-8);
    762 #=====================================================================
     858#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    763859VARIABLES
    764860
    765 PdropNozzles    as Pdrop_Nozzles_Main;
    766 Unity(Nb+1)     as Heatex_Discretized_NTU;
     861Unity(Nb+1)     as Heatex_Discretized_LMTD;
    767862Sumary          as Profiles;
    768863
    769864CONNECTIONS
    770865
    771 Unity([1:Nb]).Outlet.Hot  to Unity([2:Nb+1]).Inlet.Hot;
     866Unity([1:Nb]).Outlet.Hot        to Unity([2:Nb+1]).Inlet.Hot;
    772867Unity([2:Nb+1]).Outlet.Cold to Unity([1:Nb]).Inlet.Cold;
    773868
    774869EQUATIONS
    775870
    776 Sumary.Thot     = Unity.Outlet.Hot.T ;
    777 Sumary.Tcold                = Unity.Outlet.Cold.T ;
    778 Sumary.Phot                 = Unity.Outlet.Hot.P ;
    779 Sumary.Pcold                = Unity.Outlet.Cold.P ;
    780 
    781 Sumary.hshellaverage            = sum(Unity.Shell.HeatTransfer.hshell)/Sumary.Zones;
    782 Sumary.htubeaverage             = sum(Unity.Tubes.HeatTransfer.htube)/Sumary.Zones;
    783 Sumary.Uaverage                 = sum(Unity.Details.U)/Sumary.Zones;
    784 Sumary.Area             = sum(Unity.Details.A);
    785 Sumary.Q                = sum(Unity.Details.Q);
    786 Sumary.Lz(1)                    = Unity(1).Baffles.Lsi;
    787 Sumary.Lz(Nb+1)                 = Unity(1).Baffles.Lso;
    788 Sumary.PdropShellTotal = sum(Unity.Shell.PressureDrop.Pdtotal)+PdropNozzles.Shell.Pdnozzle_in + PdropNozzles.Shell.Pdnozzle_out;
    789 Sumary.PdropTubesTotal = sum(Unity.Tubes.PressureDrop.Pdtotal)+PdropNozzles.Tubes.Pdnozzle_in + PdropNozzles.Tubes.Pdnozzle_out;
    790 Sumary.PdropWinTotal    = sum(Unity.Shell.PressureDrop.Pdwindow);
    791 Sumary.PdropCrossTotal = sum(Unity.Shell.PressureDrop.PdCross);
    792 Sumary.PdropEndsTotal   = sum(Unity.Shell.PressureDrop.PdEndZones);
     871"Hot Temperatures"
     872        Sumary.Thot     = Unity.Outlet.Hot.T;
     873       
     874"Cold Temperatures"
     875        Sumary.Tcold    = Unity.Outlet.Cold.T ;
     876
     877"Hot Pressures"
     878        Sumary.Phot     = Unity.Outlet.Hot.P ;
     879       
     880"Cold Pressures"
     881        Sumary.Pcold    = Unity.Outlet.Cold.P ;
     882
     883"Average Shell Side Film Coefficient"
     884        Sumary.hshellaverage            = sum(Unity.Shell.HeatTransfer.hshell)/Sumary.Zones;
     885
     886"Average Tube Side Film Coefficient"
     887        Sumary.htubeaverage             = sum(Unity.Tubes.HeatTransfer.htube)/Sumary.Zones;
     888
     889"Average Overall Heat Transfer Coefficient"
     890        Sumary.Uaverage                 = sum(Unity.Details.U)/Sumary.Zones;
     891
     892"Area Total"
     893        Sumary.Area                             = sum(Unity.Details.A);
     894
     895"Duty Total"
     896        Sumary.Q                                = sum(Unity.Details.Q);
     897
     898"Length Inlet zone"
     899        Sumary.Lz(1)                            = Unity(1).Baffles.Lsi;
     900
     901"Length Outlet zone"
     902        Sumary.Lz(Nb+1)                         = Unity(1).Baffles.Lso;
     903
     904"Total Shell Side Pressure Drop"
     905        Sumary.PdropShell                       = sum(Unity.Shell.PressureDrop.Pdtotal);
     906
     907"Total Tube Side Pressure Drop"
     908        Sumary.PdropTubes                       = sum(Unity.Tubes.PressureDrop.Pdtotal);
     909
     910"Total Tube Side Nozzles Pressure Drop"
     911        Sumary.PdropTubesNozzle         = sum(Unity.Tubes.PressureDrop.Pdnozzle_in + Unity.Tubes.PressureDrop.Pdnozzle_out);
     912
     913"Total Shell Side Nozzles Pressure Drop"
     914        Sumary.PdropShellNozzle         = sum(Unity.Shell.PressureDrop.Pdnozzle_in + Unity.Shell.PressureDrop.Pdnozzle_out);
     915
     916"Total Shell Side Window Pressure Drop"
     917        Sumary.PdropWin                         = sum(Unity.Shell.PressureDrop.Pdwindow);
     918
     919"Total Shell Side Cross Flow Pressure Drop"
     920        Sumary.PdropCross                       = sum(Unity.Shell.PressureDrop.PdCross);
     921
     922"Total Shell Side Ends Pressure Drop"
     923        Sumary.PdropEnds                        = sum(Unity.Shell.PressureDrop.PdEndZones);
    793924
    794925"Shell Side Cross Flow Area"
     
    802933       
    803934        then
    804        
     935
     936"Shell Side inlet Nozzle rho-V^2"
     937        Unity(1).Shell.PressureDrop.RVsquare_in = Unity(1).Properties.Hot.Inlet.rho*(Unity(1).Shell.PressureDrop.Vnozzle_in)^2;
     938
     939"Shell Side Outlet Nozzle rho-V^2"
     940        Unity(Nb+1).Shell.PressureDrop.RVsquare_out = Unity(Nb+1).Properties.Hot.Outlet.rho*(Unity(Nb+1).Shell.PressureDrop.Vnozzle_out)^2;
     941
     942"Shell Pressure End Zones"
     943        Unity(1).Shell.PressureDrop.PdEndZones          =       HE.DeltaPendZonesIncremental(Unity(1).Shell.HeatTransfer.Re,Unity(1).Baffles.Ls,Unity(1).Baffles.Lso,
     944        Unity(1).Baffles.Lsi,Unity(1).Properties.Hot.Inlet.Fw,Unity(1).Shell.HeatTransfer.Phi,Unity(1).Properties.Hot.Average.rho);
     945
     946"Shell Pressure End Zones"
     947        Unity(Nb+1).Shell.PressureDrop.PdEndZones       =       HE.DeltaPendZonesIncremental(Unity(Nb+1).Shell.HeatTransfer.Re,Unity(Nb+1).Baffles.Ls,Unity(Nb+1).Baffles.Lso,
     948        Unity(Nb+1).Baffles.Lsi,Unity(Nb+1).Properties.Hot.Inlet.Fw,Unity(Nb+1).Shell.HeatTransfer.Phi,Unity(Nb+1).Properties.Hot.Average.rho);
     949
    805950"Pressure Drop Tube Side Inlet Nozzle"
    806         PdropNozzles.Tubes.Pdnozzle_in  = HE.DeltaPtubeNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
     951        Unity(1).Tubes.PressureDrop.Pdnozzle_in = HE.DeltaPtubeNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
    807952
    808953"Velocity Tube Side Inlet Nozzle"
    809         PdropNozzles.Tubes.Vnozzle_in   = HE.TubeVelocityNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
     954        Unity(1).Tubes.PressureDrop.Vnozzle_in  = HE.TubeVelocityNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
    810955
    811956"Pressure Drop Tube Side Outlet Nozzle"
    812         PdropNozzles.Tubes.Pdnozzle_out = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
     957        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_out     = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
    813958
    814959"Velocity Tube Side Outlet Nozzle"
    815         PdropNozzles.Tubes.Vnozzle_out  = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
     960        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_out      = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
    816961
    817962"Shell Pressure Drop Inlet Nozzle"
    818         PdropNozzles.Shell.Pdnozzle_in  = HE.DeltaPshellNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
     963        Unity(1).Shell.PressureDrop.Pdnozzle_in = HE.DeltaPshellNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
    819964
    820965"Velocity Shell Side Inlet Nozzle"
    821         PdropNozzles.Shell.Vnozzle_in   = HE.ShellVelocityNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
     966        Unity(1).Shell.PressureDrop.Vnozzle_in  = HE.ShellVelocityNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
    822967
    823968"Shell Pressure Drop Outlet Nozzle"
    824         PdropNozzles.Shell.Pdnozzle_out =HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
     969        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_out     =HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
    825970
    826971"Velocity Shell Side Outlet Nozzle"
    827         PdropNozzles.Shell.Vnozzle_out  =HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
    828        
    829 "Pressure Drop Hot Stream"
    830         Unity(1).Outlet.Hot.P  = Unity(1).Inlet.Hot.P - Unity(1).Shell.PressureDrop.Pdtotal - PdropNozzles.Shell.Pdnozzle_in;   
    831         Unity(Nb+1).Outlet.Hot.P  = Unity(Nb+1).Inlet.Hot.P - Unity(Nb+1).Shell.PressureDrop.Pdtotal - PdropNozzles.Shell.Pdnozzle_out;
    832 
    833 "Pressure Drop Cold Stream"
    834         Unity(1).Outlet.Cold.P  = Unity(1).Inlet.Cold.P - Unity(1).Tubes.PressureDrop.Pdtotal - PdropNozzles.Tubes.Pdnozzle_in;
    835         Unity(Nb+1).Outlet.Cold.P  = Unity(Nb+1).Inlet.Cold.P - Unity(Nb+1).Tubes.PressureDrop.Pdtotal - PdropNozzles.Tubes.Pdnozzle_out;
    836 
     972        Unity(Nb+1).Shell.PressureDrop.Vnozzle_out      =HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
     973       
    837974
    838975        else
    839976
     977"Shell Side inlet Nozzle rho-V^2"
     978        Unity(1).Shell.PressureDrop.RVsquare_in = Unity(1).Properties.Cold.Inlet.rho*(Unity(1).Shell.PressureDrop.Vnozzle_in)^2;
     979
     980"Shell Side Outlet Nozzle rho-V^2"
     981        Unity(Nb+1).Shell.PressureDrop.RVsquare_out = Unity(Nb+1).Properties.Cold.Outlet.rho*(Unity(Nb+1).Shell.PressureDrop.Vnozzle_out)^2;
     982
     983"Shell Pressure End Zones"
     984        Unity(1).Shell.PressureDrop.PdEndZones          =       HE.DeltaPendZonesIncremental(Unity(1).Shell.HeatTransfer.Re,Unity(1).Baffles.Ls,Unity(1).Baffles.Lso,
     985        Unity(1).Baffles.Lsi,Unity(1).Properties.Cold.Inlet.Fw,Unity(1).Shell.HeatTransfer.Phi,Unity(1).Properties.Cold.Average.rho);
     986
     987"Shell Pressure End Zones"
     988        Unity(Nb+1).Shell.PressureDrop.PdEndZones       =       HE.DeltaPendZonesIncremental(Unity(Nb+1).Shell.HeatTransfer.Re,Unity(Nb+1).Baffles.Ls,Unity(Nb+1).Baffles.Lso,
     989        Unity(Nb+1).Baffles.Lsi,Unity(Nb+1).Properties.Cold.Inlet.Fw,Unity(Nb+1).Shell.HeatTransfer.Phi,Unity(Nb+1).Properties.Cold.Average.rho);
     990
     991
    840992"Pressure Drop Tube Side Inlet Nozzle"
    841         PdropNozzles.Tubes.Pdnozzle_in  = HE.DeltaPtubeNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
     993        Unity(1).Tubes.PressureDrop.Pdnozzle_in = HE.DeltaPtubeNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
    842994
    843995"Velocity Tube Side Inlet Nozzle"
    844         PdropNozzles.Tubes.Vnozzle_in   = HE.TubeVelocityNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
     996        Unity(1).Tubes.PressureDrop.Vnozzle_in  = HE.TubeVelocityNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
    845997
    846998"Pressure Drop Tube Side Outlet Nozzle"
    847         PdropNozzles.Tubes.Pdnozzle_out = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);   
     999        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_out     = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);   
    8481000
    8491001"Velocity Tube Side Outlet Nozzle"
    850         PdropNozzles.Tubes.Vnozzle_out  = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw); 
     1002        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_out      = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw); 
    8511003
    8521004"Shell Pressure Drop Inlet Nozzle"
    853         PdropNozzles.Shell.Pdnozzle_in  = HE.DeltaPshellNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
     1005        Unity(1).Shell.PressureDrop.Pdnozzle_in = HE.DeltaPshellNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
    8541006
    8551007"Velocity Shell Side Inlet Nozzle"
    856         PdropNozzles.Shell.Vnozzle_in   = HE.ShellVelocityNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
     1008        Unity(1).Shell.PressureDrop.Vnozzle_in  = HE.ShellVelocityNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
    8571009
    8581010"Shell Pressure Drop Outlet Nozzle"
    859         PdropNozzles.Shell.Pdnozzle_out = HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
     1011        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_out = HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
    8601012
    8611013"Velocity Shell Side Outlet Nozzle"
    862         PdropNozzles.Shell.Vnozzle_out  = HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
    863 
    864 "Pressure Drop Hot Stream"
    865         Unity(1).Outlet.Hot.P  = Unity(1).Inlet.Hot.P- Unity(1).Tubes.PressureDrop.Pdtotal - PdropNozzles.Tubes.Pdnozzle_in;   
    866         Unity(Nb+1).Outlet.Hot.P  = Unity(Nb+1).Inlet.Hot.P- Unity(Nb+1).Tubes.PressureDrop.Pdtotal - PdropNozzles.Tubes.Pdnozzle_out; 
    867        
    868 "Pressure Drop Cold Stream"
    869         Unity(1).Outlet.Cold.P  = Unity(1).Inlet.Cold.P - Unity(1).Shell.PressureDrop.Pdtotal- PdropNozzles.Shell.Pdnozzle_in;
    870         Unity(Nb+1).Outlet.Cold.P  = Unity(Nb+1).Inlet.Cold.P - Unity(Nb+1).Shell.PressureDrop.Pdtotal- PdropNozzles.Shell.Pdnozzle_out;
     1014        Unity(Nb+1).Shell.PressureDrop.Vnozzle_out  = HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
    8711015
    8721016
     
    8761020for i in [2:Nb]
    8771021
    878 
     1022"Pressure Drop Tube Side Inlet Nozzle"
     1023        Unity(i).Tubes.PressureDrop.Pdnozzle_in = 0;
     1024
     1025"Velocity Tube Side Inlet Nozzle"
     1026        Unity(i).Tubes.PressureDrop.Vnozzle_in  = 0;
     1027
     1028"Pressure Drop Tube Side Outlet Nozzle"
     1029        Unity(i).Tubes.PressureDrop.Pdnozzle_out        = 0;   
     1030
     1031"Velocity Tube Side Outlet Nozzle"
     1032        Unity(i).Tubes.PressureDrop.Vnozzle_out = 0;   
     1033
     1034"Shell Pressure Drop Inlet Nozzle"
     1035        Unity(i).Shell.PressureDrop.Pdnozzle_in = 0;
     1036
     1037"Velocity Shell Side Inlet Nozzle"
     1038        Unity(i).Shell.PressureDrop.Vnozzle_in  = 0;
     1039
     1040"Shell Pressure Drop Outlet Nozzle"
     1041        Unity(i).Shell.PressureDrop.Pdnozzle_out = 0;
     1042
     1043"Velocity Shell Side Outlet Nozzle"
     1044        Unity(i).Shell.PressureDrop.Vnozzle_out  = 0;
     1045
     1046"Shell Pressure End Zones"
     1047        Unity(i).Shell.PressureDrop.PdEndZones          =       0;
     1048
     1049"Shell Side Outlet Nozzle rho-V^2"
     1050        Unity(i).Shell.PressureDrop.RVsquare_out = 0;
     1051       
     1052"Shell Side inlet Nozzle rho-V^2"
     1053        Unity(i).Shell.PressureDrop.RVsquare_in = 0;
     1054       
    8791055if side equal 1
    8801056       
    8811057        then
    8821058       
     1059"Shell Pressure Drop Cross Flow"
     1060        Unity(i).Shell.PressureDrop.PdCross             =       HE.DeltaPcrossIncremental(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Hot.Average.rho);
     1061
     1062
     1063        else
     1064
     1065"Shell Pressure Drop Cross Flow"
     1066        Unity(i).Shell.PressureDrop.PdCross     =       HE.DeltaPcrossIncremental(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Cold.Average.rho);
     1067
     1068
     1069end
     1070
     1071"Zone Length"
     1072        Sumary.Lz(i) = Unity(1).Baffles.Ls;
     1073
     1074"Shell Side Cross Flow Area"
     1075        Unity(i).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(i).Baffles.Ls);
     1076       
     1077end
     1078
     1079
     1080for i in [1:Nb+1]
     1081       
     1082if side equal 1
     1083       
     1084        then
    8831085"Pressure Drop Hot Stream"
    8841086        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P - Unity(i).Shell.PressureDrop.Pdtotal;   
     
    8861088"Pressure Drop Cold Stream"
    8871089        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Tubes.PressureDrop.Pdtotal;
    888 
    889 
    890         else
    891 
    892 "Pressure Drop Hot Stream"
    893         Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P- Unity(i).Tubes.PressureDrop.Pdtotal;     
    894        
    895 "Pressure Drop Cold Stream"
    896         Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Shell.PressureDrop.Pdtotal;
    897 
    898 
    899 end
    900 
    901 Sumary.Lz(i) = Unity(1).Baffles.Ls;
    902 
    903 "Shell Side Cross Flow Area"
    904         Unity(i).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(i).Baffles.Ls);
    905        
    906 end
    907 
    908 
    909 for i in [1:Nb+1]
    910        
    911 if side equal 1
    912        
    913         then
    914 
     1090       
    9151091"Shell Side Reynolds Number"
    9161092        Unity(i).Shell.HeatTransfer.Re                          =       HE.ShellReynoldsNumber(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Hot.Average.Mu);
     
    9191095        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);
    9201096
    921 "Shell Pressure Drop Cross Flow"
    922         Unity(i).Shell.PressureDrop.PdCross             =       HE.DeltaPcrossIncremental(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Hot.Average.rho);
    9231097
    9241098"Shell Pressure Baffle Window"
    9251099        Unity(i).Shell.PressureDrop.Pdwindow            =       HE.DeltaPwindowIncremental(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Hot.Average.rho,Unity(i).Properties.Hot.Average.Mu,Unity(i).Baffles.Ls);
    9261100
    927 "Shell Pressure End Zones"
    928         Unity(i).Shell.PressureDrop.PdEndZones          =       HE.DeltaPendZonesIncremental(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Hot.Average.rho);
    929 
    930 "Wall Temperature"
    931 #       Tubes.HeatTransfer.Twall  = HE.WallTemperature(Properties.Hot.Average.T,Properties.Cold.Average.T,Tubes.HeatTransfer.htube,Shell.HeatTransfer.hshell);
    932        
     1101"Hot Wall Temperature"
    9331102        Unity(i).Properties.Hot.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    9341103       
     1104"Cold Wall Temperature"
    9351105        Unity(i).Properties.Cold.Wall.Twall =   (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    9361106
     
    9491119"Tube Side Film Coefficient"
    9501120        Unity(i).Tubes.HeatTransfer.htube       =       HE.TubeFilmCoeffIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Cold.Average.K,
    951         Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lpos(i));
     1121        Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lz(i));
    9521122       
    9531123"Shell Side Prandtl Number"
     
    9691139        else
    9701140
     1141"Pressure Drop Hot Stream"
     1142        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P- Unity(i).Tubes.PressureDrop.Pdtotal;     
     1143       
     1144"Pressure Drop Cold Stream"
     1145        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Shell.PressureDrop.Pdtotal;
     1146       
    9711147"Shell Side Reynolds Number"
    9721148        Unity(i).Shell.HeatTransfer.Re                  =       HE.ShellReynoldsNumber(Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Cold.Average.Mu);
    9731149
    9741150"Shell Heat Transfer Coefficient"
    975         Unity(i).Shell.HeatTransfer.hshell              =       HE.ShellFilmCoeff(Unity(i).Shell.HeatTransfer.Ji,Unity(i).Properties.Cold.Average.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Shell.HeatTransfer.PR,Unity(i).Shell.HeatTransfer.Jtotal,Unity(i).Shell.HeatTransfer.Phi);
    976 
    977 "Shell Pressure Drop Cross Flow"
    978         Unity(i).Shell.PressureDrop.PdCross     =       HE.DeltaPcrossIncremental(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Cold.Average.rho);
     1151        Unity(i).Shell.HeatTransfer.hshell              =       HE.ShellFilmCoeff(Unity(i).Shell.HeatTransfer.Ji,Unity(i).Properties.Cold.Average.Cp,Unity(i).Properties.Cold.Average.Mw,
     1152        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);
     1153
    9791154
    9801155"Shell Pressure Baffle Window"
    9811156        Unity(i).Shell.PressureDrop.Pdwindow    =       HE.DeltaPwindowIncremental(Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Cold.Average.rho,Unity(i).Properties.Cold.Average.Mu,Unity(i).Baffles.Ls);
    9821157
    983 "Shell Pressure End Zones"
    984         Unity(i).Shell.PressureDrop.PdEndZones  =       HE.DeltaPendZonesIncremental(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Cold.Average.rho);
    985 
    986 "Wall Temperature"
    987 #       Tubes.HeatTransfer.Twall = HE.WallTemperature(Properties.Cold.Average.T,Properties.Hot.Average.T,Tubes.HeatTransfer.htube,Shell.HeatTransfer.hshell);
    988        
     1158
     1159"Hot Wall Temperature"
    9891160        Unity(i).Properties.Hot.Wall.Twall      =       (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    9901161       
     1162"Cold Wall Temperature"
    9911163        Unity(i).Properties.Cold.Wall.Twall     =       (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    9921164
     
    10061178"Tube Side Film Coefficient"
    10071179        Unity(i).Tubes.HeatTransfer.htube               =       HE.TubeFilmCoeffIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Hot.Average.K,
    1008         Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lpos(i));
     1180        Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lz(i));
    10091181       
    10101182"Shell Side Prandtl Number"
     
    10261198end
    10271199
    1028 "Position for discretization"
    1029         Sumary.Lpos(i)                                                  =       sum(Sumary.Lz([1:i]));
    1030 
    10311200"Tube Resistance"       
    10321201        Unity(i).Resistances.Rtube*(Unity(i).Tubes.HeatTransfer.htube*Ditube) = Dotube;
     
    10461215"Baffles Spacing"
    10471216        Ltube = Unity(i).Baffles.Lsi+Unity(i).Baffles.Lso+Unity(i).Baffles.Ls*(Nb-1);
    1048        
    10491217
    10501218"Js Factor"     
    1051         Unity(i).Shell.HeatTransfer.Js                  =       HE.JsFactor(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Lsi,Unity(i).Baffles.Lso,Unity(i).Baffles.Ls);
     1219        Unity(i).Shell.HeatTransfer.Js                  =       1;
    10521220
    10531221"Ji Factor"
     
    10681236"Total J Factor"
    10691237        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;
    1070 
    1071 end
    1072 
     1238end
     1239
     1240"Velocity Tube Side Inlet Nozzle"
     1241        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_in       = 0;
     1242
     1243"Velocity Tube Side Outlet Nozzle"
     1244        Unity(1).Tubes.PressureDrop.Vnozzle_out = 0;
     1245       
     1246"Tube Pressure Drop Inlet Nozzle"
     1247        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_in      = 0;
     1248
     1249"Tube Pressure Drop Outlet Nozzle"
     1250        Unity(1).Tubes.PressureDrop.Pdnozzle_out        = 0;
     1251
     1252"Velocity Shell Side Inlet Nozzle"
     1253        Unity(Nb+1).Shell.PressureDrop.Vnozzle_in       = 0;
     1254
     1255"Velocity Shell Side Outlet Nozzle"
     1256        Unity(1).Shell.PressureDrop.Vnozzle_out = 0;
     1257       
     1258"Shell Pressure Drop Inlet Nozzle"
     1259        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_in      = 0;
     1260       
     1261"Shell Pressure Drop Outlet Nozzle"
     1262        Unity(1).Shell.PressureDrop.Pdnozzle_out        = 0;
     1263
     1264"Shell Cross Flow Pressure Drop"
     1265        Unity(1).Shell.PressureDrop.PdCross             = 0;
     1266       
     1267"Shell Cross Flow Pressure Drop"
     1268        Unity(Nb+1).Shell.PressureDrop.PdCross          = 0;
     1269       
     1270"Shell Side Outlet Nozzle rho-V^2"
     1271        Unity(1).Shell.PressureDrop.RVsquare_out = 0;
     1272       
     1273"Shell Side inlet Nozzle rho-V^2"
     1274        Unity(Nb+1).Shell.PressureDrop.RVsquare_in = 0;
    10731275
    10741276SET
    1075 #=====================================================================
     1277#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    10761278#  Set Parameters for heatex Calculation
    1077 #=====================================================================
     1279#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    10781280        Sumary.Zones        = Nb+1;
    10791281        Pi                              = 3.14159265;
  • /mso/eml/heat_exchangers/HeatExchangerSimplified.mso

    r20 r30  
    1  #*--------------------------------------------------------------------*
    2 *
    3 *
    4 *
    5 *
    6 *
    7 *
    8 *               
    9 *                                               
    10 *
    11 *
    12 *----------------------------------------------------------------------
    13 * Author: Gerson Balbueno Bicca
    14 * $Id$
    15 *--------------------------------------------------------------------*#
    16 
     1 
    172using "HEX_Engine";
    18 
    193#=====================================================================
    204#       Basic Models for Simplified Heat Exchangers
    215#=====================================================================
    22 
    236Model HeatExchangerSimplified_Basic
    24 
    257PARAMETERS
    26 
    27 ext PP      as CalcObject(Brief="External Physical Properties");
    28 ext HE      as CalcObject(Brief="STHE Calculations",File="heatex.dll");
    29 ext NComp   as Integer   (Brief="Number of Components");
    30   M(NComp)  as molweight (Brief="Component Mol Weight");
     8ext PP          as CalcObject   (Brief="External Physical Properties");
     9ext HE          as CalcObject   (Brief="STHE Calculations",File="heatex.dll");
     10ext NComp       as Integer      (Brief="Number of Components");
     11        M(NComp)        as molweight    (Brief="Component Mol Weight");
    3112       
    3213VARIABLES
     
    7152
    7253if Inlet.Cold.v equal 0
    73        
    7454        then   
    75        
    7655"Heat Capacity Cold Stream"
    7756        Properties.Cold.Average.Cp      =       PP.LiquidCp(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
    78         Properties.Cold.Inlet.Cp        =       PP.LiquidCp(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
    79         Properties.Cold.Outlet.Cp       =       PP.LiquidCp(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
     57        Properties.Cold.Inlet.Cp                =       PP.LiquidCp(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
     58        Properties.Cold.Outlet.Cp               =       PP.LiquidCp(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    8059
    8160"Mass Density Cold Stream"
    8261        Properties.Cold.Average.rho     =       PP.LiquidDensity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
    83         Properties.Cold.Inlet.rho       =       PP.LiquidDensity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
     62        Properties.Cold.Inlet.rho               =       PP.LiquidDensity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
    8463        Properties.Cold.Outlet.rho      =       PP.LiquidDensity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    8564
    8665"Viscosity Cold Stream"
    8766        Properties.Cold.Average.Mu =    PP.LiquidViscosity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
    88         Properties.Cold.Inlet.Mu =              PP.LiquidViscosity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
    89         Properties.Cold.Outlet.Mu =     PP.LiquidViscosity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
     67        Properties.Cold.Inlet.Mu                =               PP.LiquidViscosity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
     68        Properties.Cold.Outlet.Mu       =       PP.LiquidViscosity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    9069
    9170"Conductivity Cold Stream"
    92         Properties.Cold.Average.K =     PP.LiquidThermalConductivity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
    93         Properties.Cold.Inlet.K =               PP.LiquidThermalConductivity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
    94         Properties.Cold.Outlet.K =              PP.LiquidThermalConductivity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
     71        Properties.Cold.Average.K        =      PP.LiquidThermalConductivity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
     72        Properties.Cold.Inlet.K                         =               PP.LiquidThermalConductivity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
     73        Properties.Cold.Outlet.K                =               PP.LiquidThermalConductivity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    9574
    9675"Heat Capacity Cold Stream"
    97         Properties.Cold.Wall.Cp         =       PP.LiquidCp(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
     76        Properties.Cold.Wall.Cp                 =       PP.LiquidCp(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
    9877       
    9978"Viscosity Cold Stream"
     
    218197       
    219198"Heat Capacity Ratio"
    220         [Details.Cmin,Details.Cmax,Details.Cr]  = HE.HeatCapacityRatio(Details.Ch,Details.Cc);
    221 
     199
     200Details.Cmin  = min([Details.Ch,Details.Cc]);
     201Details.Cmax  = max([Details.Ch,Details.Cc]);
     202Details.Cr    = Details.Cmin/Details.Cmax;
    222203#=====================================================================
    223204#       Energy Balance
     
    307288VARIABLES
    308289
    309 LMTD                    as temp_delta   (Brief="Logarithmic Mean Temperature Difference");
    310 Fc                              as positive             (Brief="LMTD Correction Factor",Lower=0.75);
    311 MTD                             as temp_delta   (Brief="Mean Temperature Difference");
     290LMTD    as temp_delta   (Brief="Logarithmic Mean Temperature Difference",Lower=1);
     291Fc              as positive             (Brief="LMTD Correction Factor",Lower=0.5);
     292MTD             as temp_delta   (Brief="Mean Temperature Difference");
    312293
    313294EQUATIONS
    314295
    315296"Exchange Surface Area"
    316         Details.Q = Details.U*Details.A*Fc*LMTD;       
     297        Details.Q = Details.U*Details.A*MTD;   
    317298       
    318299"Mean Temperature Difference"   
     
    367348end
    368349
    369 Model Multipass_LMTD            as Heatex_Basic_LMTD
    370 #============================================================================
    371 #       Shell and Tubes Heat Exchanger In Series with 1 shell pass - LMTD Method
    372 #============================================================================
    373 PARAMETERS
    374 
    375 Nshell  as Integer      (Brief="N Shell in Series",Lower=2);
    376 
    377 EQUATIONS
    378 
    379 "Counter Flow LMTD"
    380         LMTD = HE.CounterLMTD(Inlet.Hot.T,Outlet.Hot.T,Inlet.Cold.T,Outlet.Cold.T);
    381 
    382 "LMTD Correction Factor"
    383         Fc = HE.MpassCorrectionFactor(Inlet.Hot.T,Outlet.Hot.T,Inlet.Cold.T,Outlet.Cold.T,Nshell);
    384 
    385 end
    386 
    387 
    388350#=====================================================================
    389351# NTU Method
     
    393355
    394356EQUATIONS
    395 
    396357"Effectiveness"
    397358        Eft=HE.Effectiveness(Details.Cr,Details.NTU);
     
    404365#=====================================================================
    405366EQUATIONS
    406 
    407367"TEMA E Shell Effectiveness"
    408368        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;
  • /mso/eml/heat_exchangers/Mheatex.mso

    r20 r30  
    11#*---------------------------------------------------------------------
    2 * This file is property of the author and cannot be used, copyed
    3 * or modified without permission.
     2* Model of a Multistream Heat Exchanger
    43*
    5 * Copyright (C) 2004-2006  the author
     4*       Streams:
     5*               * Inlet(Ninlet) streams ....    at least one material stream
     6*               * Outlet stream             ....        one material stream
    67*
     8*       Purpose:
     9*               * Determines thermal and phase conditions of outlet stream
    710*
    8 *               Multistream Heat Exchanger                                                     
    9 *               Cocurrent and Counter Flow
    10 
    1111*----------------------------------------------------------------------
    1212* Author: Gerson Balbueno Bicca
    1313* $Id$
    1414*--------------------------------------------------------------------*#
    15 
    1615using "streams.mso";
    1716
    1817Model Parameters
    19 #=====================================================================
    20 #       Heat Exchanger Parameters
    21 #===================================================================== 
     18#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     19#       Heat Exchanger External Parameters
     20#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    2221PARAMETERS
    2322       
    24 ext PP                  as CalcObject;
     23ext PP                  as CalcObject   (Brief="Physical Properties");
    2524ext     NComp           as Integer              (Brief="Number of Components");
    26 ext     Ncold           as Integer              (Brief="Number of Inlet Cold Streams",Lower=1,Default=1);
    27 ext     Nhot            as Integer              (Brief="Number of Inlet Hot Streams",Lower=1,Default=1);
     25ext     Ncold           as Integer              (Brief="Number of Inlet Cold Streams",Lower=1);
     26ext     Nhot            as Integer              (Brief="Number of Inlet Hot Streams",Lower=1);
    2827       
    2928end     
    3029
    3130Model Inlet_Main_Stream         as Parameters
    32 #=====================================================================
     31#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    3332#       Inlet Streams
    34 #===================================================================== 
    35 
     33#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    3634VARIABLES
    3735
     
    4240
    4341Model Outlet_Main_Stream        as Parameters
    44 #=====================================================================
     42#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    4543#       Outlet Streams
    46 #===================================================================== 
    47 
     44#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    4845VARIABLES
    4946
     
    5451
    5552Model Mheatex
    56 #=====================================================================
     53#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    5754#       Multistream Heat Exchanger Basic Calculation
    58 #=====================================================================         
     55#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    5956PARAMETERS
    6057
     
    6461SET
    6562
    66 Side = HE.FlowDirection();
     63Side = HE.FlowDir();
    6764
    6865VARIABLES
     
    104101        Q=UA*LMTD;
    105102
    106 #===================================================================
     103#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    107104#       Flow Direction
    108 #===================================================================
     105#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     106
    109107if Side equal 0
    110108       
    111109        then
    112 #=====================================================================
    113 #       Cocurrent Flow Multistream Heat Exchanger
    114 #===================================================================
    115110"Cocurrent Flow LMTD"
    116111        LMTD = HE.CocurrentLMTD(max(Inlet.Hot.T),min(Outlet.Hot.T),min(Inlet.Cold.T),max(Outlet.Cold.T));
    117112       
    118113        else
    119 #=====================================================================
    120 #       Counter Flow Multistream Heat Exchanger
    121 #=====================================================================
    122114"Counter Flow LMTD"
    123115        LMTD = HE.CounterLMTD(max(Inlet.Hot.T),min(Outlet.Hot.T),max(Inlet.Cold.T),min(Outlet.Cold.T));
  • /mso/eml/heat_exchangers/heater.mso

    r20 r30  
    11#*---------------------------------------------------------------------
    2 * This file is property of the author and cannot be used, copyed
    3 * or modified without permission.
     2* Model of a Heater and Cooler
    43*
    5 * Copyright (C) 2004-2005  the author
     4*       Streams:
     5*               * Inlet(Ninlet) streams ....    at least one material stream
     6*               * Outlet stream             ....        one material stream
    67*
    7 *
    8 *                                       Heater and Cooler                                                       
    9 *
     8*       Purpose:
     9*               * Determines thermal and phase conditions of outlet stream
    1010*
    1111*----------------------------------------------------------------------
     
    1414*--------------------------------------------------------------------*#
    1515
    16 
    1716using "streams.mso";
    1817
    1918Model Heater_Cooler_Basic
    20 #=====================================================================
     19       
     20#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    2121#       Heater or Cooler Basic Equations
    22 #=====================================================================         
     22#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#   
    2323PARAMETERS
    2424        ext PP                  as CalcObject   (Brief="Physical Properties");
     
    3030        out Outlet              as stream_therm;#(Brief="Outlet Stream")
    3131        Q                               as power                (Brief="Heat Transfer");
     32        Vfrac                           as fraction     (Brief = "Vapor fraction Outlet Stream");
     33        Lfrac                           as fraction     (Brief = "Liquid fraction Outlet Stream");
    3234       
    3335EQUATIONS
     
    4547
    4648"Outlet Vapourisation Fraction"
    47         Outlet.v = PP.VapourFraction(Outlet.T,Outlet.P,Outlet.z);       
     49        Outlet.v = PP.VapourFraction(Outlet.T,Outlet.P,Outlet.z);
     50
     51"Vapor fraction Outlet Stream"
     52        Vfrac = Outlet.v;
     53
     54"Liquid fraction Outlet Stream"
     55        Lfrac = 1-Vfrac;
    4856       
    4957end
    5058
    5159Model Heater            as Heater_Cooler_Basic
    52 #=====================================================================
    53 #       Heater
    54 #=====================================================================
     60
    5561EQUATIONS
    5662
     
    6167
    6268Model Cooler            as Heater_Cooler_Basic
    63 #=====================================================================
    64 #       Cooler
    65 #=====================================================================
     69
    6670EQUATIONS
    6771
  • /mso/eml/types.mso

    r20 r30  
    5252# Eletric
    5353current     as positive (Brief = "Electrical Current", Default=10, Upper=1e12, Unit ="A");
    54 charge      as Real (Brief = "Electrical Charge", Default=10, Upper=1e12, Lower=-1e12, Unit ="C");
     54charge      as Real (Brief = "Electrical Charge", Default=10, Lower=-1e12, Upper=1e12, Unit ="C");
    5555capacitance as positive (Brief = "Electrical Capacitance", Default=10, Upper=1e12, Unit ="F");
    5656indutance   as positive (Brief = "Electrical Indutance", Default=10, Upper=1e12, Unit ="V*s/A");
     
    131131flow_vol as positive (Brief = "Volumetric Flow", Default=1, Upper=1e12, Unit = "m^3/h");
    132132flow_vol_delta as flow_vol (Brief = "Difference of Volumetric Flow", Lower=-1e12);
    133 flow_mol as positive (Brief = "Mole Flow", Default=10, Lower=-1e-6, Upper=1e8, Unit = "kmol/h");
     133flow_mol as positive (Brief = "Mole Flow", Default=10, Upper=1e8, Unit = "kmol/h");
    134134
    135135flow_mol_delta as flow_mol (Brief = "Difference of Mole Flow", Lower=-1e8);
  • /mso/sample/controllers/CSTR_noniso_pid.mso

    r20 r30  
    160160        OPTIONS
    161161        time = [0:0.1:1 1:1:100] * "h";
    162         outputLevel = "high";
    163162end
  • /mso/sample/controllers/Sample_flash_pid.mso

    r20 r30  
    151151        OPTIONS
    152152        relativeAccuracy = 1e-6;
    153         outputLevel = "medium";
    154153        time = [0:100:7000 7000:0.10:8150 8150:100:10000];
    155154end
  • /mso/sample/controllers/sample_tanks_pid.mso

    r20 r30  
    6161
    6262        #Perturbação regulatória
    63         if time<10*"h"
     63        if time<10*"h" then
    6464                Tanque1.Fin= 3*"m^3/h";
    6565        else
     
    7373        OPTIONS
    7474        time = [0:0.1:30] * "h" ;
    75         outputLevel = "medium";
    7675end
    7776
     
    117116
    118117        #Perturbação regulatória
    119         if time<10*"h"
     118        if time<10*"h" then
    120119                Tanque1.Fin= 3*"m^3/h";
    121120        else
     
    129128        OPTIONS
    130129        time = [0:0.1:30] * "h" ;
    131         outputLevel = "medium";
    132130end
    133131
  • /mso/sample/heat_exchangers/sample_cooler.mso

    r20 r30  
    5454        cooler.Outlet.T         = 70*"K";
    5555        cooler.Outlet.P         = 1 * "atm";
     56
    5657       
    5758       
     
    5960 
    6061        mode                    = "steady";
    61         outputLevel             = "all";
    6262        relativeAccuracy        = 1e-8;
    63        
    6463       
    6564end
  • /mso/sample/heat_exchangers/samples2.mso

    r20 r30  
    22using "heat_exchangers/HeatExchangerSimplified";
    33
    4  FlowSheet HeatExchanger_Multipass
     4 FlowSheet E_Shell
    55       
    66DEVICES
    77#===============================================================
    8 #   Heat Exchanger Multipasses - LMTD Method
     8#   TEMA E Shell Heat Exchanger - Shortcut LMTD Method
    99#===============================================================
    1010
    11         exchanger       as Multipass_LMTD;
     11        exchanger       as E_Shell_LMTD;
    1212        streamhot       as stream_therm;
    1313        streamcold      as stream_therm;
     
    2121
    2222        PP                      as CalcObject   (File="vrpp.dll");
     23        HE                      as CalcObject   (File="heatex.dll");
    2324        NComp   as Integer;
    24         HE              as CalcObject   (File="Heatex.dll");
     25       
    2526SET
    2627#===============================================================
    27 #   Components - State Equation - Nshell in series
     28#   Components - State Equation
    2829#===============================================================
    2930       
     
    3233        PP.Components           = ["water"];
    3334        NComp                           = PP.NumberOfComponents;
    34         exchanger.Nshell    = 2;
    3535       
    3636SPECIFY
     
    5858        exchanger.Details.A                     = 65    *"m^2";
    5959        exchanger.Details.U                 = 0.74  *"W/m^2/K";
    60         exchanger.PressureDrop.Hot.Pdrop        = 0*"atm";
    61         exchanger.PressureDrop.Cold.Pdrop   = 0*"atm";
     60        exchanger.PressureDrop.Hot.Pdrop        = 0   * "atm";
     61        exchanger.PressureDrop.Cold.Pdrop       = 0   * "atm";
    6262OPTIONS
    6363#============================================
  • /mso/sample/miscellaneous/sample_pend.mso

    r20 r30  
    6464        time = [0:0.1:30];
    6565        integration = "original"; # original, index0 or index1
    66         outputLevel = "high";
    6766        accuracyType = "scalar"; # scalar or vector     
    68         relativeAccuracy = 1e-7;
     67        relativeAccuracy = 1e-8;
    6968        absoluteAccuracy = 1e-9;
    7069        indVarAccuracy = 1e-3;
  • /mso/tutorial/ThreeTank1.mso

    r20 r30  
    1515*-------------------------------------------------------------------*#
    1616
    17 using "tanks";
     17using "stage_separators/tank";
    1818
    1919FlowSheet ThreeTank
  • /mso/tutorial/ThreeTank2.mso

    r20 r30  
    1515*-------------------------------------------------------------------*#
    1616
    17 using "tanks";
     17using "stage_separators/tank";
    1818
    1919FlowSheet ThreeTank
  • /mso/tutorial/ThreeTank3.mso

    r20 r30  
    1515*-------------------------------------------------------------------*#
    1616
    17 using "tanks";
     17using "stage_separators/tank";
    1818
    1919FlowSheet ThreeTank
Note: See TracChangeset for help on using the changeset viewer.