source: mso/eml/heat_exchangers/HeatExchangerDetailed.mso @ 68

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

added double pipe heat exchanger model and updated eml/heat_exchangers

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