source: mso/eml/heat_exchangers/HeatExchangerDiscretized.mso @ 45

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

updated heat exchanger model

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 54.7 KB
Line 
1
2#--------------------------------------------------------------------
3# Author: Gerson Balbueno Bicca
4# $Id: HeatExchangerDiscretized.mso 45 2006-11-07 16:11:10Z bicca $
5#--------------------------------------------------------------------
6
7using "HEX_Engine";
8
9#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
10#       Basic Model for Discretized Heat Exchangers
11#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
12
13Model HeatExchangerDiscretized_Basic
14
15PARAMETERS
16
17ext PP      as CalcObject(Brief="External Physical Properties");
18        HE          as CalcObject(Brief="STHE Calculations",File="heatex");
19ext NComp   as Integer   (Brief="Number of Components");
20  M(NComp)  as molweight (Brief="Component Mol Weight");
21       
22VARIABLES
23
24in  Inlet           as Inlet_Main_Stream;       # Hot and Cold Inlets
25out Outlet      as Outlet_Main_Stream;  # Hot and Cold Outlets
26        Properties  as Main_Properties;         # Hot and Cold 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
35M   = PP.MolecularWeight();
36
37EQUATIONS
38
39"Hot Stream Average Temperature"
40        Properties.Hot.Average.T = 0.5*Inlet.Hot.T + 0.5*Outlet.Hot.T;
41       
42"Cold Stream Average Temperature"
43        Properties.Cold.Average.T = 0.5*Inlet.Cold.T + 0.5*Outlet.Cold.T;
44       
45"Hot Stream Average Pressure"
46        Properties.Hot.Average.P = 0.5*Inlet.Hot.P+0.5*Outlet.Hot.P;
47       
48"Cold Stream Average Pressure"
49        Properties.Cold.Average.P = 0.5*Inlet.Cold.P+0.5*Outlet.Cold.P;
50       
51"Hot Stream Average Molecular Weight"
52        Properties.Hot.Average.Mw = sum(M*Inlet.Hot.z);
53
54"Cold Stream Average Molecular Weight"
55        Properties.Cold.Average.Mw = sum(M*Inlet.Cold.z);
56       
57
58if Inlet.Cold.v equal 0
59       
60        then   
61       
62"Heat Capacity Cold Stream"
63        Properties.Cold.Average.Cp      =       PP.LiquidCp(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
64        Properties.Cold.Inlet.Cp        =       PP.LiquidCp(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
65        Properties.Cold.Outlet.Cp       =       PP.LiquidCp(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
66
67"Mass Density Cold Stream"
68        Properties.Cold.Average.rho =   PP.LiquidDensity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
69        Properties.Cold.Inlet.rho       =       PP.LiquidDensity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
70        Properties.Cold.Outlet.rho      =       PP.LiquidDensity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
71
72"Viscosity Cold Stream"
73        Properties.Cold.Average.Mu =    PP.LiquidViscosity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
74        Properties.Cold.Inlet.Mu =              PP.LiquidViscosity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
75        Properties.Cold.Outlet.Mu =     PP.LiquidViscosity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
76
77"Conductivity Cold Stream"
78        Properties.Cold.Average.K =     PP.LiquidThermalConductivity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
79        Properties.Cold.Inlet.K =               PP.LiquidThermalConductivity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
80        Properties.Cold.Outlet.K =              PP.LiquidThermalConductivity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
81
82"Heat Capacity Cold Stream"
83        Properties.Cold.Wall.Cp         =       PP.LiquidCp(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
84       
85"Viscosity Cold Stream"
86        Properties.Cold.Wall.Mu =       PP.LiquidViscosity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
87
88"Conductivity Cold Stream"
89        Properties.Cold.Wall.K =        PP.LiquidThermalConductivity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
90
91
92        else
93
94"Heat Capacity Cold Stream"
95        Properties.Cold.Average.Cp      =       PP.VapourCp(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
96        Properties.Cold.Inlet.Cp        =       PP.VapourCp(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
97        Properties.Cold.Outlet.Cp       =       PP.VapourCp(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
98
99"Mass Density Cold Stream"
100        Properties.Cold.Average.rho     =       PP.VapourDensity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
101        Properties.Cold.Inlet.rho       =       PP.VapourDensity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
102        Properties.Cold.Outlet.rho      =       PP.VapourDensity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
103
104"Viscosity Cold Stream"
105        Properties.Cold.Average.Mu =    PP.VapourViscosity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
106        Properties.Cold.Inlet.Mu =              PP.VapourViscosity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
107        Properties.Cold.Outlet.Mu =             PP.VapourViscosity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
108
109"Conductivity Cold Stream"
110        Properties.Cold.Average.K =     PP.VapourThermalConductivity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
111        Properties.Cold.Inlet.K =               PP.VapourThermalConductivity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
112        Properties.Cold.Outlet.K =              PP.VapourThermalConductivity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
113       
114"Heat Capacity Cold Stream"
115        Properties.Cold.Wall.Cp         =       PP.VapourCp(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
116
117
118"Viscosity Cold Stream"
119        Properties.Cold.Wall.Mu =       PP.VapourViscosity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
120
121"Conductivity Cold Stream"
122        Properties.Cold.Wall.K =        PP.VapourThermalConductivity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
123       
124       
125       
126end
127
128if Inlet.Hot.v equal 0
129
130        then
131
132"Heat Capacity Hot Stream"
133        Properties.Hot.Average.Cp       =               PP.LiquidCp(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);
134        Properties.Hot.Inlet.Cp         =               PP.LiquidCp(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);
135        Properties.Hot.Outlet.Cp        =               PP.LiquidCp(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);
136
137"Mass Density Hot Stream"
138        Properties.Hot.Average.rho      =               PP.LiquidDensity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);
139        Properties.Hot.Inlet.rho        =               PP.LiquidDensity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);
140        Properties.Hot.Outlet.rho       =               PP.LiquidDensity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);
141
142"Viscosity Hot Stream"
143        Properties.Hot.Average.Mu       =               PP.LiquidViscosity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);     
144        Properties.Hot.Inlet.Mu         =               PP.LiquidViscosity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);       
145        Properties.Hot.Outlet.Mu        =               PP.LiquidViscosity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);     
146
147"Conductivity Hot Stream"
148        Properties.Hot.Average.K        =               PP.LiquidThermalConductivity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);   
149        Properties.Hot.Inlet.K  =               PP.LiquidThermalConductivity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);     
150        Properties.Hot.Outlet.K         =               PP.LiquidThermalConductivity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);   
151
152"Heat Capacity Hot Stream"
153        Properties.Hot.Wall.Cp  =               PP.LiquidCp(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
154
155"Viscosity Hot Stream"
156        Properties.Hot.Wall.Mu  =               PP.LiquidViscosity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);     
157
158"Conductivity Hot Stream"
159        Properties.Hot.Wall.K   =               PP.LiquidThermalConductivity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);   
160       
161
162        else
163
164"Heat Capacity Hot Stream"
165        Properties.Hot.Average.Cp       =               PP.VapourCp(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);
166        Properties.Hot.Inlet.Cp         =               PP.VapourCp(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);
167        Properties.Hot.Outlet.Cp        =               PP.VapourCp(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);
168
169"Mass Density Hot Stream"
170        Properties.Hot.Average.rho      =               PP.VapourDensity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);
171        Properties.Hot.Inlet.rho        =               PP.VapourDensity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);
172        Properties.Hot.Outlet.rho       =               PP.VapourDensity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);
173
174"Viscosity Hot Stream"
175        Properties.Hot.Average.Mu       =               PP.VapourViscosity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);
176        Properties.Hot.Inlet.Mu         =               PP.VapourViscosity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);
177        Properties.Hot.Outlet.Mu        =               PP.VapourViscosity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);
178
179"Conductivity Hot Stream"
180        Properties.Hot.Average.K        =               PP.VapourThermalConductivity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);   
181        Properties.Hot.Inlet.K  =               PP.VapourThermalConductivity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);     
182        Properties.Hot.Outlet.K         =               PP.VapourThermalConductivity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);   
183
184"Heat Capacity Hot Stream"
185        Properties.Hot.Wall.Cp  =               PP.VapourCp(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
186
187"Viscosity Hot Stream"
188        Properties.Hot.Wall.Mu  =               PP.VapourViscosity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
189
190"Conductivity Hot Stream"
191        Properties.Hot.Wall.K   =               PP.VapourThermalConductivity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);   
192
193
194end
195
196#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
197#       Thermal Details
198#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
199"Hot Stream Heat Capacity"
200        Details.Ch =Inlet.Hot.F*Properties.Hot.Average.Cp;
201       
202"Cold Stream Heat Capacity"
203        Details.Cc =Inlet.Cold.F*Properties.Cold.Average.Cp;
204       
205"Minimum Heat Capacity"
206        Details.Cmin  = min([Details.Ch,Details.Cc]);
207
208"Maximum Heat Capacity"
209        Details.Cmax  = max([Details.Ch,Details.Cc]);
210
211"Heat Capacity Ratio"
212        Details.Cr    = Details.Cmin/Details.Cmax;
213       
214#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
215#       Energy Balance
216#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
217"Energy Balance Hot Stream"
218        Details.Q = Inlet.Hot.F*(Inlet.Hot.h-Outlet.Hot.h);
219
220"Energy Balance Cold Stream"
221        Details.Q =-Inlet.Cold.F*(Inlet.Cold.h-Outlet.Cold.h);
222
223#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
224#       Material Balance
225#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
226"Flow Mass Inlet Cold Stream"
227        Properties.Cold.Inlet.Fw        =  sum(M*Inlet.Cold.z)*Inlet.Cold.F;
228
229"Flow Mass Outlet Cold Stream"
230        Properties.Cold.Outlet.Fw       =  sum(M*Outlet.Cold.z)*Outlet.Cold.F;
231
232"Flow Mass Inlet Hot Stream"
233        Properties.Hot.Inlet.Fw         =  sum(M*Inlet.Hot.z)*Inlet.Hot.F;
234
235"Flow Mass Outlet Hot Stream"   
236        Properties.Hot.Outlet.Fw        =  sum(M*Outlet.Hot.z)*Outlet.Hot.F;
237
238"Molar Balance Hot Stream"
239        Inlet.Hot.F  = Outlet.Hot.F;
240       
241"Molar Balance Cold Stream"
242        Inlet.Cold.F = Outlet.Cold.F;
243
244#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
245#       Constraints
246#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
247"Hot Stream Molar Fraction Constraint"
248        Outlet.Hot.z=Inlet.Hot.z;
249       
250"Cold Stream Molar Fraction Constraint"
251        Outlet.Cold.z=Inlet.Cold.z;
252       
253"No Phase Change In Cold Stream"
254        Inlet.Cold.v=Outlet.Cold.v;
255
256"No Phase Change In Hot Stream"
257        Inlet.Hot.v=Outlet.Hot.v;
258
259       
260end
261
262Model Heatex_Discretized_NTU            as HeatExchangerDiscretized_Basic
263       
264VARIABLES
265
266Eft             as positive (Brief="Effectiveness",Default=0.05,Lower=1e-8);
267       
268EQUATIONS
269
270"Exchange Surface Area"
271        Details.Q       = Eft*Details.Cmin*(Inlet.Hot.T-Inlet.Cold.T); 
272
273"TEMA E Shell Effectiveness"
274        Eft = HE.EshellEffectiveness(Details.Cr,Details.NTU);
275       
276end
277
278Model Heatex_Discretized_LMTD           as HeatExchangerDiscretized_Basic
279       
280VARIABLES
281DT0     as temp_delta   (Brief="Temperature Difference at Inlet",Lower=1);
282DTL             as temp_delta   (Brief="Temperature Difference at Outlet",Lower=1);
283LMTD    as temp_delta   (Brief="Logarithmic Mean Temperature Difference",Lower=5);
284Fc              as positive             (Brief="LMTD Correction Factor",Lower=0.5);
285MTD             as temp_delta   (Brief="Mean Temperature Difference",Lower=1);
286
287EQUATIONS
288"Exchange Surface Area"
289        Details.Q   = Details.U*Details.A*MTD;
290       
291"Mean Temperature Difference"   
292        MTD   = Fc*LMTD;
293       
294#"LMTD Correction Factor"
295#       Fc = HE.EshellCorrectionFactor(Inlet.Hot.T,Outlet.Hot.T,Inlet.Cold.T,Outlet.Cold.T);
296
297"Temperature Difference at Inlet"
298        DT0 = Inlet.Hot.T - Outlet.Cold.T;
299
300"Temperature Difference at Outlet"
301        DTL = Outlet.Hot.T - Inlet.Cold.T;
302#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
303#                       Log Mean Temperature Difference
304#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
305if abs(DT0 - DTL) > 0.05*max(abs([DT0,DTL]))
306       
307        then
308"Log Mean Temperature Difference"
309        LMTD= (DT0-DTL)/ln(DT0/DTL);
310
311        else
312       
313if DT0*DTL equal 0
314       
315        then
316"Log Mean Temperature Difference"
317        LMTD = 0.5*(DT0+DTL);
318       
319        else
320"Log Mean Temperature Difference"
321        LMTD = 0.5*(DT0+DTL)*(1-(DT0-DTL)^2/(DT0*DTL)*(1+(DT0-DTL)^2/(DT0*DTL)/2)/12);
322       
323end
324       
325end
326
327       
328end
329
330Model Profiles
331
332PARAMETERS
333
334Zones   as Integer(Brief="Number of Zones");
335
336VARIABLES
337
338Lz(Zones)               as length                       (Brief="Zone Tube Length");
339Area                            as area                         (Brief="Area Total");
340Q                               as power                        (Brief="Total Duty");
341PdropTubesNozzle        as pressure                     (Brief="Total Tube Nozzles Pressure Drop");
342PdropTubes                      as pressure                     (Brief="Total Tube Pressure Drop");
343PdropWin                        as pressure                     (Brief="Total Shell Side Window Pressure Drop");
344PdropCross                      as pressure                     (Brief="Total Shell Side Cross Flow Pressure Drop");
345PdropEnds                       as pressure                     (Brief="Total Shell Side Ends Pressure Drop");
346PdropShellNozzle        as pressure                     (Brief="Total Shell Side Nozzles Pressure Drop");
347PdropShell                      as pressure                     (Brief="Total Shell Side Pressure Drop");
348Uaverage                        as heat_trans_coeff (Brief="Average Overall Heat Transfer Coefficient",Default=1,Lower=1e-6,Upper=1e10);
349hshellaverage           as heat_trans_coeff     (Brief="Average Shell Side Film Coefficient",Default=1,Lower=1e-12, Upper=1e6);
350htubeaverage            as heat_trans_coeff     (Brief="Average Tube Side Film Coefficient",Default=1,Lower=1e-12, Upper=1e6);
351Thot(Zones)             as temperature          (Brief="Hot Temperature",Lower = 300, Upper = 500);
352Tcold(Zones)            as temperature          (Brief="Cold Temperature",Lower = 300, Upper = 500);
353Phot(Zones)             as pressure                     (Brief="Hot Pressure",Lower = 0.8, Upper = 30);
354Pcold(Zones)            as pressure                     (Brief="Cold Pressure",Lower = 0.8, Upper = 30);
355
356end
357
358Model E_Shell_NTU_Disc           
359#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
360#       Shell and Tubes Heat Exchanger with 1 shell pass - NTU Method
361#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
362PARAMETERS
363
364        HE      as CalcObject   (Brief="STHE Calculations",File="heatex");
365ext PP  as CalcObject   (Brief="External Physical Properties");
366side    as Integer              (Brief="Fluid Alocation",Lower=0,Upper=1);
367Pi              as constant     (Brief="Pi Number",Default=3.14159265);
368
369#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
370#       Shell Geometrical Parameters
371#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
372Tpass                   as Integer              (Brief="Number of Tube Passes",Lower=1);
373Nss                             as Integer              (Brief="Number of Sealing Strips pairs",Lower=1);
374Dishell                 as length               (Brief="Inside Shell Diameter",Lower=10e-6);
375Donozzle_Shell  as length               (Brief="Shell Outlet Nozzle Diameter",Lower=10e-6);
376Dinozzle_Shell  as length               (Brief="Shell Inlet Nozzle Diameter",Lower=10e-6);
377Hinozzle_Shell  as length               (Brief="Height Under Shell Inlet Nozzle",Lower=10e-6);
378Honozzle_Shell  as length               (Brief="Height Under Shell Outlet Nozzle",Lower=10e-6);
379Lcf                     as length               (Brief="Bundle-to-Shell Clearance",Lower=10e-8);
380#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
381#       Tubes Geometrical Parameters
382#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
383Ntt                             as Integer              (Brief="Total Number of Tubes in Shell",Default=100,Lower=1);
384Pattern         as Integer              (Brief="Tube Layout Characteristic Angle",Lower=30);
385Ltube                   as length               (Brief="Effective Tube Length",Lower=0.1);
386pitch                   as length               (Brief="Tube Pitch",Lower=1e-8);
387Kwall                   as conductivity (Brief="Tube Wall Material Thermal Conductivity");
388Dotube                  as length               (Brief="Tube Outside Diameter",Lower=10e-6);
389Ditube                  as length               (Brief="Tube Inside Diameter",Lower=10e-6);
390Donozzle_Tube   as length               (Brief="Tube Outlet Nozzle Diameter",Lower=10e-6);
391Dinozzle_Tube   as length               (Brief="Tube Inlett Nozzle Diameter",Lower=10e-6);
392#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
393#       Baffles Geometrical Parameters
394#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
395Bc                      as Integer              (Brief="Baffle Cut",Default=25,Lower=25);
396Nb              as Integer              (Brief="Number of Baffles",Default=4);
397Lcd                     as length               (Brief="Baffle-to-Shell Clearance",Lower=10e-8);
398Ltd                             as length               (Brief="Tube-to-Bafflehole Clearance",Lower=10e-8);
399#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
400VARIABLES
401
402Unity(Nb+1)     as Heatex_Discretized_NTU;
403Sumary          as Profiles;
404
405CONNECTIONS
406
407Unity([1:Nb]).Outlet.Hot  to Unity([2:Nb+1]).Inlet.Hot;
408Unity([2:Nb+1]).Outlet.Cold to Unity([1:Nb]).Inlet.Cold;
409
410EQUATIONS
411
412"Hot Temperatures"
413        Sumary.Thot     = Unity.Outlet.Hot.T;
414       
415"Cold Temperatures"
416        Sumary.Tcold    = Unity.Outlet.Cold.T ;
417
418"Hot Pressures"
419        Sumary.Phot     = Unity.Outlet.Hot.P ;
420       
421"Cold Pressures"
422        Sumary.Pcold    = Unity.Outlet.Cold.P ;
423
424"Average Shell Side Film Coefficient"
425        Sumary.hshellaverage            = sum(Unity.Shell.HeatTransfer.hshell)/Sumary.Zones;
426
427"Average Tube Side Film Coefficient"
428        Sumary.htubeaverage             = sum(Unity.Tubes.HeatTransfer.htube)/Sumary.Zones;
429
430"Average Overall Heat Transfer Coefficient"
431        Sumary.Uaverage                 = sum(Unity.Details.U)/Sumary.Zones;
432
433"Area Total"
434        Sumary.Area                             = sum(Unity.Details.A);
435
436"Duty Total"
437        Sumary.Q                                = sum(Unity.Details.Q);
438
439"Length Inlet zone"
440        Sumary.Lz(1)                            = Unity(1).Baffles.Lsi;
441
442"Length Outlet zone"
443        Sumary.Lz(Nb+1)                         = Unity(1).Baffles.Lso;
444
445"Total Shell Side Pressure Drop"
446        Sumary.PdropShell                       = sum(Unity.Shell.PressureDrop.Pdtotal);
447
448"Total Tube Side Pressure Drop"
449        Sumary.PdropTubes                       = sum(Unity.Tubes.PressureDrop.Pdtotal);
450
451"Total Tube Side Nozzles Pressure Drop"
452        Sumary.PdropTubesNozzle         = sum(Unity.Tubes.PressureDrop.Pdnozzle_in + Unity.Tubes.PressureDrop.Pdnozzle_out);
453
454"Total Shell Side Nozzles Pressure Drop"
455        Sumary.PdropShellNozzle         = sum(Unity.Shell.PressureDrop.Pdnozzle_in + Unity.Shell.PressureDrop.Pdnozzle_out);
456
457"Total Shell Side Window Pressure Drop"
458        Sumary.PdropWin                         = sum(Unity.Shell.PressureDrop.Pdwindow);
459
460"Total Shell Side Cross Flow Pressure Drop"
461        Sumary.PdropCross                       = sum(Unity.Shell.PressureDrop.PdCross);
462
463"Total Shell Side Ends Pressure Drop"
464        Sumary.PdropEnds                        = sum(Unity.Shell.PressureDrop.PdEndZones);
465
466"Shell Side Cross Flow Area"
467        Unity(1).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(1).Baffles.Lsi);
468       
469"Shell Side Cross Flow Area"
470        Unity(Nb+1).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(Nb+1).Baffles.Lso);
471
472
473if side equal 1
474       
475        then
476       
477"Shell Side inlet Nozzle rho-V^2"
478        Unity(1).Shell.PressureDrop.RVsquare_in = Unity(1).Properties.Hot.Inlet.rho*(Unity(1).Shell.PressureDrop.Vnozzle_in)^2;
479
480"Shell Side Outlet Nozzle rho-V^2"
481        Unity(Nb+1).Shell.PressureDrop.RVsquare_out = Unity(Nb+1).Properties.Hot.Outlet.rho*(Unity(Nb+1).Shell.PressureDrop.Vnozzle_out)^2;
482
483"Shell Pressure End Zones"
484        Unity(1).Shell.PressureDrop.PdEndZones          =       HE.DeltaPendZonesIncremental(Unity(1).Shell.HeatTransfer.Re,Unity(1).Baffles.Ls,Unity(1).Baffles.Lso,
485        Unity(1).Baffles.Lsi,Unity(1).Properties.Hot.Inlet.Fw,Unity(1).Shell.HeatTransfer.Phi,Unity(1).Properties.Hot.Average.rho);
486
487"Shell Pressure End Zones"
488        Unity(Nb+1).Shell.PressureDrop.PdEndZones       =       HE.DeltaPendZonesIncremental(Unity(Nb+1).Shell.HeatTransfer.Re,Unity(Nb+1).Baffles.Ls,Unity(Nb+1).Baffles.Lso,
489        Unity(Nb+1).Baffles.Lsi,Unity(Nb+1).Properties.Hot.Inlet.Fw,Unity(Nb+1).Shell.HeatTransfer.Phi,Unity(Nb+1).Properties.Hot.Average.rho);
490
491"Pressure Drop Tube Side Inlet Nozzle"
492        Unity(1).Tubes.PressureDrop.Pdnozzle_in = HE.DeltaPtubeNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
493
494"Velocity Tube Side Inlet Nozzle"
495        Unity(1).Tubes.PressureDrop.Vnozzle_in  = HE.TubeVelocityNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
496
497"Pressure Drop Tube Side Outlet Nozzle"
498        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_out     = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
499
500"Velocity Tube Side Outlet Nozzle"
501        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_out      = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
502
503"Shell Pressure Drop Inlet Nozzle"
504        Unity(1).Shell.PressureDrop.Pdnozzle_in = HE.DeltaPshellNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
505
506"Velocity Shell Side Inlet Nozzle"
507        Unity(1).Shell.PressureDrop.Vnozzle_in  = HE.ShellVelocityNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
508
509"Shell Pressure Drop Outlet Nozzle"
510        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_out     =HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
511
512"Velocity Shell Side Outlet Nozzle"
513        Unity(Nb+1).Shell.PressureDrop.Vnozzle_out      =HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
514       
515
516        else
517       
518"Shell Side inlet Nozzle rho-V^2"
519        Unity(1).Shell.PressureDrop.RVsquare_in = Unity(1).Properties.Cold.Inlet.rho*(Unity(1).Shell.PressureDrop.Vnozzle_in)^2;
520
521"Shell Side Outlet Nozzle rho-V^2"
522        Unity(Nb+1).Shell.PressureDrop.RVsquare_out = Unity(Nb+1).Properties.Cold.Outlet.rho*(Unity(Nb+1).Shell.PressureDrop.Vnozzle_out)^2;
523
524"Shell Pressure End Zones"
525        Unity(1).Shell.PressureDrop.PdEndZones          =       HE.DeltaPendZonesIncremental(Unity(1).Shell.HeatTransfer.Re,Unity(1).Baffles.Ls,Unity(1).Baffles.Lso,
526        Unity(1).Baffles.Lsi,Unity(1).Properties.Cold.Inlet.Fw,Unity(1).Shell.HeatTransfer.Phi,Unity(1).Properties.Cold.Average.rho);
527
528"Shell Pressure End Zones"
529        Unity(Nb+1).Shell.PressureDrop.PdEndZones       =       HE.DeltaPendZonesIncremental(Unity(Nb+1).Shell.HeatTransfer.Re,Unity(Nb+1).Baffles.Ls,Unity(Nb+1).Baffles.Lso,
530        Unity(Nb+1).Baffles.Lsi,Unity(Nb+1).Properties.Cold.Inlet.Fw,Unity(Nb+1).Shell.HeatTransfer.Phi,Unity(Nb+1).Properties.Cold.Average.rho);
531
532
533"Pressure Drop Tube Side Inlet Nozzle"
534        Unity(1).Tubes.PressureDrop.Pdnozzle_in = HE.DeltaPtubeNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
535
536"Velocity Tube Side Inlet Nozzle"
537        Unity(1).Tubes.PressureDrop.Vnozzle_in  = HE.TubeVelocityNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
538
539"Pressure Drop Tube Side Outlet Nozzle"
540        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_out     = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);   
541
542"Velocity Tube Side Outlet Nozzle"
543        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_out      = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw); 
544
545"Shell Pressure Drop Inlet Nozzle"
546        Unity(1).Shell.PressureDrop.Pdnozzle_in = HE.DeltaPshellNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
547
548"Velocity Shell Side Inlet Nozzle"
549        Unity(1).Shell.PressureDrop.Vnozzle_in  = HE.ShellVelocityNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
550
551"Shell Pressure Drop Outlet Nozzle"
552        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_out = HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
553
554"Velocity Shell Side Outlet Nozzle"
555        Unity(Nb+1).Shell.PressureDrop.Vnozzle_out  = HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
556
557
558end
559
560
561for i in [2:Nb]
562
563"Pressure Drop Tube Side Inlet Nozzle"
564        Unity(i).Tubes.PressureDrop.Pdnozzle_in = 0;
565
566"Velocity Tube Side Inlet Nozzle"
567        Unity(i).Tubes.PressureDrop.Vnozzle_in  = 0;
568
569"Pressure Drop Tube Side Outlet Nozzle"
570        Unity(i).Tubes.PressureDrop.Pdnozzle_out        = 0;   
571
572"Velocity Tube Side Outlet Nozzle"
573        Unity(i).Tubes.PressureDrop.Vnozzle_out = 0;   
574
575"Shell Pressure Drop Inlet Nozzle"
576        Unity(i).Shell.PressureDrop.Pdnozzle_in = 0;
577
578"Velocity Shell Side Inlet Nozzle"
579        Unity(i).Shell.PressureDrop.Vnozzle_in  = 0;
580
581"Shell Pressure Drop Outlet Nozzle"
582        Unity(i).Shell.PressureDrop.Pdnozzle_out = 0;
583
584"Velocity Shell Side Outlet Nozzle"
585        Unity(i).Shell.PressureDrop.Vnozzle_out  = 0;
586
587"Shell Pressure End Zones"
588        Unity(i).Shell.PressureDrop.PdEndZones          =       0;
589       
590"Shell Side Outlet Nozzle rho-V^2"
591        Unity(i).Shell.PressureDrop.RVsquare_out = 0;
592       
593"Shell Side inlet Nozzle rho-V^2"
594        Unity(i).Shell.PressureDrop.RVsquare_in = 0;
595
596if side equal 1
597       
598        then
599       
600"Shell Pressure Drop Cross Flow"
601        Unity(i).Shell.PressureDrop.PdCross             =       HE.DeltaPcrossIncremental(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Hot.Average.rho);
602
603
604        else
605
606"Shell Pressure Drop Cross Flow"
607        Unity(i).Shell.PressureDrop.PdCross     =       HE.DeltaPcrossIncremental(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Cold.Average.rho);
608
609
610end
611
612"Zone Length"
613        Sumary.Lz(i) = Unity(1).Baffles.Ls;
614
615"Shell Side Cross Flow Area"
616        Unity(i).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(i).Baffles.Ls);
617       
618end
619
620
621for i in [1:Nb+1]
622       
623if side equal 1
624       
625        then
626"Pressure Drop Hot Stream"
627        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P - Unity(i).Shell.PressureDrop.Pdtotal;   
628
629"Pressure Drop Cold Stream"
630        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Tubes.PressureDrop.Pdtotal;
631       
632"Shell Side Reynolds Number"
633        Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Hot.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Hot.Average.Mu;
634
635"Shell Heat Transfer Coefficient"
636        Unity(i).Shell.HeatTransfer.hshell =Unity(i).Shell.HeatTransfer.Ji*(Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*(Unity(i).Properties.Hot.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)*(Unity(i).Shell.HeatTransfer.PR^(-2/3))*Unity(i).Shell.HeatTransfer.Jtotal*Unity(i).Shell.HeatTransfer.Phi;
637
638
639"Shell Pressure Baffle Window"
640        Unity(i).Shell.PressureDrop.Pdwindow            =       HE.DeltaPwindowIncremental(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Hot.Average.rho,Unity(i).Properties.Hot.Average.Mu,Unity(i).Baffles.Ls);
641
642"Hot Wall Temperature"
643        Unity(i).Properties.Hot.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
644
645"Cold Wall Temperature"
646        Unity(i).Properties.Cold.Wall.Twall =   (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
647
648"Tube Side Velocity"
649        Unity(i).Tubes.HeatTransfer.Vtube  = Unity(i).Properties.Cold.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Cold.Average.rho*Ntt);
650
651"Tube Side Reynolds Number"
652        Unity(i).Tubes.HeatTransfer.Re          =       (Unity(i).Properties.Cold.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Cold.Average.Mu;
653       
654"Tube Side Prandtl Number"
655        Unity(i).Tubes.HeatTransfer.PR          = ((Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Average.Mu)/Unity(i).Properties.Cold.Average.K;
656
657"Tube Side Prandtl Number at Wall"
658        Unity(i).Tubes.HeatTransfer.PRw         =       ((Unity(i).Properties.Cold.Wall.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Wall.Mu)/Unity(i).Properties.Cold.Wall.K;
659
660"Tube Side Film Coefficient"
661        Unity(i).Tubes.HeatTransfer.htube       =       HE.TubeFilmCoeffIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Cold.Average.K,Sumary.Lz(i))*Unity(i).Tubes.HeatTransfer.Phi;
662       
663"Shell Side Prandtl Number"
664        Unity(i).Shell.HeatTransfer.PR          =       ((Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Average.Mu)/Unity(i).Properties.Hot.Average.K;
665
666"Shell Side Prandtl Number at Wall"
667        Unity(i).Shell.HeatTransfer.PRw         =       ((Unity(i).Properties.Hot.Wall.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Wall.Mu)/Unity(i).Properties.Hot.Wall.K; 
668
669"Tube Side Pressure Drop"
670        Unity(i).Tubes.PressureDrop.PdTube      =       HE.DeltaPtubeIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Cold.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,
671        Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lz(i));
672       
673"Shell Side Phi correction for viscosity"
674        Unity(i).Shell.HeatTransfer.Phi         =       HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
675       
676"Tube Side Phi correction for viscosity"
677        Unity(i).Tubes.HeatTransfer.Phi         =       HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
678       
679        else
680
681"Pressure Drop Hot Stream"
682        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P- Unity(i).Tubes.PressureDrop.Pdtotal;     
683       
684"Pressure Drop Cold Stream"
685        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Shell.PressureDrop.Pdtotal;
686       
687"Shell Side Reynolds Number"
688        Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Cold.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Cold.Average.Mu;
689
690"Shell Heat Transfer Coefficient"
691        Unity(i).Shell.HeatTransfer.hshell      =Unity(i).Shell.HeatTransfer.Ji*(Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*
692        (Unity(i).Properties.Cold.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)*(Unity(i).Shell.HeatTransfer.PR^(-2/3))*Unity(i).Shell.HeatTransfer.Jtotal*Unity(i).Shell.HeatTransfer.Phi;
693
694
695"Shell Pressure Baffle Window"
696        Unity(i).Shell.PressureDrop.Pdwindow    =       HE.DeltaPwindowIncremental(Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Cold.Average.rho,Unity(i).Properties.Cold.Average.Mu,Unity(i).Baffles.Ls);
697
698"Hot Wall Temperature"
699        Unity(i).Properties.Hot.Wall.Twall      =       (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
700
701"Cold Wall Temperature"
702        Unity(i).Properties.Cold.Wall.Twall     =       (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
703
704"Tube Side Velocity"
705        Unity(i).Tubes.HeatTransfer.Vtube               = Unity(i).Properties.Hot.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Hot.Average.rho*Ntt);
706
707"Tube Side Reynolds Number"
708        Unity(i).Tubes.HeatTransfer.Re                  =       (Unity(i).Properties.Hot.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Hot.Average.Mu;
709       
710"Tube Side Prandtl Number"
711        Unity(i).Tubes.HeatTransfer.PR                  =       ((Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Average.Mu)/Unity(i).Properties.Hot.Average.K;
712       
713"Tube Side Prandtl Number at Wall"
714        Unity(i).Tubes.HeatTransfer.PRw                 =       ((Unity(i).Properties.Hot.Wall.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Wall.Mu)/Unity(i).Properties.Hot.Wall.K;
715       
716"Tube Side Film Coefficient"
717        Unity(i).Tubes.HeatTransfer.htube               =       HE.TubeFilmCoeffIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Hot.Average.K,Sumary.Lz(i))*Unity(i).Tubes.HeatTransfer.Phi;
718       
719"Shell Side Prandtl Number"
720        Unity(i).Shell.HeatTransfer.PR                  =       ((Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Average.Mu)/Unity(i).Properties.Cold.Average.K;
721
722"Shell Side Prandtl Number at Wall"
723        Unity(i).Shell.HeatTransfer.PRw                 =       ((Unity(i).Properties.Cold.Wall.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Wall.Mu)/Unity(i).Properties.Cold.Wall.K;
724
725"Tube Side Pressure Drop"
726        Unity(i).Tubes.PressureDrop.PdTube              =       HE.DeltaPtubeIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Hot.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,
727        Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lz(i));
728
729"Shell Side Phi correction for viscosity"
730        Unity(i).Shell.HeatTransfer.Phi                 =       HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
731       
732"Tube Side Phi correction for viscosity"
733        Unity(i).Tubes.HeatTransfer.Phi                 =       HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
734
735end
736
737"Tube Resistance"       
738        Unity(i).Resistances.Rtube*(Unity(i).Tubes.HeatTransfer.htube*Ditube) = Dotube;
739       
740"Wall Resistance"
741        Unity(i).Resistances.Rwall      =       Dotube*ln(Dotube/Ditube)/(2*Kwall);
742       
743"Shell Resistance"
744        Unity(i).Resistances.Rshell*(Unity(i).Shell.HeatTransfer.hshell)        =       1;
745       
746"Overall Heat Transfer Coefficient"
747        Unity(i).Details.U      =       1/(Dotube/(Unity(i).Tubes.HeatTransfer.htube*Ditube)+(Dotube*ln(Dotube/Ditube)/(2*Kwall))+(1/(Unity(i).Shell.HeatTransfer.hshell)));
748
749"Exchange Surface Area"
750        Unity(i).Details.A      =       Pi*Dotube*Ntt*Sumary.Lz(i);
751
752"Baffles Spacing"
753        Ltube = Unity(i).Baffles.Lsi+Unity(i).Baffles.Lso+Unity(i).Baffles.Ls*(Nb-1);
754       
755
756"Js Factor"     
757        Unity(i).Shell.HeatTransfer.Js                  =       1;
758       
759"Ji Factor"
760        Unity(i).Shell.HeatTransfer.Ji                  =       HE.JiFactor(Unity(i).Shell.HeatTransfer.Re);
761
762"Jc Factor"
763        Unity(i).Shell.HeatTransfer.Jc                  =       HE.JcFactor();
764       
765"Jl Factor"
766        Unity(i).Shell.HeatTransfer.Jl                  =       HE.JlFactor(Unity(i).Shell.HeatTransfer.Sm);
767
768"Jb Factor"
769        Unity(i).Shell.HeatTransfer.Jb                  =       HE.JbFactor(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Shell.HeatTransfer.Sm);
770
771"Jr Factor"     
772        Unity(i).Shell.HeatTransfer.Jr                  =       HE.JrFactor(Unity(i).Shell.HeatTransfer.Re);
773       
774"Total J Factor"
775        Unity(i).Shell.HeatTransfer.Jtotal              =       Unity(i).Shell.HeatTransfer.Jc*Unity(i).Shell.HeatTransfer.Jl*Unity(i).Shell.HeatTransfer.Jb*Unity(i).Shell.HeatTransfer.Jr*Unity(i).Shell.HeatTransfer.Js;
776end
777
778
779"Velocity Tube Side Inlet Nozzle"
780        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_in       = 0;
781
782"Velocity Tube Side Outlet Nozzle"
783        Unity(1).Tubes.PressureDrop.Vnozzle_out = 0;
784       
785"Tube Pressure Drop Inlet Nozzle"
786        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_in      = 0;
787
788"Tube Pressure Drop Outlet Nozzle"
789        Unity(1).Tubes.PressureDrop.Pdnozzle_out        = 0;
790
791"Velocity Shell Side Inlet Nozzle"
792        Unity(Nb+1).Shell.PressureDrop.Vnozzle_in       = 0;
793
794"Velocity Shell Side Outlet Nozzle"
795        Unity(1).Shell.PressureDrop.Vnozzle_out = 0;
796       
797"Shell Pressure Drop Inlet Nozzle"
798        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_in      = 0;
799       
800"Shell Pressure Drop Outlet Nozzle"
801        Unity(1).Shell.PressureDrop.Pdnozzle_out        = 0;
802
803"Shell Cross Flow Pressure Drop"
804        Unity(1).Shell.PressureDrop.PdCross             = 0;
805       
806"Shell Cross Flow Pressure Drop"
807        Unity(Nb+1).Shell.PressureDrop.PdCross          = 0;
808       
809"Shell Side Outlet Nozzle rho-V^2"
810        Unity(1).Shell.PressureDrop.RVsquare_out = 0;
811       
812"Shell Side inlet Nozzle rho-V^2"
813        Unity(Nb+1).Shell.PressureDrop.RVsquare_in = 0;
814
815SET
816#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
817#  Set Parameters for heatex Calculation
818#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
819        Sumary.Zones        = Nb+1;
820        Pi                              = 3.14159265;
821        HE.Tpass                        = Tpass;
822        HE.Nss                          = Nss;
823        HE.Ntt                          = Ntt;
824        HE.Pattern                      = Pattern;
825        HE.Bc                           = Bc;
826        HE.Donozzle_Shell       = Donozzle_Shell;
827        HE.Dinozzle_Shell       = Dinozzle_Shell;
828        HE.Honozzle_Shell       = Honozzle_Shell;
829        HE.Hinozzle_Shell       = Hinozzle_Shell;
830        HE.Donozzle_Tube        = Donozzle_Tube;
831        HE.Dinozzle_Tube        = Dinozzle_Tube;
832        HE.Nb                       = Nb;
833        HE.Dishell                      = Dishell;             
834        HE.Lcf                          = Lcf; 
835        HE.pitch                        = pitch;               
836        HE.Dotube                       = Dotube;       
837        HE.Ditube                       = Ditube;       
838        HE.Lcd                          = Lcd;
839        HE.Ltd                          = Ltd;
840        side                            = HE.FluidAlocation();
841end
842
843Model E_Shell_LMTD_Disc         
844#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
845#       Shell and Tubes Heat Exchanger with 1 shell pass - LMTD Method
846#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
847PARAMETERS
848
849        HE      as CalcObject   (Brief="STHE Calculations",File="heatex");
850ext PP  as CalcObject   (Brief="External Physical Properties");
851side    as Integer              (Brief="Fluid Alocation",Lower=0,Upper=1);
852Pi              as constant     (Brief="Pi Number",Default=3.14159265);
853
854#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
855#       Shell Geometrical Parameters
856#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
857Tpass                   as Integer              (Brief="Number of Tube Passes",Lower=1);
858Nss                             as Integer              (Brief="Number of Sealing Strips pairs",Lower=1);
859Dishell                 as length               (Brief="Inside Shell Diameter",Lower=10e-6);
860Donozzle_Shell  as length               (Brief="Shell Outlet Nozzle Diameter",Lower=10e-6);
861Dinozzle_Shell  as length               (Brief="Shell Inlet Nozzle Diameter",Lower=10e-6);
862Hinozzle_Shell  as length               (Brief="Height Under Shell Inlet Nozzle",Lower=10e-6);
863Honozzle_Shell  as length               (Brief="Height Under Shell Outlet Nozzle",Lower=10e-6);
864Lcf                     as length               (Brief="Bundle-to-Shell Clearance",Lower=10e-8);
865#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
866#       Tubes Geometrical Parameters
867#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
868Ntt                             as Integer              (Brief="Total Number of Tubes in Shell",Default=100,Lower=1);
869Pattern         as Integer              (Brief="Tube Layout Characteristic Angle",Lower=30);
870Ltube                   as length               (Brief="Effective Tube Length",Lower=0.1);
871pitch                   as length               (Brief="Tube Pitch",Lower=1e-8);
872Kwall                   as conductivity (Brief="Tube Wall Material Thermal Conductivity");
873Dotube                  as length               (Brief="Tube Outside Diameter",Lower=10e-6);
874Ditube                  as length               (Brief="Tube Inside Diameter",Lower=10e-6);
875Donozzle_Tube   as length               (Brief="Tube Outlet Nozzle Diameter",Lower=10e-6);
876Dinozzle_Tube   as length               (Brief="Tube Inlett Nozzle Diameter",Lower=10e-6);
877#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
878#       Baffles Geometrical Parameters
879#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
880Bc                      as Integer              (Brief="Baffle Cut",Default=25,Lower=25);
881Nb              as Integer              (Brief="Number of Baffles",Default=4);
882Lcd                     as length               (Brief="Baffle-to-Shell Clearance",Lower=10e-8);
883Ltd                             as length               (Brief="Tube-to-Bafflehole Clearance",Lower=10e-8);
884#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
885VARIABLES
886
887Unity(Nb+1)     as Heatex_Discretized_LMTD;
888Sumary          as Profiles;
889
890CONNECTIONS
891
892Unity([1:Nb]).Outlet.Hot        to Unity([2:Nb+1]).Inlet.Hot;
893Unity([2:Nb+1]).Outlet.Cold to Unity([1:Nb]).Inlet.Cold;
894
895EQUATIONS
896
897"Hot Temperatures"
898        Sumary.Thot     = Unity.Outlet.Hot.T;
899       
900"Cold Temperatures"
901        Sumary.Tcold    = Unity.Outlet.Cold.T ;
902
903"Hot Pressures"
904        Sumary.Phot     = Unity.Outlet.Hot.P ;
905       
906"Cold Pressures"
907        Sumary.Pcold    = Unity.Outlet.Cold.P ;
908
909"Average Shell Side Film Coefficient"
910        Sumary.hshellaverage            = sum(Unity.Shell.HeatTransfer.hshell)/Sumary.Zones;
911
912"Average Tube Side Film Coefficient"
913        Sumary.htubeaverage             = sum(Unity.Tubes.HeatTransfer.htube)/Sumary.Zones;
914
915"Average Overall Heat Transfer Coefficient"
916        Sumary.Uaverage                 = sum(Unity.Details.U)/Sumary.Zones;
917
918"Area Total"
919        Sumary.Area                             = sum(Unity.Details.A);
920
921"Duty Total"
922        Sumary.Q                                = sum(Unity.Details.Q);
923
924"Length Inlet zone"
925        Sumary.Lz(1)                            = Unity(1).Baffles.Lsi;
926
927"Length Outlet zone"
928        Sumary.Lz(Nb+1)                         = Unity(1).Baffles.Lso;
929
930"Total Shell Side Pressure Drop"
931        Sumary.PdropShell                       = sum(Unity.Shell.PressureDrop.Pdtotal);
932
933"Total Tube Side Pressure Drop"
934        Sumary.PdropTubes                       = sum(Unity.Tubes.PressureDrop.Pdtotal);
935
936"Total Tube Side Nozzles Pressure Drop"
937        Sumary.PdropTubesNozzle         = sum(Unity.Tubes.PressureDrop.Pdnozzle_in + Unity.Tubes.PressureDrop.Pdnozzle_out);
938
939"Total Shell Side Nozzles Pressure Drop"
940        Sumary.PdropShellNozzle         = sum(Unity.Shell.PressureDrop.Pdnozzle_in + Unity.Shell.PressureDrop.Pdnozzle_out);
941
942"Total Shell Side Window Pressure Drop"
943        Sumary.PdropWin                         = sum(Unity.Shell.PressureDrop.Pdwindow);
944
945"Total Shell Side Cross Flow Pressure Drop"
946        Sumary.PdropCross                       = sum(Unity.Shell.PressureDrop.PdCross);
947
948"Total Shell Side Ends Pressure Drop"
949        Sumary.PdropEnds                        = sum(Unity.Shell.PressureDrop.PdEndZones);
950
951"Shell Side Cross Flow Area"
952        Unity(1).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(1).Baffles.Lsi);
953       
954"Shell Side Cross Flow Area"
955        Unity(Nb+1).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(Nb+1).Baffles.Lso);
956
957"LMTD Correction Factor"
958        Unity.Fc = HE.EshellCorrectionFactor(Unity(1).Inlet.Hot.T,Unity(Nb+1).Outlet.Hot.T,Unity(Nb+1).Inlet.Cold.T,Unity(1).Outlet.Cold.T);
959
960if side equal 1
961       
962        then
963
964"Shell Side inlet Nozzle rho-V^2"
965        Unity(1).Shell.PressureDrop.RVsquare_in = Unity(1).Properties.Hot.Inlet.rho*(Unity(1).Shell.PressureDrop.Vnozzle_in)^2;
966
967"Shell Side Outlet Nozzle rho-V^2"
968        Unity(Nb+1).Shell.PressureDrop.RVsquare_out = Unity(Nb+1).Properties.Hot.Outlet.rho*(Unity(Nb+1).Shell.PressureDrop.Vnozzle_out)^2;
969
970"Shell Pressure End Zones"
971        Unity(1).Shell.PressureDrop.PdEndZones          =       HE.DeltaPendZonesIncremental(Unity(1).Shell.HeatTransfer.Re,Unity(1).Baffles.Ls,Unity(1).Baffles.Lso,
972        Unity(1).Baffles.Lsi,Unity(1).Properties.Hot.Inlet.Fw,Unity(1).Shell.HeatTransfer.Phi,Unity(1).Properties.Hot.Average.rho);
973
974"Shell Pressure End Zones"
975        Unity(Nb+1).Shell.PressureDrop.PdEndZones       =       HE.DeltaPendZonesIncremental(Unity(Nb+1).Shell.HeatTransfer.Re,Unity(Nb+1).Baffles.Ls,Unity(Nb+1).Baffles.Lso,
976        Unity(Nb+1).Baffles.Lsi,Unity(Nb+1).Properties.Hot.Inlet.Fw,Unity(Nb+1).Shell.HeatTransfer.Phi,Unity(Nb+1).Properties.Hot.Average.rho);
977
978"Pressure Drop Tube Side Inlet Nozzle"
979        Unity(1).Tubes.PressureDrop.Pdnozzle_in = HE.DeltaPtubeNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
980
981"Velocity Tube Side Inlet Nozzle"
982        Unity(1).Tubes.PressureDrop.Vnozzle_in  = HE.TubeVelocityNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
983
984"Pressure Drop Tube Side Outlet Nozzle"
985        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_out     = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
986
987"Velocity Tube Side Outlet Nozzle"
988        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_out      = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
989
990"Shell Pressure Drop Inlet Nozzle"
991        Unity(1).Shell.PressureDrop.Pdnozzle_in = HE.DeltaPshellNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
992
993"Velocity Shell Side Inlet Nozzle"
994        Unity(1).Shell.PressureDrop.Vnozzle_in  = HE.ShellVelocityNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
995
996"Shell Pressure Drop Outlet Nozzle"
997        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_out     =HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
998
999"Velocity Shell Side Outlet Nozzle"
1000        Unity(Nb+1).Shell.PressureDrop.Vnozzle_out      =HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
1001       
1002
1003        else
1004
1005"Shell Side inlet Nozzle rho-V^2"
1006        Unity(1).Shell.PressureDrop.RVsquare_in = Unity(1).Properties.Cold.Inlet.rho*(Unity(1).Shell.PressureDrop.Vnozzle_in)^2;
1007
1008"Shell Side Outlet Nozzle rho-V^2"
1009        Unity(Nb+1).Shell.PressureDrop.RVsquare_out = Unity(Nb+1).Properties.Cold.Outlet.rho*(Unity(Nb+1).Shell.PressureDrop.Vnozzle_out)^2;
1010
1011"Shell Pressure End Zones"
1012        Unity(1).Shell.PressureDrop.PdEndZones          =       HE.DeltaPendZonesIncremental(Unity(1).Shell.HeatTransfer.Re,Unity(1).Baffles.Ls,Unity(1).Baffles.Lso,
1013        Unity(1).Baffles.Lsi,Unity(1).Properties.Cold.Inlet.Fw,Unity(1).Shell.HeatTransfer.Phi,Unity(1).Properties.Cold.Average.rho);
1014
1015"Shell Pressure End Zones"
1016        Unity(Nb+1).Shell.PressureDrop.PdEndZones       =       HE.DeltaPendZonesIncremental(Unity(Nb+1).Shell.HeatTransfer.Re,Unity(Nb+1).Baffles.Ls,Unity(Nb+1).Baffles.Lso,
1017        Unity(Nb+1).Baffles.Lsi,Unity(Nb+1).Properties.Cold.Inlet.Fw,Unity(Nb+1).Shell.HeatTransfer.Phi,Unity(Nb+1).Properties.Cold.Average.rho);
1018
1019
1020"Pressure Drop Tube Side Inlet Nozzle"
1021        Unity(1).Tubes.PressureDrop.Pdnozzle_in = HE.DeltaPtubeNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
1022
1023"Velocity Tube Side Inlet Nozzle"
1024        Unity(1).Tubes.PressureDrop.Vnozzle_in  = HE.TubeVelocityNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
1025
1026"Pressure Drop Tube Side Outlet Nozzle"
1027        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_out     = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);   
1028
1029"Velocity Tube Side Outlet Nozzle"
1030        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_out      = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw); 
1031
1032"Shell Pressure Drop Inlet Nozzle"
1033        Unity(1).Shell.PressureDrop.Pdnozzle_in = HE.DeltaPshellNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
1034
1035"Velocity Shell Side Inlet Nozzle"
1036        Unity(1).Shell.PressureDrop.Vnozzle_in  = HE.ShellVelocityNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
1037
1038"Shell Pressure Drop Outlet Nozzle"
1039        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_out = HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
1040
1041"Velocity Shell Side Outlet Nozzle"
1042        Unity(Nb+1).Shell.PressureDrop.Vnozzle_out  = HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
1043
1044
1045end
1046
1047
1048for i in [2:Nb]
1049
1050"Pressure Drop Tube Side Inlet Nozzle"
1051        Unity(i).Tubes.PressureDrop.Pdnozzle_in = 0;
1052
1053"Velocity Tube Side Inlet Nozzle"
1054        Unity(i).Tubes.PressureDrop.Vnozzle_in  = 0;
1055
1056"Pressure Drop Tube Side Outlet Nozzle"
1057        Unity(i).Tubes.PressureDrop.Pdnozzle_out        = 0;   
1058
1059"Velocity Tube Side Outlet Nozzle"
1060        Unity(i).Tubes.PressureDrop.Vnozzle_out = 0;   
1061
1062"Shell Pressure Drop Inlet Nozzle"
1063        Unity(i).Shell.PressureDrop.Pdnozzle_in = 0;
1064
1065"Velocity Shell Side Inlet Nozzle"
1066        Unity(i).Shell.PressureDrop.Vnozzle_in  = 0;
1067
1068"Shell Pressure Drop Outlet Nozzle"
1069        Unity(i).Shell.PressureDrop.Pdnozzle_out = 0;
1070
1071"Velocity Shell Side Outlet Nozzle"
1072        Unity(i).Shell.PressureDrop.Vnozzle_out  = 0;
1073
1074"Shell Pressure End Zones"
1075        Unity(i).Shell.PressureDrop.PdEndZones          =       0;
1076
1077"Shell Side Outlet Nozzle rho-V^2"
1078        Unity(i).Shell.PressureDrop.RVsquare_out = 0;
1079       
1080"Shell Side inlet Nozzle rho-V^2"
1081        Unity(i).Shell.PressureDrop.RVsquare_in = 0;
1082       
1083if side equal 1
1084       
1085        then
1086       
1087"Shell Pressure Drop Cross Flow"
1088        Unity(i).Shell.PressureDrop.PdCross             =       HE.DeltaPcrossIncremental(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Hot.Average.rho);
1089
1090
1091        else
1092
1093"Shell Pressure Drop Cross Flow"
1094        Unity(i).Shell.PressureDrop.PdCross     =       HE.DeltaPcrossIncremental(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Baffles.Lso,Unity(i).Baffles.Lsi,Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Phi,Unity(i).Properties.Cold.Average.rho);
1095
1096
1097end
1098
1099"Zone Length"
1100        Sumary.Lz(i) = Unity(1).Baffles.Ls;
1101
1102"Shell Side Cross Flow Area"
1103        Unity(i).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(i).Baffles.Ls);
1104       
1105end
1106
1107
1108for i in [1:Nb+1]
1109
1110
1111if side equal 1
1112       
1113        then
1114"Pressure Drop Hot Stream"
1115        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P - Unity(i).Shell.PressureDrop.Pdtotal;   
1116
1117"Pressure Drop Cold Stream"
1118        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Tubes.PressureDrop.Pdtotal;
1119       
1120"Shell Side Reynolds Number"
1121        Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Hot.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Hot.Average.Mu;
1122
1123"Shell Heat Transfer Coefficient"
1124        Unity(i).Shell.HeatTransfer.hshell =Unity(i).Shell.HeatTransfer.Ji*(Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*(Unity(i).Properties.Hot.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)*(Unity(i).Shell.HeatTransfer.PR^(-2/3))*Unity(i).Shell.HeatTransfer.Jtotal*Unity(i).Shell.HeatTransfer.Phi;
1125
1126"Shell Pressure Baffle Window"
1127        Unity(i).Shell.PressureDrop.Pdwindow            =       HE.DeltaPwindowIncremental(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Hot.Average.rho,Unity(i).Properties.Hot.Average.Mu,Unity(i).Baffles.Ls);
1128
1129"Hot Wall Temperature"
1130        Unity(i).Properties.Hot.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
1131       
1132"Cold Wall Temperature"
1133        Unity(i).Properties.Cold.Wall.Twall =   (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
1134
1135"Tube Side Velocity"
1136        Unity(i).Tubes.HeatTransfer.Vtube       =       Unity(i).Properties.Cold.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Cold.Average.rho*Ntt);
1137
1138"Tube Side Reynolds Number"
1139        Unity(i).Tubes.HeatTransfer.Re          =       (Unity(i).Properties.Cold.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Cold.Average.Mu;
1140       
1141"Tube Side Prandtl Number"
1142        Unity(i).Tubes.HeatTransfer.PR          =       ((Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Average.Mu)/Unity(i).Properties.Cold.Average.K;
1143
1144"Tube Side Prandtl Number at Wall"
1145        Unity(i).Tubes.HeatTransfer.PRw         =       ((Unity(i).Properties.Cold.Wall.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Wall.Mu)/Unity(i).Properties.Cold.Wall.K;
1146
1147"Tube Side Film Coefficient"
1148        Unity(i).Tubes.HeatTransfer.htube       =       HE.TubeFilmCoeffIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Cold.Average.K,Sumary.Lz(i))*Unity(i).Tubes.HeatTransfer.Phi;
1149       
1150"Shell Side Prandtl Number"
1151        Unity(i).Shell.HeatTransfer.PR          =       ((Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Average.Mu)/Unity(i).Properties.Hot.Average.K;
1152
1153"Shell Side Prandtl Number at Wall"
1154        Unity(i).Shell.HeatTransfer.PRw         =       ((Unity(i).Properties.Hot.Wall.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Wall.Mu)/Unity(i).Properties.Hot.Wall.K; 
1155
1156"Tube Side Pressure Drop"
1157        Unity(i).Tubes.PressureDrop.PdTube      =       HE.DeltaPtubeIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Cold.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,
1158        Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lz(i));
1159       
1160"Shell Side Phi correction for viscosity"
1161        Unity(i).Shell.HeatTransfer.Phi         =       HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
1162       
1163"Tube Side Phi correction for viscosity"
1164        Unity(i).Tubes.HeatTransfer.Phi         =       HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
1165       
1166        else
1167
1168"Pressure Drop Hot Stream"
1169        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P- Unity(i).Tubes.PressureDrop.Pdtotal;     
1170       
1171"Pressure Drop Cold Stream"
1172        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Shell.PressureDrop.Pdtotal;
1173       
1174"Shell Side Reynolds Number"
1175        Unity(i).Shell.HeatTransfer.Re=(Dotube*Unity(i).Properties.Cold.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)/Unity(i).Properties.Cold.Average.Mu;
1176
1177"Shell Heat Transfer Coefficient"
1178        Unity(i).Shell.HeatTransfer.hshell      =Unity(i).Shell.HeatTransfer.Ji*(Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*
1179        (Unity(i).Properties.Cold.Inlet.Fw/Unity(i).Shell.HeatTransfer.Sm)*(Unity(i).Shell.HeatTransfer.PR^(-2/3))*Unity(i).Shell.HeatTransfer.Jtotal*Unity(i).Shell.HeatTransfer.Phi;
1180
1181
1182"Shell Pressure Baffle Window"
1183        Unity(i).Shell.PressureDrop.Pdwindow    =       HE.DeltaPwindowIncremental(Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Cold.Average.rho,Unity(i).Properties.Cold.Average.Mu,Unity(i).Baffles.Ls);
1184
1185
1186"Hot Wall Temperature"
1187        Unity(i).Properties.Hot.Wall.Twall      =       (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
1188       
1189"Cold Wall Temperature"
1190        Unity(i).Properties.Cold.Wall.Twall     =       (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
1191
1192"Tube Side Velocity"
1193        Unity(i).Tubes.HeatTransfer.Vtube               = Unity(i).Properties.Hot.Inlet.Fw*Tpass/((Pi*Ditube*Ditube/4)*Unity(i).Properties.Hot.Average.rho*Ntt);
1194
1195"Tube Side Reynolds Number"
1196        Unity(i).Tubes.HeatTransfer.Re                  =       (Unity(i).Properties.Hot.Average.rho*Unity(i).Tubes.HeatTransfer.Vtube*Ditube)/Unity(i).Properties.Hot.Average.Mu;
1197       
1198"Tube Side Prandtl Number"
1199        Unity(i).Tubes.HeatTransfer.PR                  =((Unity(i).Properties.Hot.Average.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Average.Mu)/Unity(i).Properties.Hot.Average.K;
1200       
1201"Tube Side Prandtl Number at Wall"
1202        Unity(i).Tubes.HeatTransfer.PRw                 =       ((Unity(i).Properties.Hot.Wall.Cp/Unity(i).Properties.Hot.Average.Mw)*Unity(i).Properties.Hot.Wall.Mu)/Unity(i).Properties.Hot.Wall.K;
1203       
1204       
1205"Tube Side Film Coefficient"
1206        Unity(i).Tubes.HeatTransfer.htube               =       HE.TubeFilmCoeffIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Hot.Average.K,Sumary.Lz(i))*Unity(i).Tubes.HeatTransfer.Phi;
1207       
1208"Shell Side Prandtl Number"
1209        Unity(i).Shell.HeatTransfer.PR                  =       ((Unity(i).Properties.Cold.Average.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Average.Mu)/Unity(i).Properties.Cold.Average.K;
1210
1211"Shell Side Prandtl Number at Wall"
1212        Unity(i).Shell.HeatTransfer.PRw                 =       ((Unity(i).Properties.Cold.Wall.Cp/Unity(i).Properties.Cold.Average.Mw)*Unity(i).Properties.Cold.Wall.Mu)/Unity(i).Properties.Cold.Wall.K;
1213
1214"Tube Side Pressure Drop"
1215        Unity(i).Tubes.PressureDrop.PdTube              =       HE.DeltaPtubeIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Hot.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,
1216        Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lz(i));
1217
1218"Shell Side Phi correction for viscosity"
1219        Unity(i).Shell.HeatTransfer.Phi                 =       HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
1220       
1221"Tube Side Phi correction for viscosity"
1222        Unity(i).Tubes.HeatTransfer.Phi                 =       HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
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"
1236        Unity(i).Details.U      =       1/(Dotube/(Unity(i).Tubes.HeatTransfer.htube*Ditube)+(Dotube*ln(Dotube/Ditube)/(2*Kwall))+(1/(Unity(i).Shell.HeatTransfer.hshell)));
1237
1238"Exchange Surface Area"
1239        Unity(i).Details.A      =       Pi*Dotube*Ntt*Sumary.Lz(i);
1240
1241"Baffles Spacing"
1242        Ltube = Unity(i).Baffles.Lsi+Unity(i).Baffles.Lso+Unity(i).Baffles.Ls*(Nb-1);
1243
1244"Js Factor"     
1245        Unity(i).Shell.HeatTransfer.Js                  =       1;
1246
1247"Ji Factor"
1248        Unity(i).Shell.HeatTransfer.Ji                  =       HE.JiFactor(Unity(i).Shell.HeatTransfer.Re);
1249
1250"Jc Factor"
1251        Unity(i).Shell.HeatTransfer.Jc                  =       HE.JcFactor();
1252       
1253"Jl Factor"
1254        Unity(i).Shell.HeatTransfer.Jl                  =       HE.JlFactor(Unity(i).Shell.HeatTransfer.Sm);
1255
1256"Jb Factor"
1257        Unity(i).Shell.HeatTransfer.Jb                  =       HE.JbFactor(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Shell.HeatTransfer.Sm);
1258
1259"Jr Factor"     
1260        Unity(i).Shell.HeatTransfer.Jr                  =       HE.JrFactor(Unity(i).Shell.HeatTransfer.Re);
1261       
1262"Total J Factor"
1263        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;
1264end
1265
1266"Velocity Tube Side Inlet Nozzle"
1267        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_in       = 0;
1268
1269"Velocity Tube Side Outlet Nozzle"
1270        Unity(1).Tubes.PressureDrop.Vnozzle_out = 0;
1271       
1272"Tube Pressure Drop Inlet Nozzle"
1273        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_in      = 0;
1274
1275"Tube Pressure Drop Outlet Nozzle"
1276        Unity(1).Tubes.PressureDrop.Pdnozzle_out        = 0;
1277
1278"Velocity Shell Side Inlet Nozzle"
1279        Unity(Nb+1).Shell.PressureDrop.Vnozzle_in       = 0;
1280
1281"Velocity Shell Side Outlet Nozzle"
1282        Unity(1).Shell.PressureDrop.Vnozzle_out = 0;
1283       
1284"Shell Pressure Drop Inlet Nozzle"
1285        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_in      = 0;
1286       
1287"Shell Pressure Drop Outlet Nozzle"
1288        Unity(1).Shell.PressureDrop.Pdnozzle_out        = 0;
1289
1290"Shell Cross Flow Pressure Drop"
1291        Unity(1).Shell.PressureDrop.PdCross             = 0;
1292       
1293"Shell Cross Flow Pressure Drop"
1294        Unity(Nb+1).Shell.PressureDrop.PdCross          = 0;
1295       
1296"Shell Side Outlet Nozzle rho-V^2"
1297        Unity(1).Shell.PressureDrop.RVsquare_out = 0;
1298       
1299"Shell Side inlet Nozzle rho-V^2"
1300        Unity(Nb+1).Shell.PressureDrop.RVsquare_in = 0;
1301
1302SET
1303#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
1304#  Set Parameters for heatex Calculation
1305#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
1306        Sumary.Zones        = Nb+1;
1307        Pi                              = 3.14159265;
1308        HE.Tpass                        = Tpass;
1309        HE.Nss                          = Nss;
1310        HE.Ntt                          = Ntt;
1311        HE.Pattern                      = Pattern;
1312        HE.Bc                           = Bc;
1313        HE.Donozzle_Shell       = Donozzle_Shell;
1314        HE.Dinozzle_Shell       = Dinozzle_Shell;
1315        HE.Honozzle_Shell       = Honozzle_Shell;
1316        HE.Hinozzle_Shell       = Hinozzle_Shell;
1317        HE.Donozzle_Tube        = Donozzle_Tube;
1318        HE.Dinozzle_Tube        = Dinozzle_Tube;
1319        HE.Nb                       = Nb;
1320        HE.Dishell                      = Dishell;             
1321        HE.Lcf                          = Lcf; 
1322        HE.pitch                        = pitch;               
1323        HE.Dotube                       = Dotube;       
1324        HE.Ditube                       = Ditube;       
1325        HE.Lcd                          = Lcd;
1326        HE.Ltd                          = Ltd;
1327        side                            = HE.FluidAlocation();
1328end
Note: See TracBrowser for help on using the repository browser.