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

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

testing the new language

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 20.7 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 147 2007-01-31 19:02:46Z 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#=====================================================================
278#       Thermal Details
279#=====================================================================
280"Hot Stream Heat Capacity"
281        Details.Ch =Inlet.Hot.F*Properties.Hot.Average.Cp;
282       
283"Cold Stream Heat Capacity"
284        Details.Cc =Inlet.Cold.F*Properties.Cold.Average.Cp;
285
286"Minimum Heat Capacity"
287        Details.Cmin  = min([Details.Ch,Details.Cc]);
288
289"Maximum Heat Capacity"
290        Details.Cmax  = max([Details.Ch,Details.Cc]);
291
292"Heat Capacity Ratio"   
293        Details.Cr    = Details.Cmin/Details.Cmax;
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#======================================
340#       Pressure Drop
341#======================================
342
343"Pressure Drop Hot Stream"
344        Outlet.Hot.P  = Inlet.Hot.P - PressureDrop.Hot.Pdrop;
345       
346"Pressure Drop Cold Stream"
347        Outlet.Cold.P  = Inlet.Cold.P - PressureDrop.Cold.Pdrop;
348       
349"Fraction of Inlet Pressure : Hot Stream"
350        PressureDrop.Hot.Pdrop  = Inlet.Hot.P*PressureDrop.Hot.FPdrop;
351       
352"Fraction of Inlet Pressure : Cold Stream"
353        PressureDrop.Cold.Pdrop  = Inlet.Cold.P*PressureDrop.Cold.FPdrop;
354       
355end
356
357Model Heatex_Basic_NTU   as HeatExchangerSimplified_Basic
358
359ATTRIBUTES
360        Pallete         = false;
361        Brief           = "Basic Model for Heat Exchangers - NTU Method";
362        Info            =
363        "write some information";
364
365VARIABLES
366
367Eft       as positive (Brief="Effectiveness",Default=0.05,Lower=1e-8, Upper=1);
368
369EQUATIONS       
370
371"Energy Balance"
372        Details.Q       = Eft*Details.Cmin*(Inlet.Hot.T-Inlet.Cold.T); 
373
374
375end
376
377Model Heatex_Basic_LMTD  as HeatExchangerSimplified_Basic
378
379ATTRIBUTES
380        Pallete         = false;
381        Brief           = "Basic Model for Heat Exchangers - LMTD Method";
382        Info            =
383        "write some information";
384
385VARIABLES
386
387DT0             as temp_delta   (Brief="Temperature Difference at Inlet",Lower=1);
388DTL             as temp_delta   (Brief="Temperature Difference at Outlet",Lower=1);
389LMTD            as temp_delta   (Brief="Logarithmic Mean Temperature Difference",Lower=1);
390Fc                      as positive             (Brief="LMTD Correction Factor",Lower=0.5);
391MTD             as temp_delta   (Brief="Mean Temperature Difference",Lower=1);
392
393EQUATIONS
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"Exchange Surface Area"
420        Details.Q = Details.Ud*Details.A*MTD;   
421       
422"Mean Temperature Difference"   
423        MTD   = Fc*LMTD;
424
425end
426
427
428#=====================================================================
429#       Concrete Models for Simplified Heat Exchangers
430#=====================================================================
431
432#=====================================================================
433# LMTD Method
434#=====================================================================
435
436Model HeatExchanger_LMTD        as Heatex_Basic_LMTD
437
438ATTRIBUTES
439        Pallete         = true;
440        Brief           = "Heat Exchanger Block - LMTD Method";
441        Info            =
442        "write some information";
443       
444PARAMETERS
445
446        FlowDirection as Switcher(Brief="Flow Direction",Valid=["counter","cocurrent"],Default="cocurrent");
447
448EQUATIONS
449
450switch FlowDirection
451       
452        case "cocurrent":
453
454"Temperature Difference at Inlet"
455        DT0 = Inlet.Hot.T - Inlet.Cold.T;
456
457"Temperature Difference at Outlet"
458        DTL = Outlet.Hot.T - Outlet.Cold.T;
459
460case "counter":
461       
462"Temperature Difference at Inlet"
463        DT0 = Inlet.Hot.T - Outlet.Cold.T;
464
465"Temperature Difference at Outlet"
466        DTL = Outlet.Hot.T - Inlet.Cold.T;
467end
468
469end
470
471Model E_Shell_LMTD                      as Heatex_Basic_LMTD       
472
473ATTRIBUTES
474        Pallete         = true;
475        Brief           = "Shell and Tubes Heat Exchanger with 1 shell pass - LMTD Method";
476        Info            =
477        "write some information";
478
479PARAMETERS
480
481LMTDcorrection as Switcher(Brief="LMTD Correction Factor Model",Valid=["Bowmann","Fakeri"],Default="Bowmann");
482
483VARIABLES
484
485R               as positive;
486P               as positive;
487Rho     as positive;
488Phi    as positive;
489
490EQUATIONS
491
492"Capacity Ratio for LMTD Correction Fator"
493        R*(Outlet.Cold.T - Inlet.Cold.T ) = (Inlet.Hot.T-Outlet.Hot.T);
494
495"Non - Dimensional Variable for LMTD Correction Fator"
496        P*(Inlet.Hot.T- Inlet.Cold.T)= (Outlet.Cold.T-Inlet.Cold.T);
497
498"Temperature Difference at Inlet"
499        DT0 = Inlet.Hot.T - Outlet.Cold.T;
500
501"Temperature Difference at Outlet"
502        DTL = Outlet.Hot.T - Inlet.Cold.T;
503
504"Rho: Non - Dimensional Variable for LMTD Correction Fator in Fakeri Equation"
505        Rho*(1-P*R) = (1-P);
506
507"Phi: Non - Dimensional Variable for LMTD Correction Fator in Fakeri Equation"
508        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)));
509
510switch LMTDcorrection
511       
512        case "Bowmann":
513
514 if R equal 1
515       
516    then
517        Fc = (sqrt(2)*P)/((1-P)*ln( abs( ( 2-P*0.585786)/( 2-P*3.414214))));
518
519        else
520        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))))));
521
522end
523
524case "Fakeri":
525
526if Rho equal 1
527       
528        then
529        Fc = (4*Phi)/(ln(abs((1+2*Phi)/(1-2*Phi))));
530
531        else
532        Fc = (2*Phi*(Rho+1)*ln(abs(Rho)))/( ln(abs((1+2*Phi)/(1-2*Phi)))*(Rho-1));
533       
534end
535
536end
537
538end
539
540Model F_Shell_LMTD              as Heatex_Basic_LMTD
541       
542ATTRIBUTES
543        Pallete         = true;
544        Brief           = "Shell and Tubes Heat Exchanger with 2 shell pass - LMTD Method";
545        Info            =
546        "write some information";
547       
548PARAMETERS
549
550LMTDcorrection as Switcher(Brief="LMTD Correction Factor Model",Valid=["Bowmann","Fakeri"],Default="Bowmann");
551
552VARIABLES
553
554R                       as positive;
555P                       as positive;
556Pc                      as positive;
557Rho             as positive;
558Phi     as positive;
559lambdaN as positive;
560lambda1 as positive;
561
562EQUATIONS
563
564"Rho: Non - Dimensional Variable for LMTD Correction Fator in Fakeri Equation"
565        Rho*(1-P*R) = (1-P);
566
567"R: Capacity Ratio for LMTD Correction Fator"
568        R*(Outlet.Cold.T - Inlet.Cold.T ) = (Inlet.Hot.T-Outlet.Hot.T);
569
570"P: Non - Dimensional Variable for LMTD Correction Fator"
571        P*(Inlet.Hot.T- Inlet.Cold.T)= (Outlet.Cold.T-Inlet.Cold.T);
572       
573"Temperature Difference at Inlet"
574        DT0 = Inlet.Hot.T - Outlet.Cold.T;
575
576"Temperature Difference at Outlet"
577        DTL = Outlet.Hot.T - Inlet.Cold.T;
578
579switch LMTDcorrection
580       
581        case "Bowmann":
582       
583        lambdaN =1;
584        lambda1 =1;
585        Phi = 1;
586
587if R equal 1
588       
589        then
590        Pc*(2-P)= P;
591        Fc= (sqrt(2)*Pc)/((1-Pc)*ln( abs( ( 2-Pc*0.585786)/( 2-Pc*3.414214))));
592       
593        else
594        Pc = (sqrt(abs(( 1-P*R)/(1-P)))-1)/(sqrt(abs(( 1-P*R)/(1-P)))-R);
595        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))))));
596       
597end
598
599        case "Fakeri":
600        Pc = P;
601        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)));
602
603if Rho equal 1
604       
605        then
606        lambdaN =       1;
607        lambda1 =       1;
608        Fc = (2*Phi )/(ln(abs((1+Phi )/(1-Phi ))));
609       
610        else
611
612        lambdaN = (1/ln(sqrt(abs(Rho))))*((2*sqrt(abs(Rho))-2)/(sqrt(abs(Rho))+1));
613       
614        lambda1 = (1/ln(abs(Rho)))*((2*Rho-2)/(Rho+1));
615
616        Fc =    ((2*Phi *(lambdaN/lambda1))/(ln(abs((1+Phi *(lambdaN/lambda1))/(1-Phi *(lambdaN/lambda1))))))*(1/lambdaN);
617
618end
619
620
621end
622
623
624end
625#=====================================================================
626# NTU Method
627#=====================================================================
628
629Model HeatExchanger_NTU         as Heatex_Basic_NTU
630
631ATTRIBUTES
632        Pallete         = true;
633        Brief           = "Heat Exchanger Block - NTU Method";
634        Info            =
635        "write some information";
636       
637PARAMETERS
638
639        FlowDirection as Switcher(Brief="Flow Direction",Valid=["counter","cocurrent"],Default="cocurrent");
640
641EQUATIONS
642
643if Details.Cr equal 0
644       
645        then
646       
647        Eft = 1-exp(-Details.NTU);
648       
649        else
650
651switch  FlowDirection
652
653        case "cocurrent":
654       
655"Effectiveness in Cocurrent Flow"
656        Eft = (1-exp(-Details.NTU*(1+Details.Cr)))/(1+Details.Cr);
657
658        case "counter":
659
660if Details.Cr equal 1
661       
662        then
663"Effectiveness in Counter Flow"
664        Eft = Details.NTU/(1+Details.NTU);
665       
666        else
667"Effectiveness in Counter Flow"
668        Eft*(1-Details.Cr*exp(-Details.NTU*(1-Details.Cr))) = (1-exp(-Details.NTU*(1-Details.Cr)));
669       
670end
671
672end
673
674
675end
676
677end
678
679Model E_Shell_NTU                       as Heatex_Basic_NTU
680       
681ATTRIBUTES
682        Pallete         = true;
683        Brief           = "Shell and Tubes Heat Exchanger with 1 shell pass - NTU Method";
684        Info            =
685        "write some information";
686
687EQUATIONS
688"TEMA E Shell Effectiveness"
689        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;
690
691end
692
693Model F_Shell_NTU               as Heatex_Basic_NTU
694
695ATTRIBUTES
696        Pallete         = true;
697        Brief           = "Shell and Tubes Heat Exchanger with 2 shell pass - NTU Method";
698        Info            =
699        "write some information";
700       
701VARIABLES
702
703Eft1    as positive (Brief="Effectiveness Correction",Lower=0.01,Upper=1,Default=0.5);
704
705EQUATIONS
706
707"Effectiveness Correction"
708        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;
709
710"TEMA F Shell Effectiveness"
711        Eft = ( ((1-Eft1*Details.Cr)/(1-Eft1))^2 -1  )*( ((1-Eft1*Details.Cr)/(1-Eft1))^2 - Details.Cr )^-1;
712
713end
Note: See TracBrowser for help on using the repository browser.