source: branches/newlanguage/eml/heat_exchangers/HeatExchangerSimplified.mso @ 149

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

updated samples and testing new heat exchangers models

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 21.5 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: HeatExchangerSimplified.mso 149 2007-02-05 11:31:00Z bicca $
18*--------------------------------------------------------------------*#
19
20using "HEX_Engine";
21
22Model HeatExchangerSimplified_Basic
23       
24ATTRIBUTES
25        Pallete         = false;
26        Brief           = "Basic Models for Simplified Heat Exchangers";
27        Info            =
28        "write some information";
29       
30PARAMETERS
31outer PP                as Plugin               (Brief="External Physical Properties");
32outer NComp     as Integer      (Brief="Number of Components");
33                M(NComp)  as molweight  (Brief="Component Mol Weight");
34       
35VARIABLES
36
37in      Inlet                   as Inlet_Main_Stream    (Brief="Hot and Cold Inlets");
38out     Outlet                  as Outlet_Main_Stream (Brief="Hot and Cold Outlets");
39                Properties              as Main_Properties              (Brief="Hot and Cold Properties");
40                Details                 as Details_Main                         (Brief="Heat Exchanger Details");
41                PressureDrop    as Main_Pdrop                   (Brief="Heat Exchanger Pressure Drop");
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"Cold Stream Wall Temperature"
62        Properties.Cold.Wall.Twall =   0.5*Properties.Hot.Average.T + 0.5*Properties.Cold.Average.T;
63
64"Hot Stream Wall Temperature"
65        Properties.Hot.Wall.Twall =   0.5*Properties.Hot.Average.T + 0.5*Properties.Cold.Average.T;
66
67"Hot Stream Average Molecular Weight"
68        Properties.Hot.Average.Mw = sum(M*Inlet.Hot.z);
69
70"Cold Stream Average Molecular Weight"
71        Properties.Cold.Average.Mw = sum(M*Inlet.Cold.z);
72
73
74if Inlet.Cold.v equal 0
75       
76        then   
77       
78"Cold Stream Average Heat Capacity"
79        Properties.Cold.Average.Cp      =       PP.LiquidCp(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
80
81"Cold Stream Inlet Heat Capacity"
82        Properties.Cold.Inlet.Cp        =       PP.LiquidCp(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
83
84"Cold Stream Outlet Heat Capacity"
85        Properties.Cold.Outlet.Cp       =       PP.LiquidCp(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
86
87"Cold Stream Average Mass Density"
88        Properties.Cold.Average.rho =   PP.LiquidDensity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
89
90"Cold Stream Inlet Mass Density"
91        Properties.Cold.Inlet.rho       =       PP.LiquidDensity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
92
93"Cold Stream Outlet Mass Density"
94        Properties.Cold.Outlet.rho      =       PP.LiquidDensity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
95
96"Cold Stream Average Viscosity"
97        Properties.Cold.Average.Mu      =       PP.LiquidViscosity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
98
99"Cold Stream inlet Viscosity"
100        Properties.Cold.Inlet.Mu        =       PP.LiquidViscosity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
101       
102"Cold Stream Outlet Viscosity"
103        Properties.Cold.Outlet.Mu       =       PP.LiquidViscosity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
104
105"Cold Stream Average Conductivity"
106        Properties.Cold.Average.K       =       PP.LiquidThermalConductivity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
107
108"Cold Stream Inlet Conductivity"       
109        Properties.Cold.Inlet.K         =       PP.LiquidThermalConductivity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
110
111"Cold Stream Outlet Conductivity"
112        Properties.Cold.Outlet.K        =       PP.LiquidThermalConductivity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
113
114"Cold Stream Heat Capacity at Wall Temperature"
115        Properties.Cold.Wall.Cp         =       PP.LiquidCp(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
116       
117"Cold Stream Viscosity at Wall Temperature"
118        Properties.Cold.Wall.Mu         =       PP.LiquidViscosity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
119
120"Cold Stream Conductivity at Wall Temperature"
121        Properties.Cold.Wall.K          =       PP.LiquidThermalConductivity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
122
123
124        else
125
126"Cold Stream Average Heat Capacity"
127        Properties.Cold.Average.Cp      =       PP.VapourCp(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
128
129"Cold Stream Inlet Heat Capacity"       
130        Properties.Cold.Inlet.Cp        =       PP.VapourCp(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
131
132"Cold Stream Outlet Heat Capacity"     
133        Properties.Cold.Outlet.Cp       =       PP.VapourCp(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
134
135"Cold Stream Average Mass Density"
136        Properties.Cold.Average.rho =   PP.VapourDensity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
137
138"Cold Stream Inlet Mass Density"
139        Properties.Cold.Inlet.rho       =       PP.VapourDensity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
140
141"Cold Stream Outlet Mass Density"       
142        Properties.Cold.Outlet.rho      =       PP.VapourDensity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
143
144"Cold Stream Average Viscosity "
145        Properties.Cold.Average.Mu      =       PP.VapourViscosity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
146
147"Cold Stream Inlet Viscosity " 
148        Properties.Cold.Inlet.Mu        =       PP.VapourViscosity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
149
150"Cold Stream Outlet Viscosity "
151        Properties.Cold.Outlet.Mu       =       PP.VapourViscosity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
152
153"Cold Stream Average Conductivity "
154        Properties.Cold.Average.K       =       PP.VapourThermalConductivity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
155
156"Cold Stream Inlet Conductivity "
157        Properties.Cold.Inlet.K         =       PP.VapourThermalConductivity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
158
159"Cold Stream Outlet Conductivity "
160        Properties.Cold.Outlet.K        =       PP.VapourThermalConductivity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
161       
162"Cold Stream Heat Capacity at Wall Temperature"
163        Properties.Cold.Wall.Cp         =       PP.VapourCp(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
164
165
166"Cold Stream Viscosity at Wall Temperature"
167        Properties.Cold.Wall.Mu         =       PP.VapourViscosity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
168
169"Cold Stream Conductivity at Wall Temperature"
170        Properties.Cold.Wall.K          =       PP.VapourThermalConductivity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
171       
172       
173       
174end
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#       Energy Balance
295#=====================================================================
296"Energy Balance Hot Stream"
297        Details.Q = Inlet.Hot.F*(Inlet.Hot.h-Outlet.Hot.h);
298
299"Energy Balance Cold Stream"
300        Details.Q =-Inlet.Cold.F*(Inlet.Cold.h-Outlet.Cold.h);
301
302#=====================================================================
303#       Material Balance
304#=====================================================================
305"Flow Mass Inlet Cold Stream"
306        Properties.Cold.Inlet.Fw        =  sum(M*Inlet.Cold.z)*Inlet.Cold.F;
307
308"Flow Mass Outlet Cold Stream"
309        Properties.Cold.Outlet.Fw       =  sum(M*Outlet.Cold.z)*Outlet.Cold.F;
310
311"Flow Mass Inlet Hot Stream"
312        Properties.Hot.Inlet.Fw         =  sum(M*Inlet.Hot.z)*Inlet.Hot.F;
313
314"Flow Mass Outlet Hot Stream"   
315        Properties.Hot.Outlet.Fw        =  sum(M*Outlet.Hot.z)*Outlet.Hot.F;
316
317"Molar Balance Hot Stream"
318        Inlet.Hot.F  = Outlet.Hot.F;
319       
320"Molar Balance Cold Stream"
321        Inlet.Cold.F = Outlet.Cold.F;
322
323#======================================
324#       Constraints
325#======================================
326"Hot Stream Molar Fraction Constraint"
327        Outlet.Hot.z=Inlet.Hot.z;
328       
329"Cold Stream Molar Fraction Constraint"
330        Outlet.Cold.z=Inlet.Cold.z;
331       
332#======================================
333#       Pressure Drop
334#======================================
335
336"Pressure Drop Hot Stream"
337        Outlet.Hot.P  = Inlet.Hot.P - PressureDrop.Hot.Pdrop;
338       
339"Pressure Drop Cold Stream"
340        Outlet.Cold.P  = Inlet.Cold.P - PressureDrop.Cold.Pdrop;
341       
342"Fraction of Inlet Pressure : Hot Stream"
343        PressureDrop.Hot.Pdrop  = Inlet.Hot.P*PressureDrop.Hot.FPdrop;
344       
345"Fraction of Inlet Pressure : Cold Stream"
346        PressureDrop.Cold.Pdrop  = Inlet.Cold.P*PressureDrop.Cold.FPdrop;
347       
348end
349
350Model Heatex_Basic_NTU                  as HeatExchangerSimplified_Basic
351
352ATTRIBUTES
353        Pallete         = false;
354        Brief           = "Basic Model for Heat Exchangers - NTU Method";
355        Info            =
356        "write some information";
357
358VARIABLES
359
360Eft       as positive (Brief="Effectiveness",Default=0.05,Lower=1e-8, Upper=1);
361
362EQUATIONS       
363
364"Energy Balance"
365        Details.Q       = Eft*Details.Cmin*(Inlet.Hot.T-Inlet.Cold.T); 
366
367
368end
369
370Model Heatex_Basic_LMTD                 as HeatExchangerSimplified_Basic
371
372ATTRIBUTES
373        Pallete         = false;
374        Brief           = "Basic Model for Heat Exchangers - LMTD Method";
375        Info            =
376        "write some information";
377
378VARIABLES
379
380DT0             as temp_delta   (Brief="Temperature Difference at Inlet",Lower=1);
381DTL             as temp_delta   (Brief="Temperature Difference at Outlet",Lower=1);
382LMTD            as temp_delta   (Brief="Logarithmic Mean Temperature Difference",Lower=1);
383Fc                      as positive             (Brief="LMTD Correction Factor",Lower=0.5);
384MTD             as temp_delta   (Brief="Mean Temperature Difference",Lower=1);
385
386EQUATIONS
387#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
388#                       Log Mean Temperature Difference
389#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
390if abs(DT0 - DTL) > 0.05*max(abs([DT0,DTL]))
391       
392        then
393"Log Mean Temperature Difference"
394        LMTD= (DT0-DTL)/ln(DT0/DTL);
395
396        else
397       
398if DT0*DTL equal 0
399       
400        then
401"Log Mean Temperature Difference"
402        LMTD = 0.5*(DT0+DTL);
403       
404        else
405"Log Mean Temperature Difference"
406        LMTD = 0.5*(DT0+DTL)*(1-(DT0-DTL)^2/(DT0*DTL)*(1+(DT0-DTL)^2/(DT0*DTL)/2)/12);
407       
408end
409       
410end
411
412"Exchange Surface Area"
413        Details.Q = Details.Ud*Details.A*MTD;   
414       
415"Mean Temperature Difference"   
416        MTD   = Fc*LMTD;
417
418end
419
420Model HeatExchanger_LMTD                as Heatex_Basic_LMTD
421
422ATTRIBUTES
423        Pallete         = true;
424        Brief           = "Heat Exchanger Block - LMTD Method";
425        Info            =
426        "write some information";
427       
428PARAMETERS
429
430        FlowDirection as Switcher(Brief="Flow Direction",Valid=["counter","cocurrent"],Default="cocurrent");
431
432EQUATIONS
433
434switch FlowDirection
435       
436        case "cocurrent":
437
438"Temperature Difference at Inlet"
439        DT0 = Inlet.Hot.T - Inlet.Cold.T;
440
441"Temperature Difference at Outlet"
442        DTL = Outlet.Hot.T - Outlet.Cold.T;
443
444case "counter":
445       
446"Temperature Difference at Inlet"
447        DT0 = Inlet.Hot.T - Outlet.Cold.T;
448
449"Temperature Difference at Outlet"
450        DTL = Outlet.Hot.T - Inlet.Cold.T;
451end
452
453end
454
455Model Shell_and_Tubes_LMTD      as Heatex_Basic_LMTD
456       
457ATTRIBUTES
458        Pallete         = true;
459        Brief           = "Shell and Tubes Heat Exchanger with 1 or 2 shell pass - LMTD Method";
460        Info            =
461        "write some information";
462       
463PARAMETERS
464
465LMTDcorrection as Switcher(Brief="LMTD Correction Factor Model",Valid=["Bowmann","Fakeri"],Default="Bowmann");
466ShellType                as Switcher(Brief="TEMA Designation",Valid=["Eshell","Fshell"],Default="Eshell");
467
468VARIABLES
469
470R                       as positive     (Brief=" Capacity Ratio for LMTD Correction Fator",Lower=1e-6);
471P                       as positive     (Brief="Non - Dimensional Variable for LMTD Correction Fator ",Lower=1e-6);
472Pc                      as positive     (Brief="Non - Dimensional Variable for LMTD Correction Fator when 2 Pass Shell Side",Lower=1e-6);
473Rho             as positive     (Brief="Non - Dimensional Variable for LMTD Correction Fator in Fakeri Equation",Lower=1e-6);
474Phi     as positive     (Brief="Non - Dimensional Variable for LMTD Correction Fator in Fakeri Equation",Lower=1e-6);
475lambdaN as Real             (Brief="Non - Dimensional Variable for LMTD Correction Fator in Fakeri Equation when 2 Pass Shell Side");
476lambda1 as Real         (Brief="Non - Dimensional Variable for LMTD Correction Fator in Fakeri Equationwhen 2 Pass Shell Side");
477
478EQUATIONS
479
480"R: Capacity Ratio for LMTD Correction Fator"
481        R*(Outlet.Cold.T - Inlet.Cold.T ) = (Inlet.Hot.T-Outlet.Hot.T);
482
483"P: Non - Dimensional Variable for LMTD Correction Fator"
484        P*(Inlet.Hot.T- Inlet.Cold.T)= (Outlet.Cold.T-Inlet.Cold.T);
485       
486"Temperature Difference at Inlet"
487        DT0 = Inlet.Hot.T - Outlet.Cold.T;
488
489"Temperature Difference at Outlet"
490        DTL = Outlet.Hot.T - Inlet.Cold.T;
491
492switch ShellType
493       
494        case "Fshell":
495       
496switch LMTDcorrection
497       
498        case "Bowmann":
499       
500" Variable not in use with Bowmann equation"
501        lambdaN =1;
502       
503" Variable not in use with Bowmann equation"
504        lambda1 =1;
505
506" Variable not in use with Bowmann equation"
507        Phi = 1;
508
509" Variable not in use with Bowmann equation"
510        Rho =1;
511
512if R equal 1
513       
514        then
515       
516"Non Dimensional Variable for LMTD Correction Fator when 2 Pass Shell Side"
517        Pc*(2-P)= P;
518
519"LMTD Correction Fator when 2 Pass Shell Side"
520        Fc= (sqrt(2)*Pc)/((1-Pc)*ln( abs( ( 2-Pc*0.585786)/( 2-Pc*3.414214))));
521       
522        else
523       
524"Non Dimensional Variable for LMTD Correction Fator when 2 Pass Shell Side"
525        Pc = (sqrt(abs(( 1-P*R)/(1-P)))-1)/(sqrt(abs(( 1-P*R)/(1-P)))-R);
526
527"LMTD Correction Fator when 2 Pass Shell Side"
528        Fc = sqrt(R*R+1)*ln(abs((1-Pc*R)/(1-Pc)))/((1-R)*ln( abs( ( 2-Pc*(R+1-sqrt(R*R+1)))/ ( 2-Pc*(R + 1 + sqrt(R*R+1))))));
529       
530end
531
532        case "Fakeri":
533       
534" Variable not in use with Fakeri equation"
535        Pc = P;
536       
537"Non Dimensional Variable for LMTD Correction Fator in Fakeri Equation"
538        Rho*(1-P*R) = (1-P);
539
540"Non Dimensional Variable for LMTD Correction Fator in Fakeri Equation "
541        Phi = (sqrt(((Inlet.Hot.T - Outlet.Hot.T)*(Inlet.Hot.T- Outlet.Hot.T))+((Outlet.Cold.T -  Inlet.Cold.T)*(Outlet.Cold.T -  Inlet.Cold.T))))/(2*((Inlet.Hot.T + Outlet.Hot.T)-( Inlet.Cold.T + Outlet.Cold.T)));
542
543if Rho equal 1
544       
545        then
546       
547" Variable not in use when Rho = 1"
548        lambdaN =       1;
549       
550" Variable not in use when Rho = 1"
551        lambda1 =       1;
552       
553"LMTD Correction Fator when 2 Pass Shell Side"
554        Fc = (2*Phi )/(ln(abs((1+Phi )/(1-Phi ))));
555       
556        else
557
558"Non Dimensional Variable for LMTD Correction Fator in Fakeri Equation"
559        lambdaN = (1/ln(sqrt(abs(Rho))))*((2*sqrt(abs(Rho))-2)/(sqrt(abs(Rho))+1));
560       
561"Non Dimensional Variable for LMTD Correction Fator in Fakeri Equation"
562        lambda1 = (1/ln(abs(Rho)))*((2*Rho-2)/(Rho+1));
563
564"LMTD Correction Fator when 2 Pass Shell Side"
565        Fc =    ((2*Phi *(lambdaN/lambda1))/(ln(abs((1+Phi *(lambdaN/lambda1))/(1-Phi *(lambdaN/lambda1))))))*(1/lambdaN);
566
567end
568
569
570end
571
572        case "Eshell":
573       
574" Variable not in use when 1 Pass Shell Side"
575        lambdaN =1;
576
577" Variable not in use when 1 Pass Shell Side"
578        lambda1 =1;
579       
580" Variable not in use when 1 Pass Shell Side"
581        Pc = P;
582       
583switch LMTDcorrection
584       
585        case "Bowmann":
586
587" Variable not in use with Bowmann equation"
588        Phi  = 1;
589       
590" Variable not in use with Bowmann equation"
591        Rho = 1;
592
593
594 if R equal 1
595       
596    then
597       
598"LMTD Correction Fator when 1 Pass Shell Side"
599        Fc = (sqrt(2)*P)/((1-P)*ln( abs( ( 2-P*0.585786)/( 2-P*3.414214))));
600
601        else
602       
603"LMTD Correction Fator when 1 Pass Shell Side"
604        Fc = sqrt(R*R+1)*ln(abs((1-P*R)/(1-P)))/((1-R)*ln( abs( ( 2-P*(R+1-sqrt(R*R+1)))/ ( 2-P*(R + 1 + sqrt(R*R+1))))));
605
606end
607
608        case "Fakeri":
609
610"Non Dimensional Variable for LMTD Correction Fator in Fakeri Equation "
611        Phi  = (sqrt(((Inlet.Hot.T- Outlet.Hot.T)*(Inlet.Hot.T- Outlet.Hot.T))+((Outlet.Cold.T - Inlet.Cold.T)*(Outlet.Cold.T - Inlet.Cold.T))))/(2*((Inlet.Hot.T+ Outlet.Hot.T)-(Inlet.Cold.T+ Outlet.Cold.T)));
612
613"Non Dimensional Variable for LMTD Correction Fator in Fakeri Equation"
614        Rho*(1-P*R) = (1-P);
615
616if Rho equal 1
617       
618        then
619       
620"LMTD Correction Fator when 1 Pass Shell Side"
621        Fc = (4*Phi)/(ln(abs((1+2*Phi)/(1-2*Phi))));
622
623        else
624
625"LMTD Correction Fator when 1 Pass Shell Side"
626        Fc = (2*Phi*(Rho+1)*ln(abs(Rho)))/( ln(abs((1+2*Phi)/(1-2*Phi)))*(Rho-1));
627       
628end
629
630end
631
632       
633end
634
635end
636
637Model HeatExchanger_NTU                 as Heatex_Basic_NTU
638
639ATTRIBUTES
640        Pallete         = true;
641        Brief           = "Heat Exchanger Block - NTU Method";
642        Info            =
643        "write some information";
644       
645PARAMETERS
646
647        FlowDirection as Switcher(Brief="Flow Direction",Valid=["counter","cocurrent"],Default="cocurrent");
648
649EQUATIONS
650
651if Details.Cr equal 0
652       
653        then
654       
655        Eft = 1-exp(-Details.NTU);
656       
657        else
658
659switch  FlowDirection
660
661        case "cocurrent":
662       
663"Effectiveness in Cocurrent Flow"
664        Eft = (1-exp(-Details.NTU*(1+Details.Cr)))/(1+Details.Cr);
665
666        case "counter":
667
668if Details.Cr equal 1
669       
670        then
671"Effectiveness in Counter Flow"
672        Eft = Details.NTU/(1+Details.NTU);
673       
674        else
675"Effectiveness in Counter Flow"
676        Eft*(1-Details.Cr*exp(-Details.NTU*(1-Details.Cr))) = (1-exp(-Details.NTU*(1-Details.Cr)));
677       
678end
679
680end
681
682
683end
684
685end
686 
687Model Shell_and_Tubes_NTU       as Heatex_Basic_NTU
688
689ATTRIBUTES
690        Pallete         = true;
691        Brief           = "Shell and Tubes Heat Exchanger with 1 or 2 shell pass - NTU Method";
692        Info            =
693        "write some information";
694
695PARAMETERS
696
697ShellType                as Switcher(Brief="TEMA Designation",Valid=["Eshell","Fshell"],Default="Eshell");
698
699VARIABLES
700
701Eft1    as positive (Brief="Effectiveness Correction",Lower=0.01,Upper=1,Default=0.5);
702
703EQUATIONS
704
705switch ShellType
706       
707        case "Fshell":
708       
709"Effectiveness Correction for 2 pass shell side"
710        Eft1 = 2*(1+Details.Cr+sqrt(1+Details.Cr^2)*((1+exp(-Details.NTU*sqrt(1+Details.Cr^2)))/(1-exp(-Details.NTU*sqrt(1+Details.Cr^2)))) )^-1;
711
712"TEMA F Shell Effectiveness"
713        Eft = ( ((1-Eft1*Details.Cr)/(1-Eft1))^2 -1  )*( ((1-Eft1*Details.Cr)/(1-Eft1))^2 - Details.Cr )^-1;
714
715        case "Eshell":
716       
717"TEMA E Shell Effectiveness"
718        Eft     = 2*(1+Details.Cr+sqrt(1+Details.Cr^2)*((1+exp(-Details.NTU*sqrt(1+Details.Cr^2)))/(1-exp(-Details.NTU*sqrt(1+Details.Cr^2)))) )^-1;
719
720"Variable not in use when 1 Pass Shell Side"
721        Eft1    = Eft;
722       
723end
724
725end
Note: See TracBrowser for help on using the repository browser.