source: branches/newlanguage/eml/heat_exchangers/HeatExchangerDiscretized.mso @ 147

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

updated models for the new language

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