Changeset 164


Ignore:
Timestamp:
Feb 27, 2007, 3:15:46 PM (15 years ago)
Author:
gerson bicca
Message:

reorganized models and samples in heat exchanger folder

Location:
branches/newlanguage
Files:
3 added
29 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • branches/newlanguage/eml/heat_exchangers/DoublePipe.mso

    r157 r164  
    1919
    2020using "HEX_Engine";
    21 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    22 #       Basic Models for Double Pipe Heat Exchangers
    23 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    2421
    2522Model DoublePipe_Basic
     
    2724ATTRIBUTES
    2825        Pallete         = false;
    29         Brief           = "Double Pipe Basic Equations";
     26        Brief           = "Basic Equations for rigorous double pipe heat exchanger model.";
    3027        Info            =
    31         "write some information";
    32        
     28        "to be documented.";
     29
    3330PARAMETERS
     31
    3432outer PP                        as Plugin               (Brief="External Physical Properties");
    3533outer NComp             as Integer      (Brief="Number of Components");
    36                 M(NComp)        as molweight    (Brief="Component Mol Weight");
    37        
    38 VARIABLES
    39 
    40 in      Inlet                   as Inlet_Main_Stream    (Brief="Hot and Cold Inlets");   
    41 out     Outlet                  as Outlet_Main_Stream   (Brief="Hot and Cold Outlets"); 
    42                 Properties              as Main_Properties              (Brief="Hot and Cold Properties");       
    43                 Details                 as Details_Main                 (Brief="Details");
    44                 Inner                   as Main_DoublePipe              (Brief="Inner Side");
    45                 Outer                   as Main_DoublePipe              (Brief="Outer Side");
    46                 Resistances     as Main_Resistances             (Brief="Resistances");
    47 
    48 SET
    49 
    50         M  = PP.MolecularWeight();
    51 
    52 EQUATIONS
    53 
    54 "Hot Stream Average Temperature"
    55         Properties.Hot.Average.T = 0.5*Inlet.Hot.T + 0.5*Outlet.Hot.T;
    56        
    57 "Cold Stream Average Temperature"
    58         Properties.Cold.Average.T = 0.5*Inlet.Cold.T + 0.5*Outlet.Cold.T;
    59        
    60 "Hot Stream Average Pressure"
    61         Properties.Hot.Average.P = 0.5*Inlet.Hot.P+0.5*Outlet.Hot.P;
    62        
    63 "Cold Stream Average Pressure"
    64         Properties.Cold.Average.P = 0.5*Inlet.Cold.P+0.5*Outlet.Cold.P;
    65 
    66 "Cold Stream Wall Temperature"
    67         Properties.Cold.Wall.Twall =   0.5*Properties.Hot.Average.T + 0.5*Properties.Cold.Average.T;
    68 
    69 "Hot Stream Wall Temperature"
    70         Properties.Hot.Wall.Twall =   0.5*Properties.Hot.Average.T + 0.5*Properties.Cold.Average.T;
    71 
    72 "Hot Stream Average Molecular Weight"
    73         Properties.Hot.Average.Mw = sum(M*Inlet.Hot.z);
    74 
    75 "Cold Stream Average Molecular Weight"
    76         Properties.Cold.Average.Mw = sum(M*Inlet.Cold.z);
    77 
    78 if Inlet.Cold.v equal 0
    79         then   
    80 "Heat Capacity Cold Stream"
    81         Properties.Cold.Average.Cp              =       PP.LiquidCp(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
    82         Properties.Cold.Inlet.Cp                =       PP.LiquidCp(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
    83         Properties.Cold.Outlet.Cp               =       PP.LiquidCp(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    84 
    85 "Mass Density Cold Stream"
    86         Properties.Cold.Average.rho     =       PP.LiquidDensity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
    87         Properties.Cold.Inlet.rho               =       PP.LiquidDensity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
    88         Properties.Cold.Outlet.rho              =       PP.LiquidDensity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    89 
    90 "Viscosity Cold Stream"
    91         Properties.Cold.Average.Mu      =       PP.LiquidViscosity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
    92         Properties.Cold.Inlet.Mu                =       PP.LiquidViscosity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
    93         Properties.Cold.Outlet.Mu               =       PP.LiquidViscosity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    94 
    95 "Conductivity Cold Stream"
    96         Properties.Cold.Average.K               =       PP.LiquidThermalConductivity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
    97         Properties.Cold.Inlet.K                 =       PP.LiquidThermalConductivity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
    98         Properties.Cold.Outlet.K                =       PP.LiquidThermalConductivity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    99 
    100 "Heat Capacity Cold Stream"
    101         Properties.Cold.Wall.Cp                 =       PP.LiquidCp(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
    102        
    103 "Viscosity Cold Stream"
    104         Properties.Cold.Wall.Mu                 =       PP.LiquidViscosity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
    105 
    106 "Conductivity Cold Stream"
    107         Properties.Cold.Wall.K                  =       PP.LiquidThermalConductivity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
    108 
    109 
    110         else
    111 
    112 "Heat Capacity Cold Stream"
    113         Properties.Cold.Average.Cp      =       PP.VapourCp(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
    114         Properties.Cold.Inlet.Cp        =       PP.VapourCp(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
    115         Properties.Cold.Outlet.Cp       =       PP.VapourCp(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    116 
    117 "Mass Density Cold Stream"
    118         Properties.Cold.Average.rho     =       PP.VapourDensity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
    119         Properties.Cold.Inlet.rho               =       PP.VapourDensity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
    120         Properties.Cold.Outlet.rho              =       PP.VapourDensity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    121 
    122 "Viscosity Cold Stream"
    123         Properties.Cold.Average.Mu              =       PP.VapourViscosity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
    124         Properties.Cold.Inlet.Mu                =       PP.VapourViscosity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
    125         Properties.Cold.Outlet.Mu               =       PP.VapourViscosity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    126 
    127 "Conductivity Cold Stream"
    128         Properties.Cold.Average.K               =       PP.VapourThermalConductivity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
    129         Properties.Cold.Inlet.K                 =       PP.VapourThermalConductivity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
    130         Properties.Cold.Outlet.K                =       PP.VapourThermalConductivity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
    131        
    132 "Heat Capacity Cold Stream"
    133         Properties.Cold.Wall.Cp                 =       PP.VapourCp(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
    134 
    135 
    136 "Viscosity Cold Stream"
    137         Properties.Cold.Wall.Mu                 =       PP.VapourViscosity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
    138 
    139 "Conductivity Cold Stream"
    140         Properties.Cold.Wall.K                  =       PP.VapourThermalConductivity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
    141        
    142        
    143        
    144 end
    145 
    146 if Inlet.Hot.v equal 0
    147 
    148         then
    149 
    150 "Heat Capacity Hot Stream"
    151         Properties.Hot.Average.Cp       =               PP.LiquidCp(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);
    152         Properties.Hot.Inlet.Cp         =               PP.LiquidCp(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);
    153         Properties.Hot.Outlet.Cp        =               PP.LiquidCp(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);
    154 
    155 "Mass Density Hot Stream"
    156         Properties.Hot.Average.rho      =               PP.LiquidDensity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);
    157         Properties.Hot.Inlet.rho        =               PP.LiquidDensity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);
    158         Properties.Hot.Outlet.rho       =               PP.LiquidDensity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);
    159 
    160 "Viscosity Hot Stream"
    161         Properties.Hot.Average.Mu       =               PP.LiquidViscosity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);     
    162         Properties.Hot.Inlet.Mu         =               PP.LiquidViscosity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);       
    163         Properties.Hot.Outlet.Mu        =               PP.LiquidViscosity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);     
    164 
    165 "Conductivity Hot Stream"
    166         Properties.Hot.Average.K        =               PP.LiquidThermalConductivity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);   
    167         Properties.Hot.Inlet.K          =               PP.LiquidThermalConductivity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);     
    168         Properties.Hot.Outlet.K         =               PP.LiquidThermalConductivity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);   
    169 
    170 "Heat Capacity Hot Stream"
    171         Properties.Hot.Wall.Cp          =               PP.LiquidCp(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
    172 
    173 "Viscosity Hot Stream"
    174         Properties.Hot.Wall.Mu          =               PP.LiquidViscosity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);     
    175 
    176 "Conductivity Hot Stream"
    177         Properties.Hot.Wall.K           =               PP.LiquidThermalConductivity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);   
    178        
    179 
    180         else
    181 
    182 "Heat Capacity Hot Stream"
    183         Properties.Hot.Average.Cp       =               PP.VapourCp(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);
    184         Properties.Hot.Inlet.Cp         =               PP.VapourCp(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);
    185         Properties.Hot.Outlet.Cp        =               PP.VapourCp(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);
    186 
    187 "Mass Density Hot Stream"
    188         Properties.Hot.Average.rho      =               PP.VapourDensity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);
    189         Properties.Hot.Inlet.rho        =               PP.VapourDensity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);
    190         Properties.Hot.Outlet.rho       =               PP.VapourDensity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);
    191 
    192 "Viscosity Hot Stream"
    193         Properties.Hot.Average.Mu       =               PP.VapourViscosity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);
    194         Properties.Hot.Inlet.Mu         =               PP.VapourViscosity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);
    195         Properties.Hot.Outlet.Mu        =               PP.VapourViscosity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);
    196 
    197 "Conductivity Hot Stream"
    198         Properties.Hot.Average.K        =               PP.VapourThermalConductivity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);   
    199         Properties.Hot.Inlet.K          =               PP.VapourThermalConductivity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);     
    200         Properties.Hot.Outlet.K         =               PP.VapourThermalConductivity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);   
    201 
    202 "Heat Capacity Hot Stream"
    203         Properties.Hot.Wall.Cp          =               PP.VapourCp(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
    204 
    205 "Viscosity Hot Stream"
    206         Properties.Hot.Wall.Mu          =               PP.VapourViscosity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
    207 
    208 "Conductivity Hot Stream"
    209         Properties.Hot.Wall.K           =               PP.VapourThermalConductivity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);   
    210 
    211 
    212 end
    213 
    214 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    215 #       Thermal Details
    216 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    217 "Hot Stream Heat Capacity"
    218         Details.Ch =Inlet.Hot.F*Properties.Hot.Average.Cp;
    219        
    220 "Cold Stream Heat Capacity"
    221         Details.Cc =Inlet.Cold.F*Properties.Cold.Average.Cp;
    222 
    223 "Minimum Heat Capacity"
    224         Details.Cmin  = min([Details.Ch,Details.Cc]);
    225 
    226 "Maximum Heat Capacity"
    227         Details.Cmax  = max([Details.Ch,Details.Cc]);
    228 
    229 "Heat Capacity Ratio"   
    230         Details.Cr*Details.Cmax   = Details.Cmin;
    231        
    232 #--------------------------------------------------------------------
    233 #       Energy Balance
    234 #--------------------------------------------------------------------
    235 
    236 "Energy Balance Hot Stream"
    237         Details.Q = Inlet.Hot.F*(Inlet.Hot.h-Outlet.Hot.h);
    238 
    239 "Energy Balance Cold Stream"
    240         Details.Q = Inlet.Cold.F*(Outlet.Cold.h - Inlet.Cold.h);
    241 
    242 #--------------------------------------------------------------------
    243 #       Material Balance
    244 #--------------------------------------------------------------------
    245 
    246 "Flow Mass Inlet Cold Stream"
    247         Properties.Cold.Inlet.Fw        =  sum(M*Inlet.Cold.z)*Inlet.Cold.F;
    248 
    249 "Flow Mass Outlet Cold Stream"
    250         Properties.Cold.Outlet.Fw       =  sum(M*Outlet.Cold.z)*Outlet.Cold.F;
    251 
    252 "Flow Mass Inlet Hot Stream"
    253         Properties.Hot.Inlet.Fw         =  sum(M*Inlet.Hot.z)*Inlet.Hot.F;
    254 
    255 "Flow Mass Outlet Hot Stream"   
    256         Properties.Hot.Outlet.Fw        =  sum(M*Outlet.Hot.z)*Outlet.Hot.F;
    257 
    258 "Molar Balance Hot Stream"
    259         Inlet.Hot.F  = Outlet.Hot.F;
    260        
    261 "Molar Balance Cold Stream"
    262         Inlet.Cold.F = Outlet.Cold.F;
    263 
    264 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    265 #       Constraints
    266 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    267 "Hot Stream Molar Fraction Constraint"
    268         Outlet.Hot.z=Inlet.Hot.z;
    269        
    270 "Cold Stream Molar Fraction Constraint"
    271         Outlet.Cold.z=Inlet.Cold.z;
    272        
    273 if Inner.PressureDrop.Re < 2300
    274 
    275         then
    276 "Inner Side Friction Factor - laminar Flow"
    277         Inner.PressureDrop.fi*Inner.PressureDrop.Re = 16;
    278 
    279         else
    280 "Inner Side Friction Factor - Turbulent Flow"
    281         (Inner.PressureDrop.fi-0.0035)*(Inner.PressureDrop.Re^0.42) = 0.264;
    282 
    283 end     
    284 
    285 
    286 if Outer.PressureDrop.Re < 2300
    287 
    288         then
    289 "Inner Side Friction Factor - laminar Flow"
    290         Outer.PressureDrop.fi*Outer.PressureDrop.Re = 16;
    291 
    292         else
    293 "Inner Side Friction Factor - Turbulent Flow"
    294         (Outer.PressureDrop.fi - 0.0035)*(Outer.PressureDrop.Re^0.42) = 0.264;
    295 
    296 end
    297 
    298 end
    299 
    300 Model DoublePipe                                        as DoublePipe_Basic
    301 
    302 ATTRIBUTES
    303         Pallete         = false;
    304         Brief           = "Double Pipe";
    305         Info            =
    306         "write some information";
    307        
    308 PARAMETERS
    309 
    310         HotSide                                                 as Switcher             (Brief="Hot Side in the Exchanger",Valid=["inner","outer"],Default="outer");
    311         innerFlowRegime                                 as Switcher             (Brief="Inner Flow Regime ",Valid=["laminar","transition","turbulent"],Default="laminar");
    312         outerFlowRegime                                 as Switcher             (Brief="Outer Flow Regime ",Valid=["laminar","transition","turbulent"],Default="laminar");
     34       
     35        M(NComp)        as molweight    (Brief="Component Mol Weight");
     36       
     37        Side                                    as Switcher     (Brief="Flag for Fluid Alocation ",Valid=["outer","inner"],Default="outer");
     38        innerFlowRegime         as Switcher     (Brief="Inner Flow Regime ",Valid=["laminar","transition","turbulent"],Default="laminar");
     39        outerFlowRegime         as Switcher     (Brief="Outer Flow Regime ",Valid=["laminar","transition","turbulent"],Default="laminar");
    31340
    31441        InnerLaminarCorrelation         as Switcher             (Brief="Heat Transfer Correlation in Laminar Flow for the Inner Side",Valid=["Hausen","Schlunder"],Default="Hausen");
     
    32047        OuterTurbulentCorrelation  as Switcher          (Brief="Heat Transfer Correlation in Turbulent Flow for the Outer Side",Valid=["Petukhov","SiederTate"],Default="Petukhov");
    32148
    322         Pi                                                                      as constant             (Brief="Pi Number",Default=3.14159265);
    323         DoInner                                                 as length                       (Brief="Outside Diameter of Inner Pipe",Lower=1e-6);
    324         DiInner                                                 as length                       (Brief="Inside Diameter of Inner Pipe",Lower=1e-10);
    325         DiOuter                                                 as length                       (Brief="Inside Diameter of Outer pipe",Lower=1e-10);
    326         Lpipe                                                           as length                       (Brief="Effective Tube Length",Lower=0.1);
    327         Kwall                                                           as conductivity         (Brief="Tube Wall Material Thermal Conductivity",Default=1.0);
    328        
     49        Pi                      as constant             (Brief="Pi Number",Default=3.14159265);
     50        DoInner  as length                      (Brief="Outside Diameter of Inner Pipe",Lower=1e-6);
     51        DiInner as length                       (Brief="Inside Diameter of Inner Pipe",Lower=1e-10);
     52        DiOuter as length                       (Brief="Inside Diameter of Outer pipe",Lower=1e-10);
     53        Lpipe           as length                       (Brief="Effective Tube Length",Lower=0.1);
     54        Kwall           as conductivity         (Brief="Tube Wall Material Thermal Conductivity",Default=1.0);
     55        Rfi                     as positive                     (Brief="Inside Fouling Resistance",Unit='m^2*K/kW',Default=1e-6,Lower=0);
     56        Rfo             as positive                     (Brief="Outside Fouling Resistance",Unit='m^2*K/kW',Default=1e-6,Lower=0);
     57
     58VARIABLES
     59
     60in      InletInner              as stream                       (Brief="Inlet Inner Stream");   
     61in      InletOuter              as stream                       (Brief="Inlet Outer Stream");
     62out     OutletInner             as streamPH             (Brief="Outlet Inner Stream");
     63out     OutletOuter     as streamPH             (Brief="Outlet Outer Stream");
     64
     65        Details                 as Details_Main                 (Brief="Some Details in the Heat Exchanger");
     66        Inner                   as Main_DoublePipe              (Brief="Inner Side of the Heat Exchanger");
     67        Outer                   as Main_DoublePipe              (Brief="Outer Side of the Heat Exchanger");
     68
    32969SET
    33070
     71        M  = PP.MolecularWeight();
     72       
    33173        Pi      = 3.14159265;
    332 
    333 SET
    334 
     74       
    33575#"Inner Pipe Cross Sectional Area for Flow"
    33676        Inner.HeatTransfer.As=Pi*DiInner*DiInner/4;
     
    35393EQUATIONS
    35494
     95"OuterStream Average Temperature"
     96        Outer.Properties.Average.T = 0.5*InletOuter.T + 0.5*OutletOuter.T;
     97
     98"Inner Stream Average Temperature"
     99        Inner.Properties.Average.T = 0.5*InletInner.T + 0.5*OutletInner.T;
     100       
     101"Outer Stream Average Pressure"
     102        Outer.Properties.Average.P = 0.5*InletOuter.P+0.5*OutletOuter.P;
     103       
     104"Cold Stream Average Pressure"
     105        Inner.Properties.Average.P = 0.5*InletInner.P+0.5*OutletInner.P;
     106
     107"Cold Stream Wall Temperature"
     108        Inner.Properties.Wall.Twall =   0.5*Outer.Properties.Average.T + 0.5*Inner.Properties.Average.T;
     109
     110"Outer Stream Wall Temperature"
     111        Outer.Properties.Wall.Twall =   0.5*Outer.Properties.Average.T + 0.5*Inner.Properties.Average.T;
     112
     113"Outer Stream Average Molecular Weight"
     114        Outer.Properties.Average.Mw = sum(M*InletOuter.z);
     115
     116"Cold Stream Average Molecular Weight"
     117        Inner.Properties.Average.Mw = sum(M*InletInner.z);
     118
     119if InletInner.v equal 0
     120       
     121        then   
     122
     123"Heat Capacity Cold Stream"
     124        Inner.Properties.Average.Cp             =       PP.LiquidCp(Inner.Properties.Average.T,Inner.Properties.Average.P,InletInner.z);
     125        Inner.Properties.Inlet.Cp               =       PP.LiquidCp(InletInner.T,InletInner.P,InletInner.z);
     126        Inner.Properties.Outlet.Cp              =       PP.LiquidCp(OutletInner.T,OutletInner.P,OutletInner.z);
     127
     128"Mass Density Cold Stream"
     129        Inner.Properties.Average.rho    =       PP.LiquidDensity(Inner.Properties.Average.T,Inner.Properties.Average.P,InletInner.z);
     130        Inner.Properties.Inlet.rho              =       PP.LiquidDensity(InletInner.T,InletInner.P,InletInner.z);
     131        Inner.Properties.Outlet.rho             =       PP.LiquidDensity(OutletInner.T,OutletInner.P,OutletInner.z);
     132
     133"Viscosity Cold Stream"
     134        Inner.Properties.Average.Mu     =       PP.LiquidViscosity(Inner.Properties.Average.T,Inner.Properties.Average.P,InletInner.z);
     135        Inner.Properties.Inlet.Mu               =       PP.LiquidViscosity(InletInner.T,InletInner.P,InletInner.z);
     136        Inner.Properties.Outlet.Mu              =       PP.LiquidViscosity(OutletInner.T,OutletInner.P,OutletInner.z);
     137
     138"Conductivity Cold Stream"
     139        Inner.Properties.Average.K              =       PP.LiquidThermalConductivity(Inner.Properties.Average.T,Inner.Properties.Average.P,InletInner.z);
     140        Inner.Properties.Inlet.K                =       PP.LiquidThermalConductivity(InletInner.T,InletInner.P,InletInner.z);
     141        Inner.Properties.Outlet.K               =       PP.LiquidThermalConductivity(OutletInner.T,OutletInner.P,OutletInner.z);
     142
     143"Heat Capacity Cold Stream"
     144        Inner.Properties.Wall.Cp                =       PP.LiquidCp(Inner.Properties.Wall.Twall,Inner.Properties.Average.P,InletInner.z);
     145       
     146"Viscosity Cold Stream"
     147        Inner.Properties.Wall.Mu                =       PP.LiquidViscosity(Inner.Properties.Wall.Twall,Inner.Properties.Average.P,InletInner.z);
     148
     149"Conductivity Cold Stream"
     150        Inner.Properties.Wall.K                         =       PP.LiquidThermalConductivity(Inner.Properties.Wall.Twall,Inner.Properties.Average.P,InletInner.z);
     151
     152
     153        else
     154
     155"Heat Capacity Cold Stream"
     156        Inner.Properties.Average.Cp     =       PP.VapourCp(Inner.Properties.Average.T,Inner.Properties.Average.P,InletInner.z);
     157        Inner.Properties.Inlet.Cp       =       PP.VapourCp(InletInner.T,InletInner.P,InletInner.z);
     158        Inner.Properties.Outlet.Cp      =       PP.VapourCp(OutletInner.T,OutletInner.P,OutletInner.z);
     159
     160"Mass Density Cold Stream"
     161        Inner.Properties.Average.rho    =       PP.VapourDensity(Inner.Properties.Average.T,Inner.Properties.Average.P,InletInner.z);
     162        Inner.Properties.Inlet.rho              =       PP.VapourDensity(InletInner.T,InletInner.P,InletInner.z);
     163        Inner.Properties.Outlet.rho             =       PP.VapourDensity(OutletInner.T,OutletInner.P,OutletInner.z);
     164
     165"Viscosity Cold Stream"
     166        Inner.Properties.Average.Mu             =       PP.VapourViscosity(Inner.Properties.Average.T,Inner.Properties.Average.P,InletInner.z);
     167        Inner.Properties.Inlet.Mu               =       PP.VapourViscosity(InletInner.T,InletInner.P,InletInner.z);
     168        Inner.Properties.Outlet.Mu              =       PP.VapourViscosity(OutletInner.T,OutletInner.P,OutletInner.z);
     169
     170"Conductivity Cold Stream"
     171        Inner.Properties.Average.K              =       PP.VapourThermalConductivity(Inner.Properties.Average.T,Inner.Properties.Average.P,InletInner.z);
     172        Inner.Properties.Inlet.K                =       PP.VapourThermalConductivity(InletInner.T,InletInner.P,InletInner.z);
     173        Inner.Properties.Outlet.K               =       PP.VapourThermalConductivity(OutletInner.T,OutletInner.P,OutletInner.z);
     174       
     175"Heat Capacity Cold Stream"
     176        Inner.Properties.Wall.Cp                =       PP.VapourCp(Inner.Properties.Wall.Twall,Inner.Properties.Average.P,InletInner.z);
     177
     178
     179"Viscosity Cold Stream"
     180        Inner.Properties.Wall.Mu                =       PP.VapourViscosity(Inner.Properties.Wall.Twall,Inner.Properties.Average.P,InletInner.z);
     181
     182"Conductivity Cold Stream"
     183        Inner.Properties.Wall.K                         =       PP.VapourThermalConductivity(Inner.Properties.Wall.Twall,Inner.Properties.Average.P,InletInner.z);
     184       
     185       
     186       
     187end
     188
     189if InletOuter.v equal 0
     190
     191        then
     192
     193"Heat Capacity Hot Stream"
     194        Outer.Properties.Average.Cp     =               PP.LiquidCp(Outer.Properties.Average.T,Outer.Properties.Average.P,InletOuter.z);
     195        Outer.Properties.Inlet.Cp       =               PP.LiquidCp(InletOuter.T,InletOuter.P,InletOuter.z);
     196        Outer.Properties.Outlet.Cp      =               PP.LiquidCp(OutletOuter.T,OutletOuter.P,OutletOuter.z);
     197
     198"Mass Density Hot Stream"
     199        Outer.Properties.Average.rho    =               PP.LiquidDensity(Outer.Properties.Average.T,Outer.Properties.Average.P,InletOuter.z);
     200        Outer.Properties.Inlet.rho      =               PP.LiquidDensity(InletOuter.T,InletOuter.P,InletOuter.z);
     201        Outer.Properties.Outlet.rho     =               PP.LiquidDensity(OutletOuter.T,OutletOuter.P,OutletOuter.z);
     202
     203"Viscosity Hot Stream"
     204        Outer.Properties.Average.Mu     =               PP.LiquidViscosity(Outer.Properties.Average.T,Outer.Properties.Average.P,InletOuter.z);
     205        Outer.Properties.Inlet.Mu       =               PP.LiquidViscosity(InletOuter.T,InletOuter.P,InletOuter.z);     
     206        Outer.Properties.Outlet.Mu      =               PP.LiquidViscosity(OutletOuter.T,OutletOuter.P,OutletOuter.z); 
     207
     208"Conductivity Hot Stream"
     209        Outer.Properties.Average.K      =               PP.LiquidThermalConductivity(Outer.Properties.Average.T,Outer.Properties.Average.P,InletOuter.z);       
     210        Outer.Properties.Inlet.K                =               PP.LiquidThermalConductivity(InletOuter.T,InletOuter.P,InletOuter.z);   
     211        Outer.Properties.Outlet.K       =               PP.LiquidThermalConductivity(OutletOuter.T,OutletOuter.P,OutletOuter.z);       
     212
     213"Heat Capacity Hot Stream"
     214        Outer.Properties.Wall.Cp                =               PP.LiquidCp(Outer.Properties.Wall.Twall,Outer.Properties.Average.P,InletOuter.z);
     215
     216"Viscosity Hot Stream"
     217        Outer.Properties.Wall.Mu                =               PP.LiquidViscosity(Outer.Properties.Wall.Twall,Outer.Properties.Average.P,InletOuter.z);       
     218
     219"Conductivity Hot Stream"
     220        Outer.Properties.Wall.K                 =               PP.LiquidThermalConductivity(Outer.Properties.Wall.Twall,Outer.Properties.Average.P,InletOuter.z);     
     221       
     222
     223        else
     224
     225"Heat Capacity Hot Stream"
     226        Outer.Properties.Average.Cp     =               PP.VapourCp(Outer.Properties.Average.T,Outer.Properties.Average.P,InletOuter.z);
     227        Outer.Properties.Inlet.Cp       =               PP.VapourCp(InletOuter.T,InletOuter.P,InletOuter.z);
     228        Outer.Properties.Outlet.Cp      =               PP.VapourCp(OutletOuter.T,OutletOuter.P,OutletOuter.z);
     229
     230"Mass Density Hot Stream"
     231        Outer.Properties.Average.rho    =               PP.VapourDensity(Outer.Properties.Average.T,Outer.Properties.Average.P,InletOuter.z);
     232        Outer.Properties.Inlet.rho      =               PP.VapourDensity(InletOuter.T,InletOuter.P,InletOuter.z);
     233        Outer.Properties.Outlet.rho     =               PP.VapourDensity(OutletOuter.T,OutletOuter.P,OutletOuter.z);
     234
     235"Viscosity Hot Stream"
     236        Outer.Properties.Average.Mu     =               PP.VapourViscosity(Outer.Properties.Average.T,Outer.Properties.Average.P,InletOuter.z);
     237        Outer.Properties.Inlet.Mu       =               PP.VapourViscosity(InletOuter.T,InletOuter.P,InletOuter.z);
     238        Outer.Properties.Outlet.Mu      =               PP.VapourViscosity(OutletOuter.T,OutletOuter.P,OutletOuter.z);
     239
     240"Conductivity Hot Stream"
     241        Outer.Properties.Average.K      =               PP.VapourThermalConductivity(Outer.Properties.Average.T,Outer.Properties.Average.P,InletOuter.z);       
     242        Outer.Properties.Inlet.K                =               PP.VapourThermalConductivity(InletOuter.T,InletOuter.P,InletOuter.z);   
     243        Outer.Properties.Outlet.K       =               PP.VapourThermalConductivity(OutletOuter.T,OutletOuter.P,OutletOuter.z);       
     244
     245"Heat Capacity Hot Stream"
     246        Outer.Properties.Wall.Cp                =               PP.VapourCp(Outer.Properties.Wall.Twall,Outer.Properties.Average.P,InletOuter.z);
     247
     248"Viscosity Hot Stream"
     249        Outer.Properties.Wall.Mu                =               PP.VapourViscosity(Outer.Properties.Wall.Twall,Outer.Properties.Average.P,InletOuter.z);
     250
     251"Conductivity Hot Stream"
     252        Outer.Properties.Wall.K                 =               PP.VapourThermalConductivity(Outer.Properties.Wall.Twall,Outer.Properties.Average.P,InletOuter.z);     
     253
     254
     255end
     256
     257switch Side
     258       
     259        case "outer":
     260
     261"Energy Balance Hot Stream"
     262        Details.Q = InletOuter.F*(InletOuter.h-OutletOuter.h);
     263
     264"Energy Balance Cold Stream"
     265        Details.Q = InletInner.F*(OutletInner.h - InletInner.h);
     266
     267        when InletInner.T > InletOuter.T switchto "inner";
     268
     269case "inner":
     270
     271"Energy Balance Hot Stream"
     272        Details.Q = InletInner.F*(InletInner.h-OutletInner.h);
     273
     274"Energy Balance Cold Stream"
     275        Details.Q = InletOuter.F*(OutletOuter.h - InletOuter.h);
     276
     277        when InletInner.T < InletOuter.T switchto "outer";
     278
     279end
     280
     281"Flow Mass Inlet Cold Stream"
     282        Inner.Properties.Inlet.Fw       =  sum(M*InletInner.z)*InletInner.F;
     283
     284"Flow Mass Outlet Cold Stream"
     285        Inner.Properties.Outlet.Fw      =  sum(M*OutletInner.z)*OutletInner.F;
     286
     287"Flow Mass Inlet Hot Stream"
     288        Outer.Properties.Inlet.Fw               =  sum(M*InletOuter.z)*InletOuter.F;
     289
     290"Flow Mass Outlet Hot Stream"   
     291        Outer.Properties.Outlet.Fw      =  sum(M*OutletOuter.z)*OutletOuter.F;
     292
     293"Molar Balance Hot Stream"
     294        OutletOuter.F = InletOuter.F;
     295       
     296"Molar Balance Cold Stream"
     297        OutletInner.F = InletInner.F;
     298
     299"Hot Stream Molar Fraction Constraint"
     300        OutletOuter.z=InletOuter.z;
     301       
     302"Cold Stream Molar Fraction Constraint"
     303        OutletInner.z=InletInner.z;
     304
    355305"Exchange Surface Area"
    356306        Details.A=Pi*DoInner*Lpipe;
    357307
    358 
    359308switch innerFlowRegime
    360309       
    361310        case "laminar":
    362311       
     312"Inner Side Friction Factor for Pressure Drop - laminar Flow"
     313        Inner.PressureDrop.fi*Inner.PressureDrop.Re = 16;
     314       
     315        when Inner.PressureDrop.Re > 2300 switchto "transition";
     316
     317        case "transition":
     318       
     319"using Turbulent Flow - to be implemented"
     320        (Inner.PressureDrop.fi-0.0035)*(Inner.PressureDrop.Re^0.42) = 0.264;
     321
     322        when Inner.PressureDrop.Re < 2300 switchto "laminar";
     323        when Inner.PressureDrop.Re > 10000 switchto "turbulent";
     324
     325        case "turbulent":
     326
     327"Inner Side Friction Factor - Turbulent Flow"
     328        (Inner.PressureDrop.fi-0.0035)*(Inner.PressureDrop.Re^0.42) = 0.264;
     329
     330        when Inner.PressureDrop.Re < 10000 switchto "transition";
     331       
     332end     
     333
     334switch outerFlowRegime
     335       
     336        case "laminar":
     337       
     338"Outer Side Friction Factor - laminar Flow"
     339        Outer.PressureDrop.fi*Outer.PressureDrop.Re = 16;
     340       
     341        when Outer.PressureDrop.Re > 2300 switchto "transition";
     342
     343        case "transition":
     344       
     345"using Turbulent Flow - Transition Flow must be implemented"
     346        (Outer.PressureDrop.fi-0.0035)*(Outer.PressureDrop.Re^0.42) = 0.264;
     347
     348        when Outer.PressureDrop.Re < 2300 switchto "laminar";
     349        when Outer.PressureDrop.Re > 10000 switchto "turbulent";
     350
     351        case "turbulent":
     352
     353"Outer Side Friction Factor - Turbulent Flow"
     354        (Outer.PressureDrop.fi-0.0035)*(Outer.PressureDrop.Re^0.42) = 0.264;
     355
     356        when Outer.PressureDrop.Re < 10000 switchto "transition";
     357       
     358end
     359
     360switch innerFlowRegime
     361       
     362        case "laminar":
     363       
     364"Inner Side Friction Factor for Heat Transfer - laminar Flow"
    363365        Inner.HeatTransfer.fi   = 1/(0.79*ln(Inner.HeatTransfer.Re)-1.64)^2;
    364         switch InnerLaminarCorrelation
     366       
     367switch InnerLaminarCorrelation
    365368       
    366369        case "Hausen":
     
    377380       
    378381        Inner.HeatTransfer.fi   = 1/(0.79*ln(Inner.HeatTransfer.Re)-1.64)^2;
    379         switch InnerTransitionCorrelation
     382       
     383switch InnerTransitionCorrelation
    380384       
    381385        case "Gnielinski":
     
    392396        case "turbulent":
    393397
    394         switch InnerTurbulentCorrelation
     398switch InnerTurbulentCorrelation
    395399       
    396400        case "Petukhov":
     
    413417       
    414418        Outer.HeatTransfer.fi   = 1/(0.79*ln(Outer.HeatTransfer.Re)-1.64)^2;
    415         switch OuterLaminarCorrelation
     419switch OuterLaminarCorrelation
    416420       
    417421        case "Hausen":
     
    427431        case "transition":
    428432       
    429         switch OuterTransitionCorrelation
     433switch OuterTransitionCorrelation
    430434       
    431435        case "Gnielinski":
     
    436440        Outer.HeatTransfer.Nu =1;#to be implemented
    437441        Outer.HeatTransfer.fi   = 1/(0.79*ln(Outer.HeatTransfer.Re)-1.64)^2;
     442       
    438443end
    439444       
     
    443448        case "turbulent":
    444449       
    445         switch OuterTurbulentCorrelation
     450switch OuterTurbulentCorrelation
    446451       
    447452        case "Petukhov":
     
    452457        Outer.HeatTransfer.Nu = 0.027*(Outer.HeatTransfer.PR)^(1/3)*(Outer.HeatTransfer.Re)^(4/5);
    453458        Outer.HeatTransfer.fi   = 1/(1.82*log(Outer.HeatTransfer.Re)-1.64)^2;
     459       
    454460end
    455461
     
    458464end
    459465
    460 
    461 switch HotSide
    462        
    463         case "outer":
    464 
    465466"Inner Pipe Film Coefficient"
    466         Inner.HeatTransfer.hcoeff = (Inner.HeatTransfer.Nu*Properties.Cold.Average.K/DiInner)*Inner.HeatTransfer.Phi;
     467        Inner.HeatTransfer.hcoeff = (Inner.HeatTransfer.Nu*Inner.Properties.Average.K/DiInner)*Inner.HeatTransfer.Phi;
    467468
    468469"Outer Pipe Film Coefficient"
    469         Outer.HeatTransfer.hcoeff= (Outer.HeatTransfer.Nu*Properties.Hot.Average.K/Outer.HeatTransfer.Dh)*Outer.HeatTransfer.Phi;
     470        Outer.HeatTransfer.hcoeff= (Outer.HeatTransfer.Nu*Outer.Properties.Average.K/Outer.HeatTransfer.Dh)*Outer.HeatTransfer.Phi;
    470471
    471472"Pressure Drop Hot Stream"
    472         Outlet.Hot.P  = Inlet.Hot.P - Outer.PressureDrop.Pdrop;
     473        OutletOuter.P  = InletOuter.P - Outer.PressureDrop.Pdrop;
    473474
    474475"Pressure Drop Cold Stream"
    475         Outlet.Cold.P  = Inlet.Cold.P - Inner.PressureDrop.Pdrop;
     476        OutletInner.P  = InletInner.P - Inner.PressureDrop.Pdrop;
    476477       
    477478"Outer Pipe Pressure Drop"
    478         Outer.PressureDrop.Pdrop = (2*Outer.PressureDrop.fi*Lpipe*Properties.Hot.Average.rho*Outer.HeatTransfer.Vmean^2)/(Outer.PressureDrop.Dh*Outer.HeatTransfer.Phi);
     479        Outer.PressureDrop.Pdrop = (2*Outer.PressureDrop.fi*Lpipe*Outer.Properties.Average.rho*Outer.HeatTransfer.Vmean^2)/(Outer.PressureDrop.Dh*Outer.HeatTransfer.Phi);
    479480       
    480481"Inner Pipe Pressure Drop"
    481         Inner.PressureDrop.Pdrop = (2*Inner.PressureDrop.fi*Lpipe*Properties.Cold.Average.rho*Inner.HeatTransfer.Vmean^2)/(DiInner*Inner.HeatTransfer.Phi);
     482        Inner.PressureDrop.Pdrop = (2*Inner.PressureDrop.fi*Lpipe*Inner.Properties.Average.rho*Inner.HeatTransfer.Vmean^2)/(DiInner*Inner.HeatTransfer.Phi);
    482483
    483484"Outer Pipe Phi correction"
    484         Outer.HeatTransfer.Phi = (Properties.Hot.Average.Mu/Properties.Hot.Wall.Mu)^0.14;
     485        Outer.HeatTransfer.Phi = (Outer.Properties.Average.Mu/Outer.Properties.Wall.Mu)^0.14;
    485486       
    486487"Inner Pipe Phi correction"
    487         Inner.HeatTransfer.Phi  = (Properties.Cold.Average.Mu/Properties.Cold.Wall.Mu)^0.14;
     488        Inner.HeatTransfer.Phi  = (Inner.Properties.Average.Mu/Inner.Properties.Wall.Mu)^0.14;
    488489
    489490"Outer Pipe Prandtl Number"
    490         Outer.HeatTransfer.PR = ((Properties.Hot.Average.Cp/Properties.Hot.Average.Mw)*Properties.Hot.Average.Mu)/Properties.Hot.Average.K;
     491        Outer.HeatTransfer.PR = ((Outer.Properties.Average.Cp/Outer.Properties.Average.Mw)*Outer.Properties.Average.Mu)/Outer.Properties.Average.K;
    491492
    492493"Inner Pipe Prandtl Number"
    493         Inner.HeatTransfer.PR = ((Properties.Cold.Average.Cp/Properties.Cold.Average.Mw)*Properties.Cold.Average.Mu)/Properties.Cold.Average.K;
     494        Inner.HeatTransfer.PR = ((Inner.Properties.Average.Cp/Inner.Properties.Average.Mw)*Inner.Properties.Average.Mu)/Inner.Properties.Average.K;
    494495
    495496"Outer Pipe Reynolds Number for Heat Transfer"
    496         Outer.HeatTransfer.Re = (Properties.Hot.Average.rho*Outer.HeatTransfer.Vmean*Outer.HeatTransfer.Dh)/Properties.Hot.Average.Mu;
     497        Outer.HeatTransfer.Re = (Outer.Properties.Average.rho*Outer.HeatTransfer.Vmean*Outer.HeatTransfer.Dh)/Outer.Properties.Average.Mu;
    497498
    498499"Outer Pipe Reynolds Number for Pressure Drop"
    499         Outer.PressureDrop.Re = (Properties.Hot.Average.rho*Outer.HeatTransfer.Vmean*Outer.PressureDrop.Dh)/Properties.Hot.Average.Mu;
     500        Outer.PressureDrop.Re = (Outer.Properties.Average.rho*Outer.HeatTransfer.Vmean*Outer.PressureDrop.Dh)/Outer.Properties.Average.Mu;
    500501
    501502"Inner Pipe Reynolds Number for Heat Transfer"
    502         Inner.HeatTransfer.Re = (Properties.Cold.Average.rho*Inner.HeatTransfer.Vmean*Inner.HeatTransfer.Dh)/Properties.Cold.Average.Mu;
     503        Inner.HeatTransfer.Re = (Inner.Properties.Average.rho*Inner.HeatTransfer.Vmean*Inner.HeatTransfer.Dh)/Inner.Properties.Average.Mu;
    503504
    504505"Inner Pipe Reynolds Number for Pressure Drop"
     
    506507
    507508"Outer Pipe Velocity"
    508         Outer.HeatTransfer.Vmean*(Outer.HeatTransfer.As*Properties.Hot.Average.rho)  = Properties.Hot.Inlet.Fw;
     509        Outer.HeatTransfer.Vmean*(Outer.HeatTransfer.As*Outer.Properties.Average.rho)  = Outer.Properties.Inlet.Fw;
    509510
    510511"Inner Pipe Velocity"
    511         Inner.HeatTransfer.Vmean*(Inner.HeatTransfer.As*Properties.Cold.Average.rho)  = Properties.Cold.Inlet.Fw;
    512 
    513         case "inner":
    514 
    515 "Outer Pipe Film Coefficient"
    516         Outer.HeatTransfer.hcoeff = (Outer.HeatTransfer.Nu*Properties.Cold.Average.K/Outer.HeatTransfer.Dh)*Outer.HeatTransfer.Phi;
    517 
    518 "InnerPipe Film Coefficient"
    519         Inner.HeatTransfer.hcoeff= (Inner.HeatTransfer.Nu*Properties.Hot.Average.K/DiInner)*Inner.HeatTransfer.Phi;
    520 
    521 "Pressure Drop Hot Stream"
    522         Outlet.Hot.P  = Inlet.Hot.P - Inner.PressureDrop.Pdrop;
    523 
    524 "Pressure Drop Cold Stream"
    525         Outlet.Cold.P  = Inlet.Cold.P - Outer.PressureDrop.Pdrop;
    526        
    527 "Outer Pipe Pressure Drop"
    528         Outer.PressureDrop.Pdrop = (2*Outer.PressureDrop.fi*Lpipe*Properties.Cold.Average.rho*Outer.HeatTransfer.Vmean^2)/(Outer.PressureDrop.Dh*Outer.HeatTransfer.Phi);
    529        
    530 "Inner Pipe Pressure Drop"
    531         Inner.PressureDrop.Pdrop        = (2*Inner.PressureDrop.fi*Lpipe*Properties.Hot.Average.rho*Inner.HeatTransfer.Vmean^2)/(DiInner*Inner.HeatTransfer.Phi);
    532 
    533 "Outer Pipe Phi correction"
    534         Outer.HeatTransfer.Phi          = (Properties.Cold.Average.Mu/Properties.Cold.Wall.Mu)^0.14;
    535        
    536 "Inner Pipe Phi correction"
    537         Inner.HeatTransfer.Phi          = (Properties.Hot.Average.Mu/Properties.Hot.Wall.Mu)^0.14;
    538        
    539 "Outer Pipe Prandtl Number"
    540         Outer.HeatTransfer.PR           = ((Properties.Cold.Average.Cp/Properties.Cold.Average.Mw)*Properties.Cold.Average.Mu)/Properties.Cold.Average.K;
    541 
    542 "Inner Pipe Prandtl Number"
    543         Inner.HeatTransfer.PR           = ((Properties.Hot.Average.Cp/Properties.Hot.Average.Mw)*Properties.Hot.Average.Mu)/Properties.Hot.Average.K;
    544 
    545 "Outer Pipe Reynolds Number for Heat Transfer"
    546         Outer.HeatTransfer.Re           = (Properties.Cold.Average.rho*Outer.HeatTransfer.Vmean*Outer.HeatTransfer.Dh)/Properties.Cold.Average.Mu;
    547 
    548 "Outer Pipe Reynolds Number for Pressure Drop"
    549         Outer.PressureDrop.Re           = (Properties.Cold.Average.rho*Outer.HeatTransfer.Vmean*Outer.PressureDrop.Dh)/Properties.Cold.Average.Mu;
    550 
    551 "Inner Pipe Reynolds Number for Pressure Drop"
    552         Inner.PressureDrop.Re           = Inner.HeatTransfer.Re;
    553 
    554 "Inner Pipe Reynolds Number for Heat Transfer"
    555         Inner.HeatTransfer.Re           = (Properties.Hot.Average.rho*Inner.HeatTransfer.Vmean*Inner.HeatTransfer.Dh)/Properties.Hot.Average.Mu;
    556 
    557 "Outer Pipe Velocity"
    558         Outer.HeatTransfer.Vmean*(Outer.HeatTransfer.As*Properties.Cold.Average.rho)= Properties.Cold.Inlet.Fw;
    559        
    560 "Inner Pipe Velocity"
    561         Inner.HeatTransfer.Vmean*(Inner.HeatTransfer.As*Properties.Hot.Average.rho)     = Properties.Hot.Inlet.Fw;
    562 
    563 end
    564 
    565 "Inner Pipe Resistance"
    566         Resistances.Rtube*(Inner.HeatTransfer.hcoeff*DiInner) = DoInner;
    567        
    568 "Wall Resistance"
    569         Resistances.Rwall*(2*Kwall) = DoInner*ln(DoInner/DiInner);
    570 
    571 "Outer Pipe Resistance"
    572         Resistances.Rshell*(Outer.HeatTransfer.hcoeff)=1;
     512        Inner.HeatTransfer.Vmean*(Inner.HeatTransfer.As*Inner.Properties.Average.rho)  = Inner.Properties.Inlet.Fw;
    573513
    574514"Overall Heat Transfer Coefficient Clean"
    575         Details.Uc*(Resistances.Rtube+Resistances.Rwall+Resistances.Rshell)=1;
     515        Details.Uc*((DoInner/(Inner.HeatTransfer.hcoeff*DiInner) )+(DoInner*ln(DoInner/DiInner)/(2*Kwall))+(1/(Outer.HeatTransfer.hcoeff)))=1;
    576516
    577517"Overall Heat Transfer Coefficient Dirty"
    578         Details.Ud*(Resistances.Rfi*(DoInner/DiInner) + Resistances.Rfo + Resistances.Rtube + Resistances.Rwall + Resistances.Rshell)=1;
    579        
    580 end
    581 
    582 Model DoublePipe_Basic_NTU                      as DoublePipe
     518        Details.Ud*(Rfi*(DoInner/DiInner) +  Rfo + (DoInner/(Inner.HeatTransfer.hcoeff*DiInner) )+(DoInner*ln(DoInner/DiInner)/(2*Kwall))+(1/(Outer.HeatTransfer.hcoeff)))=1;
     519
     520end
     521
     522Model DoublePipe_NTU as DoublePipe_Basic
    583523
    584524ATTRIBUTES
    585         Pallete         = false;
    586         Brief           = "Basic Model Double Pipe Heat Exchanger - NTU Method";
    587         Info            =
     525        Pallete = false;
     526        Brief  = "Double Pipe Heat Exchanger - NTU Method";
     527        Info  =
    588528        "write some information";
     529
     530PARAMETERS
     531
     532HotSide                         as Switcher     (Brief="Hot Side in the Exchanger",Valid=["outer","inner"],Default="outer");
     533FlowDirection   as Switcher     (Brief="Flow Direction",Valid=["counter","cocurrent"],Default="cocurrent");
    589534       
    590535VARIABLES
    591536
    592 Eft       as positive (Brief="Effectiveness",Default=0.5,Lower=1e-12);
    593 
    594 EQUATIONS       
    595 
    596 "Energy Balance"
    597         Details.Q       = Eft*Details.Cmin*(Inlet.Hot.T-Inlet.Cold.T); 
    598 
    599 
    600 end
    601 
    602 Model DoublePipe_Basic_LMTD                     as DoublePipe
    603 
    604 ATTRIBUTES
    605         Pallete         = false;
    606         Brief           = "Basic Model Double Pipe Heat Exchanger - LMTD Method";
    607         Info            =
    608         "write some information";
    609        
    610 VARIABLES
    611 
    612 DT0             as temp_delta   (Brief="Temperature Difference at Inlet",Lower=1);
    613 DTL             as temp_delta   (Brief="Temperature Difference at Outlet",Lower=1);
    614 LMTD            as temp_delta   (Brief="Logarithmic Mean Temperature Difference",Lower=1);
     537Method as NTU_Basic;
    615538
    616539EQUATIONS
    617 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    618 #                       Log Mean Temperature Difference
    619 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    620 
    621 if abs(DT0 - DTL) > 0.05*max(abs([DT0,DTL]))
    622        
    623         then
    624 "Log Mean Temperature Difference"
    625         LMTD*ln(DT0/DTL) = (DT0-DTL);
    626 
    627         else
    628        
    629 if DT0*DTL equal 0
    630        
    631         then
    632 "Log Mean Temperature Difference"
    633         LMTD = 0.5*(DT0+DTL);
    634 
    635         else
    636 "Log Mean Temperature Difference"
    637         LMTD = 0.5*(DT0+DTL)*(1-(DT0-DTL)^2/(DT0*DTL)*(1+(DT0-DTL)^2/(DT0*DTL)/2)/12);
    638        
    639 end
    640        
    641 end
    642 
    643 "Exchange Surface Area"
    644         Details.Q = Details.Ud*Pi*DoInner*Lpipe*LMTD;
    645 
    646 end
    647 
    648 Model DoublePipe_LMTD                                   as DoublePipe_Basic_LMTD
    649 
    650 ATTRIBUTES
    651         Pallete         = true;
    652         Brief           = "Double Pipe Heat Exchanger - LMTD Method";
    653         Info            =
    654         "write some information";
    655 
    656 PARAMETERS
    657 
    658         FlowDirection   as Switcher(Brief="Flow Direction",Valid=["counter","cocurrent"],Default="cocurrent");
    659 
    660 EQUATIONS
    661 
    662 switch FlowDirection
    663 
    664         case "cocurrent":
    665 "Temperature Difference at Inlet - Cocurrent Flow"
    666         DT0 = Inlet.Hot.T - Inlet.Cold.T;
    667 
    668 "Temperature Difference at Outlet - Cocurrent Flow"
    669         DTL = Outlet.Hot.T - Outlet.Cold.T;
    670 
    671         case "counter":
    672 "Temperature Difference at Inlet - Counter Flow"
    673         DT0 = Inlet.Hot.T - Outlet.Cold.T;
    674 
    675 "Temperature Difference at Outlet - Counter Flow"
    676         DTL = Outlet.Hot.T - Inlet.Cold.T;
    677 end
    678        
    679 end
    680 
    681 Model DoublePipe_NTU                            as DoublePipe_Basic_NTU
    682 
    683 ATTRIBUTES
    684         Pallete         = true;
    685         Brief           = "Basic Model Double Pipe Heat Exchanger - NTU Method";
    686         Info            =
    687         "write some information";
    688 
    689 PARAMETERS
    690 
    691         FlowDirection as Switcher(Brief="Flow Direction",Valid=["counter","cocurrent"],Default="cocurrent");
    692 
    693 EQUATIONS
    694 
    695 if Details.Cr equal 0
     540
     541"Number of Units Transference"
     542        Method.NTU*Method.Cmin = Details.Ud*Pi*DoInner*Lpipe;
     543       
     544"Minimum Heat Capacity"
     545        Method.Cmin  = min([Method.Ch,Method.Cc]);
     546
     547"Maximum Heat Capacity"
     548        Method.Cmax  = max([Method.Ch,Method.Cc]);
     549
     550"Thermal Capacity Ratio"
     551        Method.Cr    = Method.Cmin/Method.Cmax;
     552
     553"Effectiveness Correction"
     554        Method.Eft1 = 1;
     555
     556if Method.Cr equal 0
    696557       
    697558        then   
    698559"Effectiveness"
    699         Eft = 1-exp(-Details.NTU);
     560        Method.Eft = 1-exp(-Method.NTU);
    700561       
    701562        else
     
    706567       
    707568"Effectiveness in Cocurrent Flow"
    708         Eft*(1+Details.Cr) = (1-exp(-Details.NTU*(1+Details.Cr)));
    709        
     569        Method.Eft = (1-exp(-Method.NTU*(1+Method.Cr)))/(1+Method.Cr);
     570
    710571        case "counter":
    711572
    712 if Details.Cr equal 1
     573if Method.Cr equal 1
    713574       
    714575        then
    715576"Effectiveness in Counter Flow"
    716         Eft*(1+Details.NTU) = Details.NTU;
     577        Method.Eft = Method.NTU/(1+Method.NTU);
    717578       
    718579        else
    719580"Effectiveness in Counter Flow"
    720         Eft*(1-Details.Cr*exp(-Details.NTU*(1-Details.Cr))) = (1-exp(-Details.NTU*(1-Details.Cr)));
    721        
    722 end
    723 
    724 end
    725 
    726 
    727 end
    728 
    729 end
    730 
    731 Model Multitubular_Basic
    732 
     581        Method.Eft = (1-exp(-Method.NTU*(1-Method.Cr)))/(1-Method.Cr*exp(-Method.NTU*(1-Method.Cr)));
     582       
     583end
     584
     585end
     586
     587end
     588
     589switch HotSide
     590       
     591        case "outer":
     592
     593"Duty"
     594        Details.Q       = Method.Eft*Method.Cmin*(InletOuter.T-InletInner.T);
     595
     596"Hot Stream Heat Capacity"
     597        Method.Ch  = InletOuter.F*Outer.Properties.Average.Cp;
     598       
     599"Cold Stream Heat Capacity"
     600        Method.Cc = InletInner.F*Inner.Properties.Average.Cp;
     601
     602        when InletInner.T > InletOuter.T switchto "inner";
     603       
     604        case "inner":
     605
     606"Duty"
     607        Details.Q       = Method.Eft*Method.Cmin*(InletInner.T-InletOuter.T);
     608
     609"Cold Stream Heat Capacity"
     610        Method.Cc = InletOuter.F*Outer.Properties.Average.Cp;
     611       
     612"Hot Stream Heat Capacity"
     613        Method.Ch = InletInner.F*Inner.Properties.Average.Cp;
     614       
     615        when InletInner.T < InletOuter.T switchto "outer";
     616       
     617end
     618
     619end
     620
     621Model DoublePipe_LMTD as DoublePipe_Basic
     622       
    733623ATTRIBUTES
    734         Pallete         = false;
    735         Brief           = "Basic Model Multitubular Double Pipe Heat Exchanger";
    736         Info            =
     624        Pallete = false;
     625        Brief  = "Double Pipe Heat Exchanger - LMTD Method";
     626        Info  =
    737627        "write some information";
    738        
     628
    739629PARAMETERS
    740630
    741                 Npipe           as Integer                      (Brief="N Pipe in Series",Default=2);
    742 outer PP                        as Plugin                       (Brief="External Physical Properties");
    743                 HE                      as Plugin                       (Brief="STHE Calculations",File="heatex");
    744                 Pi                              as constant             (Brief="Pi Number",Default=3.14159265);
    745                 Hside       as Integer                  (Brief="Fluid Alocation Flag-Default:Outer",Lower=0,Upper=1);
    746                 DoInner         as length                       (Brief="Outside Diameter of Inner Pipe",Lower=1e-6);
    747                 DiInner         as length                       (Brief="Inside Diameter of Inner Pipe",Lower=1e-10);
    748                 DiOuter         as length                       (Brief="Inside Diameter of Outer pipe",Lower=1e-10);
    749                 Lpipe                   as length                       (Brief="Effective Tube Length",Lower=0.1);
    750                 Kwall                   as conductivity         (Brief="Tube Wall Material Thermal Conductivity",Default=1.0);
    751 
     631HotSide                         as Switcher     (Brief="Hot Side in the Exchanger",Valid=["outer","inner"],Default="outer");
     632FlowDirection   as Switcher     (Brief="Flow Direction",Valid=["counter","cocurrent"],Default="cocurrent");
     633       
    752634VARIABLES
    753635
    754 Unity(Npipe)  as DoublePipe_Basic;
    755 
    756 SET
    757         Pi      = 3.14159265;
    758         Hside   = HE.FluidAlocation();
    759        
    760 #"Inner Pipe Cross Sectional Area for Flow"
    761         Unity.Inner.HeatTransfer.As=Pi*DiInner*DiInner/4;
    762        
    763 #"Outer Pipe Cross Sectional Area for Flow"
    764         Unity.Outer.HeatTransfer.As=Pi*(DiOuter*DiOuter-DoInner*DoInner)/4;
    765        
    766 #"Inner Pipe Hydraulic Diameter for Heat Transfer"
    767         Unity.Inner.HeatTransfer.Dh=DiInner;
    768        
    769 #"Outer Pipe Hydraulic Diameter for Heat Transfer"
    770         Unity.Outer.HeatTransfer.Dh=(DiOuter*DiOuter-DoInner*DoInner)/DoInner;
    771 
    772 #"Inner Pipe Hydraulic Diameter for Pressure Drop"
    773         Unity.Inner.PressureDrop.Dh=DiInner;
    774        
    775 #"Outer Pipe Hydraulic Diameter for Pressure Drop"
    776         Unity.Outer.PressureDrop.Dh=DiOuter-DoInner;
     636Method as LMTD_Basic;
    777637
    778638EQUATIONS
    779639
    780 for i in [1:Npipe]
    781 
    782 "Overall Heat Transfer Coefficient Clean"
    783         Unity(i).Details.Uc*(Unity(i).Resistances.Rtube+Unity(i).Resistances.Rwall+Unity(i).Resistances.Rshell)=1;
    784 
    785 "Overall Heat Transfer Coefficient Dirty"
    786         Unity(i).Details.Ud*(Unity(i).Resistances.Rfi*(DoInner/DiInner) + Unity(i).Resistances.Rfo + Unity(i).Resistances.Rtube + Unity(i).Resistances.Rwall + Unity(i).Resistances.Rshell)=1;
    787 
    788640"Exchange Surface Area"
    789         Unity(i).Details.A=Pi*DoInner*Lpipe;
    790        
    791 if Hside equal 1
    792        
    793         then
    794        
    795 "Pressure Drop Hot Stream"
    796         Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P - Unity(i).Outer.PressureDrop.Pdrop;
    797 
    798 "Pressure Drop Cold Stream"
    799         Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Inner.PressureDrop.Pdrop;
    800        
    801 "Outer Pipe Film Coefficient"
    802         Unity(i).Outer.HeatTransfer.hcoeff= HE.PipeFilmCoeff(Unity(i).Outer.HeatTransfer.Re,Unity(i).Outer.HeatTransfer.PR,Unity(i).Properties.Hot.Average.K,Unity(i).Outer.HeatTransfer.Dh,Lpipe)*Unity(i).Outer.HeatTransfer.Phi;
    803 
    804 "Inner Pipe Film Coefficient"
    805         Unity(i).Inner.HeatTransfer.hcoeff= HE.PipeFilmCoeff(Unity(i).Inner.HeatTransfer.Re,Unity(i).Inner.HeatTransfer.PR,Unity(i).Properties.Cold.Average.K,DiInner,Lpipe)*Unity(i).Inner.HeatTransfer.Phi;
    806 
    807 "Outer Pipe Pressure Drop"
    808         Unity(i).Outer.PressureDrop.Pdrop = (2*Unity(i).Outer.PressureDrop.fi*Lpipe*Unity(i).Properties.Hot.Average.rho*Unity(i).Outer.HeatTransfer.Vmean^2)/(Unity(i).Outer.PressureDrop.Dh*Unity(i).Outer.HeatTransfer.Phi);
    809        
    810 "Inner Pipe Pressure Drop"
    811         Unity(i).Inner.PressureDrop.Pdrop = (2*Unity(i).Inner.PressureDrop.fi*Lpipe*Unity(i).Properties.Cold.Average.rho*Unity(i).Inner.HeatTransfer.Vmean^2)/(DiInner*Unity(i).Inner.HeatTransfer.Phi);
    812 
    813 "Outer Pipe Phi correction"
    814         Unity(i).Outer.HeatTransfer.Phi = HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
    815        
    816 "Inner Pipe Phi correction"
    817         Unity(i).Inner.HeatTransfer.Phi  = HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
    818 
    819 "Outer Pipe Prandtl Number"
    820         Unity(i).Outer.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;
    821 
    822 "Inner Pipe Prandtl Number"
    823         Unity(i).Inner.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;
    824 
    825 "Outer Pipe Reynolds Number for Heat Transfer"
    826         Unity(i).Outer.HeatTransfer.Re =        (Unity(i).Properties.Hot.Average.rho*Unity(i).Outer.HeatTransfer.Vmean*Unity(i).Outer.HeatTransfer.Dh)/Unity(i).Properties.Hot.Average.Mu;
    827 
    828 "Outer Pipe Reynolds Number for Pressure Drop"
    829         Unity(i).Outer.PressureDrop.Re =        (Unity(i).Properties.Hot.Average.rho*Unity(i).Outer.HeatTransfer.Vmean*Unity(i).Outer.PressureDrop.Dh)/Unity(i).Properties.Hot.Average.Mu;
    830 
    831 "Inner Pipe Reynolds Number for Heat Transfer"
    832         Unity(i).Inner.HeatTransfer.Re =        (Unity(i).Properties.Cold.Average.rho*Unity(i).Inner.HeatTransfer.Vmean*Unity(i).Inner.HeatTransfer.Dh)/Unity(i).Properties.Cold.Average.Mu;
    833 
    834 "Inner Pipe Reynolds Number for Pressure Drop"
    835         Unity(i).Inner.PressureDrop.Re =        Unity(i).Inner.HeatTransfer.Re;
    836 
    837 "Outer Pipe Velocity"
    838         Unity(i).Outer.HeatTransfer.Vmean  = Unity(i).Properties.Hot.Inlet.Fw/(Unity(i).Outer.HeatTransfer.As*Unity(i).Properties.Hot.Average.rho);
    839 
    840 "Inner Pipe Velocity"
    841         Unity(i).Inner.HeatTransfer.Vmean  = Unity(i).Properties.Cold.Inlet.Fw/(Unity(i).Inner.HeatTransfer.As*Unity(i).Properties.Cold.Average.rho);
    842 
    843         else
    844        
    845 "Pressure Drop Hot Stream"
    846         Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P - Unity(i).Inner.PressureDrop.Pdrop;
    847 
    848 "Pressure Drop Cold Stream"
    849         Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Outer.PressureDrop.Pdrop;
    850        
    851 "Inner Pipe Film Coefficient"
    852         Unity(i).Inner.HeatTransfer.hcoeff= HE.PipeFilmCoeff(Unity(i).Inner.HeatTransfer.Re,Unity(i).Inner.HeatTransfer.PR,Unity(i).Properties.Hot.Average.K,DiInner,Lpipe)*Unity(i).Inner.HeatTransfer.Phi;
    853 
    854 "Outer Pipe Film Coefficient"
    855         Unity(i).Outer.HeatTransfer.hcoeff= HE.PipeFilmCoeff(Unity(i).Outer.HeatTransfer.Re,Unity(i).Outer.HeatTransfer.PR,Unity(i).Properties.Cold.Average.K,Unity(i).Outer.HeatTransfer.Dh,Lpipe)*Unity(i).Outer.HeatTransfer.Phi;
    856        
    857 "Outer Pipe Pressure Drop"
    858         Unity(i).Outer.PressureDrop.Pdrop = (2*Unity(i).Outer.PressureDrop.fi*Lpipe*Unity(i).Properties.Cold.Average.rho*Unity(i).Outer.HeatTransfer.Vmean^2)/(Unity(i).Outer.PressureDrop.Dh*Unity(i).Outer.HeatTransfer.Phi);
    859        
    860 "Inner Pipe Pressure Drop"
    861         Unity(i).Inner.PressureDrop.Pdrop       = (2*Unity(i).Inner.PressureDrop.fi*Lpipe*Unity(i).Properties.Hot.Average.rho*Unity(i).Inner.HeatTransfer.Vmean^2)/(DiInner*Unity(i).Inner.HeatTransfer.Phi);
    862 
    863 "Outer Pipe Phi correction"
    864         Unity(i).Outer.HeatTransfer.Phi         = HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
    865        
    866 "Inner Pipe Phi correction"
    867         Unity(i).Inner.HeatTransfer.Phi         = HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
    868        
    869 "Outer Pipe Prandtl Number"
    870         Unity(i).Outer.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;
    871 
    872 "Inner Pipe Prandtl Number"
    873         Unity(i).Inner.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;
    874 
    875 "Outer Pipe Reynolds Number for Heat Transfer"
    876         Unity(i).Outer.HeatTransfer.Re          = (Unity(i).Properties.Cold.Average.rho*Unity(i).Outer.HeatTransfer.Vmean*Unity(i).Outer.HeatTransfer.Dh)/Unity(i).Properties.Cold.Average.Mu;
    877 
    878 "Outer Pipe Reynolds Number for Pressure Drop"
    879         Unity(i).Outer.PressureDrop.Re          = (Unity(i).Properties.Cold.Average.rho*Unity(i).Outer.HeatTransfer.Vmean*Unity(i).Outer.PressureDrop.Dh)/Unity(i).Properties.Cold.Average.Mu;
    880 
    881 "Inner Pipe Reynolds Number for Pressure Drop"
    882         Unity(i).Inner.PressureDrop.Re          = Unity(i).Inner.HeatTransfer.Re;
    883 
    884 "Inner Pipe Reynolds Number for Heat Transfer"
    885         Unity(i).Inner.HeatTransfer.Re          = (Unity(i).Properties.Hot.Average.rho*Unity(i).Inner.HeatTransfer.Vmean*Unity(i).Inner.HeatTransfer.Dh)/Unity(i).Properties.Hot.Average.Mu;
    886 
    887 "Outer Pipe Velocity"
    888         Unity(i).Outer.HeatTransfer.Vmean       = Unity(i).Properties.Cold.Inlet.Fw/(Unity(i).Outer.HeatTransfer.As*Unity(i).Properties.Cold.Average.rho);
    889 
    890 "Inner Pipe Velocity"
    891         Unity(i).Inner.HeatTransfer.Vmean       = Unity(i).Properties.Hot.Inlet.Fw/(Unity(i).Inner.HeatTransfer.As*Unity(i).Properties.Hot.Average.rho);
    892 
    893 end
    894 
    895 "Inner Pipe Resistance"
    896         Unity(i).Resistances.Rtube*(Unity(i).Inner.HeatTransfer.hcoeff*DiInner) = DoInner;
    897        
    898 "Wall Resistance"
    899         Unity(i).Resistances.Rwall=DoInner*ln(DoInner/DiInner)/(2*Kwall);
    900 
    901 "Outer Pipe Resistance"
    902         Unity(i).Resistances.Rshell*(Unity(i).Outer.HeatTransfer.hcoeff)=1;
    903        
    904 end
    905 
    906 
    907 end
    908 
    909 Model Multitubular_Basic_LMTD           as Multitubular_Basic
    910 
    911 ATTRIBUTES
    912         Pallete         = false;
    913         Brief           = "Basic Model for Multitubular Double Pipe Heat Exchanger- LMTD Method";
    914         Info            =
    915         "write some information";
    916 
    917 VARIABLES
    918 
    919 DT0(Npipe)      as temp_delta   (Brief="Temperature Difference at Inlet",Lower=1);
    920 DTL(Npipe)                      as temp_delta   (Brief="Temperature Difference at Outlet",Lower=1);
    921 LMTD(Npipe)             as temp_delta   (Brief="Logarithmic Mean Temperature Difference",Lower=1);
    922 
    923 EQUATIONS
    924 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    925 #                       Log Mean Temperature Difference
    926 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
    927 for i in [1:Npipe]
    928        
    929 if abs(DT0(i) - DTL(i)) > 0.05*max(abs([DT0(i),DTL(i)]))
    930        
    931         then
    932 "Log Mean Temperature Difference"
    933         LMTD(i)= (DT0(i)-DTL(i))/ln(DT0(i)/DTL(i));
    934 
    935         else
    936        
    937 if DT0(i)*DTL(i) equal 0
    938        
    939         then
    940 "Log Mean Temperature Difference"
    941         LMTD(i) = 0.5*(DT0(i)+DTL(i));
    942        
    943         else
    944 "Log Mean Temperature Difference"
    945         LMTD(i) = 0.5*(DT0(i)+DTL(i))*(1-(DT0(i)-DTL(i))^2/(DT0(i)*DTL(i))*(1+(DT0(i)-DTL(i))^2/(DT0(i)*DTL(i))/2)/12);
    946        
    947 end
    948        
    949 end
    950 
    951 "Exchange Surface Area"
    952         Unity(i).Details.Q = Unity(i).Details.Ud*Unity(i).Details.A*LMTD(i);
    953 
    954 end
    955 
    956 end
    957 
    958 Model Multitubular_Counter_NTU          as Multitubular_Basic
    959 
    960 ATTRIBUTES
    961         Pallete         = true;
    962         Brief           = "Multitubular Double Pipe Heat Exchanger in counter flow - NTU Method";
    963         Info            =
    964         "write some information";
    965        
    966 VARIABLES
    967 
    968 Eft(Npipe)        as positive (Brief="Effectiveness",Default=0.05,Lower=1e-8);
    969 
    970 CONNECTIONS
    971 
    972 Unity([1:Npipe-1]).Outlet.Hot  to Unity([2:Npipe]).Inlet.Hot;
    973 Unity([2:Npipe]).Outlet.Cold     to Unity([1:Npipe-1]).Inlet.Cold;
    974 
    975 EQUATIONS
    976 
    977 for i in [1:Npipe]
    978 
    979 if Unity(i).Details.Cr equal 0
    980        
    981         then   
    982 "Effectiveness"
    983         Eft(i) = 1-exp(-Unity(i).Details.NTU);
    984        
    985         else
    986 
    987 if Unity(i).Details.Cr equal 1
    988        
    989         then
    990 "Effectiveness in Counter Flow"
    991         Eft(i) = Unity(i).Details.NTU/(1+Unity(i).Details.NTU);
    992        
    993         else
    994 "Effectiveness in Counter Flow"
    995         Eft(i)*(1-Unity(i).Details.Cr*exp(-Unity(i).Details.NTU*(1-Unity(i).Details.Cr))) = (1-exp(-Unity(i).Details.NTU*(1-Unity(i).Details.Cr)));
    996        
    997 end
    998 
    999 
    1000 end
    1001 
    1002 "Energy Balance"
    1003         Unity(i).Details.Q      = Eft(i)*Unity(i).Details.Cmin*(Unity(i).Inlet.Hot.T-Unity(i).Inlet.Cold.T);
    1004        
    1005 end
    1006 
    1007 end
    1008 
    1009 Model Multitubular_Cocurrent_NTU        as Multitubular_Basic
    1010 
    1011 ATTRIBUTES
    1012         Pallete         = true;
    1013         Brief           = "Multitubular Double Pipe Heat Exchanger in cocurrent flow - NTU Method";
    1014         Info            =
    1015         "write some information";
    1016        
    1017 VARIABLES
    1018 
    1019 Eft(Npipe)        as positive (Brief="Effectiveness",Default=0.05,Lower=1e-8);
    1020 
    1021 CONNECTIONS
    1022 
    1023 Unity([1:Npipe-1]).Outlet.Hot   to Unity([2:Npipe]).Inlet.Hot;
    1024 Unity([1:Npipe-1]).Outlet.Cold  to Unity([2:Npipe]).Inlet.Cold;
    1025 
    1026 EQUATIONS
    1027 
    1028 for i in [1:Npipe]
    1029 
    1030 if Unity(i).Details.Cr equal 0
    1031        
    1032         then   
    1033 "Effectiveness"
    1034         Eft(i) = 1-exp(-Unity(i).Details.NTU);
    1035        
    1036         else
    1037 "Effectiveness in Cocurrent Flow"
    1038         Eft(i) = (1-exp(-Unity(i).Details.NTU*(1+Unity(i).Details.Cr)))/(1+Unity(i).Details.Cr);
    1039 
    1040 end
    1041 
    1042 "Energy Balance"
    1043         Unity(i).Details.Q      = Eft(i)*Unity(i).Details.Cmin*(Unity(i).Inlet.Hot.T-Unity(i).Inlet.Cold.T);
    1044        
    1045 end
    1046 
    1047 end
    1048 
    1049 Model Multitubular_Counter_LMTD         as Multitubular_Basic_LMTD
    1050 
    1051 ATTRIBUTES
    1052         Pallete         = true;
    1053         Brief           = "Multitubular Double Pipe Heat Exchanger in counter flow - LMTDMethod";
    1054         Info            =
    1055         "write some information";
    1056        
    1057 CONNECTIONS
    1058 
    1059 Unity([1:Npipe-1]).Outlet.Hot   to Unity([2:Npipe]).Inlet.Hot;
    1060 Unity([2:Npipe]).Outlet.Cold    to Unity([1:Npipe-1]).Inlet.Cold;
    1061 
    1062 EQUATIONS
    1063 for i in [1:Npipe]
     641        Details.Q = Details.Ud*Pi*DoInner*Lpipe*Method.LMTD;
     642       
     643"LMTD Correction Factor - True counter ou cocurrent flow"
     644        Method.Fc = 1;
     645
     646switch HotSide
     647       
     648        case "outer":
     649       
     650switch FlowDirection
     651
     652        case "cocurrent":
     653       
     654"Temperature Difference at Inlet - Cocurrent Flow"
     655        Method.DT0 = InletOuter.T - InletInner.T;
     656
     657"Temperature Difference at Outlet - Cocurrent Flow"
     658        Method.DTL = OutletOuter.T - OutletInner.T;
     659
     660        case "counter":
    1064661       
    1065662"Temperature Difference at Inlet - Counter Flow"
    1066         DT0(i) = Unity(i).Inlet.Hot.T - Unity(i).Outlet.Cold.T;
     663        Method.DT0 = InletOuter.T - OutletInner.T;
    1067664
    1068665"Temperature Difference at Outlet - Counter Flow"
    1069         DTL(i) = Unity(i).Outlet.Hot.T - Unity(i).Inlet.Cold.T;
    1070        
    1071 end
    1072 
    1073 end
    1074 
    1075 Model Multitubular_Cocurrent_LMTD       as Multitubular_Basic_LMTD
    1076 
    1077 ATTRIBUTES
    1078         Pallete         = true;
    1079         Brief           = "Multitubular Double Pipe Heat Exchanger in cocurrent flow - NTU Method";
    1080         Info            =
    1081         "write some information";
    1082        
    1083 CONNECTIONS
    1084 
    1085 Unity([1:Npipe-1]).Outlet.Hot   to Unity([2:Npipe]).Inlet.Hot;
    1086 Unity([1:Npipe-1]).Outlet.Cold  to Unity([2:Npipe]).Inlet.Cold;
    1087 
    1088 EQUATIONS
    1089 
    1090 for i in [1:Npipe]
     666        Method.DTL = OutletOuter.T - InletInner.T;
     667       
     668
     669end
     670
     671        when InletInner.T > InletOuter.T switchto "inner";
     672       
     673        case "inner":
     674
     675switch FlowDirection
     676
     677        case "cocurrent":
    1091678       
    1092679"Temperature Difference at Inlet - Cocurrent Flow"
    1093         DT0(i) = Unity(i).Inlet.Hot.T - Unity(i).Inlet.Cold.T;
     680        Method.DT0 = InletInner.T - InletOuter.T;
    1094681
    1095682"Temperature Difference at Outlet - Cocurrent Flow"
    1096         DTL(i) = Unity(i).Outlet.Hot.T - Unity(i).Outlet.Cold.T;
    1097        
    1098 end
    1099 
    1100 end
     683        Method.DTL = OutletInner.T - OutletOuter.T;
     684       
     685        case "counter":
     686       
     687"Temperature Difference at Inlet - Counter Flow"
     688        Method.DT0 = InletInner.T - OutletOuter.T;
     689
     690"Temperature Difference at Outlet - Counter Flow"
     691        Method.DTL = OutletInner.T - InletOuter.T;
     692       
     693end
     694
     695        when InletInner.T < InletOuter.T switchto "outer";
     696
     697end
     698
     699end
  • branches/newlanguage/eml/heat_exchangers/HEX_Engine.mso

    r160 r164  
    1616*                       Heat Exchangers Abstract Models
    1717*--------------------------------------------------------------------
    18 *       - Inlet_Main_Stream     : Inlet Streams
    19 *--------------------------------------------------------------------
    20 *                                       - Hot   : Inlet Hot Stream
    21 *                                       - Cold  : Inlet Cold Stream
    22 *--------------------------------------------------------------------
    23 *       - Outlet_Main_Stream    : Outlet Streams
    24 *--------------------------------------------------------------------
    25 *                                       - Hot   : Outlet Hot Stream
    26 *                                       - Cold  : Outlet Cold Stream
    27 *--------------------------------------------------------------------
    28 *       - Main_Properties               : Physical Properties for Hot and Cold Side
    29 *--------------------------------------------------------------------
    3018*               Physical_Properties
    3119*                       Properties_In_Out       :       Inlet/Outlet Physical Properties
     
    3321*                       Properties_Wall         :       Physical Properties at Wall Temperature
    3422*--------------------------------------------------------------------
    35 *       - Tube_Side_Main        : Tube Side Main Variables
     23*       - Tube_Side_Main        : Tube Side Main Variables for shell and tubes heat exchangers
    3624*----------------------------------------------------------------------
    3725*                       Tube_Pdrop                      : Tube Side Pressure Drop
    38 *                       Tube_Heat_Transfer      : Tube Side Heat Transfer
    39 *----------------------------------------------------------------------
    40 *       - Shell_Side_Main       : Shell Side Main Variables
    41 *----------------------------------------------------------------------
    42 *                       Shell_Pdrop                     : Shell Side Pressure Drop
    43 *                       Shell_Heat_Transfer     : Shell Side Heat Transfer
     26*                       Tube_Heat_Transfer      : Tube Side Heat Transfer
     27*                       Properties                      : Tube Side Physical Properties
     28*----------------------------------------------------------------------
     29*       - Shell_Side_Main       : Shell Side Main Variables for shell and tubes heat exchangers
     30*----------------------------------------------------------------------
     31*                       Shell_Pdrop                             : Shell Side Pressure Drop
     32*                       Shell_Heat_Transfer     : Shell Side Heat Transfer
     33*                       Properties                      : Shell Side Physical Properties
    4434*----------------------------------------------------------------------
    4535*       - Baffles_Main  : Baffles Spacing
     
    5545*               DoublePipe_HeatTransfer
    5646*               DoublePipe_PressureDrop
     47*               Properties
    5748*----------------------------------------------------------------------
    5849* Author: Gerson Balbueno Bicca
     
    6253using "streams";
    6354
    64 Model Inlet_Main_Stream
    65        
    66 ATTRIBUTES
    67         Pallete = false;
    68         Brief = "write some information";
    69         Info =
    70         "write some information";
    71        
    72 VARIABLES
    73 Hot     as stream       (Brief="Inlet Hot Stream");
    74 Cold    as stream       (Brief="Inlet Cold Stream");
    75 
    76 end
    77 
    78 Model Outlet_Main_Stream
    79        
    80 ATTRIBUTES
    81         Pallete = false;
    82         Brief = "write some information";
    83         Info =
    84         "write some information";
    85        
    86 VARIABLES
    87 # Must be streamPH
    88 Hot     as streamPH (Brief="Outlet Hot Stream");
    89 #Hot    as liquid_stream (Brief="Outlet Hot Stream");
    90 Cold    as streamPH (Brief="Outlet Cold Stream");
    91 #Cold   as liquid_stream (Brief="Outlet Cold Stream");
    92 
    93 end
    94 
    95 #=====================================================================
    96 # Heat Exchangers Physical Properties
    97 #=====================================================================
    98  
    9955Model Properties_Average
    10056       
     
    158114       
    159115VARIABLES
     116
    160117Inlet           as Properties_In_Out    (Brief="Properties at Inlet Stream");
    161118Average         as Properties_Average   (Brief="Properties at Average Temperature");
    162119Outlet          as Properties_In_Out    (Brief="Properties at Outlet Stream");
    163120Wall                    as Properties_Wall              (Brief="Properties at Wall Temperature");
    164 
    165 end
    166 
    167 Model Main_Properties
    168 ATTRIBUTES
    169         Pallete = false;
    170         Brief = "write some information";
    171         Info =
    172         "write some information";
    173        
    174 VARIABLES
    175 
    176 Hot  as Physical_Properties  (Brief="Hot Stream");
    177 Cold as Physical_Properties  (Brief="Cold Stream");
    178121
    179122end
     
    305248end
    306249
     250Model NTU_Basic
     251
     252ATTRIBUTES
     253        Pallete = false;
     254        Brief = "write some information";
     255        Info =
     256        "write some information";
     257
     258VARIABLES
     259
     260Ch   as positive        (Brief="Hot Stream Heat Capacity",Lower=1e-3,Default=1e3,Unit='W/K');
     261Cc   as positive        (Brief="Cold Stream Heat Capacity",Lower=1e-3,Default=1e3,Unit='W/K');
     262Cr      as positive     (Brief="Heat Capacity Ratio",Default=0.5,Lower=1e-6);
     263Cmin  as positive       (Brief="Minimum Heat Capacity",Lower=1e-10,Default=1e3,Unit='W/K');
     264Cmax as positive        (Brief="Maximum Heat Capacity",Lower=1e-10,Default=1e3,Unit='W/K');
     265NTU     as positive     (Brief="Number of Units Transference",Default=0.05,Lower=1e-10);
     266Eft     as positive  (Brief="Effectiveness",Default=0.5,Lower=1e-8,Upper=1);
     267Eft1    as positive  (Brief="Effectiveness Correction",Lower=1e-8,Default=0.5);
     268
     269end
     270
     271Model LMTD_Basic
     272
     273ATTRIBUTES
     274        Pallete = false;
     275        Brief = "write some information";
     276        Info =
     277        "write some information";
     278       
     279VARIABLES
     280
     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=1);
     284Fc                      as positive             (Brief="LMTD Correction Factor",Lower=0.4);
     285
     286EQUATIONS
     287
     288if abs(DT0 - DTL) > 0.05*max(abs([DT0,DTL]))
     289       
     290        then
     291"Log Mean Temperature Difference"
     292        LMTD= (DT0-DTL)/ln(DT0/DTL);
     293
     294        else
     295       
     296if DT0*DTL equal 0
     297       
     298        then
     299"Log Mean Temperature Difference"
     300        LMTD = 0.5*(DT0+DTL);
     301       
     302        else
     303"Log Mean Temperature Difference"
     304        LMTD = 0.5*(DT0+DTL)*(1-(DT0-DTL)^2/(DT0*DTL)*(1+(DT0-DTL)^2/(DT0*DTL)/2)/12);
     305       
     306end
     307       
     308end
     309
     310end
     311
    307312Model Details_Main
    308313       
     
    318323Uc      as heat_trans_coeff (Brief="Overall Heat Transfer Coefficient Clean",Default=1,Lower=1e-6,Upper=1e10);
    319324Ud      as heat_trans_coeff (Brief="Overall Heat Transfer Coefficient Dirty",Default=1,Lower=1e-6,Upper=1e10);
    320 Ch      as positive                             (Brief="Hot Stream Heat Capacity",Lower=1e-3,Default=1e3,Unit='W/K');
    321 Cc      as positive                             (Brief="Cold Stream Heat Capacity",Lower=1e-3,Default=1e3,Unit='W/K');
    322 Cr      as positive                             (Brief="Heat Capacity Ratio",Default=0.5,Lower=1e-6);
    323 Cmin  as positive                               (Brief="Minimum Heat Capacity",Lower=1e-10,Default=1e3,Unit='W/K');
    324 Cmax as positive                                (Brief="Maximum Heat Capacity",Lower=1e-10,Default=1e3,Unit='W/K');
    325 NTU     as positive                             (Brief="Number of Units Transference",Default=0.05,Lower=1e-10);
    326 
    327 EQUATIONS
    328 "Number of Units Transference"
    329         NTU*Cmin = Ud*A;
    330        
     325
    331326end
    332327
     
    342337PressureDrop    as Tube_Pdrop                   (Brief="Tube Side Pressure Drop");
    343338HeatTransfer    as Tube_Heat_Transfer (Brief="Tube Side Heat Transfer");
     339Properties      as Physical_Properties   (Brief="Tube Side Properties");
    344340
    345341end
     
    356352PressureDrop    as Shell_Pdrop                           (Brief="Shell Side Pressure Drop");
    357353HeatTransfer    as Shell_Heat_Transfer  (Brief= "Shell Side Heat Transfer");
     354Properties      as Physical_Properties   (Brief="ShellSide Properties");
    358355
    359356end
     
    439436       
    440437VARIABLES
    441 HeatTransfer as DoublePipe_HeatTransfer (Brief="Double Pipe Heat Transfer");
    442 PressureDrop as DoublePipe_PressureDrop (Brief="Double Pipe Pressure Drop");
    443 
    444 end
     438
     439HeatTransfer    as DoublePipe_HeatTransfer      (Brief="Double Pipe Heat Transfer");
     440PressureDrop    as DoublePipe_PressureDrop      (Brief="Double Pipe Pressure Drop");
     441Properties      as Physical_Properties                  (Brief="Double Pipe Properties");
     442
     443end
  • branches/newlanguage/eml/heat_exchangers/Mheatex.mso

    r147 r164  
    3131*--------------------------------------------------------------------*#
    3232
    33 using "streams.mso";
    34 
    35 Model Inlet_Main_Stream         
    36 
    37 ATTRIBUTES
    38         Pallete = false;
    39         Brief = "Inlet material streams for Hot and Cold side";
    40         Info =
    41         "write some information";
    42        
    43 PARAMETERS
    44 
    45 outer   Ncold   as Integer      (Brief="Number of Inlet Cold Streams",Lower=1);
    46 outer   Nhot    as Integer      (Brief="Number of Inlet Hot Streams",Lower=1);
    47 
    48 VARIABLES
    49 
    50         Hot  (Nhot)     as stream (Brief="Inlet Hot Streams");
    51         Cold (Ncold)    as stream (Brief="Inlet Cold Streams");
    52        
    53 end
    54 
    55 Model Outlet_Main_Stream       
    56 
    57 ATTRIBUTES
    58         Pallete = false;
    59         Brief = "Outlet material streams for Hot and Cold side";
    60         Info =
    61         "write some information";
    62        
    63 PARAMETERS
    64 
    65 outer   Ncold   as Integer      (Brief="Number of Outlet Cold Streams",Lower=1);
    66 outer   Nhot    as Integer      (Brief="Number of Outlet Hot Streams",Lower=1);
    67 
    68 VARIABLES
    69 
    70 Hot  (Nhot)     as streamPH (Brief="Outlet Hot Streams");
    71 Cold (Ncold)    as streamPH (Brief="Outlet Cold Streams");
    72        
    73 end
     33using "HEX_Engine.mso";
    7434
    7535Model Mheatex
     
    9151VARIABLES
    9252
    93 in      Inlet   as Inlet_Main_Stream    (Brief="Inlet Streams");               
    94 out     Outlet  as Outlet_Main_Stream (Brief="Outlet Streams");
     53in      InletHot(Nhot)                  as stream               (Brief="Inlet Hot Streams");           
     54out     OutletHot(Nhot)                 as streamPH     (Brief="Outlet Hot Streams");
     55in      InletCold(Ncold)                as stream               (Brief="Inlet Cold Streams");           
     56out     OutletCold(Ncold)       as streamPH     (Brief="Outlet Cold Streams");
    9557
    96         Q               as power                (Brief="Heat Transfer");
    97         LMTD            as temp_delta   (Brief="Logarithmic Mean Temperature Difference");
    98         UA              as positive             (Brief="UA product",Unit="W/K");
    99         DT0             as temp_delta   (Brief="Temperature Difference at Inlet",Lower=1);
    100         DTL             as temp_delta   (Brief="Temperature Difference at Outlet",Lower=1);
     58        Method  as LMTD_Basic   (Brief="Log Mean Temperature Difference Method");
     59        Q               as power                        (Brief="Heat Transfer", Default=7000, Lower=1e-6, Upper=1e10);
     60        UA              as Real                 (Brief="UA product",Unit='W/K',Lower=1e-8);
    10161       
    10262EQUATIONS
    10363
    10464"Hot Flow"
    105         Outlet.Hot.F = Inlet.Hot.F;     
     65        OutletHot.F = InletHot.F;       
    10666
    10767"Cold Flow"
    108         Outlet.Cold.F = Inlet.Cold.F;
     68        OutletCold.F = InletCold.F;
    10969       
    11070"Hot Composition"
    111         Outlet.Hot.z = Inlet.Hot.z;
     71        OutletHot.z = InletHot.z;
    11272       
    11373"Cold Composition"
    114         Outlet.Cold.z = Inlet.Cold.z;
     74        OutletCold.z = InletCold.z;
    11575       
    11676"Heat Duty Hot Stream"
    117         Q =  sum(Inlet.Hot.F*(Inlet.Hot.h- Outlet.Hot.h));
     77        Q =  sum(InletHot.F*(InletHot.h- OutletHot.h));
    11878       
    11979"Heat Duty Cold Stream"
    120         Q = -sum(Inlet.Cold.F*(Inlet.Cold.h- Outlet.Cold.h));
     80        Q = -sum(InletCold.F*(InletCold.h- OutletCold.h));
    12181       
    12282"Heat Duty"
    123         Q=UA*LMTD;
    124 
    125        
    126 if abs(DT0 - DTL) > 0.05*max(abs([DT0,DTL]))
    127        
    128         then
    129 "Log Mean Temperature Difference"
    130         LMTD= (DT0-DTL)/ln(DT0/DTL);
    131 
    132         else
    133        
    134 if DT0*DTL equal 0
    135        
    136         then
    137 "Log Mean Temperature Difference"
    138         LMTD = 0.5*(DT0+DTL);
    139        
    140         else
    141 "Log Mean Temperature Difference"
    142         LMTD = 0.5*(DT0+DTL)*(1-(DT0-DTL)^2/(DT0*DTL)*(1+(DT0-DTL)^2/(DT0*DTL)/2)/12);
    143        
    144 end
    145        
    146 end     
    147 
     83        Q=UA*Method.LMTD*Method.Fc;
    14884
    14985switch FlowDirection
     
    15288
    15389"Temperature Difference at Inlet"
    154         DT0 = max(Inlet.Hot.T) - min(Inlet.Cold.T);
     90        Method.DT0 = max(InletHot.T) - min(InletCold.T);
    15591
    15692"Temperature Difference at Outlet"
    157         DTL = min(Outlet.Hot.T) - max(Outlet.Cold.T);
     93        Method.DTL = min(OutletHot.T) - max(OutletCold.T);
    15894       
    15995case "counter":
    16096       
    16197"Temperature Difference at Inlet"
    162         DT0 = max(Inlet.Hot.T) - max(Outlet.Cold.T);
     98        Method.DT0 = max(InletHot.T) - max(OutletCold.T);
    16399
    164100"Temperature Difference at Outlet"
    165         DTL = min(Outlet.Hot.T) - min(Inlet.Cold.T);
     101        Method.DTL = min(OutletHot.T) - min(InletCold.T);
    166102       
    167103end
Note: See TracChangeset for help on using the changeset viewer.