source: mso/eml/heat_exchangers/HeatExchangerSimplified.mso @ 45

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

updated heat exchanger model

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 16.3 KB
Line 
1#--------------------------------------------------------------------
2# Author: Gerson Balbueno Bicca
3# $Id: HeatExchangerSimplified.mso 45 2006-11-07 16:11:10Z bicca $
4#--------------------------------------------------------------------
5using "HEX_Engine";
6#=====================================================================
7#       Basic Models for Simplified Heat Exchangers
8#=====================================================================
9Model HeatExchangerSimplified_Basic
10PARAMETERS
11ext PP          as CalcObject   (Brief="External Physical Properties");
12        HE              as CalcObject   (Brief="STHE Calculations",File="heatex");
13ext NComp       as Integer      (Brief="Number of Components");
14        M(NComp)        as molweight    (Brief="Component Mol Weight");
15       
16VARIABLES
17
18in  Inlet               as Inlet_Main_Stream;   # Hot and Cold Inlets
19out Outlet              as Outlet_Main_Stream;  # Hot and Cold Outlets
20        Properties      as Main_Properties;             # Hot and Cold Properties
21        Details         as Details_Main;
22        PressureDrop    as Main_Pdrop;
23
24SET
25
26M   = PP.MolecularWeight();
27
28EQUATIONS
29
30"Hot Stream Average Temperature"
31        Properties.Hot.Average.T = 0.5*Inlet.Hot.T + 0.5*Outlet.Hot.T;
32       
33"Cold Stream Average Temperature"
34        Properties.Cold.Average.T = 0.5*Inlet.Cold.T + 0.5*Outlet.Cold.T;
35       
36"Hot Stream Average Pressure"
37        Properties.Hot.Average.P = 0.5*Inlet.Hot.P+0.5*Outlet.Hot.P;
38       
39"Cold Stream Average Pressure"
40        Properties.Cold.Average.P = 0.5*Inlet.Cold.P+0.5*Outlet.Cold.P;
41
42"Cold Stream Wall Temperature"
43        Properties.Cold.Wall.Twall =   0.5*Properties.Hot.Average.T + 0.5*Properties.Cold.Average.T;
44
45"Hot Stream Wall Temperature"
46        Properties.Hot.Wall.Twall =   0.5*Properties.Hot.Average.T + 0.5*Properties.Cold.Average.T;
47
48"Hot Stream Average Molecular Weight"
49        Properties.Hot.Average.Mw = sum(M*Inlet.Hot.z);
50
51"Cold Stream Average Molecular Weight"
52        Properties.Cold.Average.Mw = sum(M*Inlet.Cold.z);
53
54
55
56if Inlet.Cold.v equal 0
57        then   
58"Heat Capacity Cold Stream"
59        Properties.Cold.Average.Cp              =       PP.LiquidCp(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
60        Properties.Cold.Inlet.Cp                =       PP.LiquidCp(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
61        Properties.Cold.Outlet.Cp               =       PP.LiquidCp(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
62
63"Mass Density Cold Stream"
64        Properties.Cold.Average.rho     =       PP.LiquidDensity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
65        Properties.Cold.Inlet.rho               =       PP.LiquidDensity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
66        Properties.Cold.Outlet.rho              =       PP.LiquidDensity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
67
68"Viscosity Cold Stream"
69        Properties.Cold.Average.Mu              =       PP.LiquidViscosity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
70        Properties.Cold.Inlet.Mu                =       PP.LiquidViscosity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
71        Properties.Cold.Outlet.Mu               =       PP.LiquidViscosity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
72
73"Conductivity Cold Stream"
74        Properties.Cold.Average.K               =       PP.LiquidThermalConductivity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
75        Properties.Cold.Inlet.K                 =       PP.LiquidThermalConductivity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
76        Properties.Cold.Outlet.K                =       PP.LiquidThermalConductivity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
77
78"Heat Capacity Cold Stream"
79        Properties.Cold.Wall.Cp                 =       PP.LiquidCp(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
80       
81"Viscosity Cold Stream"
82        Properties.Cold.Wall.Mu                 =       PP.LiquidViscosity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
83
84"Conductivity Cold Stream"
85        Properties.Cold.Wall.K                  =       PP.LiquidThermalConductivity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
86
87
88        else
89
90"Heat Capacity Cold Stream"
91        Properties.Cold.Average.Cp      =       PP.VapourCp(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
92        Properties.Cold.Inlet.Cp        =       PP.VapourCp(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
93        Properties.Cold.Outlet.Cp       =       PP.VapourCp(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
94
95"Mass Density Cold Stream"
96        Properties.Cold.Average.rho     =       PP.VapourDensity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
97        Properties.Cold.Inlet.rho               =       PP.VapourDensity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
98        Properties.Cold.Outlet.rho              =       PP.VapourDensity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
99
100"Viscosity Cold Stream"
101        Properties.Cold.Average.Mu              =       PP.VapourViscosity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
102        Properties.Cold.Inlet.Mu                =       PP.VapourViscosity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
103        Properties.Cold.Outlet.Mu               =       PP.VapourViscosity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
104
105"Conductivity Cold Stream"
106        Properties.Cold.Average.K               =       PP.VapourThermalConductivity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
107        Properties.Cold.Inlet.K                 =       PP.VapourThermalConductivity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
108        Properties.Cold.Outlet.K                =       PP.VapourThermalConductivity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
109       
110"Heat Capacity Cold Stream"
111        Properties.Cold.Wall.Cp                 =       PP.VapourCp(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
112
113
114"Viscosity Cold Stream"
115        Properties.Cold.Wall.Mu                 =       PP.VapourViscosity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
116
117"Conductivity Cold Stream"
118        Properties.Cold.Wall.K                  =       PP.VapourThermalConductivity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
119       
120       
121       
122end
123
124if Inlet.Hot.v equal 0
125
126        then
127
128"Heat Capacity Hot Stream"
129        Properties.Hot.Average.Cp       =               PP.LiquidCp(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);
130        Properties.Hot.Inlet.Cp         =               PP.LiquidCp(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);
131        Properties.Hot.Outlet.Cp        =               PP.LiquidCp(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);
132
133"Mass Density Hot Stream"
134        Properties.Hot.Average.rho      =               PP.LiquidDensity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);
135        Properties.Hot.Inlet.rho        =               PP.LiquidDensity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);
136        Properties.Hot.Outlet.rho       =               PP.LiquidDensity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);
137
138"Viscosity Hot Stream"
139        Properties.Hot.Average.Mu       =               PP.LiquidViscosity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);     
140        Properties.Hot.Inlet.Mu         =               PP.LiquidViscosity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);       
141        Properties.Hot.Outlet.Mu        =               PP.LiquidViscosity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);     
142
143"Conductivity Hot Stream"
144        Properties.Hot.Average.K        =               PP.LiquidThermalConductivity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);   
145        Properties.Hot.Inlet.K          =               PP.LiquidThermalConductivity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);     
146        Properties.Hot.Outlet.K         =               PP.LiquidThermalConductivity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);   
147
148"Heat Capacity Hot Stream"
149        Properties.Hot.Wall.Cp          =               PP.LiquidCp(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
150
151"Viscosity Hot Stream"
152        Properties.Hot.Wall.Mu          =               PP.LiquidViscosity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);     
153
154"Conductivity Hot Stream"
155        Properties.Hot.Wall.K           =               PP.LiquidThermalConductivity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);   
156       
157
158        else
159
160"Heat Capacity Hot Stream"
161        Properties.Hot.Average.Cp       =               PP.VapourCp(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);
162        Properties.Hot.Inlet.Cp         =               PP.VapourCp(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);
163        Properties.Hot.Outlet.Cp        =               PP.VapourCp(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);
164
165"Mass Density Hot Stream"
166        Properties.Hot.Average.rho      =               PP.VapourDensity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);
167        Properties.Hot.Inlet.rho        =               PP.VapourDensity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);
168        Properties.Hot.Outlet.rho       =               PP.VapourDensity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);
169
170"Viscosity Hot Stream"
171        Properties.Hot.Average.Mu       =               PP.VapourViscosity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);
172        Properties.Hot.Inlet.Mu         =               PP.VapourViscosity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);
173        Properties.Hot.Outlet.Mu        =               PP.VapourViscosity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);
174
175"Conductivity Hot Stream"
176        Properties.Hot.Average.K        =               PP.VapourThermalConductivity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);   
177        Properties.Hot.Inlet.K          =               PP.VapourThermalConductivity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);     
178        Properties.Hot.Outlet.K         =               PP.VapourThermalConductivity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);   
179
180"Heat Capacity Hot Stream"
181        Properties.Hot.Wall.Cp          =               PP.VapourCp(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
182
183"Viscosity Hot Stream"
184        Properties.Hot.Wall.Mu          =               PP.VapourViscosity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
185
186"Conductivity Hot Stream"
187        Properties.Hot.Wall.K           =               PP.VapourThermalConductivity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);   
188
189
190end
191
192#=====================================================================
193#       Thermal Details
194#=====================================================================
195"Hot Stream Heat Capacity"
196        Details.Ch =Inlet.Hot.F*Properties.Hot.Average.Cp;
197       
198"Cold Stream Heat Capacity"
199        Details.Cc =Inlet.Cold.F*Properties.Cold.Average.Cp;
200
201"Minimum Heat Capacity"
202        Details.Cmin  = min([Details.Ch,Details.Cc]);
203
204"Maximum Heat Capacity"
205        Details.Cmax  = max([Details.Ch,Details.Cc]);
206
207"Heat Capacity Ratio"   
208        Details.Cr    = Details.Cmin/Details.Cmax;
209#=====================================================================
210#       Energy Balance
211#=====================================================================
212"Energy Balance Hot Stream"
213        Details.Q = Inlet.Hot.F*(Inlet.Hot.h-Outlet.Hot.h);
214
215"Energy Balance Cold Stream"
216        Details.Q =-Inlet.Cold.F*(Inlet.Cold.h-Outlet.Cold.h);
217
218#=====================================================================
219#       Material Balance
220#=====================================================================
221"Flow Mass Inlet Cold Stream"
222        Properties.Cold.Inlet.Fw        =  sum(M*Inlet.Cold.z)*Inlet.Cold.F;
223
224"Flow Mass Outlet Cold Stream"
225        Properties.Cold.Outlet.Fw       =  sum(M*Outlet.Cold.z)*Outlet.Cold.F;
226
227"Flow Mass Inlet Hot Stream"
228        Properties.Hot.Inlet.Fw         =  sum(M*Inlet.Hot.z)*Inlet.Hot.F;
229
230"Flow Mass Outlet Hot Stream"   
231        Properties.Hot.Outlet.Fw        =  sum(M*Outlet.Hot.z)*Outlet.Hot.F;
232
233"Molar Balance Hot Stream"
234        Inlet.Hot.F  = Outlet.Hot.F;
235       
236"Molar Balance Cold Stream"
237        Inlet.Cold.F = Outlet.Cold.F;
238
239#======================================
240#       Constraints
241#======================================
242"Hot Stream Molar Fraction Constraint"
243        Outlet.Hot.z=Inlet.Hot.z;
244       
245"Cold Stream Molar Fraction Constraint"
246        Outlet.Cold.z=Inlet.Cold.z;
247       
248"No Phase Change In Cold Stream"
249        Inlet.Cold.v=Outlet.Cold.v;
250
251"No Phase Change In Hot Stream"
252        Inlet.Hot.v=Outlet.Hot.v;
253
254#======================================
255#       Pressure Drop
256#======================================
257
258"Pressure Drop Hot Stream"
259        Outlet.Hot.P  = Inlet.Hot.P - PressureDrop.Hot.Pdrop;
260       
261"Pressure Drop Cold Stream"
262        Outlet.Cold.P  = Inlet.Cold.P - PressureDrop.Cold.Pdrop;
263       
264"Fraction of Inlet Pressure : Hot Stream"
265        PressureDrop.Hot.Pdrop  = Inlet.Hot.P*PressureDrop.Hot.FPdrop;
266       
267"Fraction of Inlet Pressure : Cold Stream"
268        PressureDrop.Cold.Pdrop  = Inlet.Cold.P*PressureDrop.Cold.FPdrop;
269       
270       
271end
272
273Model Heatex_Basic_NTU   as HeatExchangerSimplified_Basic
274#=====================================================================
275#       Basic Model for Heat Exchangers - NTU Method
276#=====================================================================
277VARIABLES
278
279Eft       as positive (Brief="Effectiveness",Default=0.05,Lower=1e-8);
280
281EQUATIONS       
282
283"Energy Balance"
284        Details.Q       = Eft*Details.Cmin*(Inlet.Hot.T-Inlet.Cold.T); 
285
286
287end
288
289Model Heatex_Basic_LMTD  as HeatExchangerSimplified_Basic
290#=====================================================================
291#       Basic Model for Heat Exchangers - LMTD Method
292#=====================================================================
293VARIABLES
294
295DT0     as temp_delta   (Brief="Temperature Difference at Inlet",Lower=1);
296DTL             as temp_delta   (Brief="Temperature Difference at Outlet",Lower=1);
297LMTD    as temp_delta   (Brief="Logarithmic Mean Temperature Difference",Lower=1);
298Fc              as positive             (Brief="LMTD Correction Factor",Lower=0.5);
299MTD             as temp_delta   (Brief="Mean Temperature Difference",Lower=1);
300
301EQUATIONS
302#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
303#                       Log Mean Temperature Difference
304#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
305if abs(DT0 - DTL) > 0.05*max(abs([DT0,DTL]))
306       
307        then
308"Log Mean Temperature Difference"
309        LMTD= (DT0-DTL)/ln(DT0/DTL);
310
311        else
312       
313if DT0*DTL equal 0
314       
315        then
316"Log Mean Temperature Difference"
317        LMTD = 0.5*(DT0+DTL);
318       
319        else
320"Log Mean Temperature Difference"
321        LMTD = 0.5*(DT0+DTL)*(1-(DT0-DTL)^2/(DT0*DTL)*(1+(DT0-DTL)^2/(DT0*DTL)/2)/12);
322       
323end
324       
325end
326
327"Exchange Surface Area"
328        Details.Q = Details.U*Details.A*MTD;   
329       
330"Mean Temperature Difference"   
331        MTD   = Fc*LMTD;
332
333end
334
335
336#=====================================================================
337#       Concrete Models for Simplified Heat Exchangers
338#=====================================================================
339
340#=====================================================================
341# LMTD Method
342#=====================================================================
343
344Model HeatExchanger_LMTD        as Heatex_Basic_LMTD
345
346PARAMETERS
347
348        Side as Integer         (Brief="Flow Direction",Lower=0,Upper=1);
349
350SET
351
352Side = HE.FlowDir(); # Return Flow Direction
353
354EQUATIONS
355#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
356#       Flow Direction
357#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
358if Side equal 0
359#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
360#       Cocurrent Flow
361#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#   
362        then
363"Temperature Difference at Inlet"
364        DT0 = Inlet.Hot.T - Inlet.Cold.T;
365
366"Temperature Difference at Outlet"
367        DTL = Outlet.Hot.T - Outlet.Cold.T;
368
369        else
370#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
371#       Counter Flow
372#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#           
373"Temperature Difference at Inlet"
374        DT0 = Inlet.Hot.T - Outlet.Cold.T;
375
376"Temperature Difference at Outlet"
377        DTL = Outlet.Hot.T - Inlet.Cold.T;
378end
379
380end
381
382Model E_Shell_LMTD                      as Heatex_Basic_LMTD       
383#=====================================================================
384#       Shell and Tubes Heat Exchanger with 1 shell pass - LMTD Method
385#===================================================================== 
386EQUATIONS
387"Temperature Difference at Inlet"
388        DT0 = Inlet.Hot.T - Outlet.Cold.T;
389
390"Temperature Difference at Outlet"
391        DTL = Outlet.Hot.T - Inlet.Cold.T;
392       
393"LMTD Correction Factor"
394        Fc = HE.EshellCorrectionFactor(Inlet.Hot.T,Outlet.Hot.T,Inlet.Cold.T,Outlet.Cold.T);
395
396end
397
398Model F_Shell_LMTD              as Heatex_Basic_LMTD
399#=====================================================================
400#       Shell and Tubes Heat Exchanger with 2 shell passes - LMTD Method
401#=====================================================================
402EQUATIONS
403"Temperature Difference at Inlet"
404        DT0 = Inlet.Hot.T - Outlet.Cold.T;
405
406"Temperature Difference at Outlet"
407        DTL = Outlet.Hot.T - Inlet.Cold.T;
408       
409"LMTD Correction Factor"
410        Fc = HE.FshellCorrectionFactor(Inlet.Hot.T,Outlet.Hot.T,Inlet.Cold.T,Outlet.Cold.T);
411
412end
413
414#=====================================================================
415# NTU Method
416#=====================================================================
417
418Model HeatExchanger_NTU         as Heatex_Basic_NTU
419
420EQUATIONS
421"Effectiveness"
422        Eft=HE.Effectiveness(Details.Cr,Details.NTU);
423       
424end
425
426Model E_Shell_NTU                       as Heatex_Basic_NTU
427#=====================================================================
428#       Shell and Tubes Heat Exchanger with 1 shell pass - NTU Method
429#=====================================================================
430EQUATIONS
431"TEMA E Shell Effectiveness"
432        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;
433
434end
435
436Model F_Shell_NTU               as Heatex_Basic_NTU
437#=====================================================================
438#       Shell and Tubes Heat Exchanger with 2 shell passes - NTU Method
439#===================================================================== 
440VARIABLES
441
442Eft1    as positive (Brief="Effectiveness Correction",Lower=0.01,Upper=1,Default=0.5);
443
444EQUATIONS
445
446"Effectiveness Correction"
447        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;
448
449"TEMA F Shell Effectiveness"
450        Eft = ( ((1-Eft1*Details.Cr)/(1-Eft1))^2 -1  )*( ((1-Eft1*Details.Cr)/(1-Eft1))^2 - Details.Cr )^-1;
451
452end
Note: See TracBrowser for help on using the repository browser.