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

Last change on this file since 4 was 1, checked in by Rafael de Pelegrini Soares, 17 years ago

Initial import of the library

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