Changes in / [25:49]


Ignore:
Location:
/mso
Files:
29 added
4 deleted
56 edited

Legend:

Unmodified
Added
Removed
  • /mso/eml/controllers/lead_lag.mso

    r25 r49  
    3939
    4040        INITIAL
    41         diff(aux)=0;
     41        diff(aux)= 0 * "1/s";
    4242       
    4343end
  • /mso/eml/heat_exchangers/HEX_Engine.mso

    r25 r49  
    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);
     139"Total Pressure Drop"
     140        Pdtotal = PdTube + Pdnozzle_in + Pdnozzle_out;
     141
     142end
     143
     144Model Tube_Heat_Transfer
     145#=====================================================================
     146#       Tube Side Heat Transfer Block
     147#===================================================================== 
     148VARIABLES
     149Re        as positive             (Brief="Tube Side Reynolds Number",Default=1000,Lower=1);
     150htube as heat_trans_coeff (Brief="Tube Side Film Coefficient",Default=1,Lower=1e-12, Upper=1e6);
     151PR        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);
     153Phi   as positive                 (Brief="Phi Correction",Default=1,Lower=1e-3);
     154Vtube as velocity                 (Brief="Tube Side Velocity",Lower=1e-8);
     155end
     156
     157Model Shell_Pdrop
     158#=====================================================================
     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");
    145172
    146173EQUATIONS
    147174
    148 Pdtotal = PdTube;
    149 
    150 end
    151 
    152 Model Tube_Heat_Transfer
    153 #=====================================================================
    154 #       Pressure Drop block
    155 #===================================================================== 
    156 VARIABLES
    157 Re                      as positive                     (Brief="Tube Side Reynolds Number",Default=1000,Lower=1);
    158 htube           as heat_trans_coeff     (Brief="Tube Side Film Coefficient",Default=1,Lower=1e-12, Upper=1e6);
    159 PR                      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);
    161 Phi             as positive                     (Brief="Phi Correction",Default=1,Lower=1e-3);
    162 Vtube           as velocity                     (Brief="Tube Side Velocity",Lower=1e-8);
    163 
    164 
    165 end
    166 
    167 Model Shell_Pdrop
    168 #=====================================================================
    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);
    181 
    182 EQUATIONS
    183 
    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

    r25 r49  
    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 #=====================================================================
    20 #       Basic Model for Detailed Heat Exchangers
    21 #=====================================================================
     9#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     10#       Basic Model for Detailed Shell and Tubes Heat Exchangers
     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 NComp       as Integer      (Brief="Number of Components");
     19        HE              as CalcObject   (Brief="STHE Calculations",File="heatex");
     20        M(NComp)        as molweight    (Brief="Component Mol Weight");
    3121       
    3222VARIABLES
    3323
    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;
     24in  Inlet               as Inlet_Main_Stream;   
     25out Outlet              as Outlet_Main_Stream; 
     26        Properties      as Main_Properties;             
     27        Details                 as Details_Main;
     28        Tubes                   as Tube_Side_Main;     
     29        Shell                   as Shell_Side_Main;
     30        Resistances     as Main_Resistances;
     31        Baffles         as Baffles_Main;
    4232
    4333SET
    44 
    45 M   = PP.MolecularWeight();
     34        M   = PP.MolecularWeight();
    4635
    4736EQUATIONS
     37
     38#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     39#                                               Properties                                                                      #
     40#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    4841
    4942"Hot Stream Average Temperature"
     
    7063        then   
    7164       
    72 "Heat Capacity Cold Stream"
     65"Cold Stream Average Heat Capacity"
    7366        Properties.Cold.Average.Cp      =       PP.LiquidCp(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
     67
     68"Cold Stream Inlet Heat Capacity"
    7469        Properties.Cold.Inlet.Cp        =       PP.LiquidCp(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
     70
     71"Cold Stream Outlet Heat Capacity"
    7572        Properties.Cold.Outlet.Cp       =       PP.LiquidCp(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    7673
    77 "Mass Density Cold Stream"
    78         Properties.Cold.Average.rho     =       PP.LiquidDensity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
     74"Cold Stream Average Mass Density"
     75        Properties.Cold.Average.rho =   PP.LiquidDensity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
     76
     77"Cold Stream Inlet Mass Density"
    7978        Properties.Cold.Inlet.rho       =       PP.LiquidDensity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
     79
     80"Cold Stream Outlet Mass Density"
    8081        Properties.Cold.Outlet.rho      =       PP.LiquidDensity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    8182
    82 "Viscosity Cold Stream"
    83         Properties.Cold.Average.Mu =    PP.LiquidViscosity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
    84         Properties.Cold.Inlet.Mu =              PP.LiquidViscosity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
    85         Properties.Cold.Outlet.Mu =     PP.LiquidViscosity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    86 
    87 "Conductivity Cold Stream"
    88         Properties.Cold.Average.K =     PP.LiquidThermalConductivity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
    89         Properties.Cold.Inlet.K =               PP.LiquidThermalConductivity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
    90         Properties.Cold.Outlet.K =              PP.LiquidThermalConductivity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    91 
    92 "Heat Capacity Cold Stream"
     83"Cold Stream Average Viscosity"
     84        Properties.Cold.Average.Mu      =       PP.LiquidViscosity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
     85
     86"Cold Stream inlet Viscosity"
     87        Properties.Cold.Inlet.Mu        =       PP.LiquidViscosity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
     88       
     89"Cold Stream Outlet Viscosity"
     90        Properties.Cold.Outlet.Mu       =       PP.LiquidViscosity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
     91
     92"Cold Stream Average Conductivity"
     93        Properties.Cold.Average.K       =       PP.LiquidThermalConductivity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
     94
     95"Cold Stream Inlet Conductivity"       
     96        Properties.Cold.Inlet.K         =       PP.LiquidThermalConductivity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
     97
     98"Cold Stream Outlet Conductivity"
     99        Properties.Cold.Outlet.K        =       PP.LiquidThermalConductivity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
     100
     101"Cold Stream Heat Capacity at Wall Temperature"
    93102        Properties.Cold.Wall.Cp         =       PP.LiquidCp(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
    94103       
    95 "Viscosity Cold Stream"
    96         Properties.Cold.Wall.Mu =       PP.LiquidViscosity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
    97 
    98 "Conductivity Cold Stream"
    99         Properties.Cold.Wall.K =        PP.LiquidThermalConductivity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
    100 
    101 
    102         else
    103 
    104 "Heat Capacity Cold Stream"
     104"Cold Stream Viscosity at Wall Temperature"
     105        Properties.Cold.Wall.Mu         =       PP.LiquidViscosity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
     106
     107"Cold Stream Conductivity at Wall Temperature"
     108        Properties.Cold.Wall.K          =       PP.LiquidThermalConductivity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
     109
     110
     111        else
     112
     113"Cold Stream Average Heat Capacity"
    105114        Properties.Cold.Average.Cp      =       PP.VapourCp(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
     115
     116"Cold Stream Inlet Heat Capacity"       
    106117        Properties.Cold.Inlet.Cp        =       PP.VapourCp(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
     118
     119"Cold Stream Outlet Heat Capacity"     
    107120        Properties.Cold.Outlet.Cp       =       PP.VapourCp(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    108121
    109 "Mass Density Cold Stream"
    110         Properties.Cold.Average.rho     =       PP.VapourDensity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
     122"Cold Stream Average Mass Density"
     123        Properties.Cold.Average.rho =   PP.VapourDensity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
     124
     125"Cold Stream Inlet Mass Density"
    111126        Properties.Cold.Inlet.rho       =       PP.VapourDensity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
     127
     128"Cold Stream Outlet Mass Density"       
    112129        Properties.Cold.Outlet.rho      =       PP.VapourDensity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    113130
    114 "Viscosity Cold Stream"
    115         Properties.Cold.Average.Mu =    PP.VapourViscosity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
    116         Properties.Cold.Inlet.Mu =              PP.VapourViscosity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
    117         Properties.Cold.Outlet.Mu =             PP.VapourViscosity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    118 
    119 "Conductivity Cold Stream"
    120         Properties.Cold.Average.K =     PP.VapourThermalConductivity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
    121         Properties.Cold.Inlet.K =               PP.VapourThermalConductivity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
    122         Properties.Cold.Outlet.K =              PP.VapourThermalConductivity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    123        
    124 "Heat Capacity Cold Stream"
     131"Cold Stream Average Viscosity "
     132        Properties.Cold.Average.Mu      =       PP.VapourViscosity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
     133
     134"Cold Stream Inlet Viscosity " 
     135        Properties.Cold.Inlet.Mu        =       PP.VapourViscosity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
     136
     137"Cold Stream Outlet Viscosity "
     138        Properties.Cold.Outlet.Mu       =       PP.VapourViscosity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
     139
     140"Cold Stream Average Conductivity "
     141        Properties.Cold.Average.K       =       PP.VapourThermalConductivity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
     142
     143"Cold Stream Inlet Conductivity "
     144        Properties.Cold.Inlet.K         =       PP.VapourThermalConductivity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
     145
     146"Cold Stream Outlet Conductivity "
     147        Properties.Cold.Outlet.K        =       PP.VapourThermalConductivity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
     148       
     149"Cold Stream Heat Capacity at Wall Temperature"
    125150        Properties.Cold.Wall.Cp         =       PP.VapourCp(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
    126151
    127152
    128 "Viscosity Cold Stream"
    129         Properties.Cold.Wall.Mu =       PP.VapourViscosity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
    130 
    131 "Conductivity Cold Stream"
    132         Properties.Cold.Wall.K =        PP.VapourThermalConductivity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
     153"Cold Stream Viscosity at Wall Temperature"
     154        Properties.Cold.Wall.Mu         =       PP.VapourViscosity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
     155
     156"Cold Stream Conductivity at Wall Temperature"
     157        Properties.Cold.Wall.K          =       PP.VapourThermalConductivity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
    133158       
    134159       
     
    156181
    157182"Conductivity Hot Stream"
    158         Properties.Hot.Average.K        =               PP.LiquidThermalConductivity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);   
     183        Properties.Hot.Average.K        =       PP.LiquidThermalConductivity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);   
    159184        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);   
     185        Properties.Hot.Outlet.K         =       PP.LiquidThermalConductivity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);   
    161186
    162187"Heat Capacity Hot Stream"
    163         Properties.Hot.Wall.Cp  =               PP.LiquidCp(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
     188        Properties.Hot.Wall.Cp          =       PP.LiquidCp(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
    164189
    165190"Viscosity Hot Stream"
    166         Properties.Hot.Wall.Mu  =               PP.LiquidViscosity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);     
     191        Properties.Hot.Wall.Mu          =       PP.LiquidViscosity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);     
    167192
    168193"Conductivity Hot Stream"
    169         Properties.Hot.Wall.K   =               PP.LiquidThermalConductivity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);   
     194        Properties.Hot.Wall.K           =       PP.LiquidThermalConductivity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);   
    170195       
    171196
     
    188213
    189214"Conductivity Hot Stream"
    190         Properties.Hot.Average.K        =               PP.VapourThermalConductivity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);   
     215        Properties.Hot.Average.K        =       PP.VapourThermalConductivity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);   
    191216        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);   
     217        Properties.Hot.Outlet.K         =       PP.VapourThermalConductivity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);   
    193218
    194219"Heat Capacity Hot Stream"
    195         Properties.Hot.Wall.Cp  =               PP.VapourCp(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
     220        Properties.Hot.Wall.Cp  =       PP.VapourCp(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
    196221
    197222"Viscosity Hot Stream"
    198         Properties.Hot.Wall.Mu  =               PP.VapourViscosity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
     223        Properties.Hot.Wall.Mu  =       PP.VapourViscosity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
    199224
    200225"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 #=====================================================================
     226        Properties.Hot.Wall.K   =       PP.VapourThermalConductivity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);   
     227
     228
     229end
     230
     231#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     232#                                       Thermal Details                                                                 #
     233#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     234
    209235"Hot Stream Heat Capacity"
    210236        Details.Ch =Inlet.Hot.F*Properties.Hot.Average.Cp;
     
    213239        Details.Cc =Inlet.Cold.F*Properties.Cold.Average.Cp;
    214240       
     241"Minimum Heat Capacity"
     242        Details.Cmin  = min([Details.Ch,Details.Cc]);
     243       
     244"Maximum Heat Capacity"
     245        Details.Cmax  = max([Details.Ch,Details.Cc]);
     246
    215247"Heat Capacity Ratio"
    216         [Details.Cmin,Details.Cmax,Details.Cr]  = HE.HeatCapacityRatio(Details.Ch,Details.Cc);
    217 
    218 #=====================================================================
    219 #       Energy Balance
    220 #=====================================================================
     248        Details.Cr    = Details.Cmin/Details.Cmax;
     249
     250#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     251#                                       Energy Balance
     252#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     253
    221254"Energy Balance Hot Stream"
    222255        Details.Q = Inlet.Hot.F*(Inlet.Hot.h-Outlet.Hot.h);
     
    225258        Details.Q =-Inlet.Cold.F*(Inlet.Cold.h-Outlet.Cold.h);
    226259
    227 #=====================================================================
    228 #       Material Balance
    229 #=====================================================================
     260#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     261#                                       Material Balance
     262#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    230263"Flow Mass Inlet Cold Stream"
    231264        Properties.Cold.Inlet.Fw        =  sum(M*Inlet.Cold.z)*Inlet.Cold.F;
     
    246279        Inlet.Cold.F = Outlet.Cold.F;
    247280
    248 #======================================
    249 #       Constraints
    250 #======================================
     281#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     282#                                       Constraints
     283#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    251284"Hot Stream Molar Fraction Constraint"
    252285        Outlet.Hot.z=Inlet.Hot.z;
     
    260293"No Phase Change In Hot Stream"
    261294        Inlet.Hot.v=Outlet.Hot.v;
    262 
    263295       
    264296end
     
    268300PARAMETERS
    269301
    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);
     302#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     303#                               Basic  Parameters                                                                       #
     304#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     305ext PP          as CalcObject   (Brief="External Physical Properties");
     306side        as Integer          (Brief="Fluid Alocation Flag",Lower=0,Upper=1);
    273307Pi                      as constant     (Brief="Pi Number",Default=3.14159265);
    274 
    275 #=====================================================================
    276 #       Shell Geometrical Parameters
    277 #=====================================================================
     308#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     309#                               Shell Geometrical Parameters                                            #
     310#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    278311Tpass                   as Integer              (Brief="Number of Tube Passes",Lower=1);
    279312Nss                             as Integer              (Brief="Number of Sealing Strips pairs",Lower=1);
     
    284317Honozzle_Shell  as length               (Brief="Height Under Shell Outlet Nozzle",Lower=10e-6);
    285318Lcf                     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 #=====================================================================
     319
     320#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     321#                               Tubes Geometrical Parameters                                            #
     322#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     323Ntt                       as Integer            (Brief="Total Number of Tubes in Shell",Default=100,Lower=1);
     324Pattern       as Integer                (Brief="Tube Layout Characteristic Angle",Lower=30);
     325Ltube             as length                     (Brief="Effective Tube Length",Lower=0.1);
     326pitch             as length                     (Brief="Tube Pitch",Lower=1e-8);
     327Kwall             as conductivity       (Brief="Tube Wall Material Thermal Conductivity");
     328Dotube            as length                     (Brief="Tube Outside Diameter",Lower=10e-6);
     329Ditube            as length                     (Brief="Tube Inside Diameter",Lower=10e-6);
     330Donozzle_Tube as length                 (Brief="Tube Outlet Nozzle Diameter",Lower=10e-6);
     331Dinozzle_Tube as length                 (Brief="Tube Inlett Nozzle Diameter",Lower=10e-6);
     332
     333#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     334#                               Baffles Geometrical Parameters                                          #
     335#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     336Bc     as Integer (Brief="Baffle Cut",Default=25,Lower=25);
     337Nb     as Real    (Brief="Number of Baffles",Lower=1);
     338Lcd    as length  (Brief="Baffle-to-Shell Clearance",Lower=10e-8);
     339Ltd        as length  (Brief="Tube-to-Bafflehole Clearance",Lower=10e-8);
     340
     341SET
     342
     343#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     344#             Set Parameters for heatex Calculation                                     #
     345#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    519346        Pi                              = 3.14159265;
    520347        HE.Tpass                        = Tpass;
     
    540367        side                            = HE.FluidAlocation();
    541368       
     369EQUATIONS
     370
     371#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     372#                               Heat Transfer Correction Factors                                        #
     373#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     374"Ji Factor"
     375        Shell.HeatTransfer.Ji = HE.JiFactor(Shell.HeatTransfer.Re);
     376
     377"Jc Factor"
     378        Shell.HeatTransfer.Jc = HE.JcFactor();
     379       
     380"Jl Factor"
     381        Shell.HeatTransfer.Jl = HE.JlFactor(Shell.HeatTransfer.Sm);
     382
     383"Jb Factor"
     384        Shell.HeatTransfer.Jb = HE.JbFactor(Shell.HeatTransfer.Re,Baffles.Ls,Shell.HeatTransfer.Sm);
     385
     386"Jr Factor"     
     387        Shell.HeatTransfer.Jr = HE.JrFactor(Shell.HeatTransfer.Re);
     388       
     389"Total J Factor"
     390        Shell.HeatTransfer.Jtotal =     Shell.HeatTransfer.Jc*Shell.HeatTransfer.Jl*Shell.HeatTransfer.Jb*Shell.HeatTransfer.Jr*Shell.HeatTransfer.Js;
     391
     392#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     393#                                        Nozzles rho-V^2                                                                #
     394#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     395
     396if side equal 1
     397       
     398        then
     399
     400"Shell Side inlet Nozzle rho-V^2"
     401        Shell.PressureDrop.RVsquare_in = Properties.Hot.Inlet.rho*(Shell.PressureDrop.Vnozzle_in)^2;
     402
     403"Shell Side Outlet Nozzle rho-V^2"
     404        Shell.PressureDrop.RVsquare_out = Properties.Hot.Outlet.rho*(Shell.PressureDrop.Vnozzle_out)^2;
     405       
     406        else
     407       
     408"Shell Side inlet Nozzle rho-V^2"
     409        Shell.PressureDrop.RVsquare_in = Properties.Cold.Inlet.rho*(Shell.PressureDrop.Vnozzle_in)^2;
     410
     411"Shell Side Outlet Nozzle rho-V^2"
     412        Shell.PressureDrop.RVsquare_out = Properties.Cold.Outlet.rho*(Shell.PressureDrop.Vnozzle_out)^2;
     413
     414end
     415
     416#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     417#                                        Phi correction                                                                 #
     418#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     419
     420if side equal 1
     421       
     422        then
     423
     424"Shell Side Phi correction"
     425        Shell.HeatTransfer.Phi = HE.PhiCorrection(Properties.Hot.Average.Mu,Properties.Hot.Wall.Mu);
     426       
     427"Tube Side Phi correction"
     428        Tubes.HeatTransfer.Phi  = HE.PhiCorrection(Properties.Cold.Average.Mu,Properties.Cold.Wall.Mu);
     429       
     430        else
     431       
     432"Shell Side Phi correction"
     433        Shell.HeatTransfer.Phi = HE.PhiCorrection(Properties.Cold.Average.Mu,Properties.Cold.Wall.Mu);
     434       
     435"Tube Side Phi correction"
     436        Tubes.HeatTransfer.Phi  = HE.PhiCorrection(Properties.Hot.Average.Mu,Properties.Hot.Wall.Mu);
     437
     438end
     439
     440#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     441#                                                                                                                                       #
     442#                                                                                                                                       #
     443#                                                                                                                                       #
     444#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     445
     446if side equal 1
     447       
     448        then
     449       
     450"Hot Wall Temperature"
     451        Properties.Hot.Wall.Twall  = (Properties.Hot.Average.T+Properties.Cold.Average.T)/2;
     452
     453"ColdWall Temperature"
     454        Properties.Cold.Wall.Twall  = (Properties.Hot.Average.T+Properties.Cold.Average.T)/2;
     455
     456"Tube Side Velocity"
     457        Tubes.HeatTransfer.Vtube  = Properties.Cold.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Properties.Cold.Average.rho*Ntt);
     458
     459"Tube Side Reynolds Number"
     460        Tubes.HeatTransfer.Re     =     (Properties.Cold.Average.rho*Tubes.HeatTransfer.Vtube*Ditube)/Properties.Cold.Average.Mu;
     461       
     462"Tube Side Prandtl Number"
     463        Tubes.HeatTransfer.PR = ((Properties.Cold.Average.Cp/Properties.Cold.Average.Mw)*Properties.Cold.Average.Mu)/Properties.Cold.Average.K;
     464
     465"Tube Side Prandtl Number at Wall Temperature"
     466        Tubes.HeatTransfer.PRw = ((Properties.Cold.Wall.Cp/Properties.Cold.Average.Mw)*Properties.Cold.Wall.Mu)/Properties.Cold.Wall.K;
     467
     468"Tube Side Film Coefficient"
     469        Tubes.HeatTransfer.htube= HE.TubeFilmCoeff(Tubes.HeatTransfer.Re,Tubes.HeatTransfer.PR,Properties.Cold.Average.K)*Tubes.HeatTransfer.Phi;
     470
     471"Shell Side Prandtl Number"
     472        Shell.HeatTransfer.PR = ((Properties.Hot.Average.Cp/Properties.Hot.Average.Mw)*Properties.Hot.Average.Mu)/Properties.Hot.Average.K;
     473
     474"Shell Side Prandtl Number at Wall Temperature"
     475        Shell.HeatTransfer.PRw = ((Properties.Hot.Wall.Cp/Properties.Hot.Average.Mw)*Properties.Hot.Wall.Mu)/Properties.Hot.Wall.K;
     476
     477"Tube Side Pressure Drop"
     478        Tubes.PressureDrop.PdTube               = HE.DeltaPtube(Tubes.HeatTransfer.Re,Properties.Cold.Average.rho,Tubes.HeatTransfer.Vtube,Tubes.HeatTransfer.Phi);
     479
     480"Pressure Drop Tube Side Inlet Nozzle"
     481        Tubes.PressureDrop.Pdnozzle_in  = HE.DeltaPtubeNozzlein(Properties.Cold.Inlet.rho,Properties.Cold.Inlet.Fw);
     482
     483"Velocity Tube Side Inlet Nozzle"
     484        Tubes.PressureDrop.Vnozzle_in   = HE.TubeVelocityNozzlein(Properties.Cold.Inlet.rho,Properties.Cold.Inlet.Fw);
     485
     486"Pressure Drop Tube Side Outlet Nozzle"
     487        Tubes.PressureDrop.Pdnozzle_out = HE.DeltaPtubeNozzleout(Properties.Cold.Outlet.rho,Properties.Cold.Inlet.Fw);
     488
     489"Velocity Tube Side Outlet Nozzle"
     490        Tubes.PressureDrop.Vnozzle_out  = HE.TubeVelocityNozzleout(Properties.Cold.Outlet.rho,Properties.Cold.Inlet.Fw);
     491
     492"Shell Pressure Drop Inlet Nozzle"
     493        Shell.PressureDrop.Pdnozzle_in  = HE.DeltaPshellNozzleIn(Properties.Hot.Inlet.rho,Properties.Hot.Inlet.Fw);
     494
     495"Velocity Shell Side Inlet Nozzle"
     496        Shell.PressureDrop.Vnozzle_in   = HE.ShellVelocityNozzleIn(Properties.Hot.Inlet.rho,Properties.Hot.Inlet.Fw);
     497
     498"Shell Pressure Drop Outlet Nozzle"
     499        Shell.PressureDrop.Pdnozzle_out =HE.DeltaPshellNozzleOut(Properties.Hot.Outlet.rho,Properties.Hot.Inlet.Fw);
     500
     501"Velocity Shell Side Outlet Nozzle"
     502        Shell.PressureDrop.Vnozzle_out  =HE.ShellVelocityNozzleOut(Properties.Hot.Outlet.rho,Properties.Hot.Inlet.Fw);
     503
     504"Pressure Drop Hot Stream"
     505        Outlet.Hot.P  = Inlet.Hot.P- Shell.PressureDrop.Pdtotal;       
     506       
     507"Pressure Drop Cold Stream"
     508        Outlet.Cold.P  = Inlet.Cold.P - Tubes.PressureDrop.Pdtotal;
     509
     510
     511        else
     512
     513"Hot Wall Temperature"
     514        Properties.Hot.Wall.Twall  = (Properties.Hot.Average.T+Properties.Cold.Average.T)/2;
     515
     516"Cold Wall Temperature"
     517        Properties.Cold.Wall.Twall  = (Properties.Hot.Average.T+Properties.Cold.Average.T)/2;
     518
     519"Tube Side Velocity"
     520        Tubes.HeatTransfer.Vtube  = Properties.Hot.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Properties.Hot.Average.rho*Ntt);
     521
     522"Tube Side Reynolds Number"
     523        Tubes.HeatTransfer.Re=(Properties.Hot.Average.rho*Tubes.HeatTransfer.Vtube*Ditube)/Properties.Hot.Average.Mu;
     524
     525"Tube Side Prandtl Number"
     526        Tubes.HeatTransfer.PR = ((Properties.Hot.Average.Cp/Properties.Hot.Average.Mw)*Properties.Hot.Average.Mu)/Properties.Hot.Average.K;
     527
     528"Tube Side Prandtl Number at Wall"
     529        Tubes.HeatTransfer.PRw = ((Properties.Hot.Wall.Cp/Properties.Hot.Average.Mw)*Properties.Hot.Wall.Mu)/Properties.Hot.Wall.K;
     530
     531"Tube Side Film Coefficient"
     532        Tubes.HeatTransfer.htube= HE.TubeFilmCoeff(Tubes.HeatTransfer.Re,Tubes.HeatTransfer.PR,Properties.Hot.Average.K)*Tubes.HeatTransfer.Phi;
     533       
     534"Shell Side Prandtl Number"
     535        Shell.HeatTransfer.PR = ((Properties.Cold.Average.Cp/Properties.Cold.Average.Mw)*Properties.Cold.Average.Mu)/Properties.Cold.Average.K;
     536
     537"Shell Side Prandtl Number at Wall"
     538        Shell.HeatTransfer.PRw=((Properties.Cold.Wall.Cp/Properties.Cold.Average.Mw)*Properties.Cold.Wall.Mu)/Properties.Cold.Wall.K;
     539
     540"Tube Side Pressure Drop"
     541        Tubes.PressureDrop.PdTube               = HE.DeltaPtube(Tubes.HeatTransfer.Re,Properties.Hot.Average.rho,Tubes.HeatTransfer.Vtube,Tubes.HeatTransfer.Phi);
     542
     543"Pressure Drop Tube Side Inlet Nozzle"
     544        Tubes.PressureDrop.Pdnozzle_in  = HE.DeltaPtubeNozzlein(Properties.Hot.Inlet.rho,Properties.Hot.Inlet.Fw);
     545
     546"Velocity Tube Side Inlet Nozzle"
     547        Tubes.PressureDrop.Vnozzle_in   = HE.TubeVelocityNozzlein(Properties.Hot.Inlet.rho,Properties.Hot.Inlet.Fw);
     548
     549"Pressure Drop Tube Side Outlet Nozzle"
     550        Tubes.PressureDrop.Pdnozzle_out = HE.DeltaPtubeNozzleout(Properties.Hot.Outlet.rho,Properties.Hot.Inlet.Fw);   
     551
     552"Velocity Tube Side Outlet Nozzle"
     553        Tubes.PressureDrop.Vnozzle_out  = HE.TubeVelocityNozzleout(Properties.Hot.Outlet.rho,Properties.Hot.Inlet.Fw); 
     554
     555"Shell Pressure Drop Inlet Nozzle"
     556        Shell.PressureDrop.Pdnozzle_in  = HE.DeltaPshellNozzleIn(Properties.Cold.Inlet.rho,Properties.Cold.Inlet.Fw);
     557
     558"Velocity Shell Side Inlet Nozzle"
     559        Shell.PressureDrop.Vnozzle_in   = HE.ShellVelocityNozzleIn(Properties.Cold.Inlet.rho,Properties.Cold.Inlet.Fw);
     560
     561"Shell Pressure Drop Outlet Nozzle"
     562        Shell.PressureDrop.Pdnozzle_out = HE.DeltaPshellNozzleOut(Properties.Cold.Outlet.rho,Properties.Cold.Inlet.Fw);
     563
     564"Velocity Shell Side Outlet Nozzle"
     565        Shell.PressureDrop.Vnozzle_out  = HE.ShellVelocityNozzleOut(Properties.Cold.Outlet.rho,Properties.Cold.Inlet.Fw);
     566
     567"Pressure Drop Hot Stream"
     568        Outlet.Hot.P  = Inlet.Hot.P- Tubes.PressureDrop.Pdtotal;       
     569       
     570"Pressure Drop Cold Stream"
     571        Outlet.Cold.P  = Inlet.Cold.P - Shell.PressureDrop.Pdtotal;
     572
     573end
     574
     575#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     576#                                               Resistances                                                                     #
     577#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     578
     579"Tube Resistance"       
     580        Resistances.Rtube*(Tubes.HeatTransfer.htube*Ditube) = Dotube;
     581       
     582"Wall Resistance"
     583        Resistances.Rwall=Dotube*ln(Dotube/Ditube)/(2*Kwall);
     584       
     585"Shell Resistance"
     586        Resistances.Rshell*(Shell.HeatTransfer.hshell)=1;
     587
     588#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     589#                                                                                                                                       #
     590#                                                                                                                                       #
     591#                                                                                                                                       #
     592#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     593
     594"Shell Side Cross Flow Area"
     595        Shell.HeatTransfer.Sm = HE.CrossFlowArea(Baffles.Ls);
     596       
     597"Overall Heat Transfer Coefficient"
     598        Details.U=1/(Dotube/(Tubes.HeatTransfer.htube*Ditube)+(Dotube*ln(Dotube/Ditube)/(2*Kwall))+(1/(Shell.HeatTransfer.hshell)));
     599
     600"Exchange Surface Area"
     601        Details.A=Pi*Dotube*Ntt*Ltube;
     602
     603"Baffles Spacing"
     604        Ltube = Baffles.Lsi+Baffles.Lso+Baffles.Ls*(Nb-1);
     605
    542606end
    543607
     
    546610VARIABLES
    547611
    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); 
     612Eft                      as positive (Brief="Effectiveness",Default=0.05,Lower=1e-8);
     613       
     614EQUATIONS
     615"Duty"
     616        Details.Q       = Eft*Details.Cmin*(Inlet.Hot.T-Inlet.Cold.T); 
    552617       
    553618end
     
    556621       
    557622VARIABLES
    558 LMTD            as temp_delta   (Brief="Logarithmic Mean Temperature Difference",Lower=5);
    559 Fc                      as positive             (Brief="LMTD Correction Factor",Lower=0.7);
    560 MTD                     as temp_delta   (Brief="Mean Temperature Difference",Lower=5);
     623DT0     as temp_delta   (Brief="Temperature Difference at Inlet",Lower=1);
     624DTL             as temp_delta   (Brief="Temperature Difference at Outlet",Lower=1);
     625LMTD    as temp_delta   (Brief="Logarithmic Mean Temperature Difference",Lower=5);
     626Fc              as positive             (Brief="LMTD Correction Factor",Lower=0.4);
     627MTD             as temp_delta   (Brief="Mean Temperature Difference",Lower=5);
    561628
    562629EQUATIONS
     630#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     631#                       Log Mean Temperature Difference
     632#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     633if abs(DT0 - DTL) > 0.05*max(abs([DT0,DTL]))
     634       
     635        then
     636"Log Mean Temperature Difference"
     637        LMTD= (DT0-DTL)/ln(DT0/DTL);
     638
     639        else
     640       
     641if DT0*DTL equal 0
     642       
     643        then
     644"Log Mean Temperature Difference"
     645        LMTD = 0.5*(DT0+DTL);
     646       
     647        else
     648"Log Mean Temperature Difference"
     649        LMTD = 0.5*(DT0+DTL)*(1-(DT0-DTL)^2/(DT0*DTL)*(1+(DT0-DTL)^2/(DT0*DTL)/2)/12);
     650       
     651end
     652       
     653end
    563654
    564655"Exchange Surface Area"
     
    566657       
    567658"Mean Temperature Difference"   
    568         MTD   = Fc*LMTD;
    569        
    570 end
    571 
     659        MTD = Fc*LMTD;
     660       
     661end
    572662
    573663Model E_Shell_NTU_Det                   as Heatex_Detailed_NTU
    574 #=====================================================================
     664#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    575665#       Shell and Tubes Heat Exchanger with 1 shell pass - LMTD Method
    576 #=====================================================================
     666#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    577667EQUATIONS
    578668
    579669"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;
     670#       Eft = 2*(1+Details.Cr+sqrt(1+Details.Cr^2)*((1+exp(-Details.NTU*sqrt(1+Details.Cr^2)))/(1-exp(-Details.NTU*sqrt(1+Details.Cr^2)))) )^-1;
     671        Eft = HE.EshellEffectiveness(Details.Cr,Details.NTU);
    581672
    582673"Js Factor"     
     
    588679       
    589680"Shell Side Reynolds Number"
    590         Shell.HeatTransfer.Re=HE.ShellReynoldsNumber(Properties.Hot.Inlet.Fw,Shell.HeatTransfer.Sm,Properties.Hot.Average.Mu);
     681        Shell.HeatTransfer.Re=(Dotube*Properties.Hot.Inlet.Fw/Shell.HeatTransfer.Sm)/Properties.Hot.Average.Mu;
    591682
    592683"Shell Heat Transfer Coefficient"
    593         Shell.HeatTransfer.hshell=HE.ShellFilmCoeff(Shell.HeatTransfer.Ji,Properties.Hot.Average.Cp,Properties.Hot.Average.Mw,Properties.Hot.Inlet.Fw,Shell.HeatTransfer.Sm,Shell.HeatTransfer.PR,Shell.HeatTransfer.Jtotal,Shell.HeatTransfer.Phi);
     684        Shell.HeatTransfer.hshell=Shell.HeatTransfer.Ji*(Properties.Hot.Average.Cp/Properties.Hot.Average.Mw)*(Properties.Hot.Inlet.Fw/Shell.HeatTransfer.Sm)*(Shell.HeatTransfer.PR^(-2/3))*Shell.HeatTransfer.Jtotal*Shell.HeatTransfer.Phi;
    594685
    595686"Shell Pressure Drop Cross Flow"
     
    606697
    607698"Shell Side Reynolds Number"
    608         Shell.HeatTransfer.Re=HE.ShellReynoldsNumber(Properties.Cold.Inlet.Fw,Shell.HeatTransfer.Sm,Properties.Cold.Average.Mu);
     699        Shell.HeatTransfer.Re=(Dotube*Properties.Cold.Inlet.Fw/Shell.HeatTransfer.Sm)/Properties.Cold.Average.Mu;
    609700
    610701"Shell Heat Transfer Coefficient"
    611         Shell.HeatTransfer.hshell=HE.ShellFilmCoeff(Shell.HeatTransfer.Ji,Properties.Cold.Average.Cp,Properties.Cold.Average.Mw,Properties.Cold.Inlet.Fw,Shell.HeatTransfer.Sm,Shell.HeatTransfer.PR,Shell.HeatTransfer.Jtotal,Shell.HeatTransfer.Phi);
     702        Shell.HeatTransfer.hshell=Shell.HeatTransfer.Ji*(Properties.Cold.Average.Cp/Properties.Cold.Average.Mw)*(Properties.Cold.Inlet.Fw/Shell.HeatTransfer.Sm)*(Shell.HeatTransfer.PR^(-2/3))*Shell.HeatTransfer.Jtotal*Shell.HeatTransfer.Phi;
    612703
    613704"Shell Pressure Drop Cross Flow"
     
    623714end
    624715
    625 
    626716end
    627717
    628718Model F_Shell_NTU_Det                   as Heatex_Detailed_NTU
    629 #=====================================================================
     719#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    630720#       Shell and Tubes Heat Exchanger with 1 shell pass - LMTD Method
    631 #=====================================================================
     721#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    632722VARIABLES
    633723
     
    650740       
    651741"Shell Side Reynolds Number"
    652         Shell.HeatTransfer.Re= HE.ShellReynoldsNumber(Properties.Hot.Inlet.Fw,Shell.HeatTransfer.Sm,Properties.Hot.Average.Mu);
     742        Shell.HeatTransfer.Re=(Dotube*Properties.Hot.Inlet.Fw/Shell.HeatTransfer.Sm)/Properties.Hot.Average.Mu;
    653743
    654744"Shell Heat Transfer Coefficient"
    655         Shell.HeatTransfer.hshell= HE.ShellFilmCoeff(Shell.HeatTransfer.Ji,Properties.Hot.Average.Cp,Properties.Hot.Average.Mw,Properties.Hot.Inlet.Fw,Shell.HeatTransfer.Sm,Shell.HeatTransfer.PR,Shell.HeatTransfer.Jtotal,Shell.HeatTransfer.Phi);
     745        Shell.HeatTransfer.hshell= Shell.HeatTransfer.Ji*(Properties.Hot.Average.Cp/Properties.Hot.Average.Mw)*(Properties.Hot.Inlet.Fw/Shell.HeatTransfer.Sm)*(Shell.HeatTransfer.PR^(-2/3))*Shell.HeatTransfer.Jtotal*Shell.HeatTransfer.Phi;
    656746
    657747"Shell Pressure Drop Cross Flow"
     
    668758
    669759"Shell Side Reynolds Number"
    670         Shell.HeatTransfer.Re=HE.ShellReynoldsNumber(Properties.Cold.Inlet.Fw,Shell.HeatTransfer.Sm,Properties.Cold.Average.Mu);
     760        Shell.HeatTransfer.Re=(Dotube*Properties.Cold.Inlet.Fw/Shell.HeatTransfer.Sm)/Properties.Cold.Average.Mu;
    671761
    672762"Shell Heat Transfer Coefficient"
    673         Shell.HeatTransfer.hshell=HE.ShellFilmCoeff(Shell.HeatTransfer.Ji,Properties.Cold.Average.Cp,Properties.Cold.Average.Mw,Properties.Cold.Inlet.Fw,Shell.HeatTransfer.Sm,Shell.HeatTransfer.PR,Shell.HeatTransfer.Jtotal,Shell.HeatTransfer.Phi);
     763        Shell.HeatTransfer.hshell=Shell.HeatTransfer.Ji*(Properties.Cold.Average.Cp/Properties.Cold.Average.Mw)*(Properties.Cold.Inlet.Fw/Shell.HeatTransfer.Sm)*(Shell.HeatTransfer.PR^(-2/3))*Shell.HeatTransfer.Jtotal*Shell.HeatTransfer.Phi;
    674764
    675765"Shell Pressure Drop Cross Flow"
     
    689779
    690780Model Multipass_NTU_Det         
    691 #============================================================================
     781#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    692782#       Shell and Tubes Heat Exchanger In Series with 1 shell pass - LMTD Method
    693 #============================================================================
     783#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    694784PARAMETERS
    695785
    696 Nshell          as Integer              (Brief="N Shell in Series",Default=2);
    697 ext     HE              as CalcObject   (Brief="STHE Calculations",File="heatex.dll");
    698 ext PP          as CalcObject;
    699 side        as Integer          (Brief="Fluid Alocation",Lower=0,Upper=1);
    700 Pi                      as constant     (Brief="Pi Number",Default=3.14159265);
    701 
    702 #=====================================================================
     786        Nshell          as Integer              (Brief="N Shell in Series",Default=2);
     787ext PP                  as CalcObject   (Brief="External Physical Properties");
     788        HE                      as CalcObject   (Brief="heatex Calculations", File="heatex");
     789        side        as Integer          (Brief="Fluid Alocation",Lower=0,Upper=1);
     790        Pi                      as constant     (Brief="Pi Number",Default=3.14159265);
     791
     792#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    703793#       Shell Geometrical Parameters
    704 #=====================================================================
     794#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    705795Tpass                   as Integer              (Brief="Number of Tube Passes",Lower=1);
    706796Nss                             as Integer              (Brief="Number of Sealing Strips pairs",Lower=1);
     
    711801Honozzle_Shell  as length               (Brief="Height Under Shell Outlet Nozzle",Lower=10e-6);
    712802Lcf                     as length               (Brief="Bundle-to-Shell Clearance",Lower=10e-8);
    713 #=====================================================================
     803#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    714804#       Tubes Geometrical Parameters
    715 #=====================================================================
     805#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    716806Ntt                             as Integer              (Brief="Total Number of Tubes in Shell",Default=100,Lower=1);
    717807Pattern         as Integer              (Brief="Tube Layout Characteristic Angle",Lower=30);
     
    723813Donozzle_Tube   as length               (Brief="Tube Outlet Nozzle Diameter",Lower=10e-6);
    724814Dinozzle_Tube   as length               (Brief="Tube Inlett Nozzle Diameter",Lower=10e-6);
    725 #=====================================================================
     815#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    726816#       Baffles Geometrical Parameters
    727 #=====================================================================
     817#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    728818Bc                      as Integer              (Brief="Baffle Cut",Default=25,Lower=25);
    729819Nb              as Real                 (Brief="Number of Baffles",Lower=1);
    730820Lcd                     as length               (Brief="Baffle-to-Shell Clearance",Lower=10e-8);
    731821Ltd                             as length               (Brief="Tube-to-Bafflehole Clearance",Lower=10e-8);
    732 #=====================================================================
     822#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    733823VARIABLES
    734824
     
    739829
    740830Unity([1:Nshell-1]).Outlet.Hot  to Unity([2:Nshell]).Inlet.Hot;
    741 Unity([2:Nshell]).Outlet.Cold to Unity([1:Nshell-1]).Inlet.Cold;
     831Unity([2:Nshell]).Outlet.Cold   to Unity([1:Nshell-1]).Inlet.Cold;
    742832
    743833EQUATIONS
     
    749839
    750840"Ji Factor"
    751         Unity(i).Shell.HeatTransfer.Ji = HE.JiFactor(Unity(i).Shell.HeatTransfer.Re);
     841        Unity(i).Shell.HeatTransfer.Ji =HE.JiFactor(Unity(i).Shell.HeatTransfer.Re);
    752842
    753843"Jc Factor"
     
    766856        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;
    767857
    768 
    769 
    770 #=====================================================================
     858#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    771859#  Fluid Alocation
    772 #=====================================================================
     860#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    773861
    774862if side equal 1 then
     
    795883        then
    796884       
    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);
     885"Hot Wall Temperature"
    799886        Unity(i).Properties.Hot.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
     887
     888"Cold Wall Temperature"
    800889        Unity(i).Properties.Cold.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    801890
    802891"Tube Side Velocity"
    803         Unity(i).Tubes.HeatTransfer.Vtube  = HE.TubeVelocity(Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Properties.Cold.Average.rho);
     892        Unity(i).Tubes.HeatTransfer.Vtube  = Unity(i).Properties.Cold.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Cold.Average.rho*Ntt);
    804893
    805894"Tube Side Reynolds Number"
    806         Unity(i).Tubes.HeatTransfer.Re = HE.TubeReynoldsNumber(Unity(i).Properties.Cold.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Properties.Cold.Average.Mu);
    807        
     895        Unity(i).Tubes.HeatTransfer.Re=(Unity(i).Properties.Cold.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Cold.Average.Mu;
     896
    808897"Tube Side Prandtl Number"
    809         Unity(i).Tubes.HeatTransfer.PR = HE.PrandtlNumber(Unity(i).Properties.Cold.Average.K,Unity(i).Properties.Cold.Average.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Average.Mu);
     898        Unity(i).Tubes.HeatTransfer.PR = ((Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Average.Mu)/Unity(i).Properties.Cold.Average.K;
    810899
    811900"Tube Side Prandtl Number at Wall Temperature"
    812         Unity(i).Tubes.HeatTransfer.PRw = HE.PrandtlNumber(Unity(i).Properties.Cold.Wall.K,Unity(i).Properties.Cold.Wall.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Wall.Mu);
    813 
     901        Unity(i).Tubes.HeatTransfer.PRw = ((Unity(i).Properties.Cold.Wall.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Wall.Mu)/Unity(i).Properties.Cold.Wall.K;
    814902
    815903"Tube Side Film Coefficient"
    816         Unity(i).Tubes.HeatTransfer.htube= HE.TubeFilmCoeff(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Cold.Average.K,Unity(i).Tubes.HeatTransfer.Phi);
     904        Unity(i).Tubes.HeatTransfer.htube= HE.TubeFilmCoeff(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Cold.Average.K)*Unity(i).Tubes.HeatTransfer.Phi;
    817905       
    818906"Shell Side Prandtl Number"
    819         Unity(i).Shell.HeatTransfer.PR=HE.PrandtlNumber(Unity(i).Properties.Hot.Average.K,Unity(i).Properties.Hot.Average.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Average.Mu);   
     907        Unity(i).Shell.HeatTransfer.PR=((Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Average.Mu)/Unity(i).Properties.Hot.Average.K
    820908
    821909"Shell Side Prandtl Number at Wall Temperature"
    822         Unity(i).Shell.HeatTransfer.PRw = HE.PrandtlNumber(Unity(i).Properties.Hot.Wall.K,Unity(i).Properties.Hot.Wall.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Wall.Mu)
     910        Unity(i).Shell.HeatTransfer.PRw = ((Unity(i).Properties.Hot.Wall.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Wall.Mu)/Unity(i).Properties.Hot.Wall.K;       
    823911
    824912"Tube Side Pressure Drop"
     
    858946        else
    859947
    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);
     948"Hot Wall Temperature"
    862949        Unity(i).Properties.Hot.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
     950
     951"Cold Wall Temperature"
    863952        Unity(i).Properties.Cold.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    864953
    865954"Tube Side Velocity"
    866         Unity(i).Tubes.HeatTransfer.Vtube       =       HE.TubeVelocity(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Properties.Hot.Average.rho);
     955        Unity(i).Tubes.HeatTransfer.Vtube  = Unity(i).Properties.Hot.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Hot.Average.rho*Ntt);
    867956
    868957"Tube Side Reynolds Number"
    869         Unity(i).Tubes.HeatTransfer.Re          =       HE.TubeReynoldsNumber(Unity(i).Properties.Hot.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Properties.Hot.Average.Mu);
     958        Unity(i).Tubes.HeatTransfer.Re          =       (Unity(i).Properties.Hot.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Hot.Average.Mu;
    870959       
    871960"Tube Side Prandtl Number"
    872         Unity(i).Tubes.HeatTransfer.PR          =       HE.PrandtlNumber(Unity(i).Properties.Hot.Average.K,Unity(i).Properties.Hot.Average.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Average.Mu);
     961        Unity(i).Tubes.HeatTransfer.PR          =       ((Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Average.Mu)/Unity(i).Properties.Hot.Average.K;
    873962       
    874963"Tube Side Prandtl Number at Wall"
    875         Unity(i).Tubes.HeatTransfer.PRw     =  HE.PrandtlNumber(Unity(i).Properties.Hot.Wall.K,Unity(i).Properties.Hot.Wall.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Wall.Mu);
    876 
     964        Unity(i).Tubes.HeatTransfer.PRw     =  ((Unity(i).Properties.Hot.Wall.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Wall.Mu)/Unity(i).Properties.Hot.Wall.K;
    877965
    878966"Tube Side Film Coefficient"
    879         Unity(i).Tubes.HeatTransfer.htube       =       HE.TubeFilmCoeff(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Hot.Average.K,Unity(i).Tubes.HeatTransfer.Phi);
     967        Unity(i).Tubes.HeatTransfer.htube       =       HE.TubeFilmCoeff(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Hot.Average.K)*Unity(i).Tubes.HeatTransfer.Phi;
    880968       
    881969"Shell Side Prandtl Number"
    882         Unity(i).Shell.HeatTransfer.PR          =       HE.PrandtlNumber(Unity(i).Properties.Cold.Average.K,Unity(i).Properties.Cold.Average.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Average.Mu);
     970        Unity(i).Shell.HeatTransfer.PR          =       ((Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Average.Mu)/Unity(i).Properties.Cold.Average.K;
    883971       
    884972"Shell Side Prandtl Number at Wall"
    885         Unity(i).Shell.HeatTransfer.PRw     =   HE.PrandtlNumber(Unity(i).Properties.Cold.Wall.K,Unity(i).Properties.Cold.Wall.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Wall.Mu);
    886 
     973        Unity(i).Shell.HeatTransfer.PRw     =   ((Unity(i).Properties.Cold.Wall.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Wall.Mu)/Unity(i).Properties.Cold.Wall.K;
    887974
    888975"Tube Side Pressure Drop"
     
    9221009end
    9231010
     1011if side equal 1
     1012       
     1013        then
     1014
     1015"Shell Side inlet Nozzle rho-V^2"
     1016        Unity(i).Shell.PressureDrop.RVsquare_in = Unity(i).Properties.Hot.Inlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_in)^2;
     1017
     1018"Shell Side Outlet Nozzle rho-V^2"
     1019        Unity(i).Shell.PressureDrop.RVsquare_out = Unity(i).Properties.Hot.Outlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_out)^2;
     1020       
     1021        else
     1022       
     1023"Shell Side inlet Nozzle rho-V^2"
     1024        Unity(i).Shell.PressureDrop.RVsquare_in = Unity(i).Properties.Cold.Inlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_in)^2;
     1025
     1026"Shell Side Outlet Nozzle rho-V^2"
     1027        Unity(i).Shell.PressureDrop.RVsquare_out = Unity(i).Properties.Cold.Outlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_out)^2;
     1028
     1029end
     1030
    9241031"Tube Resistance"       
    9251032        Unity(i).Resistances.Rtube*(Unity(i).Tubes.HeatTransfer.htube*Ditube) = Dotube;
     
    9391046"Baffles Spacing"
    9401047        Ltube = Unity(i).Baffles.Lsi+Unity(i).Baffles.Lso+Unity(i).Baffles.Ls*(Nb-1);
    941        
    9421048
    9431049"TEMA E Shell Effectiveness"
     
    9521058       
    9531059"Shell Side Reynolds Number"
    954         Unity(i).Shell.HeatTransfer.Re=HE.ShellReynoldsNumber(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Hot.Average.Mu);
     1060        Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Hot.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Hot.Average.Mu;
    9551061
    9561062"Shell Heat Transfer Coefficient"
    957         Unity(i).Shell.HeatTransfer.hshell=HE.ShellFilmCoeff(Unity(i).Shell.HeatTransfer.Ji,Unity(i).Properties.Hot.Average.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Shell.HeatTransfer.PR,Unity(i).Shell.HeatTransfer.Jtotal,Unity(i).Shell.HeatTransfer.Phi);
     1063        Unity(i).Shell.HeatTransfer.hshell=Unity(i).Shell.HeatTransfer.Ji*(Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*(Unity(i).Properties.Hot.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)*(Unity(i).Shell.HeatTransfer.PR^(-2/3))*Unity(i).Shell.HeatTransfer.Jtotal*Unity(i).Shell.HeatTransfer.Phi;
    9581064
    9591065"Shell Pressure Drop Cross Flow"
     
    9701076
    9711077"Shell Side Reynolds Number"
    972         Unity(i).Shell.HeatTransfer.Re=HE.ShellReynoldsNumber(Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Cold.Average.Mu);
     1078        Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Cold.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Cold.Average.Mu;
    9731079
    9741080"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);
     1081        Unity(i).Shell.HeatTransfer.hshell=Unity(i).Shell.HeatTransfer.Ji*(Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*(Unity(i).Properties.Cold.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)*(Unity(i).Shell.HeatTransfer.PR^(-2/3))*Unity(i).Shell.HeatTransfer.Jtotal*Unity(i).Shell.HeatTransfer.Phi;
    9761082
    9771083"Shell Pressure Drop Cross Flow"
     
    9871093end
    9881094
     1095"Duty"
    9891096        Unity(i).Details.Q      = Eft(i)*Unity(i).Details.Cmin*(Unity(i).Inlet.Hot.T-Unity(i).Inlet.Cold.T);
    9901097
     
    9921099
    9931100        SET
    994 #=====================================================================
     1101#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    9951102#  Set Parameters for heatex Calculation
    996 #=====================================================================
     1103#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    9971104        Pi                              = 3.14159265;
    9981105        HE.Tpass                        = Tpass;
     
    10211128
    10221129Model E_Shell_LMTD_Det                  as Heatex_Detailed_LMTD
    1023 #=====================================================================
     1130#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    10241131#       Shell and Tubes Heat Exchanger with 1 shell pass - LMTD Method
    1025 #=====================================================================
     1132#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    10261133EQUATIONS
    10271134
     
    10291136        Fc = HE.EshellCorrectionFactor(Inlet.Hot.T,Outlet.Hot.T,Inlet.Cold.T,Outlet.Cold.T);
    10301137
    1031 "Counter Flow LMTD"
    1032         LMTD = HE.CounterLMTD(Inlet.Hot.T,Outlet.Hot.T,Inlet.Cold.T,Outlet.Cold.T);
    1033 
     1138"Temperature Difference at Inlet"
     1139        DT0 = Inlet.Hot.T - Outlet.Cold.T;
     1140
     1141"Temperature Difference at Outlet"
     1142        DTL = Outlet.Hot.T - Inlet.Cold.T;
     1143       
    10341144"Js Factor"     
    10351145        Shell.HeatTransfer.Js = HE.JsFactor(Shell.HeatTransfer.Re,Baffles.Lsi,Baffles.Lso,Baffles.Ls);
     
    10401150       
    10411151"Shell Side Reynolds Number"
    1042         Shell.HeatTransfer.Re=HE.ShellReynoldsNumber(Properties.Hot.Inlet.Fw,Shell.HeatTransfer.Sm,Properties.Hot.Average.Mu);
     1152        Shell.HeatTransfer.Re=(Dotube*Properties.Hot.Inlet.Fw/Shell.HeatTransfer.Sm)/Properties.Hot.Average.Mu;
    10431153
    10441154"Shell Heat Transfer Coefficient"
    1045         Shell.HeatTransfer.hshell=HE.ShellFilmCoeff(Shell.HeatTransfer.Ji,Properties.Hot.Average.Cp,Properties.Hot.Average.Mw,Properties.Hot.Inlet.Fw,Shell.HeatTransfer.Sm,Shell.HeatTransfer.PR,Shell.HeatTransfer.Jtotal,Shell.HeatTransfer.Phi);
     1155        Shell.HeatTransfer.hshell=Shell.HeatTransfer.Ji*(Properties.Hot.Average.Cp/Properties.Hot.Average.Mw)*(Properties.Hot.Inlet.Fw/Shell.HeatTransfer.Sm)*(Shell.HeatTransfer.PR^(-2/3))*Shell.HeatTransfer.Jtotal*Shell.HeatTransfer.Phi;
    10461156
    10471157"Shell Pressure Drop Cross Flow"
     
    10581168
    10591169"Shell Side Reynolds Number"
    1060         Shell.HeatTransfer.Re=HE.ShellReynoldsNumber(Properties.Cold.Inlet.Fw,Shell.HeatTransfer.Sm,Properties.Cold.Average.Mu);
     1170        Shell.HeatTransfer.Re=(Dotube*Properties.Cold.Inlet.Fw/Shell.HeatTransfer.Sm)/Properties.Cold.Average.Mu;
    10611171
    10621172"Shell Heat Transfer Coefficient"
    1063         Shell.HeatTransfer.hshell=HE.ShellFilmCoeff(Shell.HeatTransfer.Ji,Properties.Cold.Average.Cp,Properties.Cold.Average.Mw,Properties.Cold.Inlet.Fw,Shell.HeatTransfer.Sm,Shell.HeatTransfer.PR,Shell.HeatTransfer.Jtotal,Shell.HeatTransfer.Phi);
     1173        Shell.HeatTransfer.hshell=Shell.HeatTransfer.Ji*(Properties.Cold.Average.Cp/Properties.Cold.Average.Mw)*(Properties.Cold.Inlet.Fw/Shell.HeatTransfer.Sm)*(Shell.HeatTransfer.PR^(-2/3))*Shell.HeatTransfer.Jtotal*Shell.HeatTransfer.Phi;
    10641174
    10651175"Shell Pressure Drop Cross Flow"
     
    10801190
    10811191Model F_Shell_LMTD_Det                  as Heatex_Detailed_LMTD
    1082 #=====================================================================
     1192#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    10831193#       Shell and Tubes Heat Exchanger with 2 shell pass - LMTD Method
    1084 #=====================================================================
     1194#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    10851195
    10861196EQUATIONS
     
    10891199        Fc = HE.FshellCorrectionFactor(Inlet.Hot.T,Outlet.Hot.T,Inlet.Cold.T,Outlet.Cold.T);
    10901200
    1091 "Counter Flow LMTD"
    1092         LMTD = HE.CounterLMTD(Inlet.Hot.T,Outlet.Hot.T,Inlet.Cold.T,Outlet.Cold.T);
    1093 
     1201"Temperature Difference at Inlet"
     1202        DT0 = Inlet.Hot.T - Outlet.Cold.T;
     1203
     1204"Temperature Difference at Outlet"
     1205        DTL = Outlet.Hot.T - Inlet.Cold.T;
     1206       
    10941207"Js Factor"     
    10951208        Shell.HeatTransfer.Js = HE.JsFactor(Shell.HeatTransfer.Re,Baffles.Lsi,Baffles.Lso,Baffles.Ls);
     
    11001213       
    11011214"Shell Side Reynolds Number"
    1102         Shell.HeatTransfer.Re=HE.ShellReynoldsNumber(Properties.Hot.Inlet.Fw,Shell.HeatTransfer.Sm,Properties.Hot.Average.Mu);
     1215        Shell.HeatTransfer.Re=(Dotube*Properties.Hot.Inlet.Fw/Shell.HeatTransfer.Sm)/Properties.Hot.Average.Mu;
    11031216
    11041217"Shell Heat Transfer Coefficient"
    1105         Shell.HeatTransfer.hshell=HE.ShellFilmCoeff(Shell.HeatTransfer.Ji,Properties.Hot.Average.Cp,Properties.Hot.Average.Mw,Properties.Hot.Inlet.Fw,Shell.HeatTransfer.Sm,Shell.HeatTransfer.PR,Shell.HeatTransfer.Jtotal,Shell.HeatTransfer.Phi);
     1218        Shell.HeatTransfer.hshell=Shell.HeatTransfer.Ji*(Properties.Hot.Average.Cp/Properties.Hot.Average.Mw)*(Properties.Hot.Inlet.Fw/Shell.HeatTransfer.Sm)*(Shell.HeatTransfer.PR^(-2/3))*Shell.HeatTransfer.Jtotal*Shell.HeatTransfer.Phi;
    11061219
    11071220"Shell Pressure Drop Cross Flow"
     
    11181231
    11191232"Shell Side Reynolds Number"
    1120         Shell.HeatTransfer.Re=HE.ShellReynoldsNumber(Properties.Cold.Inlet.Fw,Shell.HeatTransfer.Sm,Properties.Cold.Average.Mu);
     1233        Shell.HeatTransfer.Re=(Dotube*Properties.Cold.Inlet.Fw/Shell.HeatTransfer.Sm)/Properties.Cold.Average.Mu;
    11211234
    11221235"Shell Heat Transfer Coefficient"
    1123         Shell.HeatTransfer.hshell=HE.ShellFilmCoeff(Shell.HeatTransfer.Ji,Properties.Cold.Average.Cp,Properties.Cold.Average.Mw,Properties.Cold.Inlet.Fw,Shell.HeatTransfer.Sm,Shell.HeatTransfer.PR,Shell.HeatTransfer.Jtotal,Shell.HeatTransfer.Phi);
     1236        Shell.HeatTransfer.hshell=Shell.HeatTransfer.Ji*(Properties.Cold.Average.Cp/Properties.Cold.Average.Mw)*(Properties.Cold.Inlet.Fw/Shell.HeatTransfer.Sm)*(Shell.HeatTransfer.PR^(-2/3))*Shell.HeatTransfer.Jtotal*Shell.HeatTransfer.Phi;
    11241237
    11251238"Shell Pressure Drop Cross Flow"
     
    11351248end
    11361249
    1137 
    1138 
    11391250end
    11401251
    11411252Model Multipass_LMTD_Det         
    1142 #============================================================================
     1253#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    11431254#       Shell and Tubes Heat Exchanger In Series with 1 shell pass - LMTD Method
    1144 #============================================================================
     1255#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    11451256PARAMETERS
    11461257
    1147 Nshell          as Integer      (Brief="N Shell in Series",Default=2);
    1148 ext     HE              as CalcObject   (Brief="STHE Calculations",File="heatex.dll");
    1149 ext PP          as CalcObject;
     1258Nshell          as Integer              (Brief="N Shell in Series",Default=2);
     1259        HE              as CalcObject   (Brief="STHE Calculations",File="heatex");
     1260ext PP          as CalcObject   (Brief="External Physical Properties");
    11501261side        as Integer          (Brief="Fluid Alocation",Lower=0,Upper=1);
    11511262Pi                      as constant     (Brief="Pi Number",Default=3.14159265);
    11521263
    1153 #=====================================================================
     1264#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    11541265#       Shell Geometrical Parameters
    1155 #=====================================================================
     1266#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    11561267Tpass                   as Integer              (Brief="Number of Tube Passes",Lower=1);
    11571268Nss                             as Integer              (Brief="Number of Sealing Strips pairs",Lower=1);
     
    11621273Honozzle_Shell  as length               (Brief="Height Under Shell Outlet Nozzle",Lower=10e-6);
    11631274Lcf                     as length               (Brief="Bundle-to-Shell Clearance",Lower=10e-8);
    1164 #=====================================================================
     1275#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    11651276#       Tubes Geometrical Parameters
    1166 #=====================================================================
     1277#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    11671278Ntt                             as Integer              (Brief="Total Number of Tubes in Shell",Default=100,Lower=1);
    11681279Pattern         as Integer              (Brief="Tube Layout Characteristic Angle",Lower=30);
     
    11741285Donozzle_Tube   as length               (Brief="Tube Outlet Nozzle Diameter",Lower=10e-6);
    11751286Dinozzle_Tube   as length               (Brief="Tube Inlett Nozzle Diameter",Lower=10e-6);
    1176 #=====================================================================
     1287#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    11771288#       Baffles Geometrical Parameters
    1178 #=====================================================================
     1289#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    11791290Bc                      as Integer              (Brief="Baffle Cut",Default=25,Lower=25);
    11801291Nb              as Real                 (Brief="Number of Baffles",Lower=1);
    11811292Lcd                     as length               (Brief="Baffle-to-Shell Clearance",Lower=10e-8);
    11821293Ltd                             as length               (Brief="Tube-to-Bafflehole Clearance",Lower=10e-8);
    1183 #=====================================================================
     1294#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    11841295VARIABLES
    11851296
     
    11871298Fc(Nshell)                      as positive             (Brief="LMTD Correction Factor",Lower=0.75);
    11881299MTD(Nshell)                     as temp_delta   (Brief="Mean Temperature Difference");
    1189 
    1190 Unity(Nshell) as HeatExchangerDetailed_Basic;
     1300Unity(Nshell)           as HeatExchangerDetailed_Basic;
    11911301
    11921302CONNECTIONS
     
    12201330        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;
    12211331
    1222 
    1223 
    1224 #=====================================================================
     1332#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    12251333#  Fluid Alocation
    1226 #=====================================================================
     1334#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    12271335
    12281336if side equal 1 then
     
    12511359        then
    12521360       
    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 
     1361"Cold Wall Temperature"
    12591362        Unity(i).Properties.Cold.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    1260        
     1363
     1364"Hot Wall Temperature" 
    12611365        Unity(i).Properties.Hot.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    12621366
    12631367"Tube Side Velocity"
    1264         Unity(i).Tubes.HeatTransfer.Vtube  = HE.TubeVelocity(Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Properties.Cold.Average.rho);
     1368        Unity(i).Tubes.HeatTransfer.Vtube  = Unity(i).Properties.Cold.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Cold.Average.rho*Ntt);
    12651369
    12661370"Tube Side Reynolds Number"
    1267         Unity(i).Tubes.HeatTransfer.Re = HE.TubeReynoldsNumber(Unity(i).Properties.Cold.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Properties.Cold.Average.Mu);
    1268        
     1371        Unity(i).Tubes.HeatTransfer.Re=(Unity(i).Properties.Cold.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Cold.Average.Mu;
     1372
    12691373"Tube Side Prandtl Number"
    1270         Unity(i).Tubes.HeatTransfer.PR = HE.PrandtlNumber(Unity(i).Properties.Cold.Average.K,Unity(i).Properties.Cold.Average.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Average.Mu);
     1374        Unity(i).Tubes.HeatTransfer.PR = ((Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Average.Mu)/Unity(i).Properties.Cold.Average.K;
    12711375
    12721376"Tube Side Prandtl Number at Wall"
    1273         Unity(i).Tubes.HeatTransfer.PRw = HE.PrandtlNumber(Unity(i).Properties.Cold.Wall.K,Unity(i).Properties.Cold.Wall.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Wall.Mu);
    1274 
     1377        Unity(i).Tubes.HeatTransfer.PRw = ((Unity(i).Properties.Cold.Wall.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Wall.Mu)/Unity(i).Properties.Cold.Wall.K;
    12751378
    12761379"Tube Side Film Coefficient"
    1277         Unity(i).Tubes.HeatTransfer.htube= HE.TubeFilmCoeff(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Cold.Average.K,Unity(i).Tubes.HeatTransfer.Phi);
     1380        Unity(i).Tubes.HeatTransfer.htube= HE.TubeFilmCoeff(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Cold.Average.K)*Unity(i).Tubes.HeatTransfer.Phi;
    12781381       
    12791382"Shell Side Prandtl Number"
    1280         Unity(i).Shell.HeatTransfer.PR=HE.PrandtlNumber(Unity(i).Properties.Hot.Average.K,Unity(i).Properties.Hot.Average.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Average.Mu);   
     1383        Unity(i).Shell.HeatTransfer.PR=((Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Average.Mu)/Unity(i).Properties.Hot.Average.K
    12811384
    12821385"Shell Side Prandtl Number at Wall"
    1283         Unity(i).Shell.HeatTransfer.PRw=HE.PrandtlNumber(Unity(i).Properties.Hot.Wall.K,Unity(i).Properties.Hot.Wall.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Wall.Mu);   
     1386        Unity(i).Shell.HeatTransfer.PRw=((Unity(i).Properties.Hot.Wall.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Wall.Mu)/Unity(i).Properties.Hot.Wall.K
    12841387
    12851388"Tube Side Pressure Drop"
     
    13191422        else
    13201423
    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 
     1424"Cold Wall Temperature"
    13261425        Unity(i).Properties.Cold.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    1327        
     1426
     1427"Hot Wall Temperature"
    13281428        Unity(i).Properties.Hot.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    13291429
    1330 
    1331 
    13321430"Tube Side Velocity"
    1333         Unity(i).Tubes.HeatTransfer.Vtube=HE.TubeVelocity(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Properties.Hot.Average.rho);
     1431        Unity(i).Tubes.HeatTransfer.Vtube  = Unity(i).Properties.Hot.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Hot.Average.rho*Ntt);
    13341432
    13351433"Tube Side Reynolds Number"
    1336         Unity(i).Tubes.HeatTransfer.Re=HE.TubeReynoldsNumber(Unity(i).Properties.Hot.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Properties.Hot.Average.Mu);
     1434        Unity(i).Tubes.HeatTransfer.Re=(Unity(i).Properties.Hot.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Hot.Average.Mu;
    13371435       
    13381436"Tube Side Prandtl Number"
    1339         Unity(i).Tubes.HeatTransfer.PR=HE.PrandtlNumber(Unity(i).Properties.Hot.Average.K,Unity(i).Properties.Hot.Average.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Average.Mu);
     1437        Unity(i).Tubes.HeatTransfer.PR=((Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Average.Mu)/Unity(i).Properties.Hot.Average.K;
    13401438
    13411439"Tube Side Prandtl Number at Wall"
    1342         Unity(i).Tubes.HeatTransfer.PRw=HE.PrandtlNumber(Unity(i).Properties.Hot.Wall.K,Unity(i).Properties.Hot.Wall.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Wall.Mu);
     1440        Unity(i).Tubes.HeatTransfer.PRw=((Unity(i).Properties.Hot.Wall.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Wall.Mu)/Unity(i).Properties.Hot.Wall.K;
    13431441
    13441442"Tube Side Film Coefficient"
    1345         Unity(i).Tubes.HeatTransfer.htube= HE.TubeFilmCoeff(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Hot.Average.K,Unity(i).Tubes.HeatTransfer.Phi);
     1443        Unity(i).Tubes.HeatTransfer.htube= HE.TubeFilmCoeff(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Hot.Average.K)*Unity(i).Tubes.HeatTransfer.Phi;
    13461444       
    13471445"Shell Side Prandtl Number"
    1348         Unity(i).Shell.HeatTransfer.PR=HE.PrandtlNumber(Unity(i).Properties.Cold.Average.K,Unity(i).Properties.Cold.Average.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Average.Mu);
     1446        Unity(i).Shell.HeatTransfer.PR=((Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Average.Mu)/Unity(i).Properties.Cold.Average.K;
    13491447
    13501448"Shell Side Prandtl Number at Wall"
    1351         Unity(i).Shell.HeatTransfer.PRw=HE.PrandtlNumber(Unity(i).Properties.Cold.Wall.K,Unity(i).Properties.Cold.Wall.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Wall.Mu);
     1449        Unity(i).Shell.HeatTransfer.PRw=((Unity(i).Properties.Cold.Wall.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Wall.Mu)/Unity(i).Properties.Cold.Wall.K;
    13521450
    13531451"Tube Side Pressure Drop"
     
    13871485end
    13881486
     1487if side equal 1
     1488       
     1489        then
     1490
     1491"Shell Side inlet Nozzle rho-V^2"
     1492        Unity(i).Shell.PressureDrop.RVsquare_in = Unity(i).Properties.Hot.Inlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_in)^2;
     1493
     1494"Shell Side Outlet Nozzle rho-V^2"
     1495        Unity(i).Shell.PressureDrop.RVsquare_out = Unity(i).Properties.Hot.Outlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_out)^2;
     1496       
     1497        else
     1498       
     1499"Shell Side inlet Nozzle rho-V^2"
     1500        Unity(i).Shell.PressureDrop.RVsquare_in = Unity(i).Properties.Cold.Inlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_in)^2;
     1501
     1502"Shell Side Outlet Nozzle rho-V^2"
     1503        Unity(i).Shell.PressureDrop.RVsquare_out = Unity(i).Properties.Cold.Outlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_out)^2;
     1504
     1505end
     1506
    13891507"Tube Resistance"       
    13901508        Unity(i).Resistances.Rtube*(Unity(i).Tubes.HeatTransfer.htube*Ditube) = Dotube;
     
    14191537       
    14201538"Shell Side Reynolds Number"
    1421         Unity(i).Shell.HeatTransfer.Re=HE.ShellReynoldsNumber(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Hot.Average.Mu);
     1539        Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Hot.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Hot.Average.Mu;
    14221540
    14231541"Shell Heat Transfer Coefficient"
    1424         Unity(i).Shell.HeatTransfer.hshell=HE.ShellFilmCoeff(Unity(i).Shell.HeatTransfer.Ji,Unity(i).Properties.Hot.Average.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Shell.HeatTransfer.PR,Unity(i).Shell.HeatTransfer.Jtotal,Unity(i).Shell.HeatTransfer.Phi);
     1542        Unity(i).Shell.HeatTransfer.hshell=Unity(i).Shell.HeatTransfer.Ji*(Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*(Unity(i).Properties.Hot.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)*(Unity(i).Shell.HeatTransfer.PR^(-2/3))*Unity(i).Shell.HeatTransfer.Jtotal*Unity(i).Shell.HeatTransfer.Phi;
    14251543
    14261544"Shell Pressure Drop Cross Flow"
     
    14371555
    14381556"Shell Side Reynolds Number"
    1439         Unity(i).Shell.HeatTransfer.Re=HE.ShellReynoldsNumber(Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Cold.Average.Mu);
     1557        Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Cold.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Cold.Average.Mu;
    14401558
    14411559"Shell Heat Transfer Coefficient"
    1442         Unity(i).Shell.HeatTransfer.hshell=HE.ShellFilmCoeff(Unity(i).Shell.HeatTransfer.Ji,Unity(i).Properties.Cold.Average.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Shell.HeatTransfer.PR,Unity(i).Shell.HeatTransfer.Jtotal,Unity(i).Shell.HeatTransfer.Phi);
     1560        Unity(i).Shell.HeatTransfer.hshell=Unity(i).Shell.HeatTransfer.Ji*(Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*(Unity(i).Properties.Cold.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)*(Unity(i).Shell.HeatTransfer.PR^(-2/3))*Unity(i).Shell.HeatTransfer.Jtotal*Unity(i).Shell.HeatTransfer.Phi;
    14431561
    14441562"Shell Pressure Drop Cross Flow"
     
    14631581
    14641582        SET
    1465 #=====================================================================
     1583#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    14661584#  Set Parameters for heatex Calculation
    1467 #=====================================================================
     1585#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    14681586        Pi                              = 3.14159265;
    14691587        HE.Tpass                        = Tpass;
  • /mso/eml/heat_exchangers/HeatExchangerDiscretized.mso

    r25 r49  
    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");
     18        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
    269 LMTD            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);
     281DT0     as temp_delta   (Brief="Temperature Difference at Inlet",Lower=1);
     282DTL             as temp_delta   (Brief="Temperature Difference at Outlet",Lower=1);
     283LMTD    as temp_delta   (Brief="Logarithmic Mean Temperature Difference",Lower=5);
     284Fc              as positive             (Brief="LMTD Correction Factor",Lower=0.5);
     285MTD             as temp_delta   (Brief="Mean Temperature Difference",Lower=1);
    272286
    273287EQUATIONS
    274 
    275288"Exchange Surface Area"
    276289        Details.Q   = Details.U*Details.A*MTD;
     
    279292        MTD   = Fc*LMTD;
    280293       
    281 "LMTD Correction Factor"
    282         Fc = HE.EshellCorrectionFactor(Inlet.Hot.T,Outlet.Hot.T,Inlet.Cold.T,Outlet.Cold.T);
    283 
    284 "LMTD"
    285         LMTD = HE.CounterLMTD(Inlet.Hot.T,Outlet.Hot.T,Inlet.Cold.T,Outlet.Cold.T);
    286 
    287 end
    288 
    289 Model Heatex_Discretized_NTU            as HeatExchangerDiscretized_Basic
    290        
     294#"LMTD Correction Factor"
     295#       Fc = HE.EshellCorrectionFactor(Inlet.Hot.T,Outlet.Hot.T,Inlet.Cold.T,Outlet.Cold.T);
     296
     297"Temperature Difference at Inlet"
     298        DT0 = Inlet.Hot.T - Outlet.Cold.T;
     299
     300"Temperature Difference at Outlet"
     301        DTL = Outlet.Hot.T - Inlet.Cold.T;
     302#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     303#                       Log Mean Temperature Difference
     304#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     305if abs(DT0 - DTL) > 0.05*max(abs([DT0,DTL]))
     306       
     307        then
     308"Log Mean Temperature Difference"
     309        LMTD= (DT0-DTL)/ln(DT0/DTL);
     310
     311        else
     312       
     313if DT0*DTL equal 0
     314       
     315        then
     316"Log Mean Temperature Difference"
     317        LMTD = 0.5*(DT0+DTL);
     318       
     319        else
     320"Log Mean Temperature Difference"
     321        LMTD = 0.5*(DT0+DTL)*(1-(DT0-DTL)^2/(DT0*DTL)*(1+(DT0-DTL)^2/(DT0*DTL)/2)/12);
     322       
     323end
     324       
     325end
     326
     327       
     328end
     329
     330Model Profiles
     331
     332PARAMETERS
     333
     334Zones   as Integer(Brief="Number of Zones");
     335
    291336VARIABLES
    292337
    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 
     338Lz(Zones)               as length                       (Brief="Zone Tube Length");
     339Area                            as area                         (Brief="Area Total");
     340Q                               as power                        (Brief="Total Duty");
     341PdropTubesNozzle        as pressure                     (Brief="Total Tube Nozzles Pressure Drop");
     342PdropTubes                      as pressure                     (Brief="Total Tube Pressure Drop");
     343PdropWin                        as pressure                     (Brief="Total Shell Side Window Pressure Drop");
     344PdropCross                      as pressure                     (Brief="Total Shell Side Cross Flow Pressure Drop");
     345PdropEnds                       as pressure                     (Brief="Total Shell Side Ends Pressure Drop");
     346PdropShellNozzle        as pressure                     (Brief="Total Shell Side Nozzles Pressure Drop");
     347PdropShell                      as pressure                     (Brief="Total Shell Side Pressure Drop");
     348Uaverage                        as heat_trans_coeff (Brief="Average Overall Heat Transfer Coefficient",Default=1,Lower=1e-6,Upper=1e10);
     349hshellaverage           as heat_trans_coeff     (Brief="Average Shell Side Film Coefficient",Default=1,Lower=1e-12, Upper=1e6);
     350htubeaverage            as heat_trans_coeff     (Brief="Average Tube Side Film Coefficient",Default=1,Lower=1e-12, Upper=1e6);
     351Thot(Zones)             as temperature          (Brief="Hot Temperature",Lower = 300, Upper = 500);
     352Tcold(Zones)            as temperature          (Brief="Cold Temperature",Lower = 300, Upper = 500);
     353Phot(Zones)             as pressure                     (Brief="Hot Pressure",Lower = 0.8, Upper = 30);
     354Pcold(Zones)            as pressure                     (Brief="Cold Pressure",Lower = 0.8, Upper = 30);
     355
     356end
     357
     358Model E_Shell_NTU_Disc           
     359#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     360#       Shell and Tubes Heat Exchanger with 1 shell pass - NTU Method
     361#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    309362PARAMETERS
    310363
    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 #=====================================================================
     364        HE      as CalcObject   (Brief="STHE Calculations",File="heatex");
     365ext PP  as CalcObject   (Brief="External Physical Properties");
     366side    as Integer              (Brief="Fluid Alocation",Lower=0,Upper=1);
     367Pi              as constant     (Brief="Pi Number",Default=3.14159265);
     368
     369#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    347370#       Shell Geometrical Parameters
    348 #=====================================================================
     371#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    349372Tpass                   as Integer              (Brief="Number of Tube Passes",Lower=1);
    350373Nss                             as Integer              (Brief="Number of Sealing Strips pairs",Lower=1);
     
    355378Honozzle_Shell  as length               (Brief="Height Under Shell Outlet Nozzle",Lower=10e-6);
    356379Lcf                     as length               (Brief="Bundle-to-Shell Clearance",Lower=10e-8);
    357 #=====================================================================
     380#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    358381#       Tubes Geometrical Parameters
    359 #=====================================================================
     382#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    360383Ntt                             as Integer              (Brief="Total Number of Tubes in Shell",Default=100,Lower=1);
    361384Pattern         as Integer              (Brief="Tube Layout Characteristic Angle",Lower=30);
     
    367390Donozzle_Tube   as length               (Brief="Tube Outlet Nozzle Diameter",Lower=10e-6);
    368391Dinozzle_Tube   as length               (Brief="Tube Inlett Nozzle Diameter",Lower=10e-6);
    369 #=====================================================================
     392#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    370393#       Baffles Geometrical Parameters
    371 #=====================================================================
     394#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    372395Bc                      as Integer              (Brief="Baffle Cut",Default=25,Lower=25);
    373396Nb              as Integer              (Brief="Number of Baffles",Default=4);
    374397Lcd                     as length               (Brief="Baffle-to-Shell Clearance",Lower=10e-8);
    375398Ltd                             as length               (Brief="Tube-to-Bafflehole Clearance",Lower=10e-8);
    376 #=====================================================================
     399#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    377400VARIABLES
    378401
    379 PdropNozzles    as Pdrop_Nozzles_Main;
    380 Unity(Nb+1)     as Heatex_Discretized_LMTD;
     402Unity(Nb+1)     as Heatex_Discretized_NTU;
    381403Sumary          as Profiles;
    382404
     
    388410EQUATIONS
    389411
    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;
     412"Hot Temperatures"
     413        Sumary.Thot     = Unity.Outlet.Hot.T;
     414       
     415"Cold Temperatures"
     416        Sumary.Tcold    = Unity.Outlet.Cold.T ;
     417
     418"Hot Pressures"
     419        Sumary.Phot     = Unity.Outlet.Hot.P ;
     420       
     421"Cold Pressures"
     422        Sumary.Pcold    = Unity.Outlet.Cold.P ;
     423
     424"Average Shell Side Film Coefficient"
     425        Sumary.hshellaverage            = sum(Unity.Shell.HeatTransfer.hshell)/Sumary.Zones;
     426
     427"Average Tube Side Film Coefficient"
     428        Sumary.htubeaverage             = sum(Unity.Tubes.HeatTransfer.htube)/Sumary.Zones;
     429
     430"Average Overall Heat Transfer Coefficient"
     431        Sumary.Uaverage                 = sum(Unity.Details.U)/Sumary.Zones;
     432
     433"Area Total"
     434        Sumary.Area                             = sum(Unity.Details.A);
     435
     436"Duty Total"
     437        Sumary.Q                                = sum(Unity.Details.Q);
     438
     439"Length Inlet zone"
     440        Sumary.Lz(1)                            = Unity(1).Baffles.Lsi;
     441
     442"Length Outlet zone"
     443        Sumary.Lz(Nb+1)                         = Unity(1).Baffles.Lso;
     444
     445"Total Shell Side Pressure Drop"
     446        Sumary.PdropShell                       = sum(Unity.Shell.PressureDrop.Pdtotal);
     447
     448"Total Tube Side Pressure Drop"
     449        Sumary.PdropTubes                       = sum(Unity.Tubes.PressureDrop.Pdtotal);
     450
     451"Total Tube Side Nozzles Pressure Drop"
     452        Sumary.PdropTubesNozzle         = sum(Unity.Tubes.PressureDrop.Pdnozzle_in + Unity.Tubes.PressureDrop.Pdnozzle_out);
     453
     454"Total Shell Side Nozzles Pressure Drop"
     455        Sumary.PdropShellNozzle         = sum(Unity.Shell.PressureDrop.Pdnozzle_in + Unity.Shell.PressureDrop.Pdnozzle_out);
     456
     457"Total Shell Side Window Pressure Drop"
     458        Sumary.PdropWin                         = sum(Unity.Shell.PressureDrop.Pdwindow);
     459
     460"Total Shell Side Cross Flow Pressure Drop"
     461        Sumary.PdropCross                       = sum(Unity.Shell.PressureDrop.PdCross);
     462
     463"Total Shell Side Ends Pressure Drop"
     464        Sumary.PdropEnds                        = sum(Unity.Shell.PressureDrop.PdEndZones);
    411465
    412466"Shell Side Cross Flow Area"
     
    415469"Shell Side Cross Flow Area"
    416470        Unity(Nb+1).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(Nb+1).Baffles.Lso);
    417        
    418 Sumary.Lz(Nb+1) = Unity(1).Baffles.Lso;
     471
    419472
    420473if side equal 1
    421474       
    422475        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;
     476       
     477"Shell Side inlet Nozzle rho-V^2"
     478        Unity(1).Shell.PressureDrop.RVsquare_in = Unity(1).Properties.Hot.Inlet.rho*(Unity(1).Shell.PressureDrop.Vnozzle_in)^2;
     479
     480"Shell Side Outlet Nozzle rho-V^2"
     481        Unity(Nb+1).Shell.PressureDrop.RVsquare_out = Unity(Nb+1).Properties.Hot.Outlet.rho*(Unity(Nb+1).Shell.PressureDrop.Vnozzle_out)^2;
     482
     483"Shell Pressure End Zones"
     484        Unity(1).Shell.PressureDrop.PdEndZones          =       HE.DeltaPendZonesIncremental(Unity(1).Shell.HeatTransfer.Re,Unity(1).Baffles.Ls,Unity(1).Baffles.Lso,
     485        Unity(1).Baffles.Lsi,Unity(1).Properties.Hot.Inlet.Fw,Unity(1).Shell.HeatTransfer.Phi,Unity(1).Properties.Hot.Average.rho);
     486
     487"Shell Pressure End Zones"
     488        Unity(Nb+1).Shell.PressureDrop.PdEndZones       =       HE.DeltaPendZonesIncremental(Unity(Nb+1).Shell.HeatTransfer.Re,Unity(Nb+1).Baffles.Ls,Unity(Nb+1).Baffles.Lso,
     489        Unity(Nb+1).Baffles.Lsi,Unity(Nb+1).Properties.Hot.Inlet.Fw,Unity(Nb+1).Shell.HeatTransfer.Phi,Unity(Nb+1).Properties.Hot.Average.rho);
    431490
    432491"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);
     492        Unity(1).Tubes.PressureDrop.Pdnozzle_in = HE.DeltaPtubeNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
    434493
    435494"Velocity Tube Side Inlet Nozzle"
    436         PdropNozzles.Tubes.Vnozzle_in   = HE.TubeVelocityNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
     495        Unity(1).Tubes.PressureDrop.Vnozzle_in  = HE.TubeVelocityNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
    437496
    438497"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);
     498        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_out     = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
    440499
    441500"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);
     501        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_out      = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
    443502
    444503"Shell Pressure Drop Inlet Nozzle"
    445         PdropNozzles.Shell.Pdnozzle_in  = HE.DeltaPshellNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
     504        Unity(1).Shell.PressureDrop.Pdnozzle_in = HE.DeltaPshellNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
    446505
    447506"Velocity Shell Side Inlet Nozzle"
    448         PdropNozzles.Shell.Vnozzle_in   = HE.ShellVelocityNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
     507        Unity(1).Shell.PressureDrop.Vnozzle_in  = HE.ShellVelocityNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
    449508
    450509"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);
     510        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_out     =HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
    452511
    453512"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 
     513        Unity(Nb+1).Shell.PressureDrop.Vnozzle_out      =HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
     514       
    456515
    457516        else
    458517       
    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;
     518"Shell Side inlet Nozzle rho-V^2"
     519        Unity(1).Shell.PressureDrop.RVsquare_in = Unity(1).Properties.Cold.Inlet.rho*(Unity(1).Shell.PressureDrop.Vnozzle_in)^2;
     520
     521"Shell Side Outlet Nozzle rho-V^2"
     522        Unity(Nb+1).Shell.PressureDrop.RVsquare_out = Unity(Nb+1).Properties.Cold.Outlet.rho*(Unity(Nb+1).Shell.PressureDrop.Vnozzle_out)^2;
     523
     524"Shell Pressure End Zones"
     525        Unity(1).Shell.PressureDrop.PdEndZones          =       HE.DeltaPendZonesIncremental(Unity(1).Shell.HeatTransfer.Re,Unity(1).Baffles.Ls,Unity(1).Baffles.Lso,
     526        Unity(1).Baffles.Lsi,Unity(1).Properties.Cold.Inlet.Fw,Unity(1).Shell.HeatTransfer.Phi,Unity(1).Properties.Cold.Average.rho);
     527
     528"Shell Pressure End Zones"
     529        Unity(Nb+1).Shell.PressureDrop.PdEndZones       =       HE.DeltaPendZonesIncremental(Unity(Nb+1).Shell.HeatTransfer.Re,Unity(Nb+1).Baffles.Ls,Unity(Nb+1).Baffles.Lso,
     530        Unity(Nb+1).Baffles.Lsi,Unity(Nb+1).Properties.Cold.Inlet.Fw,Unity(Nb+1).Shell.HeatTransfer.Phi,Unity(Nb+1).Properties.Cold.Average.rho);
     531
    466532
    467533"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);
     534        Unity(1).Tubes.PressureDrop.Pdnozzle_in = HE.DeltaPtubeNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
    469535
    470536"Velocity Tube Side Inlet Nozzle"
    471         PdropNozzles.Tubes.Vnozzle_in   = HE.TubeVelocityNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
     537        Unity(1).Tubes.PressureDrop.Vnozzle_in  = HE.TubeVelocityNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
    472538
    473539"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);   
     540        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_out     = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);   
    475541
    476542"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); 
     543        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_out      = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw); 
    478544
    479545"Shell Pressure Drop Inlet Nozzle"
    480         PdropNozzles.Shell.Pdnozzle_in  = HE.DeltaPshellNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
     546        Unity(1).Shell.PressureDrop.Pdnozzle_in = HE.DeltaPshellNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
    481547
    482548"Velocity Shell Side Inlet Nozzle"
    483         PdropNozzles.Shell.Vnozzle_in   = HE.ShellVelocityNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
     549        Unity(1).Shell.PressureDrop.Vnozzle_in  = HE.ShellVelocityNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
    484550
    485551"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);
     552        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_out = HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
    487553
    488554"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);
     555        Unity(Nb+1).Shell.PressureDrop.Vnozzle_out  = HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
     556
    490557
    491558end
     
    494561for i in [2:Nb]
    495562
     563"Pressure Drop Tube Side Inlet Nozzle"
     564        Unity(i).Tubes.PressureDrop.Pdnozzle_in = 0;
     565
     566"Velocity Tube Side Inlet Nozzle"
     567        Unity(i).Tubes.PressureDrop.Vnozzle_in  = 0;
     568
     569"Pressure Drop Tube Side Outlet Nozzle"
     570        Unity(i).Tubes.PressureDrop.Pdnozzle_out        = 0;   
     571
     572"Velocity Tube Side Outlet Nozzle"
     573        Unity(i).Tubes.PressureDrop.Vnozzle_out = 0;   
     574
     575"Shell Pressure Drop Inlet Nozzle"
     576        Unity(i).Shell.PressureDrop.Pdnozzle_in = 0;
     577
     578"Velocity Shell Side Inlet Nozzle"
     579        Unity(i).Shell.PressureDrop.Vnozzle_in  = 0;
     580
     581"Shell Pressure Drop Outlet Nozzle"
     582        Unity(i).Shell.PressureDrop.Pdnozzle_out = 0;
     583
     584"Velocity Shell Side Outlet Nozzle"
     585        Unity(i).Shell.PressureDrop.Vnozzle_out  = 0;
     586
     587"Shell Pressure End Zones"
     588        Unity(i).Shell.PressureDrop.PdEndZones          =       0;
     589       
     590"Shell Side Outlet Nozzle rho-V^2"
     591        Unity(i).Shell.PressureDrop.RVsquare_out = 0;
     592       
     593"Shell Side inlet Nozzle rho-V^2"
     594        Unity(i).Shell.PressureDrop.RVsquare_in = 0;
     595
    496596if side equal 1
    497597       
    498598        then
    499599       
     600"Shell Pressure Drop Cross Flow"
     601        Unity(i).Shell.PressureDrop.PdCross             =       HE.DeltaPcrossIncremental(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Hot.Average.rho);
     602
     603
     604        else
     605
     606"Shell Pressure Drop Cross Flow"
     607        Unity(i).Shell.PressureDrop.PdCross     =       HE.DeltaPcrossIncremental(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Cold.Average.rho);
     608
     609
     610end
     611
     612"Zone Length"
     613        Sumary.Lz(i) = Unity(1).Baffles.Ls;
     614
     615"Shell Side Cross Flow Area"
     616        Unity(i).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(i).Baffles.Ls);
     617       
     618end
     619
     620
     621for i in [1:Nb+1]
     622       
     623if side equal 1
     624       
     625        then
    500626"Pressure Drop Hot Stream"
    501627        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P - Unity(i).Shell.PressureDrop.Pdtotal;   
     
    503629"Pressure Drop Cold Stream"
    504630        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Tubes.PressureDrop.Pdtotal;
    505 
    506 
     631       
     632"Shell Side Reynolds Number"
     633        Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Hot.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Hot.Average.Mu;
     634
     635"Shell Heat Transfer Coefficient"
     636        Unity(i).Shell.HeatTransfer.hshell =Unity(i).Shell.HeatTransfer.Ji*(Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*(Unity(i).Properties.Hot.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)*(Unity(i).Shell.HeatTransfer.PR^(-2/3))*Unity(i).Shell.HeatTransfer.Jtotal*Unity(i).Shell.HeatTransfer.Phi;
     637
     638
     639"Shell Pressure Baffle Window"
     640        Unity(i).Shell.PressureDrop.Pdwindow            =       HE.DeltaPwindowIncremental(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Hot.Average.rho,Unity(i).Properties.Hot.Average.Mu,Unity(i).Baffles.Ls);
     641
     642"Hot Wall Temperature"
     643        Unity(i).Properties.Hot.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
     644
     645"Cold Wall Temperature"
     646        Unity(i).Properties.Cold.Wall.Twall =   (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
     647
     648"Tube Side Velocity"
     649        Unity(i).Tubes.HeatTransfer.Vtube  = Unity(i).Properties.Cold.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Cold.Average.rho*Ntt);
     650
     651"Tube Side Reynolds Number"
     652        Unity(i).Tubes.HeatTransfer.Re          =       (Unity(i).Properties.Cold.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Cold.Average.Mu;
     653       
     654"Tube Side Prandtl Number"
     655        Unity(i).Tubes.HeatTransfer.PR          = ((Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Average.Mu)/Unity(i).Properties.Cold.Average.K;
     656
     657"Tube Side Prandtl Number at Wall"
     658        Unity(i).Tubes.HeatTransfer.PRw         =       ((Unity(i).Properties.Cold.Wall.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Wall.Mu)/Unity(i).Properties.Cold.Wall.K;
     659
     660"Tube Side Film Coefficient"
     661        Unity(i).Tubes.HeatTransfer.htube       =       HE.TubeFilmCoeffIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Cold.Average.K,Sumary.Lz(i))*Unity(i).Tubes.HeatTransfer.Phi;
     662       
     663"Shell Side Prandtl Number"
     664        Unity(i).Shell.HeatTransfer.PR          =       ((Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Average.Mu)/Unity(i).Properties.Hot.Average.K;
     665
     666"Shell Side Prandtl Number at Wall"
     667        Unity(i).Shell.HeatTransfer.PRw         =       ((Unity(i).Properties.Hot.Wall.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Wall.Mu)/Unity(i).Properties.Hot.Wall.K; 
     668
     669"Tube Side Pressure Drop"
     670        Unity(i).Tubes.PressureDrop.PdTube      =       HE.DeltaPtubeIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Cold.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,
     671        Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lz(i));
     672       
     673"Shell Side Phi correction for viscosity"
     674        Unity(i).Shell.HeatTransfer.Phi         =       HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
     675       
     676"Tube Side Phi correction for viscosity"
     677        Unity(i).Tubes.HeatTransfer.Phi         =       HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
     678       
    507679        else
    508680
     
    512684"Pressure Drop Cold Stream"
    513685        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 
     686       
    557687"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);
     688        Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Cold.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Cold.Average.Mu;
    559689
    560690"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);
     691        Unity(i).Shell.HeatTransfer.hshell      =Unity(i).Shell.HeatTransfer.Ji*(Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*
     692        (Unity(i).Properties.Cold.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)*(Unity(i).Shell.HeatTransfer.PR^(-2/3))*Unity(i).Shell.HeatTransfer.Jtotal*Unity(i).Shell.HeatTransfer.Phi;
     693
    565694
    566695"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"
     696        Unity(i).Shell.PressureDrop.Pdwindow    =       HE.DeltaPwindowIncremental(Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Cold.Average.rho,Unity(i).Properties.Cold.Average.Mu,Unity(i).Baffles.Ls);
     697
     698"Hot Wall Temperature"
    578699        Unity(i).Properties.Hot.Wall.Twall      =       (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    579700
     701"Cold Wall Temperature"
     702        Unity(i).Properties.Cold.Wall.Twall     =       (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
     703
    580704"Tube Side Velocity"
    581         Unity(i).Tubes.HeatTransfer.Vtube               =       HE.TubeVelocity(Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Properties.Cold.Average.rho);
     705        Unity(i).Tubes.HeatTransfer.Vtube               = Unity(i).Properties.Hot.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Hot.Average.rho*Ntt);
    582706
    583707"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);
     708        Unity(i).Tubes.HeatTransfer.Re                  =       (Unity(i).Properties.Hot.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Hot.Average.Mu;
    585709       
    586710"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 
     711        Unity(i).Tubes.HeatTransfer.PR                  =       ((Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Average.Mu)/Unity(i).Properties.Hot.Average.K;
     712       
    589713"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 
     714        Unity(i).Tubes.HeatTransfer.PRw                 =       ((Unity(i).Properties.Hot.Wall.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Wall.Mu)/Unity(i).Properties.Hot.Wall.K;
     715       
    592716"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));
     717        Unity(i).Tubes.HeatTransfer.htube               =       HE.TubeFilmCoeffIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Hot.Average.K,Sumary.Lz(i))*Unity(i).Tubes.HeatTransfer.Phi;
    595718       
    596719"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);   
     720        Unity(i).Shell.HeatTransfer.PR                  =       ((Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Average.Mu)/Unity(i).Properties.Cold.Average.K;
    598721
    599722"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);   
     723        Unity(i).Shell.HeatTransfer.PRw                 =       ((Unity(i).Properties.Cold.Wall.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Wall.Mu)/Unity(i).Properties.Cold.Wall.K;
    601724
    602725"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
    613        
    614 "Shell Side Reynolds Number"
    615         Unity(i).Shell.HeatTransfer.Re                  =       HE.ShellReynoldsNumber(Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Cold.Average.Mu);
    616 
    617 "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);
    622 
    623 "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;
    636 
    637 "Tube Side Velocity"
    638         Unity(i).Tubes.HeatTransfer.Vtube       =  HE.TubeVelocity(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Properties.Hot.Average.rho);
    639 
    640 "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);
    642        
    643 "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 
    646 "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 
    649 "Tube Side Film Coefficient"
    650         Unity(i).Tubes.HeatTransfer.htube               =       HE.TubeFilmCoeffIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Hot.Average.K,
    651         Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lpos(i));
    652        
    653 "Shell Side Prandtl Number"
    654         Unity(i).Shell.HeatTransfer.PR                  =       HE.PrandtlNumber(Unity(i).Properties.Cold.Average.K,Unity(i).Properties.Cold.Average.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Average.Mu);
    655 
    656 "Shell Side Prandtl Number at Wall"
    657         Unity(i).Shell.HeatTransfer.PRw                 =       HE.PrandtlNumber(Unity(i).Properties.Cold.Wall.K,Unity(i).Properties.Cold.Wall.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Wall.Mu);
    658 
    659 
    660 "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,
     726        Unity(i).Tubes.PressureDrop.PdTube              =       HE.DeltaPtubeIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Hot.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,
    662727        Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lz(i));
    663728
     
    689754       
    690755
    691 end
     756"Js Factor"     
     757        Unity(i).Shell.HeatTransfer.Js                  =       1;
     758       
     759"Ji Factor"
     760        Unity(i).Shell.HeatTransfer.Ji                  =       HE.JiFactor(Unity(i).Shell.HeatTransfer.Re);
     761
     762"Jc Factor"
     763        Unity(i).Shell.HeatTransfer.Jc                  =       HE.JcFactor();
     764       
     765"Jl Factor"
     766        Unity(i).Shell.HeatTransfer.Jl                  =       HE.JlFactor(Unity(i).Shell.HeatTransfer.Sm);
     767
     768"Jb Factor"
     769        Unity(i).Shell.HeatTransfer.Jb                  =       HE.JbFactor(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Shell.HeatTransfer.Sm);
     770
     771"Jr Factor"     
     772        Unity(i).Shell.HeatTransfer.Jr                  =       HE.JrFactor(Unity(i).Shell.HeatTransfer.Re);
     773       
     774"Total J Factor"
     775        Unity(i).Shell.HeatTransfer.Jtotal              =       Unity(i).Shell.HeatTransfer.Jc*Unity(i).Shell.HeatTransfer.Jl*Unity(i).Shell.HeatTransfer.Jb*Unity(i).Shell.HeatTransfer.Jr*Unity(i).Shell.HeatTransfer.Js;
     776end
     777
     778
     779"Velocity Tube Side Inlet Nozzle"
     780        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_in       = 0;
     781
     782"Velocity Tube Side Outlet Nozzle"
     783        Unity(1).Tubes.PressureDrop.Vnozzle_out = 0;
     784       
     785"Tube Pressure Drop Inlet Nozzle"
     786        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_in      = 0;
     787
     788"Tube Pressure Drop Outlet Nozzle"
     789        Unity(1).Tubes.PressureDrop.Pdnozzle_out        = 0;
     790
     791"Velocity Shell Side Inlet Nozzle"
     792        Unity(Nb+1).Shell.PressureDrop.Vnozzle_in       = 0;
     793
     794"Velocity Shell Side Outlet Nozzle"
     795        Unity(1).Shell.PressureDrop.Vnozzle_out = 0;
     796       
     797"Shell Pressure Drop Inlet Nozzle"
     798        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_in      = 0;
     799       
     800"Shell Pressure Drop Outlet Nozzle"
     801        Unity(1).Shell.PressureDrop.Pdnozzle_out        = 0;
     802
     803"Shell Cross Flow Pressure Drop"
     804        Unity(1).Shell.PressureDrop.PdCross             = 0;
     805       
     806"Shell Cross Flow Pressure Drop"
     807        Unity(Nb+1).Shell.PressureDrop.PdCross          = 0;
     808       
     809"Shell Side Outlet Nozzle rho-V^2"
     810        Unity(1).Shell.PressureDrop.RVsquare_out = 0;
     811       
     812"Shell Side inlet Nozzle rho-V^2"
     813        Unity(Nb+1).Shell.PressureDrop.RVsquare_in = 0;
    692814
    693815SET
    694 #=====================================================================
    695 #  Set Parameters for External Object Calculation - HE
    696 #=====================================================================
     816#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     817#  Set Parameters for heatex Calculation
     818#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    697819        Sumary.Zones        = Nb+1;
    698820        Pi                              = 3.14159265;
     
    719841end
    720842
    721 Model E_Shell_NTU_Disc           
    722 #============================================================================
    723 #       Shell and Tubes Heat Exchanger In Series with 1 shell pass - LMTD Method
    724 #============================================================================
     843Model E_Shell_LMTD_Disc         
     844#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     845#       Shell and Tubes Heat Exchanger with 1 shell pass - LMTD Method
     846#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    725847PARAMETERS
    726848
    727 ext     HE              as CalcObject   (Brief="STHE Calculations",File="heatex.dll");
    728 ext PP          as CalcObject;
     849        HE      as CalcObject   (Brief="STHE Calculations",File="heatex");
     850ext PP  as CalcObject   (Brief="External Physical Properties");
    729851side    as Integer              (Brief="Fluid Alocation",Lower=0,Upper=1);
    730 Pi                      as constant     (Brief="Pi Number",Default=3.14159265);
    731 
    732 #=====================================================================
     852Pi              as constant     (Brief="Pi Number",Default=3.14159265);
     853
     854#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    733855#       Shell Geometrical Parameters
    734 #=====================================================================
     856#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    735857Tpass                   as Integer              (Brief="Number of Tube Passes",Lower=1);
    736858Nss                             as Integer              (Brief="Number of Sealing Strips pairs",Lower=1);
     
    741863Honozzle_Shell  as length               (Brief="Height Under Shell Outlet Nozzle",Lower=10e-6);
    742864Lcf                     as length               (Brief="Bundle-to-Shell Clearance",Lower=10e-8);
    743 #=====================================================================
     865#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    744866#       Tubes Geometrical Parameters
    745 #=====================================================================
     867#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    746868Ntt                             as Integer              (Brief="Total Number of Tubes in Shell",Default=100,Lower=1);
    747869Pattern         as Integer              (Brief="Tube Layout Characteristic Angle",Lower=30);
     
    753875Donozzle_Tube   as length               (Brief="Tube Outlet Nozzle Diameter",Lower=10e-6);
    754876Dinozzle_Tube   as length               (Brief="Tube Inlett Nozzle Diameter",Lower=10e-6);
    755 #=====================================================================
     877#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    756878#       Baffles Geometrical Parameters
    757 #=====================================================================
     879#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    758880Bc                      as Integer              (Brief="Baffle Cut",Default=25,Lower=25);
    759881Nb              as Integer              (Brief="Number of Baffles",Default=4);
    760882Lcd                     as length               (Brief="Baffle-to-Shell Clearance",Lower=10e-8);
    761883Ltd                             as length               (Brief="Tube-to-Bafflehole Clearance",Lower=10e-8);
    762 #=====================================================================
     884#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    763885VARIABLES
    764886
    765 PdropNozzles    as Pdrop_Nozzles_Main;
    766 Unity(Nb+1)     as Heatex_Discretized_NTU;
     887Unity(Nb+1)     as Heatex_Discretized_LMTD;
    767888Sumary          as Profiles;
    768889
    769890CONNECTIONS
    770891
    771 Unity([1:Nb]).Outlet.Hot  to Unity([2:Nb+1]).Inlet.Hot;
     892Unity([1:Nb]).Outlet.Hot        to Unity([2:Nb+1]).Inlet.Hot;
    772893Unity([2:Nb+1]).Outlet.Cold to Unity([1:Nb]).Inlet.Cold;
    773894
    774895EQUATIONS
    775896
    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);
     897"Hot Temperatures"
     898        Sumary.Thot     = Unity.Outlet.Hot.T;
     899       
     900"Cold Temperatures"
     901        Sumary.Tcold    = Unity.Outlet.Cold.T ;
     902
     903"Hot Pressures"
     904        Sumary.Phot     = Unity.Outlet.Hot.P ;
     905       
     906"Cold Pressures"
     907        Sumary.Pcold    = Unity.Outlet.Cold.P ;
     908
     909"Average Shell Side Film Coefficient"
     910        Sumary.hshellaverage            = sum(Unity.Shell.HeatTransfer.hshell)/Sumary.Zones;
     911
     912"Average Tube Side Film Coefficient"
     913        Sumary.htubeaverage             = sum(Unity.Tubes.HeatTransfer.htube)/Sumary.Zones;
     914
     915"Average Overall Heat Transfer Coefficient"
     916        Sumary.Uaverage                 = sum(Unity.Details.U)/Sumary.Zones;
     917
     918"Area Total"
     919        Sumary.Area                             = sum(Unity.Details.A);
     920
     921"Duty Total"
     922        Sumary.Q                                = sum(Unity.Details.Q);
     923
     924"Length Inlet zone"
     925        Sumary.Lz(1)                            = Unity(1).Baffles.Lsi;
     926
     927"Length Outlet zone"
     928        Sumary.Lz(Nb+1)                         = Unity(1).Baffles.Lso;
     929
     930"Total Shell Side Pressure Drop"
     931        Sumary.PdropShell                       = sum(Unity.Shell.PressureDrop.Pdtotal);
     932
     933"Total Tube Side Pressure Drop"
     934        Sumary.PdropTubes                       = sum(Unity.Tubes.PressureDrop.Pdtotal);
     935
     936"Total Tube Side Nozzles Pressure Drop"
     937        Sumary.PdropTubesNozzle         = sum(Unity.Tubes.PressureDrop.Pdnozzle_in + Unity.Tubes.PressureDrop.Pdnozzle_out);
     938
     939"Total Shell Side Nozzles Pressure Drop"
     940        Sumary.PdropShellNozzle         = sum(Unity.Shell.PressureDrop.Pdnozzle_in + Unity.Shell.PressureDrop.Pdnozzle_out);
     941
     942"Total Shell Side Window Pressure Drop"
     943        Sumary.PdropWin                         = sum(Unity.Shell.PressureDrop.Pdwindow);
     944
     945"Total Shell Side Cross Flow Pressure Drop"
     946        Sumary.PdropCross                       = sum(Unity.Shell.PressureDrop.PdCross);
     947
     948"Total Shell Side Ends Pressure Drop"
     949        Sumary.PdropEnds                        = sum(Unity.Shell.PressureDrop.PdEndZones);
    793950
    794951"Shell Side Cross Flow Area"
     
    798955        Unity(Nb+1).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(Nb+1).Baffles.Lso);
    799956
     957"LMTD Correction Factor"
     958        Unity.Fc = HE.EshellCorrectionFactor(Unity(1).Inlet.Hot.T,Unity(Nb+1).Outlet.Hot.T,Unity(Nb+1).Inlet.Cold.T,Unity(1).Outlet.Cold.T);
    800959
    801960if side equal 1
    802961       
    803962        then
    804        
     963
     964"Shell Side inlet Nozzle rho-V^2"
     965        Unity(1).Shell.PressureDrop.RVsquare_in = Unity(1).Properties.Hot.Inlet.rho*(Unity(1).Shell.PressureDrop.Vnozzle_in)^2;
     966
     967"Shell Side Outlet Nozzle rho-V^2"
     968        Unity(Nb+1).Shell.PressureDrop.RVsquare_out = Unity(Nb+1).Properties.Hot.Outlet.rho*(Unity(Nb+1).Shell.PressureDrop.Vnozzle_out)^2;
     969
     970"Shell Pressure End Zones"
     971        Unity(1).Shell.PressureDrop.PdEndZones          =       HE.DeltaPendZonesIncremental(Unity(1).Shell.HeatTransfer.Re,Unity(1).Baffles.Ls,Unity(1).Baffles.Lso,
     972        Unity(1).Baffles.Lsi,Unity(1).Properties.Hot.Inlet.Fw,Unity(1).Shell.HeatTransfer.Phi,Unity(1).Properties.Hot.Average.rho);
     973
     974"Shell Pressure End Zones"
     975        Unity(Nb+1).Shell.PressureDrop.PdEndZones       =       HE.DeltaPendZonesIncremental(Unity(Nb+1).Shell.HeatTransfer.Re,Unity(Nb+1).Baffles.Ls,Unity(Nb+1).Baffles.Lso,
     976        Unity(Nb+1).Baffles.Lsi,Unity(Nb+1).Properties.Hot.Inlet.Fw,Unity(Nb+1).Shell.HeatTransfer.Phi,Unity(Nb+1).Properties.Hot.Average.rho);
     977
    805978"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);
     979        Unity(1).Tubes.PressureDrop.Pdnozzle_in = HE.DeltaPtubeNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
    807980
    808981"Velocity Tube Side Inlet Nozzle"
    809         PdropNozzles.Tubes.Vnozzle_in   = HE.TubeVelocityNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
     982        Unity(1).Tubes.PressureDrop.Vnozzle_in  = HE.TubeVelocityNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
    810983
    811984"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);
     985        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_out     = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
    813986
    814987"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);
     988        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_out      = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
    816989
    817990"Shell Pressure Drop Inlet Nozzle"
    818         PdropNozzles.Shell.Pdnozzle_in  = HE.DeltaPshellNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
     991        Unity(1).Shell.PressureDrop.Pdnozzle_in = HE.DeltaPshellNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
    819992
    820993"Velocity Shell Side Inlet Nozzle"
    821         PdropNozzles.Shell.Vnozzle_in   = HE.ShellVelocityNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
     994        Unity(1).Shell.PressureDrop.Vnozzle_in  = HE.ShellVelocityNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
    822995
    823996"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);
     997        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_out     =HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
    825998
    826999"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 
     1000        Unity(Nb+1).Shell.PressureDrop.Vnozzle_out      =HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
     1001       
    8371002
    8381003        else
    8391004
     1005"Shell Side inlet Nozzle rho-V^2"
     1006        Unity(1).Shell.PressureDrop.RVsquare_in = Unity(1).Properties.Cold.Inlet.rho*(Unity(1).Shell.PressureDrop.Vnozzle_in)^2;
     1007
     1008"Shell Side Outlet Nozzle rho-V^2"
     1009        Unity(Nb+1).Shell.PressureDrop.RVsquare_out = Unity(Nb+1).Properties.Cold.Outlet.rho*(Unity(Nb+1).Shell.PressureDrop.Vnozzle_out)^2;
     1010
     1011"Shell Pressure End Zones"
     1012        Unity(1).Shell.PressureDrop.PdEndZones          =       HE.DeltaPendZonesIncremental(Unity(1).Shell.HeatTransfer.Re,Unity(1).Baffles.Ls,Unity(1).Baffles.Lso,
     1013        Unity(1).Baffles.Lsi,Unity(1).Properties.Cold.Inlet.Fw,Unity(1).Shell.HeatTransfer.Phi,Unity(1).Properties.Cold.Average.rho);
     1014
     1015"Shell Pressure End Zones"
     1016        Unity(Nb+1).Shell.PressureDrop.PdEndZones       =       HE.DeltaPendZonesIncremental(Unity(Nb+1).Shell.HeatTransfer.Re,Unity(Nb+1).Baffles.Ls,Unity(Nb+1).Baffles.Lso,
     1017        Unity(Nb+1).Baffles.Lsi,Unity(Nb+1).Properties.Cold.Inlet.Fw,Unity(Nb+1).Shell.HeatTransfer.Phi,Unity(Nb+1).Properties.Cold.Average.rho);
     1018
     1019
    8401020"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);
     1021        Unity(1).Tubes.PressureDrop.Pdnozzle_in = HE.DeltaPtubeNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
    8421022
    8431023"Velocity Tube Side Inlet Nozzle"
    844         PdropNozzles.Tubes.Vnozzle_in   = HE.TubeVelocityNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
     1024        Unity(1).Tubes.PressureDrop.Vnozzle_in  = HE.TubeVelocityNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
    8451025
    8461026"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);   
     1027        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_out     = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);   
    8481028
    8491029"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); 
     1030        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_out      = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw); 
    8511031
    8521032"Shell Pressure Drop Inlet Nozzle"
    853         PdropNozzles.Shell.Pdnozzle_in  = HE.DeltaPshellNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
     1033        Unity(1).Shell.PressureDrop.Pdnozzle_in = HE.DeltaPshellNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
    8541034
    8551035"Velocity Shell Side Inlet Nozzle"
    856         PdropNozzles.Shell.Vnozzle_in   = HE.ShellVelocityNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
     1036        Unity(1).Shell.PressureDrop.Vnozzle_in  = HE.ShellVelocityNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
    8571037
    8581038"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);
     1039        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_out = HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
    8601040
    8611041"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;
     1042        Unity(Nb+1).Shell.PressureDrop.Vnozzle_out  = HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
    8711043
    8721044
     
    8761048for i in [2:Nb]
    8771049
    878 
     1050"Pressure Drop Tube Side Inlet Nozzle"
     1051        Unity(i).Tubes.PressureDrop.Pdnozzle_in = 0;
     1052
     1053"Velocity Tube Side Inlet Nozzle"
     1054        Unity(i).Tubes.PressureDrop.Vnozzle_in  = 0;
     1055
     1056"Pressure Drop Tube Side Outlet Nozzle"
     1057        Unity(i).Tubes.PressureDrop.Pdnozzle_out        = 0;   
     1058
     1059"Velocity Tube Side Outlet Nozzle"
     1060        Unity(i).Tubes.PressureDrop.Vnozzle_out = 0;   
     1061
     1062"Shell Pressure Drop Inlet Nozzle"
     1063        Unity(i).Shell.PressureDrop.Pdnozzle_in = 0;
     1064
     1065"Velocity Shell Side Inlet Nozzle"
     1066        Unity(i).Shell.PressureDrop.Vnozzle_in  = 0;
     1067
     1068"Shell Pressure Drop Outlet Nozzle"
     1069        Unity(i).Shell.PressureDrop.Pdnozzle_out = 0;
     1070
     1071"Velocity Shell Side Outlet Nozzle"
     1072        Unity(i).Shell.PressureDrop.Vnozzle_out  = 0;
     1073
     1074"Shell Pressure End Zones"
     1075        Unity(i).Shell.PressureDrop.PdEndZones          =       0;
     1076
     1077"Shell Side Outlet Nozzle rho-V^2"
     1078        Unity(i).Shell.PressureDrop.RVsquare_out = 0;
     1079       
     1080"Shell Side inlet Nozzle rho-V^2"
     1081        Unity(i).Shell.PressureDrop.RVsquare_in = 0;
     1082       
    8791083if side equal 1
    8801084       
    8811085        then
    8821086       
     1087"Shell Pressure Drop Cross Flow"
     1088        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);
     1089
     1090
     1091        else
     1092
     1093"Shell Pressure Drop Cross Flow"
     1094        Unity(i).Shell.PressureDrop.PdCross     =       HE.DeltaPcrossIncremental(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Cold.Average.rho);
     1095
     1096
     1097end
     1098
     1099"Zone Length"
     1100        Sumary.Lz(i) = Unity(1).Baffles.Ls;
     1101
     1102"Shell Side Cross Flow Area"
     1103        Unity(i).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(i).Baffles.Ls);
     1104       
     1105end
     1106
     1107
     1108for i in [1:Nb+1]
     1109
     1110
     1111if side equal 1
     1112       
     1113        then
    8831114"Pressure Drop Hot Stream"
    8841115        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P - Unity(i).Shell.PressureDrop.Pdtotal;   
     
    8861117"Pressure Drop Cold Stream"
    8871118        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 
     1119       
    9151120"Shell Side Reynolds Number"
    916         Unity(i).Shell.HeatTransfer.Re                          =       HE.ShellReynoldsNumber(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Hot.Average.Mu);
     1121        Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Hot.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Hot.Average.Mu;
    9171122
    9181123"Shell Heat Transfer Coefficient"
    919         Unity(i).Shell.HeatTransfer.hshell                      =       HE.ShellFilmCoeff(Unity(i).Shell.HeatTransfer.Ji,Unity(i).Properties.Hot.Average.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Shell.HeatTransfer.PR,Unity(i).Shell.HeatTransfer.Jtotal,Unity(i).Shell.HeatTransfer.Phi);
    920 
    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);
     1124        Unity(i).Shell.HeatTransfer.hshell =Unity(i).Shell.HeatTransfer.Ji*(Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*(Unity(i).Properties.Hot.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)*(Unity(i).Shell.HeatTransfer.PR^(-2/3))*Unity(i).Shell.HeatTransfer.Jtotal*Unity(i).Shell.HeatTransfer.Phi;
    9231125
    9241126"Shell Pressure Baffle Window"
    9251127        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);
    9261128
    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        
     1129"Hot Wall Temperature"
    9331130        Unity(i).Properties.Hot.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    9341131       
     1132"Cold Wall Temperature"
    9351133        Unity(i).Properties.Cold.Wall.Twall =   (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    9361134
    9371135"Tube Side Velocity"
    938         Unity(i).Tubes.HeatTransfer.Vtube       =       HE.TubeVelocity(Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Properties.Cold.Average.rho);
     1136        Unity(i).Tubes.HeatTransfer.Vtube       =       Unity(i).Properties.Cold.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Cold.Average.rho*Ntt);
    9391137
    9401138"Tube Side Reynolds Number"
    941         Unity(i).Tubes.HeatTransfer.Re          =       HE.TubeReynoldsNumber(Unity(i).Properties.Cold.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Properties.Cold.Average.Mu);
     1139        Unity(i).Tubes.HeatTransfer.Re          =       (Unity(i).Properties.Cold.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Cold.Average.Mu;
    9421140       
    9431141"Tube Side Prandtl Number"
    944         Unity(i).Tubes.HeatTransfer.PR          =       HE.PrandtlNumber(Unity(i).Properties.Cold.Average.K,Unity(i).Properties.Cold.Average.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Average.Mu);
     1142        Unity(i).Tubes.HeatTransfer.PR          =       ((Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Average.Mu)/Unity(i).Properties.Cold.Average.K;
    9451143
    9461144"Tube Side Prandtl Number at Wall"
    947         Unity(i).Tubes.HeatTransfer.PRw         =       HE.PrandtlNumber(Unity(i).Properties.Cold.Wall.K,Unity(i).Properties.Cold.Wall.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Wall.Mu);
     1145        Unity(i).Tubes.HeatTransfer.PRw         =       ((Unity(i).Properties.Cold.Wall.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Wall.Mu)/Unity(i).Properties.Cold.Wall.K;
    9481146
    9491147"Tube Side Film Coefficient"
    950         Unity(i).Tubes.HeatTransfer.htube       =       HE.TubeFilmCoeffIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Cold.Average.K,
    951         Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lpos(i));
     1148        Unity(i).Tubes.HeatTransfer.htube       =       HE.TubeFilmCoeffIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Cold.Average.K,Sumary.Lz(i))*Unity(i).Tubes.HeatTransfer.Phi;
    9521149       
    9531150"Shell Side Prandtl Number"
    954         Unity(i).Shell.HeatTransfer.PR          =       HE.PrandtlNumber(Unity(i).Properties.Hot.Average.K,Unity(i).Properties.Hot.Average.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Average.Mu);   
     1151        Unity(i).Shell.HeatTransfer.PR          =       ((Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Average.Mu)/Unity(i).Properties.Hot.Average.K;
    9551152
    9561153"Shell Side Prandtl Number at Wall"
    957         Unity(i).Shell.HeatTransfer.PRw         =       HE.PrandtlNumber(Unity(i).Properties.Hot.Wall.K,Unity(i).Properties.Hot.Wall.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Wall.Mu);   
     1154        Unity(i).Shell.HeatTransfer.PRw         =       ((Unity(i).Properties.Hot.Wall.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Wall.Mu)/Unity(i).Properties.Hot.Wall.K
    9581155
    9591156"Tube Side Pressure Drop"
     
    9691166        else
    9701167
     1168"Pressure Drop Hot Stream"
     1169        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P- Unity(i).Tubes.PressureDrop.Pdtotal;     
     1170       
     1171"Pressure Drop Cold Stream"
     1172        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Shell.PressureDrop.Pdtotal;
     1173       
    9711174"Shell Side Reynolds Number"
    972         Unity(i).Shell.HeatTransfer.Re                  =       HE.ShellReynoldsNumber(Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Cold.Average.Mu);
     1175        Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Cold.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Cold.Average.Mu;
    9731176
    9741177"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);
     1178        Unity(i).Shell.HeatTransfer.hshell      =Unity(i).Shell.HeatTransfer.Ji*(Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*
     1179        (Unity(i).Properties.Cold.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)*(Unity(i).Shell.HeatTransfer.PR^(-2/3))*Unity(i).Shell.HeatTransfer.Jtotal*Unity(i).Shell.HeatTransfer.Phi;
     1180
    9791181
    9801182"Shell Pressure Baffle Window"
    9811183        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);
    9821184
    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        
     1185
     1186"Hot Wall Temperature"
    9891187        Unity(i).Properties.Hot.Wall.Twall      =       (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    9901188       
     1189"Cold Wall Temperature"
    9911190        Unity(i).Properties.Cold.Wall.Twall     =       (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
    9921191
    9931192"Tube Side Velocity"
    994         Unity(i).Tubes.HeatTransfer.Vtube               =       HE.TubeVelocity(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Properties.Hot.Average.rho);
     1193        Unity(i).Tubes.HeatTransfer.Vtube               = Unity(i).Properties.Hot.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Hot.Average.rho*Ntt);
    9951194
    9961195"Tube Side Reynolds Number"
    997         Unity(i).Tubes.HeatTransfer.Re                  =       HE.TubeReynoldsNumber(Unity(i).Properties.Hot.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Properties.Hot.Average.Mu);
     1196        Unity(i).Tubes.HeatTransfer.Re                  =       (Unity(i).Properties.Hot.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Hot.Average.Mu;
    9981197       
    9991198"Tube Side Prandtl Number"
    1000         Unity(i).Tubes.HeatTransfer.PR                  =       HE.PrandtlNumber(Unity(i).Properties.Hot.Average.K,Unity(i).Properties.Hot.Average.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Average.Mu);
     1199        Unity(i).Tubes.HeatTransfer.PR                  =((Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Average.Mu)/Unity(i).Properties.Hot.Average.K;
    10011200       
    10021201"Tube Side Prandtl Number at Wall"
    1003         Unity(i).Tubes.HeatTransfer.PRw                 =       HE.PrandtlNumber(Unity(i).Properties.Hot.Wall.K,Unity(i).Properties.Hot.Wall.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Wall.Mu);
     1202        Unity(i).Tubes.HeatTransfer.PRw                 =       ((Unity(i).Properties.Hot.Wall.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Wall.Mu)/Unity(i).Properties.Hot.Wall.K;
    10041203       
    10051204       
    10061205"Tube Side Film Coefficient"
    1007         Unity(i).Tubes.HeatTransfer.htube               =       HE.TubeFilmCoeffIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Hot.Average.K,
    1008         Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lpos(i));
     1206        Unity(i).Tubes.HeatTransfer.htube               =       HE.TubeFilmCoeffIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Hot.Average.K,Sumary.Lz(i))*Unity(i).Tubes.HeatTransfer.Phi;
    10091207       
    10101208"Shell Side Prandtl Number"
    1011         Unity(i).Shell.HeatTransfer.PR                  =       HE.PrandtlNumber(Unity(i).Properties.Cold.Average.K,Unity(i).Properties.Cold.Average.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Average.Mu);
     1209        Unity(i).Shell.HeatTransfer.PR                  =       ((Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Average.Mu)/Unity(i).Properties.Cold.Average.K;
    10121210
    10131211"Shell Side Prandtl Number at Wall"
    1014         Unity(i).Shell.HeatTransfer.PRw                 =       HE.PrandtlNumber(Unity(i).Properties.Cold.Wall.K,Unity(i).Properties.Cold.Wall.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Wall.Mu);
     1212        Unity(i).Shell.HeatTransfer.PRw                 =       ((Unity(i).Properties.Cold.Wall.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Wall.Mu)/Unity(i).Properties.Cold.Wall.K;
    10151213
    10161214"Tube Side Pressure Drop"
     
    10261224end
    10271225
    1028 "Position for discretization"
    1029         Sumary.Lpos(i)                                                  =       sum(Sumary.Lz([1:i]));
    1030 
    10311226"Tube Resistance"       
    10321227        Unity(i).Resistances.Rtube*(Unity(i).Tubes.HeatTransfer.htube*Ditube) = Dotube;
     
    10461241"Baffles Spacing"
    10471242        Ltube = Unity(i).Baffles.Lsi+Unity(i).Baffles.Lso+Unity(i).Baffles.Ls*(Nb-1);
    1048        
    10491243
    10501244"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);
     1245        Unity(i).Shell.HeatTransfer.Js                  =       1;
    10521246
    10531247"Ji Factor"
     
    10681262"Total J Factor"
    10691263        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 
     1264end
     1265
     1266"Velocity Tube Side Inlet Nozzle"
     1267        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_in       = 0;
     1268
     1269"Velocity Tube Side Outlet Nozzle"
     1270        Unity(1).Tubes.PressureDrop.Vnozzle_out = 0;
     1271       
     1272"Tube Pressure Drop Inlet Nozzle"
     1273        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_in      = 0;
     1274
     1275"Tube Pressure Drop Outlet Nozzle"
     1276        Unity(1).Tubes.PressureDrop.Pdnozzle_out        = 0;
     1277
     1278"Velocity Shell Side Inlet Nozzle"
     1279        Unity(Nb+1).Shell.PressureDrop.Vnozzle_in       = 0;
     1280
     1281"Velocity Shell Side Outlet Nozzle"
     1282        Unity(1).Shell.PressureDrop.Vnozzle_out = 0;
     1283       
     1284"Shell Pressure Drop Inlet Nozzle"
     1285        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_in      = 0;
     1286       
     1287"Shell Pressure Drop Outlet Nozzle"
     1288        Unity(1).Shell.PressureDrop.Pdnozzle_out        = 0;
     1289
     1290"Shell Cross Flow Pressure Drop"
     1291        Unity(1).Shell.PressureDrop.PdCross             = 0;
     1292       
     1293"Shell Cross Flow Pressure Drop"
     1294        Unity(Nb+1).Shell.PressureDrop.PdCross          = 0;
     1295       
     1296"Shell Side Outlet Nozzle rho-V^2"
     1297        Unity(1).Shell.PressureDrop.RVsquare_out = 0;
     1298       
     1299"Shell Side inlet Nozzle rho-V^2"
     1300        Unity(Nb+1).Shell.PressureDrop.RVsquare_in = 0;
    10731301
    10741302SET
    1075 #=====================================================================
     1303#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    10761304#  Set Parameters for heatex Calculation
    1077 #=====================================================================
     1305#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    10781306        Sumary.Zones        = Nb+1;
    10791307        Pi                              = 3.14159265;
  • /mso/eml/heat_exchangers/HeatExchangerSimplified.mso

    r25 r49  
    1  #*--------------------------------------------------------------------*
    2 *
    3 *
    4 *
    5 *
    6 *
    7 *
    8 *               
    9 *                                               
    10 *
    11 *
    12 *----------------------------------------------------------------------
    13 * Author: Gerson Balbueno Bicca
    14 * $Id$
    15 *--------------------------------------------------------------------*#
    16 
     1#--------------------------------------------------------------------
     2# Author: Gerson Balbueno Bicca
     3# $Id$
     4#--------------------------------------------------------------------
    175using "HEX_Engine";
    18 
    196#=====================================================================
    207#       Basic Models for Simplified Heat Exchangers
    218#=====================================================================
    22 
    239Model HeatExchangerSimplified_Basic
    24 
    2510PARAMETERS
    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");
     11ext PP          as CalcObject   (Brief="External Physical Properties");
     12        HE              as CalcObject   (Brief="STHE Calculations",File="heatex");
     13ext NComp       as Integer      (Brief="Number of Components");
     14        M(NComp)        as molweight    (Brief="Component Mol Weight");
    3115       
    3216VARIABLES
     
    7155
    7256if Inlet.Cold.v equal 0
    73        
    7457        then   
    75        
    7658"Heat Capacity Cold Stream"
    77         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);
     59        Properties.Cold.Average.Cp              =       PP.LiquidCp(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
     60        Properties.Cold.Inlet.Cp                =       PP.LiquidCp(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
     61        Properties.Cold.Outlet.Cp               =       PP.LiquidCp(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    8062
    8163"Mass Density Cold Stream"
    8264        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);
    84         Properties.Cold.Outlet.rho      =       PP.LiquidDensity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
     65        Properties.Cold.Inlet.rho               =       PP.LiquidDensity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
     66        Properties.Cold.Outlet.rho              =       PP.LiquidDensity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    8567
    8668"Viscosity Cold Stream"
    87         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);
     69        Properties.Cold.Average.Mu              =       PP.LiquidViscosity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
     70        Properties.Cold.Inlet.Mu                =       PP.LiquidViscosity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
     71        Properties.Cold.Outlet.Mu               =       PP.LiquidViscosity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    9072
    9173"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);
     74        Properties.Cold.Average.K               =       PP.LiquidThermalConductivity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
     75        Properties.Cold.Inlet.K                 =       PP.LiquidThermalConductivity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
     76        Properties.Cold.Outlet.K                =       PP.LiquidThermalConductivity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    9577
    9678"Heat Capacity Cold Stream"
    97         Properties.Cold.Wall.Cp         =       PP.LiquidCp(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
     79        Properties.Cold.Wall.Cp                 =       PP.LiquidCp(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
    9880       
    9981"Viscosity Cold Stream"
    100         Properties.Cold.Wall.Mu =       PP.LiquidViscosity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
     82        Properties.Cold.Wall.Mu                 =       PP.LiquidViscosity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
    10183
    10284"Conductivity Cold Stream"
    103         Properties.Cold.Wall.K =        PP.LiquidThermalConductivity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
     85        Properties.Cold.Wall.K                  =       PP.LiquidThermalConductivity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
    10486
    10587
     
    11395"Mass Density Cold Stream"
    11496        Properties.Cold.Average.rho     =       PP.VapourDensity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
    115         Properties.Cold.Inlet.rho       =       PP.VapourDensity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
    116         Properties.Cold.Outlet.rho      =       PP.VapourDensity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
     97        Properties.Cold.Inlet.rho               =       PP.VapourDensity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
     98        Properties.Cold.Outlet.rho              =       PP.VapourDensity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    11799
    118100"Viscosity Cold Stream"
    119         Properties.Cold.Average.Mu =    PP.VapourViscosity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
    120         Properties.Cold.Inlet.Mu =              PP.VapourViscosity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
    121         Properties.Cold.Outlet.Mu =             PP.VapourViscosity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
     101        Properties.Cold.Average.Mu              =       PP.VapourViscosity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
     102        Properties.Cold.Inlet.Mu                =       PP.VapourViscosity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
     103        Properties.Cold.Outlet.Mu               =       PP.VapourViscosity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    122104
    123105"Conductivity Cold Stream"
    124         Properties.Cold.Average.K =     PP.VapourThermalConductivity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
    125         Properties.Cold.Inlet.K =               PP.VapourThermalConductivity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
    126         Properties.Cold.Outlet.K =              PP.VapourThermalConductivity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
     106        Properties.Cold.Average.K               =       PP.VapourThermalConductivity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
     107        Properties.Cold.Inlet.K                 =       PP.VapourThermalConductivity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
     108        Properties.Cold.Outlet.K                =       PP.VapourThermalConductivity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    127109       
    128110"Heat Capacity Cold Stream"
    129         Properties.Cold.Wall.Cp         =       PP.VapourCp(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
     111        Properties.Cold.Wall.Cp                 =       PP.VapourCp(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
    130112
    131113
    132114"Viscosity Cold Stream"
    133         Properties.Cold.Wall.Mu =       PP.VapourViscosity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
     115        Properties.Cold.Wall.Mu                 =       PP.VapourViscosity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
    134116
    135117"Conductivity Cold Stream"
    136         Properties.Cold.Wall.K =        PP.VapourThermalConductivity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
     118        Properties.Cold.Wall.K                  =       PP.VapourThermalConductivity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
    137119       
    138120       
     
    161143"Conductivity Hot Stream"
    162144        Properties.Hot.Average.K        =               PP.LiquidThermalConductivity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);   
    163         Properties.Hot.Inlet.K  =               PP.LiquidThermalConductivity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);     
     145        Properties.Hot.Inlet.K          =               PP.LiquidThermalConductivity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);     
    164146        Properties.Hot.Outlet.K         =               PP.LiquidThermalConductivity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);   
    165147
    166148"Heat Capacity Hot Stream"
    167         Properties.Hot.Wall.Cp  =               PP.LiquidCp(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
     149        Properties.Hot.Wall.Cp          =               PP.LiquidCp(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
    168150
    169151"Viscosity Hot Stream"
    170         Properties.Hot.Wall.Mu  =               PP.LiquidViscosity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);     
     152        Properties.Hot.Wall.Mu          =               PP.LiquidViscosity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);     
    171153
    172154"Conductivity Hot Stream"
    173         Properties.Hot.Wall.K   =               PP.LiquidThermalConductivity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);   
     155        Properties.Hot.Wall.K           =               PP.LiquidThermalConductivity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);   
    174156       
    175157
     
    193175"Conductivity Hot Stream"
    194176        Properties.Hot.Average.K        =               PP.VapourThermalConductivity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);   
    195         Properties.Hot.Inlet.K  =               PP.VapourThermalConductivity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);     
     177        Properties.Hot.Inlet.K          =               PP.VapourThermalConductivity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);     
    196178        Properties.Hot.Outlet.K         =               PP.VapourThermalConductivity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);   
    197179
    198180"Heat Capacity Hot Stream"
    199         Properties.Hot.Wall.Cp  =               PP.VapourCp(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
     181        Properties.Hot.Wall.Cp          =               PP.VapourCp(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
    200182
    201183"Viscosity Hot Stream"
    202         Properties.Hot.Wall.Mu  =               PP.VapourViscosity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
     184        Properties.Hot.Wall.Mu          =               PP.VapourViscosity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
    203185
    204186"Conductivity Hot Stream"
    205         Properties.Hot.Wall.K   =               PP.VapourThermalConductivity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);   
     187        Properties.Hot.Wall.K           =               PP.VapourThermalConductivity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);   
    206188
    207189
     
    216198"Cold Stream Heat Capacity"
    217199        Details.Cc =Inlet.Cold.F*Properties.Cold.Average.Cp;
    218        
    219 "Heat Capacity Ratio"
    220         [Details.Cmin,Details.Cmax,Details.Cr]  = HE.HeatCapacityRatio(Details.Ch,Details.Cc);
    221 
     200
     201"Minimum Heat Capacity"
     202        Details.Cmin  = min([Details.Ch,Details.Cc]);
     203
     204"Maximum Heat Capacity"
     205        Details.Cmax  = max([Details.Ch,Details.Cc]);
     206
     207"Heat Capacity Ratio"   
     208        Details.Cr    = Details.Cmin/Details.Cmax;
    222209#=====================================================================
    223210#       Energy Balance
     
    304291#       Basic Model for Heat Exchangers - LMTD Method
    305292#=====================================================================
    306 
    307293VARIABLES
    308294
    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");
    312 
    313 EQUATIONS
     295DT0     as temp_delta   (Brief="Temperature Difference at Inlet",Lower=1);
     296DTL             as temp_delta   (Brief="Temperature Difference at Outlet",Lower=1);
     297LMTD    as temp_delta   (Brief="Logarithmic Mean Temperature Difference",Lower=1);
     298Fc              as positive             (Brief="LMTD Correction Factor",Lower=0.5);
     299MTD             as temp_delta   (Brief="Mean Temperature Difference",Lower=1);
     300
     301EQUATIONS
     302#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     303#                       Log Mean Temperature Difference
     304#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     305if abs(DT0 - DTL) > 0.05*max(abs([DT0,DTL]))
     306       
     307        then
     308"Log Mean Temperature Difference"
     309        LMTD= (DT0-DTL)/ln(DT0/DTL);
     310
     311        else
     312       
     313if DT0*DTL equal 0
     314       
     315        then
     316"Log Mean Temperature Difference"
     317        LMTD = 0.5*(DT0+DTL);
     318       
     319        else
     320"Log Mean Temperature Difference"
     321        LMTD = 0.5*(DT0+DTL)*(1-(DT0-DTL)^2/(DT0*DTL)*(1+(DT0-DTL)^2/(DT0*DTL)/2)/12);
     322       
     323end
     324       
     325end
    314326
    315327"Exchange Surface Area"
    316         Details.Q = Details.U*Details.A*Fc*LMTD;       
     328        Details.Q = Details.U*Details.A*MTD;   
    317329       
    318330"Mean Temperature Difference"   
     
    332344Model HeatExchanger_LMTD        as Heatex_Basic_LMTD
    333345
    334 EQUATIONS
    335 
    336 "Cocurrent Flow LMTD"
    337         LMTD = HE.LogMeanTemperature(Inlet.Hot.T,Outlet.Hot.T,Inlet.Cold.T,Outlet.Cold.T);
     346PARAMETERS
     347
     348        Side as Integer         (Brief="Flow Direction",Lower=0,Upper=1);
     349
     350SET
     351
     352Side = HE.FlowDir(); # Return Flow Direction
     353
     354EQUATIONS
     355#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     356#       Flow Direction
     357#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     358if Side equal 0
     359#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     360#       Cocurrent Flow
     361#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#   
     362        then
     363"Temperature Difference at Inlet"
     364        DT0 = Inlet.Hot.T - Inlet.Cold.T;
     365
     366"Temperature Difference at Outlet"
     367        DTL = Outlet.Hot.T - Outlet.Cold.T;
     368
     369        else
     370#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     371#       Counter Flow
     372#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#           
     373"Temperature Difference at Inlet"
     374        DT0 = Inlet.Hot.T - Outlet.Cold.T;
     375
     376"Temperature Difference at Outlet"
     377        DTL = Outlet.Hot.T - Inlet.Cold.T;
     378end
    338379
    339380end
     
    344385#===================================================================== 
    345386EQUATIONS
    346 
    347 "Counter Flow LMTD"
    348         LMTD = HE.CounterLMTD(Inlet.Hot.T,Outlet.Hot.T,Inlet.Cold.T,Outlet.Cold.T);
    349 
     387"Temperature Difference at Inlet"
     388        DT0 = Inlet.Hot.T - Outlet.Cold.T;
     389
     390"Temperature Difference at Outlet"
     391        DTL = Outlet.Hot.T - Inlet.Cold.T;
     392       
    350393"LMTD Correction Factor"
    351394        Fc = HE.EshellCorrectionFactor(Inlet.Hot.T,Outlet.Hot.T,Inlet.Cold.T,Outlet.Cold.T);
     
    358401#=====================================================================
    359402EQUATIONS
    360 
    361 "Counter Flow LMTD"
    362         LMTD = HE.CounterLMTD(Inlet.Hot.T,Outlet.Hot.T,Inlet.Cold.T,Outlet.Cold.T);
    363 
     403"Temperature Difference at Inlet"
     404        DT0 = Inlet.Hot.T - Outlet.Cold.T;
     405
     406"Temperature Difference at Outlet"
     407        DTL = Outlet.Hot.T - Inlet.Cold.T;
     408       
    364409"LMTD Correction Factor"
    365410        Fc = HE.FshellCorrectionFactor(Inlet.Hot.T,Outlet.Hot.T,Inlet.Cold.T,Outlet.Cold.T);
     
    367412end
    368413
    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 
    388414#=====================================================================
    389415# NTU Method
     
    393419
    394420EQUATIONS
    395 
    396421"Effectiveness"
    397422        Eft=HE.Effectiveness(Details.Cr,Details.NTU);
     
    404429#=====================================================================
    405430EQUATIONS
    406 
    407431"TEMA E Shell Effectiveness"
    408432        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

    r25 r49  
    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
     
    1616using "streams.mso";
    1717
    18 Model Parameters
    19 #=====================================================================
    20 #       Heat Exchanger Parameters
    21 #===================================================================== 
     18Model Inlet_Main_Stream         
     19#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     20#       Inlet Streams
     21#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    2222PARAMETERS
     23
     24        Ncold   as Integer      (Brief="Number of Inlet Cold Streams",Lower=1);
     25        Nhot    as Integer      (Brief="Number of Inlet Hot Streams",Lower=1);
    2326       
    24 ext PP                  as CalcObject;
    25 ext     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);
    28        
    29 end     
    30 
    31 Model Inlet_Main_Stream         as Parameters
    32 #=====================================================================
    33 #       Inlet Streams
    34 #===================================================================== 
    35 
    3627VARIABLES
    3728
    38 Hot(Nhot)               as stream;# Inlet Hot Streams
    39 Cold(Ncold)     as stream;# Inlet Cold Streams
     29        Hot  (Nhot)     as stream;# Inlet Hot Streams
     30        Cold (Ncold)    as stream;# Inlet Cold Streams
    4031       
    4132end
    4233
    43 Model Outlet_Main_Stream        as Parameters
    44 #=====================================================================
     34Model Outlet_Main_Stream       
     35#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    4536#       Outlet Streams
    46 #===================================================================== 
     37#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     38PARAMETERS
    4739
     40        Ncold   as Integer      (Brief="Number of Inlet Cold Streams",Lower=1);
     41        Nhot    as Integer      (Brief="Number of Inlet Hot Streams",Lower=1);
     42       
    4843VARIABLES
    4944
    50 Hot(Nhot)               as stream_therm;# Outlet Hot Streams
    51 Cold(Ncold)     as stream_therm;# Outlet Cold Streams
     45        Hot  (Nhot)     as stream_therm;# Outlet Hot Streams
     46        Cold (Ncold)    as stream_therm;# Outlet Cold Streams
    5247       
    5348end
    5449
    5550Model Mheatex
    56 #=====================================================================
     51#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    5752#       Multistream Heat Exchanger Basic Calculation
    58 #=====================================================================         
     53#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    5954PARAMETERS
    6055
    61 ext     HE              as CalcObject   (Brief="Cold Box Calculations",File="Heatex.dll");
     56ext PP          as CalcObject   (Brief="Physical Properties");
     57ext     NComp   as Integer              (Brief="Number of Components");
     58        HE              as CalcObject   (Brief="Cold Box Calculations",File="heatex");
    6259        Side    as Integer              (Brief="Flow Direction",Lower=0,Upper=1);
    63 
    64 SET
    65 
    66 Side = HE.FlowDirection();
    67 
     60        Ncold   as Integer              (Brief="Number of Inlet Cold Streams",Lower=1);
     61        Nhot    as Integer              (Brief="Number of Inlet Hot Streams",Lower=1);
     62       
    6863VARIABLES
    6964
     
    7469        LMTD    as temp_delta   (Brief="Logarithmic Mean Temperature Difference");
    7570        UA      as positive     (Unit="W/K");
    76        
     71
     72SET
     73
     74Side = HE.FlowDir();
     75
     76Inlet.Ncold  = Ncold;
     77Outlet.Ncold = Ncold;
     78
     79Inlet.Nhot  = Nhot ;
     80Outlet.Nhot = Nhot ;
     81
     82
    7783EQUATIONS
    7884
     
    104110        Q=UA*LMTD;
    105111
    106 #===================================================================
     112#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    107113#       Flow Direction
    108 #===================================================================
     114#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
     115
    109116if Side equal 0
    110117       
    111118        then
    112 #=====================================================================
    113 #       Cocurrent Flow Multistream Heat Exchanger
    114 #===================================================================
    115119"Cocurrent Flow LMTD"
    116120        LMTD = HE.CocurrentLMTD(max(Inlet.Hot.T),min(Outlet.Hot.T),min(Inlet.Cold.T),max(Outlet.Cold.T));
    117121       
    118122        else
    119 #=====================================================================
    120 #       Counter Flow Multistream Heat Exchanger
    121 #=====================================================================
    122123"Counter Flow LMTD"
    123124        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

    r25 r49  
    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
    24         ext PP                  as CalcObject   (Brief="Physical Properties");
    25         ext     NComp           as Integer              (Brief="Number of Components");
    26         ext     Ninlet      as Integer          (Brief="Number of Inlet Streams",Lower=1);
     24        ext PP          as CalcObject(Brief="Physical Properties");
     25        ext     NComp   as Integer       (Brief="Number of Components");       
     26                Ninlet  as Integer       (Brief="Number of Inlet Streams",Lower=1);
    2727       
    2828VARIABLES
    2929        in  Inlet(Ninlet)       as stream;              #(Brief="Inlet Streams")
    3030        out Outlet              as stream_therm;#(Brief="Outlet Stream")
    31         Q                               as power                (Brief="Heat Transfer");
     31        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
     
    4345end
    4446
     47"Outlet Vapourisation Fraction"
     48        Outlet.v = PP.VapourFraction(Outlet.T,Outlet.P,Outlet.z);
    4549
    46 "Outlet Vapourisation Fraction"
    47         Outlet.v = PP.VapourFraction(Outlet.T,Outlet.P,Outlet.z);       
     50"Vapor fraction Outlet Stream"
     51        Vfrac = Outlet.v;
     52
     53"Liquid fraction Outlet Stream"
     54        Lfrac = 1-Vfrac;
    4855       
    4956end
    5057
    5158Model Heater            as Heater_Cooler_Basic
    52 #=====================================================================
     59#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    5360#       Heater
    54 #=====================================================================
     61#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#   
    5562EQUATIONS
    5663
     
    6168
    6269Model Cooler            as Heater_Cooler_Basic
    63 #=====================================================================
     70#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    6471#       Cooler
    65 #=====================================================================
     72#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#   
    6673EQUATIONS
    6774
  • /mso/eml/pressure_changers/valve.mso

    r25 r49  
    4040        x as fraction (Brief="Plug Position");
    4141        rho as dens_mass (Brief="Fluid Density", Default=1e3);
     42        v as vol_mol (Brief="Specific volume", Default=1e3);
    4243
    4344        PARAMETERS
     
    6061                (1-Inlet.v)*PP.LiquidDensity((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z);
    6162
     63        "Volume"
     64        v = Inlet.v*PP.VapourVolume((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z) +
     65                (1-Inlet.v)*PP.LiquidVolume((Inlet.T+Outlet.T)/2, (Inlet.P+Outlet.P)/2, Outlet.z);
     66
    6267        #if Inlet.P > Outlet.P then
    6368        #       "Flow"
    64                 Outlet.F = k*x*sqrt((Inlet.P - Outlet.P)*rho_ref / rho );
     69                Outlet.F * v = k*x*sqrt((Inlet.P - Outlet.P)*rho_ref / rho ) ;
    6570        #else
    6671        #       "Closed"
  • /mso/eml/stage_separators/column.mso

    r25 r49  
    5050        trays([top:topdown:bot]).OutletV.F = (1 + tanh(1 *
    5151            (trays([top:topdown:bot]).OutletV.P -
    52             trays([top:topdown:bot]).InletL.P)))/2 *
     52            trays([top:topdown:bot]).InletL.P)/"Pa"))/2 *
    5353            trays([top:topdown:bot]).Ah/trays([top:topdown:bot]).vV *
    5454            sqrt(2*(trays([top:topdown:bot]).OutletV.P -
     
    101101
    102102        "Pressure Drop through the tray"
    103         trays(top).OutletV.F = (1 + tanh(1 * (trays(top).OutletV.P - cond.OutletL.P)))/2 *
     103        trays(top).OutletV.F = (1 + tanh(1 * (trays(top).OutletV.P - cond.OutletL.P)/"Pa"))/2 *
    104104                trays(top).Ah/trays(top).vV * sqrt(2*(trays(top).OutletV.P -
    105105                cond.OutletL.P + 1e-8 * "atm") / (trays(top).alfa*trays(top).rhoV));
     
    107107        trays([top+topdown:topdown:bot]).OutletV.F = (1 + tanh(1 *
    108108            (trays([top+topdown:topdown:bot]).OutletV.P -
    109             trays([top+topdown:topdown:bot]).InletL.P)))/2 *
     109            trays([top+topdown:topdown:bot]).InletL.P)/"Pa"))/2 *
    110110            trays([top+topdown:topdown:bot]).Ah/trays([top+topdown:topdown:bot]).vV *
    111111            sqrt(2*(trays([top+topdown:topdown:bot]).OutletV.P -
     
    160160        tbottom as tank;
    161161        ttop as tank_cylindrical;
     162        spbottom as splitter;
     163        sptop as splitter;
     164        pump1 as pump;
     165
     166        EQUATIONS
     167        "Pressure Drop through the tray"
     168        trays(top).OutletV.F = (1 + tanh(1 * (trays(top).OutletV.P - ttop.Outlet.P)/"Pa"))/2 *
     169                trays(top).Ah/trays(top).vV /2* sqrt(2*(trays(top).OutletV.P -
     170                ttop.Outlet.P + 1e-8 * "atm") / (trays(top).alfa*trays(top).rhoV));
     171               
     172        trays([top+topdown:topdown:bot]).OutletV.F = (1 + tanh(1 *
     173            (trays([top+topdown:topdown:bot]).OutletV.P -
     174            trays([top+topdown:topdown:bot]).InletL.P)/"Pa"))/2 *
     175            trays([top+topdown:topdown:bot]).Ah/trays([top+topdown:topdown:bot]).vV /2*
     176            sqrt(2*(trays([top+topdown:topdown:bot]).OutletV.P -
     177                trays([top+topdown:topdown:bot]).InletL.P + 1e-8 * "atm") /
     178            (trays([top+topdown:topdown:bot]).alfa*trays([top+topdown:topdown:bot]).rhoV));
     179       
     180        CONNECTIONS
     181        #vapor
     182        reb.OutletV to trays(bot).InletV;
     183        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
     184        trays(top).OutletV to cond.InletV;
     185       
     186        #liquid
     187        cond.OutletL to ttop.Inlet;     
     188        ttop.Outlet to sptop.Inlet;
     189        sptop.Outlet2 to pump1.Inlet;   
     190        pump1.Outlet to trays(top).InletL;
     191        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
     192        trays(bot).OutletL to tbottom.Inlet;
     193        tbottom.Outlet to spbottom.Inlet;
     194        spbottom.Outlet2 to reb.InletL;
     195end
     196
     197
     198#* -------------------------------------------------------------------
     199* Distillation Column model with:
     200*
     201*       - NTrays like tray;
     202*       - a vessel in the bottom of column;
     203*       - a splitter who separate the bottom product and the stream to reboiler;
     204*       - steady state reboiler (thermosyphon);
     205*       - a dynamic condenser without subcooling;
     206*       - a splitter which separate reflux and distillate;
     207*       - a pump in reflux stream.
     208*
     209* ------------------------------------------------------------------*#
     210Model Distillation_thermosyphon_cond
     211        PARAMETERS
     212ext PP as CalcObject;
     213ext NComp as Integer;
     214        NTrays as Integer(Brief="Number of trays", Default=2);
     215        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
     216        top as Integer(Brief="Number of top tray");
     217        bot as Integer(Brief="Number of bottom tray");
     218
     219        SET
     220        top = (NTrays-1)*(1-topdown)/2+1;
     221        bot = NTrays/top;
     222       
     223        VARIABLES
     224        trays(NTrays) as tray;
     225        cond as condenser;
     226        reb as reboilerSteady;
     227        tbottom as tank;
    162228        spbottom as splitter;
    163229        sptop as splitter;
     
    175241
    176242        "Pressure Drop through the tray"
    177         trays(top).OutletV.F = (1 + tanh(1 * (trays(top).OutletV.P - ttop.Outlet.P)))/2 *
     243        trays(top).OutletV.F = (1 + tanh(1 * (trays(top).OutletV.P - cond.OutletL.P)/"Pa"))/2 *
    178244                trays(top).Ah/trays(top).vV * sqrt(2*(trays(top).OutletV.P -
    179                 ttop.Outlet.P + 1e-8 * "atm") / (trays(top).alfa*trays(top).rhoV));
     245                cond.OutletL.P + 1e-8 * "atm") / (trays(top).alfa*trays(top).rhoV));
    180246               
    181247        trays([top+topdown:topdown:bot]).OutletV.F = (1 + tanh(1 *
    182248            (trays([top+topdown:topdown:bot]).OutletV.P -
    183             trays([top+topdown:topdown:bot]).InletL.P)))/2 *
     249            trays([top+topdown:topdown:bot]).InletL.P)/"Pa"))/2 *
    184250            trays([top+topdown:topdown:bot]).Ah/trays([top+topdown:topdown:bot]).vV *
    185251            sqrt(2*(trays([top+topdown:topdown:bot]).OutletV.P -
    186252                trays([top+topdown:topdown:bot]).InletL.P + 1e-8 * "atm") /
    187253            (trays([top+topdown:topdown:bot]).alfa*trays([top+topdown:topdown:bot]).rhoV));
    188        
     254                       
    189255        CONNECTIONS
    190256        #vapor
     
    194260       
    195261        #liquid
    196         cond.OutletL to ttop.Inlet;     
    197         ttop.Outlet to sptop.Inlet;
    198         sptop.Outlet2 to pump1.Inlet;   
     262        cond.OutletL to sptop.Inlet;   
     263        sptop.Outlet2 to pump1.Inlet;
    199264        pump1.Outlet to trays(top).InletL;
    200265        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
     
    204269end
    205270
    206 
    207271#* -------------------------------------------------------------------
    208272* Distillation Column model with:
    209273*
    210274*       - NTrays like tray;
    211 *       - a vessel in the bottom of column;
    212 *       - a splitter who separate the bottom product and the stream to reboiler;
    213 *       - steady state reboiler (thermosyphon);
    214 *       - a dynamic condenser without subcooling;
     275*       - a kettle reboiler;
     276*       - a steady state condenser with subcooling;
     277*       - a vessel drum (layed cilinder);
    215278*       - a splitter which separate reflux and distillate;
    216279*       - a pump in reflux stream.
    217280*
    218281* ------------------------------------------------------------------*#
    219 Model Distillation_thermosyphon_cond
    220         PARAMETERS
    221 ext PP as CalcObject;
    222 ext NComp as Integer;
    223         NTrays as Integer(Brief="Number of trays", Default=2);
    224         topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
    225         top as Integer(Brief="Number of top tray");
    226         bot as Integer(Brief="Number of bottom tray");
    227 
    228         SET
    229         top = (NTrays-1)*(1-topdown)/2+1;
    230         bot = NTrays/top;
    231        
    232         VARIABLES
    233         trays(NTrays) as tray;
    234         cond as condenser;
    235         reb as reboilerSteady;
    236         tbottom as tank;
    237         spbottom as splitter;
     282Model Distillation_kettle_subcooling
     283        PARAMETERS
     284ext PP as CalcObject;
     285ext NComp as Integer;
     286        NTrays as Integer(Brief="Number of trays", Default=2);
     287        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
     288        top as Integer(Brief="Number of top tray");
     289        bot as Integer(Brief="Number of bottom tray");
     290
     291        SET
     292        top = (NTrays-1)*(1-topdown)/2+1;
     293        bot = NTrays/top;
     294       
     295        VARIABLES
     296        trays(NTrays) as tray;
     297        cond as condenserSteady;
     298        reb as reboiler;
     299        ttop as tank_cylindrical;
    238300        sptop as splitter;
    239301        pump1 as pump;
     
    250312
    251313        "Pressure Drop through the tray"
    252         trays(top).OutletV.F = (1 + tanh(1 * (trays(top).OutletV.P - cond.OutletL.P)))/2 *
     314        trays(top).OutletV.F = (1 + tanh(1 * (trays(top).OutletV.P - ttop.Outlet.P)/"Pa"))/2 *
     315                trays(top).Ah/trays(top).vV * sqrt(2*(trays(top).OutletV.P -
     316                ttop.Outlet.P + 1e-8 * "atm") / (trays(top).alfa*trays(top).rhoV));
     317               
     318        trays([top+topdown:topdown:bot]).OutletV.F = (1 + tanh(1 *
     319            (trays([top+topdown:topdown:bot]).OutletV.P -
     320            trays([top+topdown:topdown:bot]).InletL.P)/"Pa"))/2 *
     321            trays([top+topdown:topdown:bot]).Ah/trays([top+topdown:topdown:bot]).vV *
     322            sqrt(2*(trays([top+topdown:topdown:bot]).OutletV.P -
     323                trays([top+topdown:topdown:bot]).InletL.P + 1e-8 * "atm") /
     324            (trays([top+topdown:topdown:bot]).alfa*trays([top+topdown:topdown:bot]).rhoV));
     325       
     326        CONNECTIONS
     327        #vapor
     328        reb.OutletV to trays(bot).InletV;
     329        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
     330        trays(top).OutletV to cond.InletV;
     331       
     332        #liquid
     333        cond.OutletL to ttop.Inlet;     
     334        ttop.Outlet to sptop.Inlet;
     335        sptop.Outlet2 to pump1.Inlet;   
     336        pump1.Outlet to trays(top).InletL;
     337        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
     338        trays(bot).OutletL to reb.InletL;
     339end
     340
     341
     342#*----------------------------------------------------------------------
     343* Model of a  rectifier containing:
     344*       - NTrays like tray;
     345*       - dymamic condenser without subcooling;
     346*       - a splitter which separate reflux and distillate;
     347*       - a pump in reflux stream;
     348*---------------------------------------------------------------------*#
     349Model Rectifier
     350        PARAMETERS
     351ext PP as CalcObject;
     352ext NComp as Integer;
     353        NTrays as Integer(Brief="Number of trays", Default=2);
     354        topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
     355        top as Integer(Brief="Number of top tray");
     356        bot as Integer(Brief="Number of bottom tray");
     357
     358        SET
     359        top = (NTrays-1)*(1-topdown)/2+1;
     360        bot = NTrays/top;
     361       
     362        VARIABLES
     363        trays(NTrays) as tray;
     364        cond as condenser;
     365        sptop as splitter;
     366        pump1 as pump;
     367
     368        EQUATIONS
     369        "Pressure Drop through the tray"
     370        trays(top).OutletV.F = (1 + tanh(1 * (trays(top).OutletV.P - cond.OutletL.P)/"Pa"))/2 *
    253371                trays(top).Ah/trays(top).vV * sqrt(2*(trays(top).OutletV.P -
    254372                cond.OutletL.P + 1e-8 * "atm") / (trays(top).alfa*trays(top).rhoV));
     
    256374        trays([top+topdown:topdown:bot]).OutletV.F = (1 + tanh(1 *
    257375            (trays([top+topdown:topdown:bot]).OutletV.P -
    258             trays([top+topdown:topdown:bot]).InletL.P)))/2 *
     376            trays([top+topdown:topdown:bot]).InletL.P)/"Pa"))/2 *
    259377            trays([top+topdown:topdown:bot]).Ah/trays([top+topdown:topdown:bot]).vV *
    260378            sqrt(2*(trays([top+topdown:topdown:bot]).OutletV.P -
    261379                trays([top+topdown:topdown:bot]).InletL.P + 1e-8 * "atm") /
    262380            (trays([top+topdown:topdown:bot]).alfa*trays([top+topdown:topdown:bot]).rhoV));
    263                        
    264         CONNECTIONS
    265         #vapor
    266         reb.OutletV to trays(bot).InletV;
     381       
     382        CONNECTIONS
     383        #vapor
    267384        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
    268385        trays(top).OutletV to cond.InletV;
     
    270387        #liquid
    271388        cond.OutletL to sptop.Inlet;   
    272         sptop.Outlet2 to pump1.Inlet;
     389        sptop.Outlet2 to pump1.Inlet;   
    273390        pump1.Outlet to trays(top).InletL;
    274391        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
    275         trays(bot).OutletL to tbottom.Inlet;
    276         tbottom.Outlet to spbottom.Inlet;
    277         spbottom.Outlet2 to reb.InletL;
    278392end
    279393
    280394
    281395#* -------------------------------------------------------------------
    282 * Distillation Column model with:
    283 *
    284 *       - NTrays like tray;
    285 *       - a vessel in the bottom of column;
    286 *       - a splitter who separate the bottom product and the stream to reboiler;
    287 *       - steady state reboiler (thermosyphon) with partial vaporization;
    288 *       - a dynamic condenser without subcooling;
    289 *       - a splitter which separate reflux and distillate;
    290 *       - a pump in reflux stream.
    291 *
    292 * ------------------------------------------------------------------*#
    293 Model Distillation_thermosyphon_partial_cond
    294         PARAMETERS
    295 ext PP as CalcObject;
    296 ext NComp as Integer;
    297         NTrays as Integer(Brief="Number of trays", Default=2);
    298         topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
    299         top as Integer(Brief="Number of top tray");
    300         bot as Integer(Brief="Number of bottom tray");
    301 
    302         SET
    303         top = (NTrays-1)*(1-topdown)/2+1;
    304         bot = NTrays/top;
    305 
    306         VARIABLES
    307         trays(NTrays) as tray;
    308         cond as condenser;
    309         reb as reboilerSteady_partial;
    310         mix as mixer_phase;
    311         tbottom as tank;
    312         spbottom as splitter;
    313         sptop as splitter;
    314         pump1 as pump;
    315 
    316         SET
    317         mix.Npres = 1;
    318 
    319         EQUATIONS
    320 
    321         if (reb.OutletV.P > reb.InletL.P) then
    322                 "Pressure Drop through the reboiler"
    323                 reb.InletL.F = trays(bot).Ah/reb.vV * sqrt((reb.OutletV.P - trays(bot).OutletL.P)
    324                                 / (trays(bot).beta*reb.rho) );
    325         else
    326                 "No flow in reboiler"
    327                 reb.InletL.F = 0.0 * "mol/s";
    328         end
    329 
    330         if trays(1).vV > 0 then
    331                 "Pressure Drop through the tray"
    332                 trays(top).OutletV.F = (1 + tanh(1 * (trays(top).OutletV.P - cond.OutletL.P)))/2 *
    333                 trays(top).Ah/trays(top).vV * sqrt(2*(trays(top).OutletV.P -
    334                 cond.OutletL.P + 1e-8 * "atm") / (trays(top).alfa*trays(top).rhoV));
    335         else
    336                 "Pressure Drop through the tray"
    337                 trays(top).OutletV.F = 0;
    338         end
    339        
    340         for i in [top+topdown:topdown:bot]
    341                 if trays(i).vV > 0 then
    342                         trays(i).OutletV.F = (1 + tanh(1 * (trays(i).OutletV.P - trays(i).InletL.P)))/2 *
    343                         trays(i).Ah/trays(i).vV * sqrt(2*(trays(i).OutletV.P -
    344                         trays(i).InletL.P + 1e-8 * "atm") / (trays(i).alfa*trays(i).rhoV));
    345                 else
    346                         trays(i).OutletV.F = 0;
    347                 end
    348         end
    349        
    350         CONNECTIONS
    351         #vapor
    352         reb.OutletV to trays(bot).InletV;
    353         trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
    354         trays(top).OutletV to cond.InletV;
    355        
    356         #liquid
    357         cond.OutletL to sptop.Inlet;   
    358         sptop.Outlet2 to pump1.Inlet;
    359         pump1.Outlet to trays(top).InletL;
    360         trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
    361 #       trays(bot).OutletL to tbottom.Inlet;
    362         trays(bot).OutletL to mix.Inlet_mixer(1);
    363         reb.OutletL to mix.Inlet_mixer(2);
    364         mix.Outlet to tbottom.Inlet;
    365         tbottom.Outlet to spbottom.Inlet;
    366         spbottom.Outlet2 to reb.InletL;
    367 end
    368 
    369 
    370 #* -------------------------------------------------------------------
    371 * Distillation Column model with:
    372 *
    373 *       - NTrays like tray;
    374 *       - a kettle reboiler;
     396* Rectifier Column with:
     397*
     398*       - NTrays like tray;
    375399*       - a steady state condenser with subcooling;
    376400*       - a vessel drum (layed cilinder);
     
    379403*
    380404* ------------------------------------------------------------------*#
    381 Model Distillation_kettle_subcooling
     405Model Rectifier_subcooling
    382406        PARAMETERS
    383407ext PP as CalcObject;
     
    395419        trays(NTrays) as tray;
    396420        cond as condenserSteady;
    397         reb as reboiler;
    398421        ttop as tank_cylindrical;
    399422        sptop as splitter;
     
    401424
    402425        EQUATIONS
    403         if (reb.OutletV.P > reb.InletL.P) then
    404                 "Pressure Drop through the reboiler"
    405                 reb.OutletV.F = trays(bot).Ah/reb.vV * sqrt((reb.OutletV.P - trays(bot).OutletL.P)
    406                                 / (trays(bot).beta*reb.rhoV) );
    407         else
    408                 "No flow in reboiler"
    409                 reb.OutletV.F = 0.0 * "mol/s";
    410         end
    411 
    412         "Pressure Drop through the tray"
    413         trays(top).OutletV.F = (1 + tanh(1 * (trays(top).OutletV.P - ttop.Outlet.P)))/2 *
     426        "Pressure Drop through the tray"
     427        trays(top).OutletV.F = (1 + tanh(1 * (trays(top).OutletV.P - ttop.Outlet.P)/"Pa"))/2 *
    414428                trays(top).Ah/trays(top).vV * sqrt(2*(trays(top).OutletV.P -
    415429                ttop.Outlet.P + 1e-8 * "atm") / (trays(top).alfa*trays(top).rhoV));
     
    417431        trays([top+topdown:topdown:bot]).OutletV.F = (1 + tanh(1 *
    418432            (trays([top+topdown:topdown:bot]).OutletV.P -
    419             trays([top+topdown:topdown:bot]).InletL.P)))/2 *
     433            trays([top+topdown:topdown:bot]).InletL.P)/"Pa"))/2 *
    420434            trays([top+topdown:topdown:bot]).Ah/trays([top+topdown:topdown:bot]).vV *
    421435            sqrt(2*(trays([top+topdown:topdown:bot]).OutletV.P -
     
    425439        CONNECTIONS
    426440        #vapor
    427         reb.OutletV to trays(bot).InletV;
    428441        trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
    429442        trays(top).OutletV to cond.InletV;
     
    435448        pump1.Outlet to trays(top).InletL;
    436449        trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
    437         trays(bot).OutletL to reb.InletL;
    438450end
    439451
    440452
    441453#*----------------------------------------------------------------------
    442 * Model of a  rectifier containing:
     454* Model of a  Refluxed Stripping column containing:
    443455*       - NTrays like tray;
    444456*       - dymamic condenser without subcooling;
     
    446458*       - a pump in reflux stream;
    447459*---------------------------------------------------------------------*#
    448 Model Rectifier
     460Model Refluxed_Stripping
    449461        PARAMETERS
    450462ext PP as CalcObject;
     
    467479        EQUATIONS
    468480        "Pressure Drop through the tray"
    469         trays(top).OutletV.F = (1 + tanh(1 * (trays(top).OutletV.P - cond.OutletL.P)))/2 *
     481        trays(top).OutletV.F = (1 + tanh(1 * (trays(top).OutletV.P - cond.OutletL.P)/"Pa"))/2 *
    470482                trays(top).Ah/trays(top).vV * sqrt(2*(trays(top).OutletV.P -
    471483                cond.OutletL.P + 1e-8 * "atm") / (trays(top).alfa*trays(top).rhoV));
     
    473485        trays([top+topdown:topdown:bot]).OutletV.F = (1 + tanh(1 *
    474486            (trays([top+topdown:topdown:bot]).OutletV.P -
    475             trays([top+topdown:topdown:bot]).InletL.P)))/2 *
     487            trays([top+topdown:topdown:bot]).InletL.P)/"Pa"))/2 *
    476488            trays([top+topdown:topdown:bot]).Ah/trays([top+topdown:topdown:bot]).vV *
    477489            sqrt(2*(trays([top+topdown:topdown:bot]).OutletV.P -
     
    493505
    494506#* -------------------------------------------------------------------
    495 * Rectifier Column with:
    496 *
    497 *       - NTrays like tray;
    498 *       - a steady state condenser with subcooling;
     507* Refluxed Stripping Column with:
     508*
     509*       - NTrays like tray;
     510*       - a steady state condenser (with subcooling);
    499511*       - a vessel drum (layed cilinder);
    500512*       - a splitter which separate reflux and distillate;
     
    502514*
    503515* ------------------------------------------------------------------*#
    504 Model Rectifier_subcooling
     516Model Refluxed_Stripping_subcooling
    505517        PARAMETERS
    506518ext PP as CalcObject;
     
    524536        EQUATIONS
    525537        "Pressure Drop through the tray"
    526         trays(top).OutletV.F = (1 + tanh(1 * (trays(top).OutletV.P - ttop.Outlet.P)))/2 *
     538        trays(top).OutletV.F = (1 + tanh(1 * (trays(top).OutletV.P - ttop.Outlet.P)/"Pa"))/2 *
    527539                trays(top).Ah/trays(top).vV * sqrt(2*(trays(top).OutletV.P -
    528540                ttop.Outlet.P + 1e-8 * "atm") / (trays(top).alfa*trays(top).rhoV));
     
    530542        trays([top+topdown:topdown:bot]).OutletV.F = (1 + tanh(1 *
    531543            (trays([top+topdown:topdown:bot]).OutletV.P -
    532             trays([top+topdown:topdown:bot]).InletL.P)))/2 *
     544            trays([top+topdown:topdown:bot]).InletL.P)/"Pa"))/2 *
    533545            trays([top+topdown:topdown:bot]).Ah/trays([top+topdown:topdown:bot]).vV *
    534546            sqrt(2*(trays([top+topdown:topdown:bot]).OutletV.P -
     
    551563
    552564#*----------------------------------------------------------------------
    553 * Model of a  Refluxed Stripping column containing:
     565* Model of a  Refluxed Absorption column containing:
    554566*       - NTrays like tray;
    555567*       - dymamic condenser without subcooling;
     
    557569*       - a pump in reflux stream;
    558570*---------------------------------------------------------------------*#
    559 Model Refluxed_Stripping
     571Model Refluxed_Absorption
    560572        PARAMETERS
    561573ext PP as CalcObject;
     
    578590        EQUATIONS
    579591        "Pressure Drop through the tray"
    580         trays(top).OutletV.F = (1 + tanh(1 * (trays(top).OutletV.P - cond.OutletL.P)))/2 *
     592        trays(top).OutletV.F = (1 + tanh(1 * (trays(top).OutletV.P - cond.OutletL.P)/"Pa"))/2 *
    581593                trays(top).Ah/trays(top).vV * sqrt(2*(trays(top).OutletV.P -
    582594                cond.OutletL.P + 1e-8 * "atm") / (trays(top).alfa*trays(top).rhoV));
     
    584596        trays([top+topdown:topdown:bot]).OutletV.F = (1 + tanh(1 *
    585597            (trays([top+topdown:topdown:bot]).OutletV.P -
    586             trays([top+topdown:topdown:bot]).InletL.P)))/2 *
     598            trays([top+topdown:topdown:bot]).InletL.P)/"Pa"))/2 *
    587599            trays([top+topdown:topdown:bot]).Ah/trays([top+topdown:topdown:bot]).vV *
    588600            sqrt(2*(trays([top+topdown:topdown:bot]).OutletV.P -
     
    596608       
    597609        #liquid
    598         cond.OutletL to sptop.Inlet;   
     610        cond.OutletL to cond.InletV;   
     611        cond.OutletL to sptop.Inlet;
    599612        sptop.Outlet2 to pump1.Inlet;   
    600613        pump1.Outlet to trays(top).InletL;
     
    604617
    605618#* -------------------------------------------------------------------
    606 * Refluxed Stripping Column with:
     619* Refluxed Absorption Column with:
    607620*
    608621*       - NTrays like tray;
     
    613626*
    614627* ------------------------------------------------------------------*#
    615 Model Refluxed_Stripping_subcooling
     628Model Refluxed_Absorption_subcooling
    616629        PARAMETERS
    617630ext PP as CalcObject;
     
    635648        EQUATIONS
    636649        "Pressure Drop through the tray"
    637         trays(top).OutletV.F = (1 + tanh(1 * (trays(top).OutletV.P - ttop.Outlet.P)))/2 *
     650        trays(top).OutletV.F = (1 + tanh(1 * (trays(top).OutletV.P - ttop.Outlet.P)/"Pa"))/2 *
    638651                trays(top).Ah/trays(top).vV * sqrt(2*(trays(top).OutletV.P -
    639652                ttop.Outlet.P + 1e-8 * "atm") / (trays(top).alfa*trays(top).rhoV));
     
    641654        trays([top+topdown:topdown:bot]).OutletV.F = (1 + tanh(1 *
    642655            (trays([top+topdown:topdown:bot]).OutletV.P -
    643             trays([top+topdown:topdown:bot]).InletL.P)))/2 *
    644             trays([top+topdown:topdown:bot]).Ah/trays([top+topdown:topdown:bot]).vV *
    645             sqrt(2*(trays([top+topdown:topdown:bot]).OutletV.P -
    646                 trays([top+topdown:topdown:bot]).InletL.P + 1e-8 * "atm") /
    647             (trays([top+topdown:topdown:bot]).alfa*trays([top+topdown:topdown:bot]).rhoV));
    648        
    649         CONNECTIONS
    650         #vapor
    651         trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
    652         trays(top).OutletV to cond.InletV;
    653        
    654         #liquid
    655         cond.OutletL to ttop.Inlet;     
    656         ttop.Outlet to sptop.Inlet;
    657         sptop.Outlet2 to pump1.Inlet;   
    658         pump1.Outlet to trays(top).InletL;
    659         trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
    660 end
    661 
    662 
    663 #*----------------------------------------------------------------------
    664 * Model of a  Refluxed Absorption column containing:
    665 *       - NTrays like tray;
    666 *       - dymamic condenser without subcooling;
    667 *       - a splitter which separate reflux and distillate;
    668 *       - a pump in reflux stream;
    669 *---------------------------------------------------------------------*#
    670 Model Refluxed_Absorption
    671         PARAMETERS
    672 ext PP as CalcObject;
    673 ext NComp as Integer;
    674         NTrays as Integer(Brief="Number of trays", Default=2);
    675         topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
    676         top as Integer(Brief="Number of top tray");
    677         bot as Integer(Brief="Number of bottom tray");
    678 
    679         SET
    680         top = (NTrays-1)*(1-topdown)/2+1;
    681         bot = NTrays/top;
    682        
    683         VARIABLES
    684         trays(NTrays) as tray;
    685         cond as condenser;
    686         sptop as splitter;
    687         pump1 as pump;
    688 
    689         EQUATIONS
    690         "Pressure Drop through the tray"
    691         trays(top).OutletV.F = (1 + tanh(1 * (trays(top).OutletV.P - cond.OutletL.P)))/2 *
    692                 trays(top).Ah/trays(top).vV * sqrt(2*(trays(top).OutletV.P -
    693                 cond.OutletL.P + 1e-8 * "atm") / (trays(top).alfa*trays(top).rhoV));
    694                
    695         trays([top+topdown:topdown:bot]).OutletV.F = (1 + tanh(1 *
    696             (trays([top+topdown:topdown:bot]).OutletV.P -
    697             trays([top+topdown:topdown:bot]).InletL.P)))/2 *
    698             trays([top+topdown:topdown:bot]).Ah/trays([top+topdown:topdown:bot]).vV *
    699             sqrt(2*(trays([top+topdown:topdown:bot]).OutletV.P -
    700                 trays([top+topdown:topdown:bot]).InletL.P + 1e-8 * "atm") /
    701             (trays([top+topdown:topdown:bot]).alfa*trays([top+topdown:topdown:bot]).rhoV));
    702        
    703         CONNECTIONS
    704         #vapor
    705         trays([top+topdown:topdown:bot]).OutletV to trays([top:topdown:bot-topdown]).InletV;
    706         trays(top).OutletV to cond.InletV;
    707        
    708         #liquid
    709         cond.OutletL to cond.InletV;   
    710         cond.OutletL to sptop.Inlet;
    711         sptop.Outlet2 to pump1.Inlet;   
    712         pump1.Outlet to trays(top).InletL;
    713         trays([top:topdown:bot-topdown]).OutletL to trays([top+topdown:topdown:bot]).InletL;
    714 end
    715 
    716 
    717 #* -------------------------------------------------------------------
    718 * Refluxed Absorption Column with:
    719 *
    720 *       - NTrays like tray;
    721 *       - a steady state condenser (with subcooling);
    722 *       - a vessel drum (layed cilinder);
    723 *       - a splitter which separate reflux and distillate;
    724 *       - a pump in reflux stream.
    725 *
    726 * ------------------------------------------------------------------*#
    727 Model Refluxed_Absorption_subcooling
    728         PARAMETERS
    729 ext PP as CalcObject;
    730 ext NComp as Integer;
    731         NTrays as Integer(Brief="Number of trays", Default=2);
    732         topdown as Integer(Brief="Trays counting (1=top-down, -1=bottom-up)", Default=1);
    733         top as Integer(Brief="Number of top tray");
    734         bot as Integer(Brief="Number of bottom tray");
    735 
    736         SET
    737         top = (NTrays-1)*(1-topdown)/2+1;
    738         bot = NTrays/top;
    739        
    740         VARIABLES
    741         trays(NTrays) as tray;
    742         cond as condenserSteady;
    743         ttop as tank_cylindrical;
    744         sptop as splitter;
    745         pump1 as pump;
    746 
    747         EQUATIONS
    748         "Pressure Drop through the tray"
    749         trays(top).OutletV.F = (1 + tanh(1 * (trays(top).OutletV.P - ttop.Outlet.P)))/2 *
    750                 trays(top).Ah/trays(top).vV * sqrt(2*(trays(top).OutletV.P -
    751                 ttop.Outlet.P + 1e-8 * "atm") / (trays(top).alfa*trays(top).rhoV));
    752                
    753         trays([top+topdown:topdown:bot]).OutletV.F = (1 + tanh(1 *
    754             (trays([top+topdown:topdown:bot]).OutletV.P -
    755             trays([top+topdown:topdown:bot]).InletL.P)))/2 *
     656            trays([top+topdown:topdown:bot]).InletL.P)/"Pa"))/2 *
    756657            trays([top+topdown:topdown:bot]).Ah/trays([top+topdown:topdown:bot]).vV *
    757658            sqrt(2*(trays([top+topdown:topdown:bot]).OutletV.P -
     
    810711        trays([top:topdown:bot]).OutletV.F = (1 + tanh(1 *
    811712            (trays([top:topdown:bot]).OutletV.P -
    812             trays([top:topdown:bot]).InletL.P)))/2 *
     713            trays([top:topdown:bot]).InletL.P)/"Pa"))/2 *
    813714            trays([top:topdown:bot]).Ah/trays([top:topdown:bot]).vV *
    814715            sqrt(2*(trays([top:topdown:bot]).OutletV.P -
     
    868769        trays([top:topdown:bot]).OutletV.F = (1 + tanh(1 *
    869770            (trays([top:topdown:bot]).OutletV.P -
    870             trays([top:topdown:bot]).InletL.P)))/2 *
     771            trays([top:topdown:bot]).InletL.P)/"Pa"))/2 *
    871772            trays([top:topdown:bot]).Ah/trays([top:topdown:bot]).vV *
    872773            sqrt(2*(trays([top:topdown:bot]).OutletV.P -
     
    915816                "Pressure Drop through the tray"
    916817                reb.OutletV.F = trays(bot).Ah/reb.vV * sqrt((reb.OutletV.P - trays(bot).OutletL.P)
    917                                 / (trays(bot).beta*reb.rhoV) ); # para o modelo com 25 pratos, o beta do refervedor é 0.8. Para a coluna com 80, o beta é:1.3
     818                                / (trays(bot).beta*reb.rhoV) );
    918819        else
    919820                "Prato selado"
     
    924825        trays([top:topdown:bot]).OutletV.F = (1 + tanh(1 *
    925826            (trays([top:topdown:bot]).OutletV.P -
    926             trays([top:topdown:bot]).InletL.P)))/2 *
     827            trays([top:topdown:bot]).InletL.P)/"Pa"))/2 *
    927828            trays([top:topdown:bot]).Ah/trays([top:topdown:bot]).vV *
    928829            sqrt(2*(trays([top:topdown:bot]).OutletV.P -
     
    973874                "Pressure Drop through the tray"
    974875                reb.OutletV.F = trays(bot).Ah/reb.vV * sqrt((reb.OutletV.P - trays(bot).OutletL.P)
    975                                 / (trays(bot).beta*reb.rhoV) ); # para o modelo com 25 pratos, o beta do refervedor é 0.8. Para a coluna com 80, o beta é:1.3
     876                                / (trays(bot).beta*reb.rhoV) );
    976877        else
    977878                "Prato selado"
     
    982883        trays([top:topdown:bot]).OutletV.F = (1 + tanh(1 *
    983884            (trays([top:topdown:bot]).OutletV.P -
    984             trays([top:topdown:bot]).InletL.P)))/2 *
     885            trays([top:topdown:bot]).InletL.P)/"Pa"))/2 *
    985886            trays([top:topdown:bot]).Ah/trays([top:topdown:bot]).vV *
    986887            sqrt(2*(trays([top:topdown:bot]).OutletV.P -
     
    999900        spbottom.Outlet2 to reb.InletL;
    1000901end
     902
     903# Reactive Distillation!!
     904Model ReactiveDistillation
     905        PARAMETERS
     906ext PP as CalcObject;
     907ext NComp as Integer;
     908        NTrays as Integer(Brief="Number of trays", Default=2);
     909       
     910        VARIABLES
     911        trays(NTrays) as trayReact;
     912        cond as condenserReact;
     913        reb as reboilerReact;
     914        sp as splitter;
     915        p as pump;
     916       
     917        EQUATIONS
     918        if ( reb.OutletV.P > 1 * "atm" ) then
     919                "Pressure Drop through the tray"
     920                reb.OutletV.F = trays(1).Ah/reb.vV * sqrt((reb.OutletV.P - 1*"atm") / (0.15*reb.rhoV) );
     921        else
     922                "Prato selado"
     923                reb.OutletV.F = 0.0 * "mol/s";
     924        end
     925       
     926        CONNECTIONS
     927        #vapor
     928        reb.OutletV to trays([NTrays]).InletV;
     929        trays([2:NTrays]).OutletV to trays([1:NTrays-1]).InletV;
     930        trays(1).OutletV to cond.InletV;
     931
     932        #liquid
     933        cond.OutletL to sp.Inlet;       
     934        sp.Outlet2 to p.Inlet;
     935        p.Outlet to trays(1).InletL;
     936        trays([1:NTrays-1]).OutletL to trays([2:NTrays]).InletL;
     937        trays(NTrays).OutletL to reb.InletL;
     938end
  • /mso/eml/stage_separators/condenser.mso

    r25 r49  
    122122        OutletL.v = 0.0;
    123123end
     124
     125#*-------------------------------------------------------------------
     126* Condenser with reaction in liquid phase
     127*--------------------------------------------------------------------*#
     128Model condenserReact
     129        PARAMETERS
     130ext PP as CalcObject;
     131ext NComp as Integer;
     132        V as volume (Brief="Condenser total volume");
     133        Across as area (Brief="Cross Section Area of reboiler");
     134
     135        stoic(NComp) as Real(Brief="Stoichiometric matrix");
     136        Hr as energy_mol;
     137        Pstartup as pressure;
     138
     139        VARIABLES
     140in      InletV as stream;                       #(Brief="Vapour inlet stream");
     141out     OutletL as stream_therm;        #(Brief="Liquid outlet stream");
     142out     OutletV as stream_therm;        #(Brief="Vapour outlet stream");
     143
     144        M(NComp) as mol (Brief="Molar Holdup in the tray");
     145        ML as mol (Brief="Molar liquid holdup");
     146        MV as mol (Brief="Molar vapour holdup");
     147        E as energy (Brief="Total Energy Holdup on tray");
     148        vL as volume_mol (Brief="Liquid Molar Volume");
     149        vV as volume_mol (Brief="Vapour Molar volume");
     150        Level as length (Brief="Level of liquid phase");
     151        Q as heat_rate (Brief="Heat supplied");
     152        Vol as volume;
     153        r as reaction_mol (Brief = "Reaction rate", Unit = "mol/l/s");
     154        C(NComp) as conc_mol (Brief = "Molar concentration", Lower = -1);
     155
     156        EQUATIONS
     157        "Molar Concentration"
     158        OutletL.z = vL * C;
     159       
     160        "Component Molar Balance"
     161        diff(M) = InletV.F*InletV.z - OutletL.F*OutletL.z
     162                                - OutletV.F*OutletV.z + stoic*r*ML*vL;
     163
     164        "Energy Balance"
     165        diff(E) = InletV.F*InletV.h - OutletL.F*OutletL.h
     166                                - OutletV.F*OutletV.h + Q + Hr * r * ML*vL;
     167
     168        "Molar Holdup"
     169        M = ML*OutletL.z + MV*OutletV.z;
     170       
     171        "Energy Holdup"
     172        E = ML*OutletL.h + MV*OutletV.h - OutletV.P*V;
     173       
     174        "Mol fraction normalisation"
     175        sum(OutletL.z)=1.0;
     176
     177        "Liquid Volume"
     178        vL = PP.LiquidVolume(OutletL.T, OutletL.P, OutletL.z);
     179        "Vapour Volume"
     180        vV = PP.VapourVolume(OutletV.T, OutletV.P, OutletV.z);
     181
     182        "Thermal Equilibrium"
     183        OutletL.T = OutletV.T;
     184
     185        "Mechanical Equilibrium"
     186        OutletV.P = OutletL.P;
     187
     188        "Geometry Constraint"
     189        V = ML*vL + MV*vV;
     190
     191        Vol = ML*vL;
     192       
     193        "Level of liquid phase"
     194        Level = ML*vL/Across;
     195       
     196        "Vapourisation Fraction"
     197        OutletL.v = 0.0;
     198        OutletV.v = 1.0;
     199       
     200        "Chemical Equilibrium"
     201        PP.LiquidFugacityCoefficient(OutletL.T, OutletL.P, OutletL.z)*OutletL.z =
     202        PP.VapourFugacityCoefficient(OutletV.T, OutletV.P, OutletV.z)*OutletV.z;
     203
     204        sum(OutletL.z)=sum(OutletV.z);
     205
     206end
  • /mso/eml/stage_separators/reboiler.mso

    r25 r49  
    141141end
    142142
     143Model reboilerSteady_fakeH
     144        PARAMETERS
     145ext PP as CalcObject;
     146ext NComp as Integer;
     147        DP as press_delta (Brief="Pressure Drop in the reboiler");
     148        k as Real (Brief = "Flow Constant", Unit="mol/J");
     149       
     150        VARIABLES
     151in      InletL as stream; #(Brief="Liquid inlet stream");
     152out     OutletV as stream; #(Brief="Vapour outlet stream");
     153in      Q as heat_rate (Brief="Heat supplied");
     154
     155        EQUATIONS
     156        "Molar Balance"
     157        InletL.F = OutletV.F;
     158        InletL.z = OutletV.z;
     159       
     160        "Energy Balance"
     161        InletL.F*InletL.h + Q = OutletV.F*OutletV.h;
     162       
     163        "Pressure"
     164