source: branches/newlanguage/eml/heat_exchangers/HeatExchangerDetailed.mso @ 157

Last change on this file since 157 was 135, checked in by gerson bicca, 16 years ago

updated models and samples for the new language

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 75.2 KB
Line 
1#*-------------------------------------------------------------------
2* EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC.
3*
4* This LIBRARY is free software; you can distribute it and/or modify
5* it under the therms of the ALSOC FREE LICENSE as available at
6* http://www.enq.ufrgs.br/alsoc.
7*
8* EMSO Copyright (C) 2004 - 2007 ALSOC, original code
9* from http://www.rps.eng.br Copyright (C) 2002-2004.
10* All rights reserved.
11*
12* EMSO is distributed under the therms of the ALSOC LICENSE as
13* available at http://www.enq.ufrgs.br/alsoc.
14*
15*-------------------------------------------------------------------
16* Author: Gerson Balbueno Bicca
17* $Id: HeatExchangerDetailed.mso 135 2007-01-25 20:00:26Z bicca $
18*------------------------------------------------------------------*#
19
20using "HEX_Engine";
21
22#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
23#       Basic Model for Detailed Shell and Tubes Heat Exchangers
24#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
25
26Model HeatExchangerDetailed_Basic
27
28ATTRIBUTES
29        Pallete = false;
30        Brief = "write some information";
31        Info =
32        "write some information";
33
34PARAMETERS
35
36outer PP                as Plugin               (Brief="External Physical Properties");
37outer NComp     as Integer      (Brief="Number of Components");
38                HE              as Plugin               (Brief="STHE Calculations",File="heatex");
39                M(NComp)  as molweight  (Brief="Component Mol Weight");
40       
41VARIABLES
42
43in      Inlet                   as Inlet_Main_Stream;   
44out     Outlet                  as Outlet_Main_Stream; 
45                Properties              as Main_Properties;             
46                Details                 as Details_Main;
47                Tubes                           as Tube_Side_Main;     
48                Shell                           as Shell_Side_Main;
49                Resistances     as Main_Resistances;
50                Baffles                 as Baffles_Main;
51
52SET
53
54        M   = PP.MolecularWeight();
55
56EQUATIONS
57
58#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
59#                                               Properties                                                                                                                                                                     
60#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
61
62"Hot Stream Average Temperature"
63        Properties.Hot.Average.T = 0.5*Inlet.Hot.T + 0.5*Outlet.Hot.T;
64       
65"Cold Stream Average Temperature"
66        Properties.Cold.Average.T = 0.5*Inlet.Cold.T + 0.5*Outlet.Cold.T;
67       
68"Hot Stream Average Pressure"
69        Properties.Hot.Average.P = 0.5*Inlet.Hot.P+0.5*Outlet.Hot.P;
70       
71"Cold Stream Average Pressure"
72        Properties.Cold.Average.P = 0.5*Inlet.Cold.P+0.5*Outlet.Cold.P;
73       
74"Hot Stream Average Molecular Weight"
75        Properties.Hot.Average.Mw = sum(M*Inlet.Hot.z);
76
77"Cold Stream Average Molecular Weight"
78        Properties.Cold.Average.Mw = sum(M*Inlet.Cold.z);
79       
80
81if Inlet.Cold.v equal 0
82       
83        then   
84       
85"Cold Stream Average Heat Capacity"
86        Properties.Cold.Average.Cp      =       PP.LiquidCp(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
87
88"Cold Stream Inlet Heat Capacity"
89        Properties.Cold.Inlet.Cp        =       PP.LiquidCp(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
90
91"Cold Stream Outlet Heat Capacity"
92        Properties.Cold.Outlet.Cp       =       PP.LiquidCp(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
93
94"Cold Stream Average Mass Density"
95        Properties.Cold.Average.rho =   PP.LiquidDensity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
96
97"Cold Stream Inlet Mass Density"
98        Properties.Cold.Inlet.rho       =       PP.LiquidDensity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
99
100"Cold Stream Outlet Mass Density"
101        Properties.Cold.Outlet.rho      =       PP.LiquidDensity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
102
103"Cold Stream Average Viscosity"
104        Properties.Cold.Average.Mu      =       PP.LiquidViscosity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
105
106"Cold Stream inlet Viscosity"
107        Properties.Cold.Inlet.Mu        =       PP.LiquidViscosity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
108       
109"Cold Stream Outlet Viscosity"
110        Properties.Cold.Outlet.Mu       =       PP.LiquidViscosity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
111
112"Cold Stream Average Conductivity"
113        Properties.Cold.Average.K       =       PP.LiquidThermalConductivity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
114
115"Cold Stream Inlet Conductivity"       
116        Properties.Cold.Inlet.K         =       PP.LiquidThermalConductivity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
117
118"Cold Stream Outlet Conductivity"
119        Properties.Cold.Outlet.K        =       PP.LiquidThermalConductivity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
120
121"Cold Stream Heat Capacity at Wall Temperature"
122        Properties.Cold.Wall.Cp         =       PP.LiquidCp(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
123       
124"Cold Stream Viscosity at Wall Temperature"
125        Properties.Cold.Wall.Mu         =       PP.LiquidViscosity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
126
127"Cold Stream Conductivity at Wall Temperature"
128        Properties.Cold.Wall.K          =       PP.LiquidThermalConductivity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
129
130
131        else
132
133"Cold Stream Average Heat Capacity"
134        Properties.Cold.Average.Cp      =       PP.VapourCp(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
135
136"Cold Stream Inlet Heat Capacity"       
137        Properties.Cold.Inlet.Cp        =       PP.VapourCp(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
138
139"Cold Stream Outlet Heat Capacity"     
140        Properties.Cold.Outlet.Cp       =       PP.VapourCp(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
141
142"Cold Stream Average Mass Density"
143        Properties.Cold.Average.rho =   PP.VapourDensity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
144
145"Cold Stream Inlet Mass Density"
146        Properties.Cold.Inlet.rho       =       PP.VapourDensity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
147
148"Cold Stream Outlet Mass Density"       
149        Properties.Cold.Outlet.rho      =       PP.VapourDensity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
150
151"Cold Stream Average Viscosity "
152        Properties.Cold.Average.Mu      =       PP.VapourViscosity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
153
154"Cold Stream Inlet Viscosity " 
155        Properties.Cold.Inlet.Mu        =       PP.VapourViscosity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
156
157"Cold Stream Outlet Viscosity "
158        Properties.Cold.Outlet.Mu       =       PP.VapourViscosity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
159
160"Cold Stream Average Conductivity "
161        Properties.Cold.Average.K       =       PP.VapourThermalConductivity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
162
163"Cold Stream Inlet Conductivity "
164        Properties.Cold.Inlet.K         =       PP.VapourThermalConductivity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
165
166"Cold Stream Outlet Conductivity "
167        Properties.Cold.Outlet.K        =       PP.VapourThermalConductivity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
168       
169"Cold Stream Heat Capacity at Wall Temperature"
170        Properties.Cold.Wall.Cp         =       PP.VapourCp(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
171
172
173"Cold Stream Viscosity at Wall Temperature"
174        Properties.Cold.Wall.Mu         =       PP.VapourViscosity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
175
176"Cold Stream Conductivity at Wall Temperature"
177        Properties.Cold.Wall.K          =       PP.VapourThermalConductivity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
178       
179       
180       
181end
182
183if Inlet.Hot.v equal 0
184
185        then
186
187"Hot Stream Average Heat Capacity"
188        Properties.Hot.Average.Cp       =               PP.LiquidCp(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);
189
190"Hot Stream Inlet Heat Capacity"
191        Properties.Hot.Inlet.Cp         =               PP.LiquidCp(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);
192
193"Hot Stream Outlet Heat Capacity"
194        Properties.Hot.Outlet.Cp        =               PP.LiquidCp(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);
195
196"Hot Stream Average Mass Density"
197        Properties.Hot.Average.rho      =               PP.LiquidDensity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);
198
199"Hot Stream Inlet Mass Density"
200        Properties.Hot.Inlet.rho        =               PP.LiquidDensity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);
201
202"Hot Stream Outlet Mass Density"       
203        Properties.Hot.Outlet.rho       =               PP.LiquidDensity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);
204
205"Hot Stream Average Viscosity"
206        Properties.Hot.Average.Mu       =               PP.LiquidViscosity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);     
207
208"Hot Stream Inlet Viscosity"
209        Properties.Hot.Inlet.Mu         =               PP.LiquidViscosity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);       
210
211"Hot Stream Outlet Viscosity"
212        Properties.Hot.Outlet.Mu        =               PP.LiquidViscosity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);     
213
214"Hot Stream Average Conductivity"
215        Properties.Hot.Average.K        =               PP.LiquidThermalConductivity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);   
216
217"Hot Stream Inlet Conductivity"
218        Properties.Hot.Inlet.K          =               PP.LiquidThermalConductivity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);     
219
220"Hot Stream Outlet Conductivity"
221        Properties.Hot.Outlet.K         =               PP.LiquidThermalConductivity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);   
222
223"Hot Stream Heat Capacity at Wall Temperature"
224        Properties.Hot.Wall.Cp          =               PP.LiquidCp(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
225
226"Hot Stream Viscosity  at Wall Temperature"
227        Properties.Hot.Wall.Mu          =               PP.LiquidViscosity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);     
228
229"Hot Stream Conductivity at Wall Temperature"
230        Properties.Hot.Wall.K           =               PP.LiquidThermalConductivity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);   
231       
232
233        else
234
235"Hot Stream Average Heat Capacity"
236        Properties.Hot.Average.Cp       =               PP.VapourCp(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);
237
238"Hot Stream Inlet Heat Capacity"
239        Properties.Hot.Inlet.Cp         =               PP.VapourCp(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);
240
241"Hot Stream Outlet Heat Capacity"
242        Properties.Hot.Outlet.Cp        =               PP.VapourCp(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);
243
244"Hot Stream Average Mass Density"
245        Properties.Hot.Average.rho      =               PP.VapourDensity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);
246
247"Hot Stream Inlet Mass Density"
248        Properties.Hot.Inlet.rho        =               PP.VapourDensity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);
249
250"Hot Stream Outlet Mass Density"
251        Properties.Hot.Outlet.rho       =               PP.VapourDensity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);
252
253"Hot Stream Average Viscosity"
254        Properties.Hot.Average.Mu       =               PP.VapourViscosity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);
255
256"Hot Stream Inlet Viscosity"
257        Properties.Hot.Inlet.Mu         =               PP.VapourViscosity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);
258
259"Hot Stream Outlet Viscosity"
260        Properties.Hot.Outlet.Mu        =               PP.VapourViscosity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);
261
262"Hot Stream Average Conductivity"
263        Properties.Hot.Average.K        =               PP.VapourThermalConductivity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);   
264
265"Hot Stream Inlet Conductivity"
266        Properties.Hot.Inlet.K          =               PP.VapourThermalConductivity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);     
267       
268"Hot Stream Outlet Conductivity"
269        Properties.Hot.Outlet.K         =               PP.VapourThermalConductivity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);   
270
271"Hot Stream Heat Capacity at Wall Temperature"
272        Properties.Hot.Wall.Cp          =               PP.VapourCp(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
273
274"Hot Stream Viscosity at Wall Temperature"
275        Properties.Hot.Wall.Mu          =               PP.VapourViscosity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
276
277"Hot Stream Conductivity at Wall Temperature"
278        Properties.Hot.Wall.K           =               PP.VapourThermalConductivity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);   
279
280
281end
282
283#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
284#                                       Thermal Details                                                                 #
285#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
286
287"Hot Stream Heat Capacity"
288        Details.Ch =Inlet.Hot.F*Properties.Hot.Average.Cp;
289       
290"Cold Stream Heat Capacity"
291        Details.Cc =Inlet.Cold.F*Properties.Cold.Average.Cp;
292       
293"Minimum Heat Capacity"
294        Details.Cmin  = min([Details.Ch,Details.Cc]);
295       
296"Maximum Heat Capacity"
297        Details.Cmax  = max([Details.Ch,Details.Cc]);
298
299"Heat Capacity Ratio"
300        Details.Cr    = Details.Cmin/Details.Cmax;
301
302#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
303#                                       Energy Balance
304#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
305
306"Energy Balance Hot Stream"
307        Details.Q = Inlet.Hot.F*(Inlet.Hot.h-Outlet.Hot.h);
308
309"Energy Balance Cold Stream"
310        Details.Q =-Inlet.Cold.F*(Inlet.Cold.h-Outlet.Cold.h);
311
312#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
313#                                       Material Balance
314#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
315"Flow Mass Inlet Cold Stream"
316        Properties.Cold.Inlet.Fw        =  sum(M*Inlet.Cold.z)*Inlet.Cold.F;
317
318"Flow Mass Outlet Cold Stream"
319        Properties.Cold.Outlet.Fw       =  sum(M*Outlet.Cold.z)*Outlet.Cold.F;
320
321"Flow Mass Inlet Hot Stream"
322        Properties.Hot.Inlet.Fw         =  sum(M*Inlet.Hot.z)*Inlet.Hot.F;
323
324"Flow Mass Outlet Hot Stream"   
325        Properties.Hot.Outlet.Fw        =  sum(M*Outlet.Hot.z)*Outlet.Hot.F;
326
327"Molar Balance Hot Stream"
328        Inlet.Hot.F  = Outlet.Hot.F;
329       
330"Molar Balance Cold Stream"
331        Inlet.Cold.F = Outlet.Cold.F;
332
333#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
334#                                       Constraints
335#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
336"Hot Stream Molar Fraction Constraint"
337        Outlet.Hot.z=Inlet.Hot.z;
338       
339"Cold Stream Molar Fraction Constraint"
340        Outlet.Cold.z=Inlet.Cold.z;
341       
342"No Phase Change In Cold Stream"
343        Inlet.Cold.v=Outlet.Cold.v;
344
345"No Phase Change In Hot Stream"
346        Inlet.Hot.v=Outlet.Hot.v;
347       
348end
349
350Model Heatex_Detailed          as HeatExchangerDetailed_Basic
351
352ATTRIBUTES
353        Pallete = false;
354        Brief = "write some information";
355        Info =
356        "write some information";
357       
358PARAMETERS
359
360outer PP                as Plugin                (Brief="External Physical Properties");
361                side        as Integer           (Brief="Fluid Alocation Flag",Lower=0,Upper=1);
362                Pi                      as constant     (Brief="Pi Number",Default=3.14159265);
363#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
364#                               Shell Geometrical Parameters                                           
365#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
366Tpass                                   as Integer              (Brief="Number of Tube Passes",Lower=1);
367Nss                                     as Integer              (Brief="Number of Sealing Strips pairs",Lower=1);
368Dishell                                 as length               (Brief="Inside Shell Diameter",Lower=10e-6);
369Donozzle_Shell          as length               (Brief="Shell Outlet Nozzle Diameter",Lower=10e-6);
370Dinozzle_Shell          as length               (Brief="Shell Inlet Nozzle Diameter",Lower=10e-6);
371Aonozzle_Shell          as area                 (Brief="Shell Outlet Nozzle Area",Lower=10e-6);
372Ainozzle_Shell          as area                 (Brief="Shell Inlet Nozzle Area",Lower=10e-6);
373Aeonozzle_Shell         as area                 (Brief="Shell Outlet Escape Area Under Nozzle",Lower=10e-6);
374Aeinozzle_Shell         as area                 (Brief="Shell Inlet Escape Area Under Nozzle",Lower=10e-6);
375Hinozzle_Shell          as length               (Brief="Height Under Shell Inlet Nozzle",Lower=10e-6);
376Honozzle_Shell          as length               (Brief="Height Under Shell Outlet Nozzle",Lower=10e-6);
377Lcf                                     as length               (Brief="Bundle-to-Shell Clearance",Lower=10e-8);
378
379#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
380#                               Tubes Geometrical Parameters                                           
381#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
382Ntt                                     as Integer                      (Brief="Total Number of Tubes in Shell",Default=100,Lower=1);
383Pattern                 as Integer                      (Brief="Tube Layout Characteristic Angle",Lower=30);
384Ltube                                   as length                       (Brief="Effective Tube Length",Lower=0.1);
385pitch                           as length                       (Brief="Tube Pitch",Lower=1e-8);
386Kwall                                   as conductivity         (Brief="Tube Wall Material Thermal Conductivity");
387Dotube                                  as length                       (Brief="Tube Outside Diameter",Lower=10e-6);
388Ditube                          as length                       (Brief="Tube Inside Diameter",Lower=10e-6);
389Donozzle_Tube   as length                       (Brief="Tube Outlet Nozzle Diameter",Lower=10e-6);
390Dinozzle_Tube   as length                       (Brief="Tube Inlet Nozzle Diameter",Lower=10e-6);
391Aonozzle_Tube   as area                         (Brief="Tube Outlet Nozzle Area",Lower=10e-6);
392Ainozzle_Tube   as area                         (Brief="Tube Inlet Nozzle Area",Lower=10e-6);
393Kinlet_Tube             as positive                     (Brief="Tube Inlet Nozzle Pressure Loss Coeff",Default=1.1);
394Koutlet_Tube    as positive                     (Brief="Tube Outlet Nozzle Pressure Loss Coeff",Default=0.7);
395
396#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
397#                               Baffles Geometrical Parameters                                         
398#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
399Bc      as Integer      (Brief="Baffle Cut",Default=25,Lower=25);
400Nb      as Real         (Brief="Number of Baffles",Lower=1);
401Lcd     as length       (Brief="Baffle-to-Shell Clearance",Lower=10e-8);
402Ltd             as length       (Brief="Tube-to-Bafflehole Clearance",Lower=10e-8);
403
404SET
405
406#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
407#             Set Parameters for heatex Calculation                                     
408#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
409        Pi                                              = 3.14159265;
410        HE.Tpass                                = Tpass;
411        HE.Nss                                  = Nss;
412        HE.Ntt                                  = Ntt;
413        HE.Pattern                              = Pattern;
414        HE.Bc                                   = Bc;
415        HE.Donozzle_Shell       = Donozzle_Shell;
416        HE.Dinozzle_Shell       = Dinozzle_Shell;
417        HE.Honozzle_Shell       = Honozzle_Shell;
418        HE.Hinozzle_Shell       = Hinozzle_Shell;
419        HE.Donozzle_Tube        = Donozzle_Tube;
420        HE.Dinozzle_Tube        = Dinozzle_Tube;
421        HE.Nb                           = Nb;
422        HE.Dishell                              = Dishell;             
423        HE.Lcf                                  = Lcf; 
424        HE.Ltube                                = Ltube;       
425        HE.pitch                                = pitch;               
426        HE.Dotube                       = Dotube;       
427        HE.Ditube                               = Ditube;       
428        HE.Lcd                                  = Lcd;
429        HE.Ltd                                  = Ltd;
430        side                                            = HE.FluidAlocation();
431       
432#"Tube Side Inlet Nozzle Area"
433        Ainozzle_Tube = (Pi*Dinozzle_Tube*Dinozzle_Tube)/4;
434       
435#"Tube Side Outlet Nozzle Area"
436        Aonozzle_Tube = (Pi*Donozzle_Tube*Donozzle_Tube)/4;
437       
438#"Tube Inlet Nozzle Pressure Loss Coeff"
439        Kinlet_Tube   = 1.1;
440
441#"Tube Outlet Nozzle Pressure Loss Coeff"
442        Koutlet_Tube  = 0.7;
443       
444#"Shell Outlet Nozzle Area"
445        Aonozzle_Shell  = (Pi*Donozzle_Shell*Donozzle_Shell)/4;
446       
447#"Shell Inlet Nozzle Area"
448        Ainozzle_Shell  = (Pi*Dinozzle_Shell*Dinozzle_Shell)/4;
449       
450#"Shell Outlet Escape Area Under Nozzle"
451        Aeonozzle_Shell = Pi*Donozzle_Shell*Honozzle_Shell + 0.6*Aonozzle_Shell*(1-(Dotube/pitch));
452       
453#"Shell Inlet Escape Area Under Nozzle"
454        Aeinozzle_Shell = Pi*Dinozzle_Shell*Hinozzle_Shell + 0.6*Ainozzle_Shell*(1-(Dotube/pitch));
455       
456       
457EQUATIONS
458
459#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
460#                               Heat Transfer Correction Factors                                       
461#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
462"Ji Factor"
463        Shell.HeatTransfer.Ji = HE.JiFactor(Shell.HeatTransfer.Re);
464
465"Jc Factor"
466        Shell.HeatTransfer.Jc = HE.JcFactor();
467       
468"Jl Factor"
469        Shell.HeatTransfer.Jl = HE.JlFactor(Shell.HeatTransfer.Sm);
470
471"Jb Factor"
472        Shell.HeatTransfer.Jb = HE.JbFactor(Shell.HeatTransfer.Re,Baffles.Ls,Shell.HeatTransfer.Sm);
473
474"Jr Factor"     
475        Shell.HeatTransfer.Jr = HE.JrFactor(Shell.HeatTransfer.Re);
476       
477"Total J Factor"
478        Shell.HeatTransfer.Jtotal =     Shell.HeatTransfer.Jc*Shell.HeatTransfer.Jl*Shell.HeatTransfer.Jb*Shell.HeatTransfer.Jr*Shell.HeatTransfer.Js;
479
480#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
481#                               Pressure Drop and Velocities                                   
482#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
483
484if side equal 1
485       
486        then
487       
488"Tube Side Pressure Drop"
489        Tubes.PressureDrop.PdTube               = HE.DeltaPtube(Tubes.HeatTransfer.Re,Properties.Cold.Average.rho,Tubes.HeatTransfer.Vtube,Tubes.HeatTransfer.Phi);
490
491"Pressure Drop Tube Side Inlet Nozzle"
492        Tubes.PressureDrop.Pdnozzle_in  = 0.5*Kinlet_Tube*Properties.Cold.Inlet.rho*Tubes.PressureDrop.Vnozzle_in^2;
493
494"Velocity Tube Side Inlet Nozzle"
495        Tubes.PressureDrop.Vnozzle_in   = Properties.Cold.Inlet.Fw/(Properties.Cold.Inlet.rho*Ainozzle_Tube);
496
497"Pressure Drop Tube Side Outlet Nozzle"
498        Tubes.PressureDrop.Pdnozzle_out = 0.5*Koutlet_Tube*Properties.Cold.Outlet.rho*Tubes.PressureDrop.Vnozzle_out^2;
499
500"Velocity Tube Side Outlet Nozzle"
501        Tubes.PressureDrop.Vnozzle_out  = Properties.Cold.Inlet.Fw/(Properties.Cold.Outlet.rho*Aonozzle_Tube);
502
503"Shell Pressure Drop Inlet Nozzle"
504        Shell.PressureDrop.Pdnozzle_in  = (0.5*Properties.Hot.Inlet.Fw^2/Properties.Hot.Inlet.rho)*((1/Ainozzle_Shell^2)+(1/Aeinozzle_Shell^2));
505
506"Velocity Shell Side Inlet Nozzle"
507        Shell.PressureDrop.Vnozzle_in   = Properties.Hot.Inlet.Fw/(Properties.Hot.Inlet.rho*Ainozzle_Shell);
508
509"Shell Pressure Drop Outlet Nozzle"
510        Shell.PressureDrop.Pdnozzle_out = (0.5*Properties.Hot.Outlet.Fw^2/Properties.Hot.Outlet.rho)*((1/Ainozzle_Shell^2)+(1/Aeinozzle_Shell^2));
511
512"Velocity Shell Side Outlet Nozzle"
513        Shell.PressureDrop.Vnozzle_out  = Properties.Hot.Outlet.Fw/(Properties.Hot.Outlet.rho*Aonozzle_Shell);
514
515"Pressure Drop Hot Stream"
516        Outlet.Hot.P  = Inlet.Hot.P - Shell.PressureDrop.Pdtotal;       
517       
518"Pressure Drop Cold Stream"
519        Outlet.Cold.P  = Inlet.Cold.P - Tubes.PressureDrop.Pdtotal;
520
521
522        else
523
524"Tube Side Pressure Drop"
525        Tubes.PressureDrop.PdTube               = HE.DeltaPtube(Tubes.HeatTransfer.Re,Properties.Hot.Average.rho,Tubes.HeatTransfer.Vtube,Tubes.HeatTransfer.Phi);
526
527"Pressure Drop Tube Side Inlet Nozzle"
528        Tubes.PressureDrop.Pdnozzle_in  = 0.5*Kinlet_Tube*Properties.Hot.Inlet.rho*Tubes.PressureDrop.Vnozzle_in^2;
529       
530"Velocity Tube Side Inlet Nozzle"
531        Tubes.PressureDrop.Vnozzle_in   = Properties.Hot.Inlet.Fw/(Properties.Hot.Inlet.rho*Ainozzle_Tube);
532       
533"Pressure Drop Tube Side Outlet Nozzle"
534        Tubes.PressureDrop.Pdnozzle_out = 0.5*Koutlet_Tube*Properties.Hot.Outlet.rho*Tubes.PressureDrop.Vnozzle_out^2;
535       
536"Velocity Tube Side Outlet Nozzle"
537        Tubes.PressureDrop.Vnozzle_out  = Properties.Hot.Inlet.Fw/(Properties.Hot.Outlet.rho*Aonozzle_Tube);   
538
539"Shell Pressure Drop Inlet Nozzle"
540        Shell.PressureDrop.Pdnozzle_in  = (0.5*Properties.Cold.Inlet.Fw^2/Properties.Cold.Inlet.rho)*((1/Ainozzle_Shell^2)+(1/Aeinozzle_Shell^2));
541
542"Velocity Shell Side Inlet Nozzle"
543        Shell.PressureDrop.Vnozzle_in   = Properties.Cold.Inlet.Fw/(Properties.Cold.Inlet.rho*Ainozzle_Shell);
544
545"Shell Pressure Drop Outlet Nozzle"
546        Shell.PressureDrop.Pdnozzle_out = (0.5*Properties.Cold.Outlet.Fw^2/Properties.Cold.Outlet.rho)*((1/Ainozzle_Shell^2)+(1/Aeinozzle_Shell^2));
547
548"Velocity Shell Side Outlet Nozzle"
549        Shell.PressureDrop.Vnozzle_out  = Properties.Cold.Outlet.Fw/(Properties.Cold.Outlet.rho*Ainozzle_Shell);
550
551"Pressure Drop Hot Stream"
552        Outlet.Hot.P  = Inlet.Hot.P- Tubes.PressureDrop.Pdtotal;       
553       
554"Pressure Drop Cold Stream"
555        Outlet.Cold.P  = Inlet.Cold.P - Shell.PressureDrop.Pdtotal;
556
557end
558
559#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
560#                               Nozzles rho-V^2                                                                 
561#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
562
563if side equal 1
564       
565        then
566
567"Shell Side inlet Nozzle rho-V^2"
568        Shell.PressureDrop.RVsquare_in = Properties.Hot.Inlet.rho*(Shell.PressureDrop.Vnozzle_in)^2;
569
570"Shell Side Outlet Nozzle rho-V^2"
571        Shell.PressureDrop.RVsquare_out = Properties.Hot.Outlet.rho*(Shell.PressureDrop.Vnozzle_out)^2;
572       
573        else
574       
575"Shell Side inlet Nozzle rho-V^2"
576        Shell.PressureDrop.RVsquare_in = Properties.Cold.Inlet.rho*(Shell.PressureDrop.Vnozzle_in)^2;
577
578"Shell Side Outlet Nozzle rho-V^2"
579        Shell.PressureDrop.RVsquare_out = Properties.Cold.Outlet.rho*(Shell.PressureDrop.Vnozzle_out)^2;
580
581end
582
583#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
584#                               Phi correction                                                                 
585#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
586
587if side equal 1
588       
589        then
590
591"Shell Side Phi correction"
592        Shell.HeatTransfer.Phi  = HE.PhiCorrection(Properties.Hot.Average.Mu,Properties.Hot.Wall.Mu);
593       
594"Tube Side Phi correction"
595        Tubes.HeatTransfer.Phi  = HE.PhiCorrection(Properties.Cold.Average.Mu,Properties.Cold.Wall.Mu);
596       
597        else
598       
599"Shell Side Phi correction"
600        Shell.HeatTransfer.Phi  = HE.PhiCorrection(Properties.Cold.Average.Mu,Properties.Cold.Wall.Mu);
601       
602"Tube Side Phi correction"
603        Tubes.HeatTransfer.Phi  = HE.PhiCorrection(Properties.Hot.Average.Mu,Properties.Hot.Wall.Mu);
604
605end
606
607#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#                                                                                                                                   #
608#                               Heat Transfer                                                                           
609#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
610
611if side equal 1
612       
613        then
614       
615"Hot Wall Temperature"
616        Properties.Hot.Wall.Twall       = (Properties.Hot.Average.T+Properties.Cold.Average.T)/2;
617
618"ColdWall Temperature"
619        Properties.Cold.Wall.Twall  = (Properties.Hot.Average.T+Properties.Cold.Average.T)/2;
620
621"Tube Side Velocity"
622        Tubes.HeatTransfer.Vtube        = Properties.Cold.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Properties.Cold.Average.rho*Ntt);
623
624"Tube Side Reynolds Number"
625        Tubes.HeatTransfer.Re           = (Properties.Cold.Average.rho*Tubes.HeatTransfer.Vtube*Ditube)/Properties.Cold.Average.Mu;
626       
627"Tube Side Prandtl Number"
628        Tubes.HeatTransfer.PR           = ((Properties.Cold.Average.Cp/Properties.Cold.Average.Mw)*Properties.Cold.Average.Mu)/Properties.Cold.Average.K;
629
630"Tube Side Prandtl Number at Wall Temperature"
631        Tubes.HeatTransfer.PRw          = ((Properties.Cold.Wall.Cp/Properties.Cold.Average.Mw)*Properties.Cold.Wall.Mu)/Properties.Cold.Wall.K;
632
633"Tube Side Film Coefficient"
634        Tubes.HeatTransfer.htube        = HE.TubeFilmCoeff(Tubes.HeatTransfer.Re,Tubes.HeatTransfer.PR,Properties.Cold.Average.K)*Tubes.HeatTransfer.Phi;
635
636"Shell Side Prandtl Number"
637        Shell.HeatTransfer.PR           = ((Properties.Hot.Average.Cp/Properties.Hot.Average.Mw)*Properties.Hot.Average.Mu)/Properties.Hot.Average.K;
638
639"Shell Side Prandtl Number at Wall Temperature"
640        Shell.HeatTransfer.PRw          = ((Properties.Hot.Wall.Cp/Properties.Hot.Average.Mw)*Properties.Hot.Wall.Mu)/Properties.Hot.Wall.K;
641
642
643        else
644
645"Hot Wall Temperature"
646        Properties.Hot.Wall.Twall  = (Properties.Hot.Average.T+Properties.Cold.Average.T)/2;
647
648"Cold Wall Temperature"
649        Properties.Cold.Wall.Twall  = (Properties.Hot.Average.T+Properties.Cold.Average.T)/2;
650
651"Tube Side Velocity"
652        Tubes.HeatTransfer.Vtube        =       Properties.Hot.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Properties.Hot.Average.rho*Ntt);
653
654"Tube Side Reynolds Number"
655        Tubes.HeatTransfer.Re           =       (Properties.Hot.Average.rho*Tubes.HeatTransfer.Vtube*Ditube)/Properties.Hot.Average.Mu;
656
657"Tube Side Prandtl Number"
658        Tubes.HeatTransfer.PR = ((Properties.Hot.Average.Cp/Properties.Hot.Average.Mw)*Properties.Hot.Average.Mu)/Properties.Hot.Average.K;
659
660"Tube Side Prandtl Number at Wall"
661        Tubes.HeatTransfer.PRw = ((Properties.Hot.Wall.Cp/Properties.Hot.Average.Mw)*Properties.Hot.Wall.Mu)/Properties.Hot.Wall.K;
662
663"Tube Side Film Coefficient"
664        Tubes.HeatTransfer.htube= HE.TubeFilmCoeff(Tubes.HeatTransfer.Re,Tubes.HeatTransfer.PR,Properties.Hot.Average.K)*Tubes.HeatTransfer.Phi;
665       
666"Shell Side Prandtl Number"
667        Shell.HeatTransfer.PR = ((Properties.Cold.Average.Cp/Properties.Cold.Average.Mw)*Properties.Cold.Average.Mu)/Properties.Cold.Average.K;
668
669"Shell Side Prandtl Number at Wall"
670        Shell.HeatTransfer.PRw=((Properties.Cold.Wall.Cp/Properties.Cold.Average.Mw)*Properties.Cold.Wall.Mu)/Properties.Cold.Wall.K;
671
672end
673
674
675"Tube Resistance"       
676        Resistances.Rtube*(Tubes.HeatTransfer.htube*Ditube) = Dotube;
677       
678"Wall Resistance"
679        Resistances.Rwall=Dotube*ln(Dotube/Ditube)/(2*Kwall);
680       
681"Shell Resistance"
682        Resistances.Rshell*(Shell.HeatTransfer.hshell)=1;
683
684"Shell Side Cross Flow Area"
685        Shell.HeatTransfer.Sm = HE.CrossFlowArea(Baffles.Ls);
686       
687"Overall Heat Transfer Coefficient Dirty"
688        Details.Ud=1/(Dotube/(Tubes.HeatTransfer.htube*Ditube)+Resistances.Rfo+Resistances.Rfi*(Dotube/Ditube)+(Dotube*ln(Dotube/Ditube)/(2*Kwall))+(1/(Shell.HeatTransfer.hshell)));
689
690"Overall Heat Transfer Coefficient Clean"
691        (1/Details.Ud)=(1/Details.Uc)+Resistances.Rfo+Resistances.Rfi*(Dotube/Ditube);
692
693"Exchange Surface Area"
694        Details.A=Pi*Dotube*Ntt*Ltube;
695
696"Baffles Spacing"
697        Ltube = Baffles.Lsi+Baffles.Lso+Baffles.Ls*(Nb-1);
698
699end
700
701Model Heatex_Detailed_NTU       as Heatex_Detailed
702
703ATTRIBUTES
704        Pallete = false;
705        Brief = "write some information";
706        Info =
707        "write some information";
708       
709VARIABLES
710
711Eft                      as positive (Brief="Effectiveness",Default=0.05,Lower=1e-8);
712       
713EQUATIONS
714"Duty"
715        Details.Q       = Eft*Details.Cmin*(Inlet.Hot.T-Inlet.Cold.T); 
716       
717end
718
719Model Heatex_Detailed_LMTD as Heatex_Detailed
720
721ATTRIBUTES
722        Pallete = false;
723        Brief = "write some information";
724        Info =
725        "write some information";
726       
727VARIABLES
728
729DT0             as temp_delta   (Brief="Temperature Difference at Inlet",Lower=1);
730DTL             as temp_delta   (Brief="Temperature Difference at Outlet",Lower=1);
731LMTD            as temp_delta   (Brief="Logarithmic Mean Temperature Difference",Lower=1);
732Fc                      as positive             (Brief="LMTD Correction Factor",Lower=0.4);
733MTD             as temp_delta   (Brief="Mean Temperature Difference",Lower=1);
734
735EQUATIONS
736#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
737#                       Log Mean Temperature Difference
738#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
739if abs(DT0 - DTL) > 0.05*max(abs([DT0,DTL]))
740       
741        then
742"Log Mean Temperature Difference"
743        LMTD= (DT0-DTL)/ln(DT0/DTL);
744
745        else
746       
747if DT0*DTL equal 0
748       
749        then
750"Log Mean Temperature Difference"
751        LMTD = 0.5*(DT0+DTL);
752       
753        else
754"Log Mean Temperature Difference"
755        LMTD = 0.5*(DT0+DTL)*(1-(DT0-DTL)^2/(DT0*DTL)*(1+(DT0-DTL)^2/(DT0*DTL)/2)/12);
756       
757end
758       
759end
760
761"Exchange Surface Area"
762        Details.Q   = Details.Ud*Details.A*MTD;
763       
764"Mean Temperature Difference"   
765        MTD = Fc*LMTD;
766       
767end
768
769Model E_Shell_NTU_Det                   as Heatex_Detailed_NTU
770
771ATTRIBUTES
772        Pallete = true;
773        Brief = "Shell and Tubes Heat Exchanger with 1 shell pass - NTU Method";
774        Info =
775        "write some information";
776       
777#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
778#       Shell and Tubes Heat Exchanger with 1 shell pass - LMTD Method
779#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
780EQUATIONS
781
782"TEMA E Shell Effectiveness"
783#       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;
784        Eft = HE.EshellEffectiveness(Details.Cr,Details.NTU);
785
786"Js Factor"     
787        Shell.HeatTransfer.Js = HE.JsFactor(Shell.HeatTransfer.Re,Baffles.Lsi,Baffles.Lso,Baffles.Ls);
788
789if side equal 1
790       
791        then
792       
793"Shell Side Reynolds Number"
794        Shell.HeatTransfer.Re=(Dotube*Properties.Hot.Inlet.Fw/Shell.HeatTransfer.Sm)/Properties.Hot.Average.Mu;
795
796"Shell Heat Transfer Coefficient"
797        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;
798
799"Shell Pressure Drop Cross Flow"
800        Shell.PressureDrop.PdCross              = HE.DeltaPcross(Shell.HeatTransfer.Re,Baffles.Ls,Baffles.Lso,Baffles.Lsi,Properties.Hot.Inlet.Fw,Shell.HeatTransfer.Phi,Properties.Hot.Average.rho);
801
802"Shell Pressure Baffle Window"
803        Shell.PressureDrop.Pdwindow             = HE.DeltaPwindow(Properties.Hot.Inlet.Fw,Shell.HeatTransfer.Sm,Properties.Hot.Average.rho,Properties.Hot.Average.Mu,Baffles.Ls);
804
805"Shell Pressure End Zones"
806        Shell.PressureDrop.PdEndZones  = HE.DeltaPendZones(Shell.HeatTransfer.Re,Baffles.Ls,Baffles.Lso,Baffles.Lsi,Properties.Hot.Inlet.Fw,Shell.HeatTransfer.Phi,Properties.Hot.Average.rho);
807
808
809        else
810
811"Shell Side Reynolds Number"
812        Shell.HeatTransfer.Re=(Dotube*Properties.Cold.Inlet.Fw/Shell.HeatTransfer.Sm)/Properties.Cold.Average.Mu;
813
814"Shell Heat Transfer Coefficient"
815        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;
816
817"Shell Pressure Drop Cross Flow"
818        Shell.PressureDrop.PdCross      = HE.DeltaPcross(Shell.HeatTransfer.Re,Baffles.Ls,Baffles.Lso,Baffles.Lsi,Properties.Cold.Inlet.Fw,Shell.HeatTransfer.Phi,Properties.Cold.Average.rho);
819
820"Shell Pressure Baffle Window"
821        Shell.PressureDrop.Pdwindow     = HE.DeltaPwindow(Properties.Cold.Inlet.Fw,Shell.HeatTransfer.Sm,Properties.Cold.Average.rho,Properties.Cold.Average.Mu,Baffles.Ls);
822
823"Shell Pressure End Zones"
824        Shell.PressureDrop.PdEndZones  = HE.DeltaPendZones(Shell.HeatTransfer.Re,Baffles.Ls,Baffles.Lso,Baffles.Lsi,Properties.Cold.Inlet.Fw,Shell.HeatTransfer.Phi,Properties.Cold.Average.rho);
825
826
827end
828
829end
830
831Model F_Shell_NTU_Det                   as Heatex_Detailed_NTU
832
833ATTRIBUTES
834        Pallete = true;
835        Brief = "Shell and Tubes Heat Exchanger with 2 shell pass - NTU Method";
836        Info =
837        "write some information";
838
839VARIABLES
840
841Eft1    as positive (Brief="Effectiveness Correction",Lower=0.01,Default=0.5);
842
843EQUATIONS
844
845"Effectiveness Correction"
846        Eft1 = 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;
847
848"TEMA F Shell Effectiveness"
849        Eft = ( ((1-Eft1*Details.Cr)/(1-Eft1))^2 -1  )*( ((1-Eft1*Details.Cr)/(1-Eft1))^2 - Details.Cr )^-1;
850
851"Js Factor"     
852        Shell.HeatTransfer.Js = HE.JsFactor(Shell.HeatTransfer.Re,Baffles.Lsi,Baffles.Lso,Baffles.Ls);
853
854if side equal 1
855       
856        then
857       
858"Shell Side Reynolds Number"
859        Shell.HeatTransfer.Re=(Dotube*Properties.Hot.Inlet.Fw/Shell.HeatTransfer.Sm)/Properties.Hot.Average.Mu;
860
861"Shell Heat Transfer Coefficient"
862        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;
863
864"Shell Pressure Drop Cross Flow"
865        Shell.PressureDrop.PdCross              = HE.DeltaPcross(Shell.HeatTransfer.Re,Baffles.Ls,Baffles.Lso,Baffles.Lsi,Properties.Hot.Inlet.Fw,Shell.HeatTransfer.Phi,Properties.Hot.Average.rho);
866
867"Shell Pressure Baffle Window"
868        Shell.PressureDrop.Pdwindow             = HE.DeltaPwindow(Properties.Hot.Inlet.Fw,Shell.HeatTransfer.Sm,Properties.Hot.Average.rho,Properties.Hot.Average.Mu,Baffles.Ls);
869
870"Shell Pressure End Zones"
871        Shell.PressureDrop.PdEndZones  = HE.DeltaPendZones(Shell.HeatTransfer.Re,Baffles.Ls,Baffles.Lso,Baffles.Lsi,Properties.Hot.Inlet.Fw,Shell.HeatTransfer.Phi,Properties.Hot.Average.rho);
872
873
874        else
875
876"Shell Side Reynolds Number"
877        Shell.HeatTransfer.Re=(Dotube*Properties.Cold.Inlet.Fw/Shell.HeatTransfer.Sm)/Properties.Cold.Average.Mu;
878
879"Shell Heat Transfer Coefficient"
880        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;
881
882"Shell Pressure Drop Cross Flow"
883        Shell.PressureDrop.PdCross      = HE.DeltaPcross(Shell.HeatTransfer.Re,Baffles.Ls,Baffles.Lso,Baffles.Lsi,Properties.Cold.Inlet.Fw,Shell.HeatTransfer.Phi,Properties.Cold.Average.rho);
884
885"Shell Pressure Baffle Window"
886        Shell.PressureDrop.Pdwindow     = HE.DeltaPwindow(Properties.Cold.Inlet.Fw,Shell.HeatTransfer.Sm,Properties.Cold.Average.rho,Properties.Cold.Average.Mu,Baffles.Ls);
887
888"Shell Pressure End Zones"
889        Shell.PressureDrop.PdEndZones  = HE.DeltaPendZones(Shell.HeatTransfer.Re,Baffles.Ls,Baffles.Lso,Baffles.Lsi,Properties.Cold.Inlet.Fw,Shell.HeatTransfer.Phi,Properties.Cold.Average.rho);
890
891
892end
893
894
895end
896
897Model Multipass_NTU_Det
898       
899ATTRIBUTES
900        Pallete = true;
901        Brief = "Shell and Tubes Heat Exchanger In Series with 1 shell pass - NTU Method";
902        Info =
903        "write some information";
904
905PARAMETERS
906
907                Nshell          as Integer              (Brief="N Shell in Series",Default=2);
908outer PP                        as Plugin               (Brief="External Physical Properties");
909                HE                      as Plugin               (Brief="heatex Calculations", File="heatex");
910                side            as Integer              (Brief="Fluid Alocation",Lower=0,Upper=1);
911                Pi                              as constant    (Brief="Pi Number",Default=3.14159265);
912
913#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
914#       Shell Geometrical Parameters
915#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
916Tpass                                   as Integer              (Brief="Number of Tube Passes",Lower=1);
917Nss                                     as Integer              (Brief="Number of Sealing Strips pairs",Lower=1);
918Dishell                                 as length               (Brief="Inside Shell Diameter",Lower=10e-6);
919Donozzle_Shell          as length               (Brief="Shell Outlet Nozzle Diameter",Lower=10e-6);
920Dinozzle_Shell          as length               (Brief="Shell Inlet Nozzle Diameter",Lower=10e-6);
921Hinozzle_Shell          as length               (Brief="Height Under Shell Inlet Nozzle",Lower=10e-6);
922Honozzle_Shell          as length               (Brief="Height Under Shell Outlet Nozzle",Lower=10e-6);
923Aonozzle_Shell          as area                 (Brief="Shell Outlet Nozzle Area",Lower=10e-6);
924Ainozzle_Shell          as area                 (Brief="Shell Inlet Nozzle Area",Lower=10e-6);
925Aeonozzle_Shell         as area                 (Brief="Shell Outlet Escape Area Under Nozzle",Lower=10e-6);
926Aeinozzle_Shell         as area                 (Brief="Shell Inlet Escape Area Under Nozzle",Lower=10e-6);
927Lcf                                     as length               (Brief="Bundle-to-Shell Clearance",Lower=10e-8);
928#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
929#       Tubes Geometrical Parameters
930#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
931Ntt                                     as Integer                      (Brief="Total Number of Tubes in Shell",Default=100,Lower=1);
932Pattern                         as Integer                      (Brief="Tube Layout Characteristic Angle",Lower=30);
933Ltube                                   as length                       (Brief="Effective Tube Length",Lower=0.1);
934pitch                           as length                       (Brief="Tube Pitch",Lower=1e-8);
935Kwall                                   as conductivity         (Brief="Tube Wall Material Thermal Conductivity");
936Dotube                                  as length                       (Brief="Tube Outside Diameter",Lower=10e-6);
937Ditube                                  as length                       (Brief="Tube Inside Diameter",Lower=10e-6);
938Donozzle_Tube   as length                       (Brief="Tube Outlet Nozzle Diameter",Lower=10e-6);
939Dinozzle_Tube   as length                       (Brief="Tube Inlett Nozzle Diameter",Lower=10e-6);
940Aonozzle_Tube   as area                         (Brief="Tube Outlet Nozzle Area",Lower=10e-6);
941Ainozzle_Tube   as area                         (Brief="Tube Inlet Nozzle Area",Lower=10e-6);
942Kinlet_Tube             as positive                     (Brief="Tube Inlet Nozzle Pressure Loss Coeff",Default=1.1);
943Koutlet_Tube    as positive                     (Brief="Tube Outlet Nozzle Pressure Loss Coeff",Default=0.7);
944
945#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
946#       Baffles Geometrical Parameters
947#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
948Bc                      as Integer              (Brief="Baffle Cut",Default=25,Lower=25);
949Nb              as Real                 (Brief="Number of Baffles",Lower=1);
950Lcd                     as length               (Brief="Baffle-to-Shell Clearance",Lower=10e-8);
951Ltd                     as length               (Brief="Tube-to-Bafflehole Clearance",Lower=10e-8);
952#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
953VARIABLES
954
955Eft(Nshell)       as positive                                                           (Brief="Effectiveness",Default=0.05,Lower=1e-8);
956Unity(Nshell) as HeatExchangerDetailed_Basic    (Brief="Shell in Series");
957
958SET
959#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
960#  Set Parameters for heatex Calculation
961#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
962        Pi                                              = 3.14159265;
963        HE.Tpass                                = Tpass;
964        HE.Nss                                  = Nss;
965        HE.Ntt                                  = Ntt;
966        HE.Pattern                              = Pattern;
967        HE.Bc                                   = Bc;
968        HE.Donozzle_Shell       = Donozzle_Shell;
969        HE.Dinozzle_Shell       = Dinozzle_Shell;
970        HE.Honozzle_Shell       = Honozzle_Shell;
971        HE.Hinozzle_Shell       = Hinozzle_Shell;
972        HE.Donozzle_Tube        = Donozzle_Tube;
973        HE.Dinozzle_Tube        = Dinozzle_Tube;
974        HE.Nb                           = Nb;
975        HE.Dishell                              = Dishell;             
976        HE.Lcf                                  = Lcf; 
977        HE.Ltube                                = Ltube;       
978        HE.pitch                                = pitch;               
979        HE.Dotube                       = Dotube;       
980        HE.Ditube                               = Ditube;       
981        HE.Lcd                                  = Lcd;
982        HE.Ltd                                  = Ltd; 
983        side                                            = HE.FluidAlocation();
984       
985#"Tube Side Inlet Nozzle Area"
986        Ainozzle_Tube = (Pi*Dinozzle_Tube*Dinozzle_Tube)/4;
987       
988#"Tube Side Outlet Nozzle Area"
989        Aonozzle_Tube = (Pi*Donozzle_Tube*Donozzle_Tube)/4;
990       
991#"Tube Inlet Nozzle Pressure Loss Coeff"
992        Kinlet_Tube   = 1.1;
993
994#"Tube Outlet Nozzle Pressure Loss Coeff"
995        Koutlet_Tube  = 0.7;
996       
997#"Shell Outlet Nozzle Area"
998        Aonozzle_Shell  = (Pi*Donozzle_Shell*Donozzle_Shell)/4;
999       
1000#"Shell Inlet Nozzle Area"
1001        Ainozzle_Shell  = (Pi*Dinozzle_Shell*Dinozzle_Shell)/4;
1002       
1003#"Shell Outlet Escape Area Under Nozzle"
1004        Aeonozzle_Shell = Pi*Donozzle_Shell*Honozzle_Shell + 0.6*Aonozzle_Shell*(1-Dotube/pitch);
1005       
1006#"Shell Inlet Escape Area Under Nozzle"
1007        Aeinozzle_Shell = Pi*Dinozzle_Shell*Hinozzle_Shell + 0.6*Ainozzle_Shell*(1-Dotube/pitch);
1008       
1009CONNECTIONS
1010
1011Unity([1:Nshell-1]).Outlet.Hot  to Unity([2:Nshell]).Inlet.Hot;
1012Unity([2:Nshell]).Outlet.Cold     to Unity([1:Nshell-1]).Inlet.Cold;
1013
1014EQUATIONS
1015
1016for i in [1:Nshell]
1017       
1018"Shell Side Cross Flow Area"
1019        Unity(i).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(i).Baffles.Ls);
1020
1021"Ji Factor"
1022        Unity(i).Shell.HeatTransfer.Ji =HE.JiFactor(Unity(i).Shell.HeatTransfer.Re);
1023
1024"Jc Factor"
1025        Unity(i).Shell.HeatTransfer.Jc = HE.JcFactor();
1026       
1027"Jl Factor"
1028        Unity(i).Shell.HeatTransfer.Jl = HE.JlFactor(Unity(i).Shell.HeatTransfer.Sm);
1029
1030"Jb Factor"
1031        Unity(i).Shell.HeatTransfer.Jb = HE.JbFactor(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Shell.HeatTransfer.Sm);
1032
1033"Jr Factor"     
1034        Unity(i).Shell.HeatTransfer.Jr = HE.JrFactor(Unity(i).Shell.HeatTransfer.Re);
1035       
1036"Total J Factor"
1037        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;
1038
1039
1040#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
1041#               Pressure Drop and Velocities                                   
1042#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
1043
1044if side equal 1
1045       
1046        then
1047       
1048"Tube Side Pressure Drop"
1049        Unity(i).Tubes.PressureDrop.PdTube              = HE.DeltaPtube(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Cold.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Tubes.HeatTransfer.Phi);
1050
1051"Pressure Drop Tube Side Inlet Nozzle"
1052        Unity(i).Tubes.PressureDrop.Pdnozzle_in = 0.5*Kinlet_Tube*Unity(i).Properties.Cold.Inlet.rho*Unity(i).Tubes.PressureDrop.Vnozzle_in^2;
1053
1054"Velocity Tube Side Inlet Nozzle"
1055        Unity(i).Tubes.PressureDrop.Vnozzle_in  = Unity(i).Properties.Cold.Inlet.Fw/(Unity(i).Properties.Cold.Inlet.rho*Ainozzle_Tube);
1056
1057"Pressure Drop Tube Side Outlet Nozzle"
1058        Unity(i).Tubes.PressureDrop.Pdnozzle_out        = 0.5*Koutlet_Tube*Unity(i).Properties.Cold.Outlet.rho*Unity(i).Tubes.PressureDrop.Vnozzle_out^2;
1059
1060"Velocity Tube Side Outlet Nozzle"
1061        Unity(i).Tubes.PressureDrop.Vnozzle_out = Unity(i).Properties.Cold.Inlet.Fw/(Unity(i).Properties.Cold.Outlet.rho*Aonozzle_Tube);
1062
1063"Shell Pressure Drop Inlet Nozzle"
1064        Unity(i).Shell.PressureDrop.Pdnozzle_in = (0.5*Unity(i).Properties.Hot.Inlet.Fw^2/Unity(i).Properties.Hot.Inlet.rho)*((1/Ainozzle_Shell^2)+(1/Aeinozzle_Shell^2));
1065
1066"Velocity Shell Side Inlet Nozzle"
1067        Unity(i).Shell.PressureDrop.Vnozzle_in  = Unity(i).Properties.Hot.Inlet.Fw/(Unity(i).Properties.Hot.Inlet.rho*Ainozzle_Shell);
1068
1069"Shell Pressure Drop Outlet Nozzle"
1070        Unity(i).Shell.PressureDrop.Pdnozzle_out        = (0.5*Unity(i).Properties.Hot.Outlet.Fw^2/Unity(i).Properties.Hot.Outlet.rho)*((1/Ainozzle_Shell^2)+(1/Aeinozzle_Shell^2));
1071
1072"Velocity Shell Side Outlet Nozzle"
1073        Unity(i).Shell.PressureDrop.Vnozzle_out = Unity(i).Properties.Hot.Outlet.Fw/(Unity(i).Properties.Hot.Outlet.rho*Aonozzle_Shell);
1074
1075"Pressure Drop Hot Stream"
1076        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P - Unity(i).Shell.PressureDrop.Pdtotal;   
1077       
1078"Pressure Drop Cold Stream"
1079        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Tubes.PressureDrop.Pdtotal;
1080
1081
1082        else
1083
1084"Tube Side Pressure Drop"
1085        Unity(i).Tubes.PressureDrop.PdTube              = HE.DeltaPtube(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Hot.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Tubes.HeatTransfer.Phi);
1086
1087"Pressure Drop Tube Side Inlet Nozzle"
1088        Unity(i).Tubes.PressureDrop.Pdnozzle_in = 0.5*Kinlet_Tube*Unity(i).Properties.Hot.Inlet.rho*Unity(i).Tubes.PressureDrop.Vnozzle_in^2;
1089       
1090"Velocity Tube Side Inlet Nozzle"
1091        Unity(i).Tubes.PressureDrop.Vnozzle_in  = Unity(i).Properties.Hot.Inlet.Fw/(Unity(i).Properties.Hot.Inlet.rho*Ainozzle_Tube);
1092       
1093"Pressure Drop Tube Side Outlet Nozzle"
1094        Unity(i).Tubes.PressureDrop.Pdnozzle_out        = 0.5*Koutlet_Tube*Unity(i).Properties.Hot.Outlet.rho*Unity(i).Tubes.PressureDrop.Vnozzle_out^2;
1095       
1096"Velocity Tube Side Outlet Nozzle"
1097        Unity(i).Tubes.PressureDrop.Vnozzle_out = Unity(i).Properties.Hot.Inlet.Fw/(Unity(i).Properties.Hot.Outlet.rho*Aonozzle_Tube); 
1098
1099"Shell Pressure Drop Inlet Nozzle"
1100        Unity(i).Shell.PressureDrop.Pdnozzle_in = (0.5*Unity(i).Properties.Cold.Inlet.Fw^2/Unity(i).Properties.Cold.Inlet.rho)*((1/Ainozzle_Shell^2)+(1/Aeinozzle_Shell^2));
1101
1102"Velocity Shell Side Inlet Nozzle"
1103        Unity(i).Shell.PressureDrop.Vnozzle_in  = Unity(i).Properties.Cold.Inlet.Fw/(Unity(i).Properties.Cold.Inlet.rho*Ainozzle_Shell);
1104
1105"Shell Pressure Drop Outlet Nozzle"
1106        Unity(i).Shell.PressureDrop.Pdnozzle_out = (0.5*Unity(i).Properties.Cold.Outlet.Fw^2/Unity(i).Properties.Cold.Outlet.rho)*((1/Ainozzle_Shell^2)+(1/Aeinozzle_Shell^2));
1107
1108"Velocity Shell Side Outlet Nozzle"
1109        Unity(i).Shell.PressureDrop.Vnozzle_out  = Unity(i).Properties.Cold.Outlet.Fw/(Unity(i).Properties.Cold.Outlet.rho*Ainozzle_Shell);
1110
1111"Pressure Drop Hot Stream"
1112        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P- Unity(i).Tubes.PressureDrop.Pdtotal;     
1113       
1114"Pressure Drop Cold Stream"
1115        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Shell.PressureDrop.Pdtotal;
1116
1117end
1118
1119#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
1120#               Phi correction
1121#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
1122
1123if side equal 1 then
1124       
1125"Shell Side Phi correction for viscosity"
1126        Unity(i).Shell.HeatTransfer.Phi = HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
1127       
1128"Tube Side Phi correction for viscosity"
1129        Unity(i).Tubes.HeatTransfer.Phi  = HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
1130       
1131        else
1132       
1133"Shell Side Phi correction for viscosity"
1134        Unity(i).Shell.HeatTransfer.Phi = HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
1135       
1136"Tube Side Phi correction for viscosity"
1137        Unity(i).Tubes.HeatTransfer.Phi  = HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Average.Mu);
1138
1139end
1140
1141
1142if side equal 1
1143       
1144        then
1145
1146"Shell Side inlet Nozzle rho-V^2"
1147        Unity(i).Shell.PressureDrop.RVsquare_in = Unity(i).Properties.Hot.Inlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_in)^2;
1148
1149"Shell Side Outlet Nozzle rho-V^2"
1150        Unity(i).Shell.PressureDrop.RVsquare_out = Unity(i).Properties.Hot.Outlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_out)^2;
1151       
1152        else
1153       
1154"Shell Side inlet Nozzle rho-V^2"
1155        Unity(i).Shell.PressureDrop.RVsquare_in = Unity(i).Properties.Cold.Inlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_in)^2;
1156
1157"Shell Side Outlet Nozzle rho-V^2"
1158        Unity(i).Shell.PressureDrop.RVsquare_out = Unity(i).Properties.Cold.Outlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_out)^2;
1159
1160end
1161
1162
1163if side equal 1
1164       
1165        then
1166       
1167"Hot Wall Temperature"
1168        Unity(i).Properties.Hot.Wall.Twall      = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
1169
1170"ColdWall Temperature"
1171        Unity(i).Properties.Cold.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
1172
1173"Tube Side Velocity"
1174        Unity(i).Tubes.HeatTransfer.Vtube       = Unity(i).Properties.Cold.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Cold.Average.rho*Ntt);
1175
1176"Tube Side Reynolds Number"
1177        Unity(i).Tubes.HeatTransfer.Re          = (Unity(i).Properties.Cold.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Cold.Average.Mu;
1178       
1179"Tube Side Prandtl Number"
1180        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;
1181
1182"Tube Side Prandtl Number at Wall Temperature"
1183        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;
1184
1185"Tube Side Film Coefficient"
1186        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;
1187
1188"Shell Side Prandtl Number"
1189        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;
1190
1191"Shell Side Prandtl Number at Wall Temperature"
1192        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;
1193
1194
1195        else
1196
1197"Hot Wall Temperature"
1198        Unity(i).Properties.Hot.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
1199
1200"Cold Wall Temperature"
1201        Unity(i).Properties.Cold.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
1202
1203"Tube Side Velocity"
1204        Unity(i).Tubes.HeatTransfer.Vtube       =       Unity(i).Properties.Hot.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Hot.Average.rho*Ntt);
1205
1206"Tube Side Reynolds Number"
1207        Unity(i).Tubes.HeatTransfer.Re          =       (Unity(i).Properties.Hot.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Hot.Average.Mu;
1208
1209"Tube Side Prandtl Number"
1210        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;
1211
1212"Tube Side Prandtl Number at Wall"
1213        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;
1214
1215"Tube Side Film Coefficient"
1216        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;
1217       
1218"Shell Side Prandtl Number"
1219        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;
1220
1221"Shell Side Prandtl Number at Wall"
1222        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;
1223
1224end
1225
1226"Tube Resistance"       
1227        Unity(i).Resistances.Rtube*(Unity(i).Tubes.HeatTransfer.htube*Ditube) = Dotube;
1228       
1229"Wall Resistance"
1230        Unity(i).Resistances.Rwall=Dotube*ln(Dotube/Ditube)/(2*Kwall);
1231       
1232"Shell Resistance"
1233        Unity(i).Resistances.Rshell*(Unity(i).Shell.HeatTransfer.hshell)=1;
1234       
1235"Overall Heat Transfer Coefficient Clean"
1236        Unity(i).Details.Uc=1/(Dotube/(Unity(i).Tubes.HeatTransfer.htube*Ditube)+(Dotube*ln(Dotube/Ditube)/(2*Kwall))+(1/(Unity(i).Shell.HeatTransfer.hshell)));
1237
1238"Overall Heat Transfer Coefficient Dirty"
1239        (1/Unity(i).Details.Ud)=(1/Unity(i).Details.Uc)+Unity(i).Resistances.Rfo+Unity(i).Resistances.Rfi*(Dotube/Ditube);
1240
1241"Exchange Surface Area"
1242        Unity(i).Details.A=Pi*Dotube*Ntt*Ltube;
1243
1244"Baffles Spacing"
1245        Ltube = Unity(i).Baffles.Lsi+Unity(i).Baffles.Lso+Unity(i).Baffles.Ls*(Nb-1);
1246
1247"TEMA E Shell Effectiveness"
1248        Eft(i) = 2*(1+Unity(i).Details.Cr+sqrt(1+Unity(i).Details.Cr^2)*((1+exp(-Unity(i).Details.NTU*sqrt(1+Unity(i).Details.Cr^2)))/(1-exp(-Unity(i).Details.NTU*sqrt(1+Unity(i).Details.Cr^2)))) )^-1;
1249
1250"Js Factor"     
1251        Unity(i).Shell.HeatTransfer.Js = HE.JsFactor(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Lsi,Unity(i).Baffles.Lso,Unity(i).Baffles.Ls);
1252
1253
1254if side equal 1
1255       
1256        then
1257       
1258"Shell Side Reynolds Number"
1259        Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Hot.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Hot.Average.Mu;
1260
1261"Shell Heat Transfer Coefficient"
1262        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;
1263
1264"Shell Pressure Drop Cross Flow"
1265        Unity(i).Shell.PressureDrop.PdCross             = HE.DeltaPcross(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);
1266
1267"Shell Pressure Baffle Window"
1268        Unity(i).Shell.PressureDrop.Pdwindow            = HE.DeltaPwindow(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);
1269
1270"Shell Pressure End Zones"
1271        Unity(i).Shell.PressureDrop.PdEndZones  = HE.DeltaPendZones(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);
1272
1273
1274        else
1275
1276"Shell Side Reynolds Number"
1277        Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Cold.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Cold.Average.Mu;
1278
1279"Shell Heat Transfer Coefficient"
1280        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;
1281
1282"Shell Pressure Drop Cross Flow"
1283        Unity(i).Shell.PressureDrop.PdCross      = HE.DeltaPcross(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);
1284
1285"Shell Pressure Baffle Window"
1286        Unity(i).Shell.PressureDrop.Pdwindow     = HE.DeltaPwindow(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);
1287
1288"Shell Pressure End Zones"
1289        Unity(i).Shell.PressureDrop.PdEndZones  = HE.DeltaPendZones(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);
1290
1291
1292end
1293
1294"Duty"
1295        Unity(i).Details.Q      = Eft(i)*Unity(i).Details.Cmin*(Unity(i).Inlet.Hot.T-Unity(i).Inlet.Cold.T);
1296
1297end
1298
1299end
1300
1301Model E_Shell_LMTD_Det          as Heatex_Detailed_LMTD
1302
1303ATTRIBUTES
1304        Pallete = true;
1305        Brief = "Shell and Tubes Heat Exchanger with 1 shell pass - LMTD Method";
1306        Info =
1307        "write some information";
1308
1309EQUATIONS
1310
1311"LMTD Correction Factor"
1312        Fc = HE.EshellCorrectionFactor(Inlet.Hot.T,Outlet.Hot.T,Inlet.Cold.T,Outlet.Cold.T);
1313
1314"Temperature Difference at Inlet"
1315        DT0 = Inlet.Hot.T - Outlet.Cold.T;
1316
1317"Temperature Difference at Outlet"
1318        DTL = Outlet.Hot.T - Inlet.Cold.T;
1319       
1320"Js Factor"     
1321        Shell.HeatTransfer.Js = HE.JsFactor(Shell.HeatTransfer.Re,Baffles.Lsi,Baffles.Lso,Baffles.Ls);
1322
1323if side equal 1
1324       
1325        then
1326       
1327"Shell Side Reynolds Number"
1328        Shell.HeatTransfer.Re=(Dotube*Properties.Hot.Inlet.Fw/Shell.HeatTransfer.Sm)/Properties.Hot.Average.Mu;
1329
1330"Shell Heat Transfer Coefficient"
1331        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;
1332
1333"Shell Pressure Drop Cross Flow"
1334        Shell.PressureDrop.PdCross              = HE.DeltaPcross(Shell.HeatTransfer.Re,Baffles.Ls,Baffles.Lso,Baffles.Lsi,Properties.Hot.Inlet.Fw,Shell.HeatTransfer.Phi,Properties.Hot.Average.rho);
1335
1336"Shell Pressure Baffle Window"
1337        Shell.PressureDrop.Pdwindow             = HE.DeltaPwindow(Properties.Hot.Inlet.Fw,Shell.HeatTransfer.Sm,Properties.Hot.Average.rho,Properties.Hot.Average.Mu,Baffles.Ls);
1338
1339"Shell Pressure End Zones"
1340        Shell.PressureDrop.PdEndZones  = HE.DeltaPendZones(Shell.HeatTransfer.Re,Baffles.Ls,Baffles.Lso,Baffles.Lsi,Properties.Hot.Inlet.Fw,Shell.HeatTransfer.Phi,Properties.Hot.Average.rho);
1341
1342
1343        else
1344
1345"Shell Side Reynolds Number"
1346        Shell.HeatTransfer.Re=(Dotube*Properties.Cold.Inlet.Fw/Shell.HeatTransfer.Sm)/Properties.Cold.Average.Mu;
1347
1348"Shell Heat Transfer Coefficient"
1349        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;
1350
1351"Shell Pressure Drop Cross Flow"
1352        Shell.PressureDrop.PdCross      = HE.DeltaPcross(Shell.HeatTransfer.Re,Baffles.Ls,Baffles.Lso,Baffles.Lsi,Properties.Cold.Inlet.Fw,Shell.HeatTransfer.Phi,Properties.Cold.Average.rho);
1353
1354"Shell Pressure Baffle Window"
1355        Shell.PressureDrop.Pdwindow     = HE.DeltaPwindow(Properties.Cold.Inlet.Fw,Shell.HeatTransfer.Sm,Properties.Cold.Average.rho,Properties.Cold.Average.Mu,Baffles.Ls);
1356
1357"Shell Pressure End Zones"
1358        Shell.PressureDrop.PdEndZones  = HE.DeltaPendZones(Shell.HeatTransfer.Re,Baffles.Ls,Baffles.Lso,Baffles.Lsi,Properties.Cold.Inlet.Fw,Shell.HeatTransfer.Phi,Properties.Cold.Average.rho);
1359
1360
1361end
1362
1363end
1364
1365Model F_Shell_LMTD_Det          as Heatex_Detailed_LMTD
1366
1367ATTRIBUTES
1368        Pallete = true;
1369        Brief = "Shell and Tubes Heat Exchanger with 2 shell pass - LMTD Method";
1370        Info =
1371        "write some information";
1372
1373EQUATIONS
1374
1375"LMTD Correction Factor"
1376        Fc = HE.FshellCorrectionFactor(Inlet.Hot.T,Outlet.Hot.T,Inlet.Cold.T,Outlet.Cold.T);
1377
1378"Temperature Difference at Inlet"
1379        DT0 = Inlet.Hot.T - Outlet.Cold.T;
1380
1381"Temperature Difference at Outlet"
1382        DTL = Outlet.Hot.T - Inlet.Cold.T;
1383       
1384"Js Factor"     
1385        Shell.HeatTransfer.Js = HE.JsFactor(Shell.HeatTransfer.Re,Baffles.Lsi,Baffles.Lso,Baffles.Ls);
1386
1387if side equal 1
1388       
1389        then
1390       
1391"Shell Side Reynolds Number"
1392        Shell.HeatTransfer.Re=(Dotube*Properties.Hot.Inlet.Fw/Shell.HeatTransfer.Sm)/Properties.Hot.Average.Mu;
1393
1394"Shell Heat Transfer Coefficient"
1395        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;
1396
1397"Shell Pressure Drop Cross Flow"
1398        Shell.PressureDrop.PdCross              = HE.DeltaPcross(Shell.HeatTransfer.Re,Baffles.Ls,Baffles.Lso,Baffles.Lsi,Properties.Hot.Inlet.Fw,Shell.HeatTransfer.Phi,Properties.Hot.Average.rho);
1399
1400"Shell Pressure Baffle Window"
1401        Shell.PressureDrop.Pdwindow             = HE.DeltaPwindow(Properties.Hot.Inlet.Fw,Shell.HeatTransfer.Sm,Properties.Hot.Average.rho,Properties.Hot.Average.Mu,Baffles.Ls);
1402
1403"Shell Pressure End Zones"
1404        Shell.PressureDrop.PdEndZones  = HE.DeltaPendZones(Shell.HeatTransfer.Re,Baffles.Ls,Baffles.Lso,Baffles.Lsi,Properties.Hot.Inlet.Fw,Shell.HeatTransfer.Phi,Properties.Hot.Average.rho);
1405
1406
1407        else
1408
1409"Shell Side Reynolds Number"
1410        Shell.HeatTransfer.Re=(Dotube*Properties.Cold.Inlet.Fw/Shell.HeatTransfer.Sm)/Properties.Cold.Average.Mu;
1411
1412"Shell Heat Transfer Coefficient"
1413        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;
1414
1415"Shell Pressure Drop Cross Flow"
1416        Shell.PressureDrop.PdCross      = HE.DeltaPcross(Shell.HeatTransfer.Re,Baffles.Ls,Baffles.Lso,Baffles.Lsi,Properties.Cold.Inlet.Fw,Shell.HeatTransfer.Phi,Properties.Cold.Average.rho);
1417
1418"Shell Pressure Baffle Window"
1419        Shell.PressureDrop.Pdwindow     = HE.DeltaPwindow(Properties.Cold.Inlet.Fw,Shell.HeatTransfer.Sm,Properties.Cold.Average.rho,Properties.Cold.Average.Mu,Baffles.Ls);
1420
1421"Shell Pressure End Zones"
1422        Shell.PressureDrop.PdEndZones  = HE.DeltaPendZones(Shell.HeatTransfer.Re,Baffles.Ls,Baffles.Lso,Baffles.Lsi,Properties.Cold.Inlet.Fw,Shell.HeatTransfer.Phi,Properties.Cold.Average.rho);
1423
1424
1425end
1426
1427end
1428
1429Model Multipass_LMTD_Det
1430       
1431ATTRIBUTES
1432        Pallete = true;
1433        Brief = "Shell and Tubes Heat Exchanger In Series with 1 shell pass - LMTD Method";
1434        Info =
1435        "write some information";
1436
1437PARAMETERS
1438
1439                Nshell  as Integer       (Brief="N Shell in Series",Default=2);
1440                HE              as Plugin        (Brief="STHE Calculations",File="heatex");
1441outer PP                as Plugin        (Brief="External Physical Properties");
1442                side        as Integer   (Brief="Fluid Alocation",Lower=0,Upper=1);
1443                Pi                      as constant (Brief="Pi Number",Default=3.14159265);
1444
1445#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
1446#       Shell Geometrical Parameters
1447#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
1448Tpass                                   as Integer              (Brief="Number of Tube Passes",Lower=1);
1449Nss                                     as Integer              (Brief="Number of Sealing Strips pairs",Lower=1);
1450Dishell                                 as length               (Brief="Inside Shell Diameter",Lower=10e-6);
1451Donozzle_Shell          as length               (Brief="Shell Outlet Nozzle Diameter",Lower=10e-6);
1452Dinozzle_Shell          as length               (Brief="Shell Inlet Nozzle Diameter",Lower=10e-6);
1453Hinozzle_Shell          as length               (Brief="Height Under Shell Inlet Nozzle",Lower=10e-6);
1454Honozzle_Shell          as length               (Brief="Height Under Shell Outlet Nozzle",Lower=10e-6);
1455Aonozzle_Shell          as area                 (Brief="Shell Outlet Nozzle Area",Lower=10e-6);
1456Ainozzle_Shell          as area                 (Brief="Shell Inlet Nozzle Area",Lower=10e-6);
1457Aeonozzle_Shell         as area                 (Brief="Shell Outlet Escape Area Under Nozzle",Lower=10e-6);
1458Aeinozzle_Shell         as area                 (Brief="Shell Inlet Escape Area Under Nozzle",Lower=10e-6);
1459Lcf                                     as length               (Brief="Bundle-to-Shell Clearance",Lower=10e-8);
1460#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
1461#       Tubes Geometrical Parameters
1462#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
1463Ntt                                     as Integer                      (Brief="Total Number of Tubes in Shell",Default=100,Lower=1);
1464Pattern                         as Integer                      (Brief="Tube Layout Characteristic Angle",Lower=30);
1465Ltube                                   as length                       (Brief="Effective Tube Length",Lower=0.1);
1466pitch                           as length                       (Brief="Tube Pitch",Lower=1e-8);
1467Kwall                                   as conductivity         (Brief="Tube Wall Material Thermal Conductivity");
1468Dotube                                  as length                       (Brief="Tube Outside Diameter",Lower=10e-6);
1469Ditube                                  as length                       (Brief="Tube Inside Diameter",Lower=10e-6);
1470Donozzle_Tube   as length                       (Brief="Tube Outlet Nozzle Diameter",Lower=10e-6);
1471Dinozzle_Tube   as length                       (Brief="Tube Inlett Nozzle Diameter",Lower=10e-6);
1472Aonozzle_Tube   as area                         (Brief="Tube Outlet Nozzle Area",Lower=10e-6);
1473Ainozzle_Tube   as area                         (Brief="Tube Inlet Nozzle Area",Lower=10e-6);
1474Kinlet_Tube             as positive                     (Brief="Tube Inlet Nozzle Pressure Loss Coeff",Default=1.1);
1475Koutlet_Tube    as positive                     (Brief="Tube Outlet Nozzle Pressure Loss Coeff",Default=0.7);
1476
1477#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
1478#       Baffles Geometrical Parameters
1479#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
1480Bc                      as Integer              (Brief="Baffle Cut",Default=25,Lower=25);
1481Nb              as Real                 (Brief="Number of Baffles",Lower=1);
1482Lcd                     as length               (Brief="Baffle-to-Shell Clearance",Lower=10e-8);
1483Ltd                     as length               (Brief="Tube-to-Bafflehole Clearance",Lower=10e-8);
1484#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
1485VARIABLES
1486
1487LMTD(Nshell)    as temp_delta                                                    (Brief="Logarithmic Mean Temperature Difference",Lower=5);
1488Fc(Nshell)              as positive                                                              (Brief="LMTD Correction Factor",Lower=0.5);
1489MTD(Nshell)     as temp_delta                                                    (Brief="Mean Temperature Difference",Lower=5);
1490Unity(Nshell)   as HeatExchangerDetailed_Basic  (Brief="Shell in Series");
1491
1492SET
1493#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
1494#  Set Parameters for heatex Calculation
1495#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
1496        Pi                                              = 3.14159265;
1497        HE.Tpass                                = Tpass;
1498        HE.Nss                                  = Nss;
1499        HE.Ntt                                  = Ntt;
1500        HE.Pattern                              = Pattern;
1501        HE.Bc                                   = Bc;
1502        HE.Donozzle_Shell       = Donozzle_Shell;
1503        HE.Dinozzle_Shell       = Dinozzle_Shell;
1504        HE.Honozzle_Shell       = Honozzle_Shell;
1505        HE.Hinozzle_Shell       = Hinozzle_Shell;
1506        HE.Donozzle_Tube        = Donozzle_Tube;
1507        HE.Dinozzle_Tube        = Dinozzle_Tube;
1508        HE.Nb                           = Nb;
1509        HE.Dishell                              = Dishell;             
1510        HE.Lcf                                  = Lcf; 
1511        HE.Ltube                                = Ltube;       
1512        HE.pitch                                = pitch;               
1513        HE.Dotube                       = Dotube;       
1514        HE.Ditube                               = Ditube;       
1515        HE.Lcd                                  = Lcd;
1516        HE.Ltd                                  = Ltd; 
1517        side                                            = HE.FluidAlocation();
1518       
1519#"Tube Side Inlet Nozzle Area"
1520        Ainozzle_Tube = (Pi*Dinozzle_Tube*Dinozzle_Tube)/4;
1521       
1522#"Tube Side Outlet Nozzle Area"
1523        Aonozzle_Tube = (Pi*Donozzle_Tube*Donozzle_Tube)/4;
1524       
1525#"Tube Inlet Nozzle Pressure Loss Coeff"
1526        Kinlet_Tube   = 1.1;
1527
1528#"Tube Outlet Nozzle Pressure Loss Coeff"
1529        Koutlet_Tube  = 0.7;
1530       
1531#"Shell Outlet Nozzle Area"
1532        Aonozzle_Shell  = (Pi*Donozzle_Shell*Donozzle_Shell)/4;
1533       
1534#"Shell Inlet Nozzle Area"
1535        Ainozzle_Shell  = (Pi*Dinozzle_Shell*Dinozzle_Shell)/4;
1536       
1537#"Shell Outlet Escape Area Under Nozzle"
1538        Aeonozzle_Shell = Pi*Donozzle_Shell*Honozzle_Shell + 0.6*Aonozzle_Shell*(1-Dotube/pitch);
1539       
1540#"Shell Inlet Escape Area Under Nozzle"
1541        Aeinozzle_Shell = Pi*Dinozzle_Shell*Hinozzle_Shell + 0.6*Ainozzle_Shell*(1-Dotube/pitch);
1542       
1543CONNECTIONS
1544
1545Unity([1:Nshell-1]).Outlet.Hot  to Unity([2:Nshell]).Inlet.Hot;
1546Unity([2:Nshell]).Outlet.Cold to Unity([1:Nshell-1]).Inlet.Cold;
1547
1548EQUATIONS
1549
1550for i in [1:Nshell]
1551       
1552"Shell Side Cross Flow Area"
1553        Unity(i).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(i).Baffles.Ls);
1554
1555"Ji Factor"
1556        Unity(i).Shell.HeatTransfer.Ji = HE.JiFactor(Unity(i).Shell.HeatTransfer.Re);
1557
1558"Jc Factor"
1559        Unity(i).Shell.HeatTransfer.Jc = HE.JcFactor();
1560       
1561"Jl Factor"
1562        Unity(i).Shell.HeatTransfer.Jl = HE.JlFactor(Unity(i).Shell.HeatTransfer.Sm);
1563
1564"Jb Factor"
1565        Unity(i).Shell.HeatTransfer.Jb = HE.JbFactor(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Shell.HeatTransfer.Sm);
1566
1567"Jr Factor"     
1568        Unity(i).Shell.HeatTransfer.Jr = HE.JrFactor(Unity(i).Shell.HeatTransfer.Re);
1569       
1570"Total J Factor"
1571        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;
1572
1573if side equal 1
1574       
1575        then
1576       
1577"Tube Side Pressure Drop"
1578        Unity(i).Tubes.PressureDrop.PdTube              = HE.DeltaPtube(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Cold.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Tubes.HeatTransfer.Phi);
1579
1580"Pressure Drop Tube Side Inlet Nozzle"
1581        Unity(i).Tubes.PressureDrop.Pdnozzle_in = 0.5*Kinlet_Tube*Unity(i).Properties.Cold.Inlet.rho*Unity(i).Tubes.PressureDrop.Vnozzle_in^2;
1582
1583"Velocity Tube Side Inlet Nozzle"
1584        Unity(i).Tubes.PressureDrop.Vnozzle_in  = Unity(i).Properties.Cold.Inlet.Fw/(Unity(i).Properties.Cold.Inlet.rho*Ainozzle_Tube);
1585
1586"Pressure Drop Tube Side Outlet Nozzle"
1587        Unity(i).Tubes.PressureDrop.Pdnozzle_out        = 0.5*Koutlet_Tube*Unity(i).Properties.Cold.Outlet.rho*Unity(i).Tubes.PressureDrop.Vnozzle_out^2;
1588
1589"Velocity Tube Side Outlet Nozzle"
1590        Unity(i).Tubes.PressureDrop.Vnozzle_out = Unity(i).Properties.Cold.Inlet.Fw/(Unity(i).Properties.Cold.Outlet.rho*Aonozzle_Tube);
1591
1592"Shell Pressure Drop Inlet Nozzle"
1593        Unity(i).Shell.PressureDrop.Pdnozzle_in = (0.5*Unity(i).Properties.Hot.Inlet.Fw^2/Unity(i).Properties.Hot.Inlet.rho)*((1/Ainozzle_Shell^2)+(1/Aeinozzle_Shell^2));
1594
1595"Velocity Shell Side Inlet Nozzle"
1596        Unity(i).Shell.PressureDrop.Vnozzle_in  = Unity(i).Properties.Hot.Inlet.Fw/(Unity(i).Properties.Hot.Inlet.rho*Ainozzle_Shell);
1597
1598"Shell Pressure Drop Outlet Nozzle"
1599        Unity(i).Shell.PressureDrop.Pdnozzle_out        = (0.5*Unity(i).Properties.Hot.Outlet.Fw^2/Unity(i).Properties.Hot.Outlet.rho)*((1/Ainozzle_Shell^2)+(1/Aeinozzle_Shell^2));
1600
1601"Velocity Shell Side Outlet Nozzle"
1602        Unity(i).Shell.PressureDrop.Vnozzle_out = Unity(i).Properties.Hot.Outlet.Fw/(Unity(i).Properties.Hot.Outlet.rho*Aonozzle_Shell);
1603
1604"Pressure Drop Hot Stream"
1605        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P - Unity(i).Shell.PressureDrop.Pdtotal;   
1606       
1607"Pressure Drop Cold Stream"
1608        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Tubes.PressureDrop.Pdtotal;
1609
1610
1611        else
1612
1613"Tube Side Pressure Drop"
1614        Unity(i).Tubes.PressureDrop.PdTube              = HE.DeltaPtube(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Hot.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Tubes.HeatTransfer.Phi);
1615
1616"Pressure Drop Tube Side Inlet Nozzle"
1617        Unity(i).Tubes.PressureDrop.Pdnozzle_in = 0.5*Kinlet_Tube*Unity(i).Properties.Hot.Inlet.rho*Unity(i).Tubes.PressureDrop.Vnozzle_in^2;
1618       
1619"Velocity Tube Side Inlet Nozzle"
1620        Unity(i).Tubes.PressureDrop.Vnozzle_in  = Unity(i).Properties.Hot.Inlet.Fw/(Unity(i).Properties.Hot.Inlet.rho*Ainozzle_Tube);
1621       
1622"Pressure Drop Tube Side Outlet Nozzle"
1623        Unity(i).Tubes.PressureDrop.Pdnozzle_out        = 0.5*Koutlet_Tube*Unity(i).Properties.Hot.Outlet.rho*Unity(i).Tubes.PressureDrop.Vnozzle_out^2;
1624       
1625"Velocity Tube Side Outlet Nozzle"
1626        Unity(i).Tubes.PressureDrop.Vnozzle_out = Unity(i).Properties.Hot.Inlet.Fw/(Unity(i).Properties.Hot.Outlet.rho*Aonozzle_Tube); 
1627
1628"Shell Pressure Drop Inlet Nozzle"
1629        Unity(i).Shell.PressureDrop.Pdnozzle_in = (0.5*Unity(i).Properties.Cold.Inlet.Fw^2/Unity(i).Properties.Cold.Inlet.rho)*((1/Ainozzle_Shell^2)+(1/Aeinozzle_Shell^2));
1630
1631"Velocity Shell Side Inlet Nozzle"
1632        Unity(i).Shell.PressureDrop.Vnozzle_in  = Unity(i).Properties.Cold.Inlet.Fw/(Unity(i).Properties.Cold.Inlet.rho*Ainozzle_Shell);
1633
1634"Shell Pressure Drop Outlet Nozzle"
1635        Unity(i).Shell.PressureDrop.Pdnozzle_out = (0.5*Unity(i).Properties.Cold.Outlet.Fw^2/Unity(i).Properties.Cold.Outlet.rho)*((1/Ainozzle_Shell^2)+(1/Aeinozzle_Shell^2));
1636
1637"Velocity Shell Side Outlet Nozzle"
1638        Unity(i).Shell.PressureDrop.Vnozzle_out  = Unity(i).Properties.Cold.Outlet.Fw/(Unity(i).Properties.Cold.Outlet.rho*Ainozzle_Shell);
1639
1640"Pressure Drop Hot Stream"
1641        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P- Unity(i).Tubes.PressureDrop.Pdtotal;     
1642       
1643"Pressure Drop Cold Stream"
1644        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Shell.PressureDrop.Pdtotal;
1645
1646end
1647
1648
1649if side equal 1 then
1650       
1651       
1652"Shell Side Phi correction for viscosity"
1653        Unity(i).Shell.HeatTransfer.Phi = HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
1654       
1655"Tube Side Phi correction for viscosity"
1656        Unity(i).Tubes.HeatTransfer.Phi  = HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
1657       
1658        else
1659       
1660       
1661"Shell Side Phi correction for viscosity"
1662        Unity(i).Shell.HeatTransfer.Phi = HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
1663       
1664"Tube Side Phi correction for viscosity"
1665        Unity(i).Tubes.HeatTransfer.Phi  = HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
1666
1667end
1668
1669
1670if side equal 1
1671       
1672        then
1673
1674"Shell Side inlet Nozzle rho-V^2"
1675        Unity(i).Shell.PressureDrop.RVsquare_in = Unity(i).Properties.Hot.Inlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_in)^2;
1676
1677"Shell Side Outlet Nozzle rho-V^2"
1678        Unity(i).Shell.PressureDrop.RVsquare_out = Unity(i).Properties.Hot.Outlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_out)^2;
1679       
1680        else
1681       
1682"Shell Side inlet Nozzle rho-V^2"
1683        Unity(i).Shell.PressureDrop.RVsquare_in = Unity(i).Properties.Cold.Inlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_in)^2;
1684
1685"Shell Side Outlet Nozzle rho-V^2"
1686        Unity(i).Shell.PressureDrop.RVsquare_out = Unity(i).Properties.Cold.Outlet.rho*(Unity(i).Shell.PressureDrop.Vnozzle_out)^2;
1687
1688end
1689
1690if side equal 1
1691       
1692        then
1693       
1694"Hot Wall Temperature"
1695        Unity(i).Properties.Hot.Wall.Twall      = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
1696
1697"ColdWall Temperature"
1698        Unity(i).Properties.Cold.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
1699
1700"Tube Side Velocity"
1701        Unity(i).Tubes.HeatTransfer.Vtube       = Unity(i).Properties.Cold.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Cold.Average.rho*Ntt);
1702
1703"Tube Side Reynolds Number"
1704        Unity(i).Tubes.HeatTransfer.Re          = (Unity(i).Properties.Cold.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Cold.Average.Mu;
1705       
1706"Tube Side Prandtl Number"
1707        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;
1708
1709"Tube Side Prandtl Number at Wall Temperature"
1710        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;
1711
1712"Tube Side Film Coefficient"
1713        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;
1714
1715"Shell Side Prandtl Number"
1716        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;
1717
1718"Shell Side Prandtl Number at Wall Temperature"
1719        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;
1720
1721
1722        else
1723
1724"Hot Wall Temperature"
1725        Unity(i).Properties.Hot.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
1726
1727"Cold Wall Temperature"
1728        Unity(i).Properties.Cold.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
1729
1730"Tube Side Velocity"
1731        Unity(i).Tubes.HeatTransfer.Vtube       =       Unity(i).Properties.Hot.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Hot.Average.rho*Ntt);
1732
1733"Tube Side Reynolds Number"
1734        Unity(i).Tubes.HeatTransfer.Re          =       (Unity(i).Properties.Hot.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Hot.Average.Mu;
1735
1736"Tube Side Prandtl Number"
1737        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;
1738
1739"Tube Side Prandtl Number at Wall"
1740        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;
1741
1742"Tube Side Film Coefficient"
1743        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;
1744       
1745"Shell Side Prandtl Number"
1746        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;
1747
1748"Shell Side Prandtl Number at Wall"
1749        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;
1750
1751end
1752
1753
1754"Tube Resistance"       
1755        Unity(i).Resistances.Rtube*(Unity(i).Tubes.HeatTransfer.htube*Ditube) = Dotube;
1756       
1757"Wall Resistance"
1758        Unity(i).Resistances.Rwall=Dotube*ln(Dotube/Ditube)/(2*Kwall);
1759       
1760"Shell Resistance"
1761        Unity(i).Resistances.Rshell*(Unity(i).Shell.HeatTransfer.hshell)=1;
1762       
1763"Overall Heat Transfer Coefficient Clean"
1764        Unity(i).Details.Uc*(Dotube/(Unity(i).Tubes.HeatTransfer.htube*Ditube)+(Dotube*ln(Dotube/Ditube)/(2*Kwall))+(1/(Unity(i).Shell.HeatTransfer.hshell)))=1;
1765
1766"Overall Heat Transfer Coefficient Dirty"
1767        (1/Unity(i).Details.Ud)=(1/Unity(i).Details.Uc)+Unity(i).Resistances.Rfo+Unity(i).Resistances.Rfi*(Dotube/Ditube);
1768
1769"Exchange Surface Area"
1770        Unity(i).Details.A=Pi*Dotube*Ntt*Ltube;
1771
1772"Baffles Spacing"
1773        Ltube = Unity(i).Baffles.Lsi+Unity(i).Baffles.Lso+Unity(i).Baffles.Ls*(Nb-1);
1774       
1775"LMTD Correction Factor"
1776        Fc(i) = HE.EshellCorrectionFactor(Unity(i).Inlet.Hot.T,Unity(i).Outlet.Hot.T,Unity(i).Inlet.Cold.T,Unity(i).Outlet.Cold.T);
1777
1778"Counter Flow LMTD"
1779        LMTD(i) = HE.CounterLMTD(Unity(i).Inlet.Hot.T,Unity(i).Outlet.Hot.T,Unity(i).Inlet.Cold.T,Unity(i).Outlet.Cold.T);
1780
1781"Js Factor"     
1782        Unity(i).Shell.HeatTransfer.Js = HE.JsFactor(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Lsi,Unity(i).Baffles.Lso,Unity(i).Baffles.Ls);
1783
1784if side equal 1
1785       
1786        then
1787       
1788"Shell Side Reynolds Number"
1789        Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Hot.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Hot.Average.Mu;
1790
1791"Shell Heat Transfer Coefficient"
1792        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;
1793
1794"Shell Pressure Drop Cross Flow"
1795        Unity(i).Shell.PressureDrop.PdCross             = HE.DeltaPcross(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);
1796
1797"Shell Pressure Baffle Window"
1798        Unity(i).Shell.PressureDrop.Pdwindow            = HE.DeltaPwindow(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);
1799
1800"Shell Pressure End Zones"
1801        Unity(i).Shell.PressureDrop.PdEndZones  = HE.DeltaPendZones(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);
1802
1803
1804        else
1805
1806"Shell Side Reynolds Number"
1807        Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Cold.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Cold.Average.Mu;
1808
1809"Shell Heat Transfer Coefficient"
1810        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;
1811
1812"Shell Pressure Drop Cross Flow"
1813        Unity(i).Shell.PressureDrop.PdCross      = HE.DeltaPcross(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);
1814
1815"Shell Pressure Baffle Window"
1816        Unity(i).Shell.PressureDrop.Pdwindow     = HE.DeltaPwindow(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);
1817
1818"Shell Pressure End Zones"
1819        Unity(i).Shell.PressureDrop.PdEndZones  = HE.DeltaPendZones(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);
1820
1821end
1822
1823"Exchange Surface Area"
1824        Unity(i).Details.Q   = Unity(i).Details.Ud*Pi*Dotube*Ntt*Ltube*Fc(i)*LMTD(i);
1825       
1826"Mean Temperature Difference"   
1827        MTD(i)   = Fc(i)*LMTD(i);
1828
1829end
1830
1831
1832end
1833
Note: See TracBrowser for help on using the repository browser.