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

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

updated heat exchangers model and samples

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 54.2 KB
Line 
1
2#--------------------------------------------------------------------
3# Author: Gerson Balbueno Bicca
4# $Id: HeatExchangerDiscretized.mso 26 2006-09-19 20:23:27Z 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");
18ext 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
281LMTD            as temp_delta   (Brief="Logarithmic Mean Temperature Difference",Lower=5);
282Fc                      as positive             (Brief="LMTD Correction Factor",Lower=0.5);
283MTD                     as temp_delta   (Brief="Mean Temperature Difference",Lower=1);
284
285EQUATIONS
286"Exchange Surface Area"
287        Details.Q   = Details.U*Details.A*MTD;
288       
289"Mean Temperature Difference"   
290        MTD   = Fc*LMTD;
291       
292"LMTD Correction Factor"
293        Fc = HE.EshellCorrectionFactor(Inlet.Hot.T,Outlet.Hot.T,Inlet.Cold.T,Outlet.Cold.T);
294
295"LMTD"
296        LMTD = HE.CounterLMTD(Inlet.Hot.T,Outlet.Hot.T,Inlet.Cold.T,Outlet.Cold.T);
297
298end
299
300Model Profiles
301
302PARAMETERS
303
304Zones   as Integer(Brief="Number of Zones");
305
306VARIABLES
307
308Lz(Zones)               as length                       (Brief="Zone Tube Length");
309Area                            as area                         (Brief="Area Total");
310Q                               as power                        (Brief="Total Duty");
311PdropTubesNozzle        as pressure                     (Brief="Total Tube Nozzles Pressure Drop");
312PdropTubes                      as pressure                     (Brief="Total Tube Pressure Drop");
313PdropWin                        as pressure                     (Brief="Total Shell Side Window Pressure Drop");
314PdropCross                      as pressure                     (Brief="Total Shell Side Cross Flow Pressure Drop");
315PdropEnds                       as pressure                     (Brief="Total Shell Side Ends Pressure Drop");
316PdropShellNozzle        as pressure                     (Brief="Total Shell Side Nozzles Pressure Drop");
317PdropShell                      as pressure                     (Brief="Total Shell Side Pressure Drop");
318Uaverage                        as heat_trans_coeff (Brief="Average Overall Heat Transfer Coefficient",Default=1,Lower=1e-6,Upper=1e10);
319hshellaverage           as heat_trans_coeff     (Brief="Average Shell Side Film Coefficient",Default=1,Lower=1e-12, Upper=1e6);
320htubeaverage            as heat_trans_coeff     (Brief="Average Tube Side Film Coefficient",Default=1,Lower=1e-12, Upper=1e6);
321Thot(Zones)             as temperature          (Brief="Hot Temperature",Lower = 300, Upper = 500);
322Tcold(Zones)            as temperature          (Brief="Cold Temperature",Lower = 300, Upper = 500);
323Phot(Zones)             as pressure                     (Brief="Hot Pressure",Lower = 0.8, Upper = 30);
324Pcold(Zones)            as pressure                     (Brief="Cold Pressure",Lower = 0.8, Upper = 30);
325
326end
327
328Model E_Shell_NTU_Disc           
329#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
330#       Shell and Tubes Heat Exchanger with 1 shell pass - NTU Method
331#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
332PARAMETERS
333
334ext     HE      as CalcObject   (Brief="STHE Calculations",File="heatex.dll");
335ext PP  as CalcObject   (Brief="External Physical Properties");
336side    as Integer              (Brief="Fluid Alocation",Lower=0,Upper=1);
337Pi              as constant     (Brief="Pi Number",Default=3.14159265);
338
339#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
340#       Shell Geometrical Parameters
341#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
342Tpass                   as Integer              (Brief="Number of Tube Passes",Lower=1);
343Nss                             as Integer              (Brief="Number of Sealing Strips pairs",Lower=1);
344Dishell                 as length               (Brief="Inside Shell Diameter",Lower=10e-6);
345Donozzle_Shell  as length               (Brief="Shell Outlet Nozzle Diameter",Lower=10e-6);
346Dinozzle_Shell  as length               (Brief="Shell Inlet Nozzle Diameter",Lower=10e-6);
347Hinozzle_Shell  as length               (Brief="Height Under Shell Inlet Nozzle",Lower=10e-6);
348Honozzle_Shell  as length               (Brief="Height Under Shell Outlet Nozzle",Lower=10e-6);
349Lcf                     as length               (Brief="Bundle-to-Shell Clearance",Lower=10e-8);
350#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
351#       Tubes Geometrical Parameters
352#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
353Ntt                             as Integer              (Brief="Total Number of Tubes in Shell",Default=100,Lower=1);
354Pattern         as Integer              (Brief="Tube Layout Characteristic Angle",Lower=30);
355Ltube                   as length               (Brief="Effective Tube Length",Lower=0.1);
356pitch                   as length               (Brief="Tube Pitch",Lower=1e-8);
357Kwall                   as conductivity (Brief="Tube Wall Material Thermal Conductivity");
358Dotube                  as length               (Brief="Tube Outside Diameter",Lower=10e-6);
359Ditube                  as length               (Brief="Tube Inside Diameter",Lower=10e-6);
360Donozzle_Tube   as length               (Brief="Tube Outlet Nozzle Diameter",Lower=10e-6);
361Dinozzle_Tube   as length               (Brief="Tube Inlett Nozzle Diameter",Lower=10e-6);
362#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
363#       Baffles Geometrical Parameters
364#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
365Bc                      as Integer              (Brief="Baffle Cut",Default=25,Lower=25);
366Nb              as Integer              (Brief="Number of Baffles",Default=4);
367Lcd                     as length               (Brief="Baffle-to-Shell Clearance",Lower=10e-8);
368Ltd                             as length               (Brief="Tube-to-Bafflehole Clearance",Lower=10e-8);
369#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
370VARIABLES
371
372Unity(Nb+1)     as Heatex_Discretized_NTU;
373Sumary          as Profiles;
374
375CONNECTIONS
376
377Unity([1:Nb]).Outlet.Hot  to Unity([2:Nb+1]).Inlet.Hot;
378Unity([2:Nb+1]).Outlet.Cold to Unity([1:Nb]).Inlet.Cold;
379
380EQUATIONS
381
382"Hot Temperatures"
383        Sumary.Thot     = Unity.Outlet.Hot.T;
384       
385"Cold Temperatures"
386        Sumary.Tcold    = Unity.Outlet.Cold.T ;
387
388"Hot Pressures"
389        Sumary.Phot     = Unity.Outlet.Hot.P ;
390       
391"Cold Pressures"
392        Sumary.Pcold    = Unity.Outlet.Cold.P ;
393
394"Average Shell Side Film Coefficient"
395        Sumary.hshellaverage            = sum(Unity.Shell.HeatTransfer.hshell)/Sumary.Zones;
396
397"Average Tube Side Film Coefficient"
398        Sumary.htubeaverage             = sum(Unity.Tubes.HeatTransfer.htube)/Sumary.Zones;
399
400"Average Overall Heat Transfer Coefficient"
401        Sumary.Uaverage                 = sum(Unity.Details.U)/Sumary.Zones;
402
403"Area Total"
404        Sumary.Area                             = sum(Unity.Details.A);
405
406"Duty Total"
407        Sumary.Q                                = sum(Unity.Details.Q);
408
409"Length Inlet zone"
410        Sumary.Lz(1)                            = Unity(1).Baffles.Lsi;
411
412"Length Outlet zone"
413        Sumary.Lz(Nb+1)                         = Unity(1).Baffles.Lso;
414
415"Total Shell Side Pressure Drop"
416        Sumary.PdropShell                       = sum(Unity.Shell.PressureDrop.Pdtotal);
417
418"Total Tube Side Pressure Drop"
419        Sumary.PdropTubes                       = sum(Unity.Tubes.PressureDrop.Pdtotal);
420
421"Total Tube Side Nozzles Pressure Drop"
422        Sumary.PdropTubesNozzle         = sum(Unity.Tubes.PressureDrop.Pdnozzle_in + Unity.Tubes.PressureDrop.Pdnozzle_out);
423
424"Total Shell Side Nozzles Pressure Drop"
425        Sumary.PdropShellNozzle         = sum(Unity.Shell.PressureDrop.Pdnozzle_in + Unity.Shell.PressureDrop.Pdnozzle_out);
426
427"Total Shell Side Window Pressure Drop"
428        Sumary.PdropWin                         = sum(Unity.Shell.PressureDrop.Pdwindow);
429
430"Total Shell Side Cross Flow Pressure Drop"
431        Sumary.PdropCross                       = sum(Unity.Shell.PressureDrop.PdCross);
432
433"Total Shell Side Ends Pressure Drop"
434        Sumary.PdropEnds                        = sum(Unity.Shell.PressureDrop.PdEndZones);
435
436"Shell Side Cross Flow Area"
437        Unity(1).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(1).Baffles.Lsi);
438       
439"Shell Side Cross Flow Area"
440        Unity(Nb+1).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(Nb+1).Baffles.Lso);
441
442
443if side equal 1
444       
445        then
446       
447"Shell Side inlet Nozzle rho-V^2"
448        Unity(1).Shell.PressureDrop.RVsquare_in = Unity(1).Properties.Hot.Inlet.rho*(Unity(1).Shell.PressureDrop.Vnozzle_in)^2;
449
450"Shell Side Outlet Nozzle rho-V^2"
451        Unity(Nb+1).Shell.PressureDrop.RVsquare_out = Unity(Nb+1).Properties.Hot.Outlet.rho*(Unity(Nb+1).Shell.PressureDrop.Vnozzle_out)^2;
452
453"Shell Pressure End Zones"
454        Unity(1).Shell.PressureDrop.PdEndZones          =       HE.DeltaPendZonesIncremental(Unity(1).Shell.HeatTransfer.Re,Unity(1).Baffles.Ls,Unity(1).Baffles.Lso,
455        Unity(1).Baffles.Lsi,Unity(1).Properties.Hot.Inlet.Fw,Unity(1).Shell.HeatTransfer.Phi,Unity(1).Properties.Hot.Average.rho);
456
457"Shell Pressure End Zones"
458        Unity(Nb+1).Shell.PressureDrop.PdEndZones       =       HE.DeltaPendZonesIncremental(Unity(Nb+1).Shell.HeatTransfer.Re,Unity(Nb+1).Baffles.Ls,Unity(Nb+1).Baffles.Lso,
459        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);
460
461"Pressure Drop Tube Side Inlet Nozzle"
462        Unity(1).Tubes.PressureDrop.Pdnozzle_in = HE.DeltaPtubeNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
463
464"Velocity Tube Side Inlet Nozzle"
465        Unity(1).Tubes.PressureDrop.Vnozzle_in  = HE.TubeVelocityNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
466
467"Pressure Drop Tube Side Outlet Nozzle"
468        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_out     = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
469
470"Velocity Tube Side Outlet Nozzle"
471        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_out      = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
472
473"Shell Pressure Drop Inlet Nozzle"
474        Unity(1).Shell.PressureDrop.Pdnozzle_in = HE.DeltaPshellNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
475
476"Velocity Shell Side Inlet Nozzle"
477        Unity(1).Shell.PressureDrop.Vnozzle_in  = HE.ShellVelocityNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
478
479"Shell Pressure Drop Outlet Nozzle"
480        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_out     =HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
481
482"Velocity Shell Side Outlet Nozzle"
483        Unity(Nb+1).Shell.PressureDrop.Vnozzle_out      =HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
484       
485
486        else
487       
488"Shell Side inlet Nozzle rho-V^2"
489        Unity(1).Shell.PressureDrop.RVsquare_in = Unity(1).Properties.Cold.Inlet.rho*(Unity(1).Shell.PressureDrop.Vnozzle_in)^2;
490
491"Shell Side Outlet Nozzle rho-V^2"
492        Unity(Nb+1).Shell.PressureDrop.RVsquare_out = Unity(Nb+1).Properties.Cold.Outlet.rho*(Unity(Nb+1).Shell.PressureDrop.Vnozzle_out)^2;
493
494"Shell Pressure End Zones"
495        Unity(1).Shell.PressureDrop.PdEndZones          =       HE.DeltaPendZonesIncremental(Unity(1).Shell.HeatTransfer.Re,Unity(1).Baffles.Ls,Unity(1).Baffles.Lso,
496        Unity(1).Baffles.Lsi,Unity(1).Properties.Cold.Inlet.Fw,Unity(1).Shell.HeatTransfer.Phi,Unity(1).Properties.Cold.Average.rho);
497
498"Shell Pressure End Zones"
499        Unity(Nb+1).Shell.PressureDrop.PdEndZones       =       HE.DeltaPendZonesIncremental(Unity(Nb+1).Shell.HeatTransfer.Re,Unity(Nb+1).Baffles.Ls,Unity(Nb+1).Baffles.Lso,
500        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);
501
502
503"Pressure Drop Tube Side Inlet Nozzle"
504        Unity(1).Tubes.PressureDrop.Pdnozzle_in = HE.DeltaPtubeNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
505
506"Velocity Tube Side Inlet Nozzle"
507        Unity(1).Tubes.PressureDrop.Vnozzle_in  = HE.TubeVelocityNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
508
509"Pressure Drop Tube Side Outlet Nozzle"
510        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_out     = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);   
511
512"Velocity Tube Side Outlet Nozzle"
513        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_out      = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw); 
514
515"Shell Pressure Drop Inlet Nozzle"
516        Unity(1).Shell.PressureDrop.Pdnozzle_in = HE.DeltaPshellNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
517
518"Velocity Shell Side Inlet Nozzle"
519        Unity(1).Shell.PressureDrop.Vnozzle_in  = HE.ShellVelocityNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
520
521"Shell Pressure Drop Outlet Nozzle"
522        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_out = HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
523
524"Velocity Shell Side Outlet Nozzle"
525        Unity(Nb+1).Shell.PressureDrop.Vnozzle_out  = HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
526
527
528end
529
530
531for i in [2:Nb]
532
533"Pressure Drop Tube Side Inlet Nozzle"
534        Unity(i).Tubes.PressureDrop.Pdnozzle_in = 0;
535
536"Velocity Tube Side Inlet Nozzle"
537        Unity(i).Tubes.PressureDrop.Vnozzle_in  = 0;
538
539"Pressure Drop Tube Side Outlet Nozzle"
540        Unity(i).Tubes.PressureDrop.Pdnozzle_out        = 0;   
541
542"Velocity Tube Side Outlet Nozzle"
543        Unity(i).Tubes.PressureDrop.Vnozzle_out = 0;   
544
545"Shell Pressure Drop Inlet Nozzle"
546        Unity(i).Shell.PressureDrop.Pdnozzle_in = 0;
547
548"Velocity Shell Side Inlet Nozzle"
549        Unity(i).Shell.PressureDrop.Vnozzle_in  = 0;
550
551"Shell Pressure Drop Outlet Nozzle"
552        Unity(i).Shell.PressureDrop.Pdnozzle_out = 0;
553
554"Velocity Shell Side Outlet Nozzle"
555        Unity(i).Shell.PressureDrop.Vnozzle_out  = 0;
556
557"Shell Pressure End Zones"
558        Unity(i).Shell.PressureDrop.PdEndZones          =       0;
559       
560"Shell Side Outlet Nozzle rho-V^2"
561        Unity(i).Shell.PressureDrop.RVsquare_out = 0;
562       
563"Shell Side inlet Nozzle rho-V^2"
564        Unity(i).Shell.PressureDrop.RVsquare_in = 0;
565
566if side equal 1
567       
568        then
569       
570"Shell Pressure Drop Cross Flow"
571        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);
572
573
574        else
575
576"Shell Pressure Drop Cross Flow"
577        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);
578
579
580end
581
582"Zone Length"
583        Sumary.Lz(i) = Unity(1).Baffles.Ls;
584
585"Shell Side Cross Flow Area"
586        Unity(i).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(i).Baffles.Ls);
587       
588end
589
590
591for i in [1:Nb+1]
592       
593if side equal 1
594       
595        then
596"Pressure Drop Hot Stream"
597        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P - Unity(i).Shell.PressureDrop.Pdtotal;   
598
599"Pressure Drop Cold Stream"
600        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Tubes.PressureDrop.Pdtotal;
601       
602"Shell Side Reynolds Number"
603        Unity(i).Shell.HeatTransfer.Re                          =       HE.ShellReynoldsNumber(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Hot.Average.Mu);
604
605"Shell Heat Transfer Coefficient"
606        Unity(i).Shell.HeatTransfer.hshell                      =       HE.ShellFilmCoeff(Unity(i).Shell.HeatTransfer.Ji,Unity(i).Properties.Hot.Average.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Shell.HeatTransfer.PR,Unity(i).Shell.HeatTransfer.Jtotal,Unity(i).Shell.HeatTransfer.Phi);
607
608
609"Shell Pressure Baffle Window"
610        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);
611
612"Hot Wall Temperature"
613        Unity(i).Properties.Hot.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
614
615"Cold Wall Temperature"
616        Unity(i).Properties.Cold.Wall.Twall =   (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
617
618"Tube Side Velocity"
619        Unity(i).Tubes.HeatTransfer.Vtube       =       HE.TubeVelocity(Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Properties.Cold.Average.rho);
620
621"Tube Side Reynolds Number"
622        Unity(i).Tubes.HeatTransfer.Re          =       HE.TubeReynoldsNumber(Unity(i).Properties.Cold.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Properties.Cold.Average.Mu);
623       
624"Tube Side Prandtl Number"
625        Unity(i).Tubes.HeatTransfer.PR          =       HE.PrandtlNumber(Unity(i).Properties.Cold.Average.K,Unity(i).Properties.Cold.Average.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Average.Mu);
626
627"Tube Side Prandtl Number at Wall"
628        Unity(i).Tubes.HeatTransfer.PRw         =       HE.PrandtlNumber(Unity(i).Properties.Cold.Wall.K,Unity(i).Properties.Cold.Wall.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Wall.Mu);
629
630"Tube Side Film Coefficient"
631        Unity(i).Tubes.HeatTransfer.htube       =       HE.TubeFilmCoeffIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Cold.Average.K,
632        Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lz(i));
633       
634"Shell Side Prandtl Number"
635        Unity(i).Shell.HeatTransfer.PR          =       HE.PrandtlNumber(Unity(i).Properties.Hot.Average.K,Unity(i).Properties.Hot.Average.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Average.Mu);   
636
637"Shell Side Prandtl Number at Wall"
638        Unity(i).Shell.HeatTransfer.PRw         =       HE.PrandtlNumber(Unity(i).Properties.Hot.Wall.K,Unity(i).Properties.Hot.Wall.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Wall.Mu);   
639
640"Tube Side Pressure Drop"
641        Unity(i).Tubes.PressureDrop.PdTube      =       HE.DeltaPtubeIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Cold.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,
642        Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lz(i));
643       
644"Shell Side Phi correction for viscosity"
645        Unity(i).Shell.HeatTransfer.Phi         =       HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
646       
647"Tube Side Phi correction for viscosity"
648        Unity(i).Tubes.HeatTransfer.Phi         =       HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
649       
650        else
651
652"Pressure Drop Hot Stream"
653        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P- Unity(i).Tubes.PressureDrop.Pdtotal;     
654       
655"Pressure Drop Cold Stream"
656        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Shell.PressureDrop.Pdtotal;
657       
658"Shell Side Reynolds Number"
659        Unity(i).Shell.HeatTransfer.Re                  =       HE.ShellReynoldsNumber(Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Cold.Average.Mu);
660
661"Shell Heat Transfer Coefficient"
662        Unity(i).Shell.HeatTransfer.hshell              =       HE.ShellFilmCoeff(Unity(i).Shell.HeatTransfer.Ji,Unity(i).Properties.Cold.Average.Cp,Unity(i).Properties.Cold.Average.Mw,
663        Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Shell.HeatTransfer.PR,Unity(i).Shell.HeatTransfer.Jtotal,Unity(i).Shell.HeatTransfer.Phi);
664
665
666"Shell Pressure Baffle Window"
667        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);
668
669
670"Hot Wall Temperature"
671        Unity(i).Properties.Hot.Wall.Twall      =       (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
672
673"Cold Wall Temperature"
674        Unity(i).Properties.Cold.Wall.Twall     =       (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
675
676"Tube Side Velocity"
677        Unity(i).Tubes.HeatTransfer.Vtube               =       HE.TubeVelocity(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Properties.Hot.Average.rho);
678
679"Tube Side Reynolds Number"
680        Unity(i).Tubes.HeatTransfer.Re                  =       HE.TubeReynoldsNumber(Unity(i).Properties.Hot.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Properties.Hot.Average.Mu);
681       
682"Tube Side Prandtl Number"
683        Unity(i).Tubes.HeatTransfer.PR                  =       HE.PrandtlNumber(Unity(i).Properties.Hot.Average.K,Unity(i).Properties.Hot.Average.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Average.Mu);
684       
685"Tube Side Prandtl Number at Wall"
686        Unity(i).Tubes.HeatTransfer.PRw                 =       HE.PrandtlNumber(Unity(i).Properties.Hot.Wall.K,Unity(i).Properties.Hot.Wall.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Wall.Mu);
687       
688       
689"Tube Side Film Coefficient"
690        Unity(i).Tubes.HeatTransfer.htube               =       HE.TubeFilmCoeffIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Hot.Average.K,
691        Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lz(i));
692       
693"Shell Side Prandtl Number"
694        Unity(i).Shell.HeatTransfer.PR                  =       HE.PrandtlNumber(Unity(i).Properties.Cold.Average.K,Unity(i).Properties.Cold.Average.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Average.Mu);
695
696"Shell Side Prandtl Number at Wall"
697        Unity(i).Shell.HeatTransfer.PRw                 =       HE.PrandtlNumber(Unity(i).Properties.Cold.Wall.K,Unity(i).Properties.Cold.Wall.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Wall.Mu);
698
699"Tube Side Pressure Drop"
700        Unity(i).Tubes.PressureDrop.PdTube              =       HE.DeltaPtubeIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Hot.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,
701        Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lz(i));
702
703"Shell Side Phi correction for viscosity"
704        Unity(i).Shell.HeatTransfer.Phi                 =       HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
705       
706"Tube Side Phi correction for viscosity"
707        Unity(i).Tubes.HeatTransfer.Phi                 =       HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
708
709end
710
711"Tube Resistance"       
712        Unity(i).Resistances.Rtube*(Unity(i).Tubes.HeatTransfer.htube*Ditube) = Dotube;
713       
714"Wall Resistance"
715        Unity(i).Resistances.Rwall      =       Dotube*ln(Dotube/Ditube)/(2*Kwall);
716       
717"Shell Resistance"
718        Unity(i).Resistances.Rshell*(Unity(i).Shell.HeatTransfer.hshell)        =       1;
719       
720"Overall Heat Transfer Coefficient"
721        Unity(i).Details.U      =       1/(Dotube/(Unity(i).Tubes.HeatTransfer.htube*Ditube)+(Dotube*ln(Dotube/Ditube)/(2*Kwall))+(1/(Unity(i).Shell.HeatTransfer.hshell)));
722
723"Exchange Surface Area"
724        Unity(i).Details.A      =       Pi*Dotube*Ntt*Sumary.Lz(i);
725
726"Baffles Spacing"
727        Ltube = Unity(i).Baffles.Lsi+Unity(i).Baffles.Lso+Unity(i).Baffles.Ls*(Nb-1);
728       
729
730"Js Factor"     
731        Unity(i).Shell.HeatTransfer.Js                  =       1;
732       
733"Ji Factor"
734        Unity(i).Shell.HeatTransfer.Ji                  =       HE.JiFactor(Unity(i).Shell.HeatTransfer.Re);
735
736"Jc Factor"
737        Unity(i).Shell.HeatTransfer.Jc                  =       HE.JcFactor();
738       
739"Jl Factor"
740        Unity(i).Shell.HeatTransfer.Jl                  =       HE.JlFactor(Unity(i).Shell.HeatTransfer.Sm);
741
742"Jb Factor"
743        Unity(i).Shell.HeatTransfer.Jb                  =       HE.JbFactor(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Shell.HeatTransfer.Sm);
744
745"Jr Factor"     
746        Unity(i).Shell.HeatTransfer.Jr                  =       HE.JrFactor(Unity(i).Shell.HeatTransfer.Re);
747       
748"Total J Factor"
749        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;
750end
751
752
753"Velocity Tube Side Inlet Nozzle"
754        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_in       = 0;
755
756"Velocity Tube Side Outlet Nozzle"
757        Unity(1).Tubes.PressureDrop.Vnozzle_out = 0;
758       
759"Tube Pressure Drop Inlet Nozzle"
760        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_in      = 0;
761
762"Tube Pressure Drop Outlet Nozzle"
763        Unity(1).Tubes.PressureDrop.Pdnozzle_out        = 0;
764
765"Velocity Shell Side Inlet Nozzle"
766        Unity(Nb+1).Shell.PressureDrop.Vnozzle_in       = 0;
767
768"Velocity Shell Side Outlet Nozzle"
769        Unity(1).Shell.PressureDrop.Vnozzle_out = 0;
770       
771"Shell Pressure Drop Inlet Nozzle"
772        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_in      = 0;
773       
774"Shell Pressure Drop Outlet Nozzle"
775        Unity(1).Shell.PressureDrop.Pdnozzle_out        = 0;
776
777"Shell Cross Flow Pressure Drop"
778        Unity(1).Shell.PressureDrop.PdCross             = 0;
779       
780"Shell Cross Flow Pressure Drop"
781        Unity(Nb+1).Shell.PressureDrop.PdCross          = 0;
782       
783"Shell Side Outlet Nozzle rho-V^2"
784        Unity(1).Shell.PressureDrop.RVsquare_out = 0;
785       
786"Shell Side inlet Nozzle rho-V^2"
787        Unity(Nb+1).Shell.PressureDrop.RVsquare_in = 0;
788
789SET
790#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
791#  Set Parameters for heatex Calculation
792#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
793        Sumary.Zones        = Nb+1;
794        Pi                              = 3.14159265;
795        HE.Tpass                        = Tpass;
796        HE.Nss                          = Nss;
797        HE.Ntt                          = Ntt;
798        HE.Pattern                      = Pattern;
799        HE.Bc                           = Bc;
800        HE.Donozzle_Shell       = Donozzle_Shell;
801        HE.Dinozzle_Shell       = Dinozzle_Shell;
802        HE.Honozzle_Shell       = Honozzle_Shell;
803        HE.Hinozzle_Shell       = Hinozzle_Shell;
804        HE.Donozzle_Tube        = Donozzle_Tube;
805        HE.Dinozzle_Tube        = Dinozzle_Tube;
806        HE.Nb                       = Nb;
807        HE.Dishell                      = Dishell;             
808        HE.Lcf                          = Lcf; 
809        HE.pitch                        = pitch;               
810        HE.Dotube                       = Dotube;       
811        HE.Ditube                       = Ditube;       
812        HE.Lcd                          = Lcd;
813        HE.Ltd                          = Ltd;
814        side                            = HE.FluidAlocation();
815end
816
817Model E_Shell_LMTD_Disc         
818#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
819#       Shell and Tubes Heat Exchanger with 1 shell pass - LMTD Method
820#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
821PARAMETERS
822
823ext     HE      as CalcObject   (Brief="STHE Calculations",File="heatex.dll");
824ext PP  as CalcObject   (Brief="External Physical Properties");
825side    as Integer              (Brief="Fluid Alocation",Lower=0,Upper=1);
826Pi              as constant     (Brief="Pi Number",Default=3.14159265);
827
828#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
829#       Shell Geometrical Parameters
830#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
831Tpass                   as Integer              (Brief="Number of Tube Passes",Lower=1);
832Nss                             as Integer              (Brief="Number of Sealing Strips pairs",Lower=1);
833Dishell                 as length               (Brief="Inside Shell Diameter",Lower=10e-6);
834Donozzle_Shell  as length               (Brief="Shell Outlet Nozzle Diameter",Lower=10e-6);
835Dinozzle_Shell  as length               (Brief="Shell Inlet Nozzle Diameter",Lower=10e-6);
836Hinozzle_Shell  as length               (Brief="Height Under Shell Inlet Nozzle",Lower=10e-6);
837Honozzle_Shell  as length               (Brief="Height Under Shell Outlet Nozzle",Lower=10e-6);
838Lcf                     as length               (Brief="Bundle-to-Shell Clearance",Lower=10e-8);
839#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
840#       Tubes Geometrical Parameters
841#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
842Ntt                             as Integer              (Brief="Total Number of Tubes in Shell",Default=100,Lower=1);
843Pattern         as Integer              (Brief="Tube Layout Characteristic Angle",Lower=30);
844Ltube                   as length               (Brief="Effective Tube Length",Lower=0.1);
845pitch                   as length               (Brief="Tube Pitch",Lower=1e-8);
846Kwall                   as conductivity (Brief="Tube Wall Material Thermal Conductivity");
847Dotube                  as length               (Brief="Tube Outside Diameter",Lower=10e-6);
848Ditube                  as length               (Brief="Tube Inside Diameter",Lower=10e-6);
849Donozzle_Tube   as length               (Brief="Tube Outlet Nozzle Diameter",Lower=10e-6);
850Dinozzle_Tube   as length               (Brief="Tube Inlett Nozzle Diameter",Lower=10e-6);
851#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
852#       Baffles Geometrical Parameters
853#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
854Bc                      as Integer              (Brief="Baffle Cut",Default=25,Lower=25);
855Nb              as Integer              (Brief="Number of Baffles",Default=4);
856Lcd                     as length               (Brief="Baffle-to-Shell Clearance",Lower=10e-8);
857Ltd                             as length               (Brief="Tube-to-Bafflehole Clearance",Lower=10e-8);
858#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
859VARIABLES
860
861Unity(Nb+1)     as Heatex_Discretized_LMTD;
862Sumary          as Profiles;
863
864CONNECTIONS
865
866Unity([1:Nb]).Outlet.Hot        to Unity([2:Nb+1]).Inlet.Hot;
867Unity([2:Nb+1]).Outlet.Cold to Unity([1:Nb]).Inlet.Cold;
868
869EQUATIONS
870
871"Hot Temperatures"
872        Sumary.Thot     = Unity.Outlet.Hot.T;
873       
874"Cold Temperatures"
875        Sumary.Tcold    = Unity.Outlet.Cold.T ;
876
877"Hot Pressures"
878        Sumary.Phot     = Unity.Outlet.Hot.P ;
879       
880"Cold Pressures"
881        Sumary.Pcold    = Unity.Outlet.Cold.P ;
882
883"Average Shell Side Film Coefficient"
884        Sumary.hshellaverage            = sum(Unity.Shell.HeatTransfer.hshell)/Sumary.Zones;
885
886"Average Tube Side Film Coefficient"
887        Sumary.htubeaverage             = sum(Unity.Tubes.HeatTransfer.htube)/Sumary.Zones;
888
889"Average Overall Heat Transfer Coefficient"
890        Sumary.Uaverage                 = sum(Unity.Details.U)/Sumary.Zones;
891
892"Area Total"
893        Sumary.Area                             = sum(Unity.Details.A);
894
895"Duty Total"
896        Sumary.Q                                = sum(Unity.Details.Q);
897
898"Length Inlet zone"
899        Sumary.Lz(1)                            = Unity(1).Baffles.Lsi;
900
901"Length Outlet zone"
902        Sumary.Lz(Nb+1)                         = Unity(1).Baffles.Lso;
903
904"Total Shell Side Pressure Drop"
905        Sumary.PdropShell                       = sum(Unity.Shell.PressureDrop.Pdtotal);
906
907"Total Tube Side Pressure Drop"
908        Sumary.PdropTubes                       = sum(Unity.Tubes.PressureDrop.Pdtotal);
909
910"Total Tube Side Nozzles Pressure Drop"
911        Sumary.PdropTubesNozzle         = sum(Unity.Tubes.PressureDrop.Pdnozzle_in + Unity.Tubes.PressureDrop.Pdnozzle_out);
912
913"Total Shell Side Nozzles Pressure Drop"
914        Sumary.PdropShellNozzle         = sum(Unity.Shell.PressureDrop.Pdnozzle_in + Unity.Shell.PressureDrop.Pdnozzle_out);
915
916"Total Shell Side Window Pressure Drop"
917        Sumary.PdropWin                         = sum(Unity.Shell.PressureDrop.Pdwindow);
918
919"Total Shell Side Cross Flow Pressure Drop"
920        Sumary.PdropCross                       = sum(Unity.Shell.PressureDrop.PdCross);
921
922"Total Shell Side Ends Pressure Drop"
923        Sumary.PdropEnds                        = sum(Unity.Shell.PressureDrop.PdEndZones);
924
925"Shell Side Cross Flow Area"
926        Unity(1).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(1).Baffles.Lsi);
927       
928"Shell Side Cross Flow Area"
929        Unity(Nb+1).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(Nb+1).Baffles.Lso);
930
931
932if side equal 1
933       
934        then
935
936"Shell Side inlet Nozzle rho-V^2"
937        Unity(1).Shell.PressureDrop.RVsquare_in = Unity(1).Properties.Hot.Inlet.rho*(Unity(1).Shell.PressureDrop.Vnozzle_in)^2;
938
939"Shell Side Outlet Nozzle rho-V^2"
940        Unity(Nb+1).Shell.PressureDrop.RVsquare_out = Unity(Nb+1).Properties.Hot.Outlet.rho*(Unity(Nb+1).Shell.PressureDrop.Vnozzle_out)^2;
941
942"Shell Pressure End Zones"
943        Unity(1).Shell.PressureDrop.PdEndZones          =       HE.DeltaPendZonesIncremental(Unity(1).Shell.HeatTransfer.Re,Unity(1).Baffles.Ls,Unity(1).Baffles.Lso,
944        Unity(1).Baffles.Lsi,Unity(1).Properties.Hot.Inlet.Fw,Unity(1).Shell.HeatTransfer.Phi,Unity(1).Properties.Hot.Average.rho);
945
946"Shell Pressure End Zones"
947        Unity(Nb+1).Shell.PressureDrop.PdEndZones       =       HE.DeltaPendZonesIncremental(Unity(Nb+1).Shell.HeatTransfer.Re,Unity(Nb+1).Baffles.Ls,Unity(Nb+1).Baffles.Lso,
948        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);
949
950"Pressure Drop Tube Side Inlet Nozzle"
951        Unity(1).Tubes.PressureDrop.Pdnozzle_in = HE.DeltaPtubeNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
952
953"Velocity Tube Side Inlet Nozzle"
954        Unity(1).Tubes.PressureDrop.Vnozzle_in  = HE.TubeVelocityNozzlein(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
955
956"Pressure Drop Tube Side Outlet Nozzle"
957        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_out     = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
958
959"Velocity Tube Side Outlet Nozzle"
960        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_out      = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
961
962"Shell Pressure Drop Inlet Nozzle"
963        Unity(1).Shell.PressureDrop.Pdnozzle_in = HE.DeltaPshellNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
964
965"Velocity Shell Side Inlet Nozzle"
966        Unity(1).Shell.PressureDrop.Vnozzle_in  = HE.ShellVelocityNozzleIn(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
967
968"Shell Pressure Drop Outlet Nozzle"
969        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_out     =HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
970
971"Velocity Shell Side Outlet Nozzle"
972        Unity(Nb+1).Shell.PressureDrop.Vnozzle_out      =HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);
973       
974
975        else
976
977"Shell Side inlet Nozzle rho-V^2"
978        Unity(1).Shell.PressureDrop.RVsquare_in = Unity(1).Properties.Cold.Inlet.rho*(Unity(1).Shell.PressureDrop.Vnozzle_in)^2;
979
980"Shell Side Outlet Nozzle rho-V^2"
981        Unity(Nb+1).Shell.PressureDrop.RVsquare_out = Unity(Nb+1).Properties.Cold.Outlet.rho*(Unity(Nb+1).Shell.PressureDrop.Vnozzle_out)^2;
982
983"Shell Pressure End Zones"
984        Unity(1).Shell.PressureDrop.PdEndZones          =       HE.DeltaPendZonesIncremental(Unity(1).Shell.HeatTransfer.Re,Unity(1).Baffles.Ls,Unity(1).Baffles.Lso,
985        Unity(1).Baffles.Lsi,Unity(1).Properties.Cold.Inlet.Fw,Unity(1).Shell.HeatTransfer.Phi,Unity(1).Properties.Cold.Average.rho);
986
987"Shell Pressure End Zones"
988        Unity(Nb+1).Shell.PressureDrop.PdEndZones       =       HE.DeltaPendZonesIncremental(Unity(Nb+1).Shell.HeatTransfer.Re,Unity(Nb+1).Baffles.Ls,Unity(Nb+1).Baffles.Lso,
989        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);
990
991
992"Pressure Drop Tube Side Inlet Nozzle"
993        Unity(1).Tubes.PressureDrop.Pdnozzle_in = HE.DeltaPtubeNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
994
995"Velocity Tube Side Inlet Nozzle"
996        Unity(1).Tubes.PressureDrop.Vnozzle_in  = HE.TubeVelocityNozzlein(Unity(1).Properties.Hot.Inlet.rho,Unity(1).Properties.Hot.Inlet.Fw);
997
998"Pressure Drop Tube Side Outlet Nozzle"
999        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_out     = HE.DeltaPtubeNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw);   
1000
1001"Velocity Tube Side Outlet Nozzle"
1002        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_out      = HE.TubeVelocityNozzleout(Unity(Nb+1).Properties.Hot.Outlet.rho,Unity(Nb+1).Properties.Hot.Inlet.Fw); 
1003
1004"Shell Pressure Drop Inlet Nozzle"
1005        Unity(1).Shell.PressureDrop.Pdnozzle_in = HE.DeltaPshellNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
1006
1007"Velocity Shell Side Inlet Nozzle"
1008        Unity(1).Shell.PressureDrop.Vnozzle_in  = HE.ShellVelocityNozzleIn(Unity(1).Properties.Cold.Inlet.rho,Unity(1).Properties.Cold.Inlet.Fw);
1009
1010"Shell Pressure Drop Outlet Nozzle"
1011        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_out = HE.DeltaPshellNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
1012
1013"Velocity Shell Side Outlet Nozzle"
1014        Unity(Nb+1).Shell.PressureDrop.Vnozzle_out  = HE.ShellVelocityNozzleOut(Unity(Nb+1).Properties.Cold.Outlet.rho,Unity(Nb+1).Properties.Cold.Inlet.Fw);
1015
1016
1017end
1018
1019
1020for i in [2:Nb]
1021
1022"Pressure Drop Tube Side Inlet Nozzle"
1023        Unity(i).Tubes.PressureDrop.Pdnozzle_in = 0;
1024
1025"Velocity Tube Side Inlet Nozzle"
1026        Unity(i).Tubes.PressureDrop.Vnozzle_in  = 0;
1027
1028"Pressure Drop Tube Side Outlet Nozzle"
1029        Unity(i).Tubes.PressureDrop.Pdnozzle_out        = 0;   
1030
1031"Velocity Tube Side Outlet Nozzle"
1032        Unity(i).Tubes.PressureDrop.Vnozzle_out = 0;   
1033
1034"Shell Pressure Drop Inlet Nozzle"
1035        Unity(i).Shell.PressureDrop.Pdnozzle_in = 0;
1036
1037"Velocity Shell Side Inlet Nozzle"
1038        Unity(i).Shell.PressureDrop.Vnozzle_in  = 0;
1039
1040"Shell Pressure Drop Outlet Nozzle"
1041        Unity(i).Shell.PressureDrop.Pdnozzle_out = 0;
1042
1043"Velocity Shell Side Outlet Nozzle"
1044        Unity(i).Shell.PressureDrop.Vnozzle_out  = 0;
1045
1046"Shell Pressure End Zones"
1047        Unity(i).Shell.PressureDrop.PdEndZones          =       0;
1048
1049"Shell Side Outlet Nozzle rho-V^2"
1050        Unity(i).Shell.PressureDrop.RVsquare_out = 0;
1051       
1052"Shell Side inlet Nozzle rho-V^2"
1053        Unity(i).Shell.PressureDrop.RVsquare_in = 0;
1054       
1055if side equal 1
1056       
1057        then
1058       
1059"Shell Pressure Drop Cross Flow"
1060        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);
1061
1062
1063        else
1064
1065"Shell Pressure Drop Cross Flow"
1066        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);
1067
1068
1069end
1070
1071"Zone Length"
1072        Sumary.Lz(i) = Unity(1).Baffles.Ls;
1073
1074"Shell Side Cross Flow Area"
1075        Unity(i).Shell.HeatTransfer.Sm = HE.CrossFlowArea(Unity(i).Baffles.Ls);
1076       
1077end
1078
1079
1080for i in [1:Nb+1]
1081       
1082if side equal 1
1083       
1084        then
1085"Pressure Drop Hot Stream"
1086        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P - Unity(i).Shell.PressureDrop.Pdtotal;   
1087
1088"Pressure Drop Cold Stream"
1089        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Tubes.PressureDrop.Pdtotal;
1090       
1091"Shell Side Reynolds Number"
1092        Unity(i).Shell.HeatTransfer.Re                          =       HE.ShellReynoldsNumber(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Hot.Average.Mu);
1093
1094"Shell Heat Transfer Coefficient"
1095        Unity(i).Shell.HeatTransfer.hshell                      =       HE.ShellFilmCoeff(Unity(i).Shell.HeatTransfer.Ji,Unity(i).Properties.Hot.Average.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Shell.HeatTransfer.PR,Unity(i).Shell.HeatTransfer.Jtotal,Unity(i).Shell.HeatTransfer.Phi);
1096
1097
1098"Shell Pressure Baffle Window"
1099        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);
1100
1101"Hot Wall Temperature"
1102        Unity(i).Properties.Hot.Wall.Twall  = (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
1103       
1104"Cold Wall Temperature"
1105        Unity(i).Properties.Cold.Wall.Twall =   (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
1106
1107"Tube Side Velocity"
1108        Unity(i).Tubes.HeatTransfer.Vtube       =       HE.TubeVelocity(Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Properties.Cold.Average.rho);
1109
1110"Tube Side Reynolds Number"
1111        Unity(i).Tubes.HeatTransfer.Re          =       HE.TubeReynoldsNumber(Unity(i).Properties.Cold.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Properties.Cold.Average.Mu);
1112       
1113"Tube Side Prandtl Number"
1114        Unity(i).Tubes.HeatTransfer.PR          =       HE.PrandtlNumber(Unity(i).Properties.Cold.Average.K,Unity(i).Properties.Cold.Average.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Average.Mu);
1115
1116"Tube Side Prandtl Number at Wall"
1117        Unity(i).Tubes.HeatTransfer.PRw         =       HE.PrandtlNumber(Unity(i).Properties.Cold.Wall.K,Unity(i).Properties.Cold.Wall.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Wall.Mu);
1118
1119"Tube Side Film Coefficient"
1120        Unity(i).Tubes.HeatTransfer.htube       =       HE.TubeFilmCoeffIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Cold.Average.K,
1121        Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lz(i));
1122       
1123"Shell Side Prandtl Number"
1124        Unity(i).Shell.HeatTransfer.PR          =       HE.PrandtlNumber(Unity(i).Properties.Hot.Average.K,Unity(i).Properties.Hot.Average.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Average.Mu);   
1125
1126"Shell Side Prandtl Number at Wall"
1127        Unity(i).Shell.HeatTransfer.PRw         =       HE.PrandtlNumber(Unity(i).Properties.Hot.Wall.K,Unity(i).Properties.Hot.Wall.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Wall.Mu);   
1128
1129"Tube Side Pressure Drop"
1130        Unity(i).Tubes.PressureDrop.PdTube      =       HE.DeltaPtubeIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Cold.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,
1131        Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lz(i));
1132       
1133"Shell Side Phi correction for viscosity"
1134        Unity(i).Shell.HeatTransfer.Phi         =       HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
1135       
1136"Tube Side Phi correction for viscosity"
1137        Unity(i).Tubes.HeatTransfer.Phi         =       HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
1138       
1139        else
1140
1141"Pressure Drop Hot Stream"
1142        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P- Unity(i).Tubes.PressureDrop.Pdtotal;     
1143       
1144"Pressure Drop Cold Stream"
1145        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Shell.PressureDrop.Pdtotal;
1146       
1147"Shell Side Reynolds Number"
1148        Unity(i).Shell.HeatTransfer.Re                  =       HE.ShellReynoldsNumber(Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Properties.Cold.Average.Mu);
1149
1150"Shell Heat Transfer Coefficient"
1151        Unity(i).Shell.HeatTransfer.hshell              =       HE.ShellFilmCoeff(Unity(i).Shell.HeatTransfer.Ji,Unity(i).Properties.Cold.Average.Cp,Unity(i).Properties.Cold.Average.Mw,
1152        Unity(i).Properties.Cold.Inlet.Fw,Unity(i).Shell.HeatTransfer.Sm,Unity(i).Shell.HeatTransfer.PR,Unity(i).Shell.HeatTransfer.Jtotal,Unity(i).Shell.HeatTransfer.Phi);
1153
1154
1155"Shell Pressure Baffle Window"
1156        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);
1157
1158
1159"Hot Wall Temperature"
1160        Unity(i).Properties.Hot.Wall.Twall      =       (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
1161       
1162"Cold Wall Temperature"
1163        Unity(i).Properties.Cold.Wall.Twall     =       (Unity(i).Properties.Hot.Average.T+Unity(i).Properties.Cold.Average.T)/2;
1164
1165"Tube Side Velocity"
1166        Unity(i).Tubes.HeatTransfer.Vtube               =       HE.TubeVelocity(Unity(i).Properties.Hot.Inlet.Fw,Unity(i).Properties.Hot.Average.rho);
1167
1168"Tube Side Reynolds Number"
1169        Unity(i).Tubes.HeatTransfer.Re                  =       HE.TubeReynoldsNumber(Unity(i).Properties.Hot.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,Unity(i).Properties.Hot.Average.Mu);
1170       
1171"Tube Side Prandtl Number"
1172        Unity(i).Tubes.HeatTransfer.PR                  =       HE.PrandtlNumber(Unity(i).Properties.Hot.Average.K,Unity(i).Properties.Hot.Average.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Average.Mu);
1173       
1174"Tube Side Prandtl Number at Wall"
1175        Unity(i).Tubes.HeatTransfer.PRw                 =       HE.PrandtlNumber(Unity(i).Properties.Hot.Wall.K,Unity(i).Properties.Hot.Wall.Cp,Unity(i).Properties.Hot.Average.Mw,Unity(i).Properties.Hot.Wall.Mu);
1176       
1177       
1178"Tube Side Film Coefficient"
1179        Unity(i).Tubes.HeatTransfer.htube               =       HE.TubeFilmCoeffIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Tubes.HeatTransfer.PR,Unity(i).Properties.Hot.Average.K,
1180        Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lz(i));
1181       
1182"Shell Side Prandtl Number"
1183        Unity(i).Shell.HeatTransfer.PR                  =       HE.PrandtlNumber(Unity(i).Properties.Cold.Average.K,Unity(i).Properties.Cold.Average.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Average.Mu);
1184
1185"Shell Side Prandtl Number at Wall"
1186        Unity(i).Shell.HeatTransfer.PRw                 =       HE.PrandtlNumber(Unity(i).Properties.Cold.Wall.K,Unity(i).Properties.Cold.Wall.Cp,Unity(i).Properties.Cold.Average.Mw,Unity(i).Properties.Cold.Wall.Mu);
1187
1188"Tube Side Pressure Drop"
1189        Unity(i).Tubes.PressureDrop.PdTube              =       HE.DeltaPtubeIncremental(Unity(i).Tubes.HeatTransfer.Re,Unity(i).Properties.Hot.Average.rho,Unity(i).Tubes.HeatTransfer.Vtube,
1190        Unity(i).Tubes.HeatTransfer.Phi,Sumary.Lz(i));
1191
1192"Shell Side Phi correction for viscosity"
1193        Unity(i).Shell.HeatTransfer.Phi                 =       HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
1194       
1195"Tube Side Phi correction for viscosity"
1196        Unity(i).Tubes.HeatTransfer.Phi                 =       HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
1197
1198end
1199
1200"Tube Resistance"       
1201        Unity(i).Resistances.Rtube*(Unity(i).Tubes.HeatTransfer.htube*Ditube) = Dotube;
1202       
1203"Wall Resistance"
1204        Unity(i).Resistances.Rwall      =       Dotube*ln(Dotube/Ditube)/(2*Kwall);
1205       
1206"Shell Resistance"
1207        Unity(i).Resistances.Rshell*(Unity(i).Shell.HeatTransfer.hshell)        =       1;
1208       
1209"Overall Heat Transfer Coefficient"
1210        Unity(i).Details.U      =       1/(Dotube/(Unity(i).Tubes.HeatTransfer.htube*Ditube)+(Dotube*ln(Dotube/Ditube)/(2*Kwall))+(1/(Unity(i).Shell.HeatTransfer.hshell)));
1211
1212"Exchange Surface Area"
1213        Unity(i).Details.A      =       Pi*Dotube*Ntt*Sumary.Lz(i);
1214
1215"Baffles Spacing"
1216        Ltube = Unity(i).Baffles.Lsi+Unity(i).Baffles.Lso+Unity(i).Baffles.Ls*(Nb-1);
1217
1218"Js Factor"     
1219        Unity(i).Shell.HeatTransfer.Js                  =       1;
1220
1221"Ji Factor"
1222        Unity(i).Shell.HeatTransfer.Ji                  =       HE.JiFactor(Unity(i).Shell.HeatTransfer.Re);
1223
1224"Jc Factor"
1225        Unity(i).Shell.HeatTransfer.Jc                  =       HE.JcFactor();
1226       
1227"Jl Factor"
1228        Unity(i).Shell.HeatTransfer.Jl                  =       HE.JlFactor(Unity(i).Shell.HeatTransfer.Sm);
1229
1230"Jb Factor"
1231        Unity(i).Shell.HeatTransfer.Jb                  =       HE.JbFactor(Unity(i).Shell.HeatTransfer.Re,Unity(i).Baffles.Ls,Unity(i).Shell.HeatTransfer.Sm);
1232
1233"Jr Factor"     
1234        Unity(i).Shell.HeatTransfer.Jr                  =       HE.JrFactor(Unity(i).Shell.HeatTransfer.Re);
1235       
1236"Total J Factor"
1237        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;
1238end
1239
1240"Velocity Tube Side Inlet Nozzle"
1241        Unity(Nb+1).Tubes.PressureDrop.Vnozzle_in       = 0;
1242
1243"Velocity Tube Side Outlet Nozzle"
1244        Unity(1).Tubes.PressureDrop.Vnozzle_out = 0;
1245       
1246"Tube Pressure Drop Inlet Nozzle"
1247        Unity(Nb+1).Tubes.PressureDrop.Pdnozzle_in      = 0;
1248
1249"Tube Pressure Drop Outlet Nozzle"
1250        Unity(1).Tubes.PressureDrop.Pdnozzle_out        = 0;
1251
1252"Velocity Shell Side Inlet Nozzle"
1253        Unity(Nb+1).Shell.PressureDrop.Vnozzle_in       = 0;
1254
1255"Velocity Shell Side Outlet Nozzle"
1256        Unity(1).Shell.PressureDrop.Vnozzle_out = 0;
1257       
1258"Shell Pressure Drop Inlet Nozzle"
1259        Unity(Nb+1).Shell.PressureDrop.Pdnozzle_in      = 0;
1260       
1261"Shell Pressure Drop Outlet Nozzle"
1262        Unity(1).Shell.PressureDrop.Pdnozzle_out        = 0;
1263
1264"Shell Cross Flow Pressure Drop"
1265        Unity(1).Shell.PressureDrop.PdCross             = 0;
1266       
1267"Shell Cross Flow Pressure Drop"
1268        Unity(Nb+1).Shell.PressureDrop.PdCross          = 0;
1269       
1270"Shell Side Outlet Nozzle rho-V^2"
1271        Unity(1).Shell.PressureDrop.RVsquare_out = 0;
1272       
1273"Shell Side inlet Nozzle rho-V^2"
1274        Unity(Nb+1).Shell.PressureDrop.RVsquare_in = 0;
1275
1276SET
1277#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
1278#  Set Parameters for heatex Calculation
1279#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
1280        Sumary.Zones        = Nb+1;
1281        Pi                              = 3.14159265;
1282        HE.Tpass                        = Tpass;
1283        HE.Nss                          = Nss;
1284        HE.Ntt                          = Ntt;
1285        HE.Pattern                      = Pattern;
1286        HE.Bc                           = Bc;
1287        HE.Donozzle_Shell       = Donozzle_Shell;
1288        HE.Dinozzle_Shell       = Dinozzle_Shell;
1289        HE.Honozzle_Shell       = Honozzle_Shell;
1290        HE.Hinozzle_Shell       = Hinozzle_Shell;
1291        HE.Donozzle_Tube        = Donozzle_Tube;
1292        HE.Dinozzle_Tube        = Dinozzle_Tube;
1293        HE.Nb                       = Nb;
1294        HE.Dishell                      = Dishell;             
1295        HE.Lcf                          = Lcf; 
1296        HE.pitch                        = pitch;               
1297        HE.Dotube                       = Dotube;       
1298        HE.Ditube                       = Ditube;       
1299        HE.Lcd                          = Lcd;
1300        HE.Ltd                          = Ltd;
1301        side                            = HE.FluidAlocation();
1302end
Note: See TracBrowser for help on using the repository browser.