source: branches/newlanguage/eml/heat_exchangers/DoublePipe.mso @ 150

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

updated double pipe heat exchanger model: testing switcher

  • Property svn:keywords set to Id
File size: 39.0 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: DoublePipe.mso 150 2007-02-05 20:47:18Z bicca $
18*------------------------------------------------------------------*#
19
20using "HEX_Engine";
21#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
22#       Basic Models for Double Pipe Heat Exchangers
23#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
24
25Model DoublePipe_Basic
26
27ATTRIBUTES
28        Pallete         = false;
29        Brief           = "Double Pipe Basic Equations";
30        Info            =
31        "write some information";
32       
33PARAMETERS
34outer PP                        as Plugin               (Brief="External Physical Properties");
35outer NComp             as Integer      (Brief="Number of Components");
36                M(NComp)        as molweight    (Brief="Component Mol Weight");
37       
38VARIABLES
39
40in      Inlet                   as Inlet_Main_Stream    (Brief="Hot and Cold Inlets");   
41out     Outlet                  as Outlet_Main_Stream   (Brief="Hot and Cold Outlets"); 
42                Properties              as Main_Properties              (Brief="Hot and Cold Properties");       
43                Details                 as Details_Main                 (Brief="Details");
44                Inner                   as Main_DoublePipe              (Brief="Inner Side");
45                Outer                   as Main_DoublePipe              (Brief="Outer Side");
46                Resistances     as Main_Resistances             (Brief="Resistances");
47
48SET
49
50        M  = 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"Cold Stream Wall Temperature"
67        Properties.Cold.Wall.Twall =   0.5*Properties.Hot.Average.T + 0.5*Properties.Cold.Average.T;
68
69"Hot Stream Wall Temperature"
70        Properties.Hot.Wall.Twall =   0.5*Properties.Hot.Average.T + 0.5*Properties.Cold.Average.T;
71
72"Hot Stream Average Molecular Weight"
73        Properties.Hot.Average.Mw = sum(M*Inlet.Hot.z);
74
75"Cold Stream Average Molecular Weight"
76        Properties.Cold.Average.Mw = sum(M*Inlet.Cold.z);
77
78if Inlet.Cold.v equal 0
79        then   
80"Heat Capacity Cold Stream"
81        Properties.Cold.Average.Cp              =       PP.LiquidCp(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
82        Properties.Cold.Inlet.Cp                =       PP.LiquidCp(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
83        Properties.Cold.Outlet.Cp               =       PP.LiquidCp(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
84
85"Mass Density Cold Stream"
86        Properties.Cold.Average.rho     =       PP.LiquidDensity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
87        Properties.Cold.Inlet.rho               =       PP.LiquidDensity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
88        Properties.Cold.Outlet.rho              =       PP.LiquidDensity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
89
90"Viscosity Cold Stream"
91        Properties.Cold.Average.Mu      =       PP.LiquidViscosity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
92        Properties.Cold.Inlet.Mu                =       PP.LiquidViscosity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
93        Properties.Cold.Outlet.Mu               =       PP.LiquidViscosity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
94
95"Conductivity Cold Stream"
96        Properties.Cold.Average.K               =       PP.LiquidThermalConductivity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
97        Properties.Cold.Inlet.K                 =       PP.LiquidThermalConductivity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
98        Properties.Cold.Outlet.K                =       PP.LiquidThermalConductivity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
99
100"Heat Capacity Cold Stream"
101        Properties.Cold.Wall.Cp                 =       PP.LiquidCp(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
102       
103"Viscosity Cold Stream"
104        Properties.Cold.Wall.Mu                 =       PP.LiquidViscosity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
105
106"Conductivity Cold Stream"
107        Properties.Cold.Wall.K                  =       PP.LiquidThermalConductivity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
108
109
110        else
111
112"Heat Capacity Cold Stream"
113        Properties.Cold.Average.Cp      =       PP.VapourCp(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
114        Properties.Cold.Inlet.Cp        =       PP.VapourCp(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
115        Properties.Cold.Outlet.Cp       =       PP.VapourCp(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
116
117"Mass Density Cold Stream"
118        Properties.Cold.Average.rho     =       PP.VapourDensity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
119        Properties.Cold.Inlet.rho               =       PP.VapourDensity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
120        Properties.Cold.Outlet.rho              =       PP.VapourDensity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
121
122"Viscosity Cold Stream"
123        Properties.Cold.Average.Mu              =       PP.VapourViscosity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
124        Properties.Cold.Inlet.Mu                =       PP.VapourViscosity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
125        Properties.Cold.Outlet.Mu               =       PP.VapourViscosity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
126
127"Conductivity Cold Stream"
128        Properties.Cold.Average.K               =       PP.VapourThermalConductivity(Properties.Cold.Average.T,Properties.Cold.Average.P,Inlet.Cold.z);
129        Properties.Cold.Inlet.K                 =       PP.VapourThermalConductivity(Inlet.Cold.T,Inlet.Cold.P,Inlet.Cold.z);
130        Properties.Cold.Outlet.K                =       PP.VapourThermalConductivity(Outlet.Cold.T,Outlet.Cold.P,Outlet.Cold.z);
131       
132"Heat Capacity Cold Stream"
133        Properties.Cold.Wall.Cp                 =       PP.VapourCp(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
134
135
136"Viscosity Cold Stream"
137        Properties.Cold.Wall.Mu                 =       PP.VapourViscosity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
138
139"Conductivity Cold Stream"
140        Properties.Cold.Wall.K                  =       PP.VapourThermalConductivity(Properties.Cold.Wall.Twall,Properties.Cold.Average.P,Inlet.Cold.z);
141       
142       
143       
144end
145
146if Inlet.Hot.v equal 0
147
148        then
149
150"Heat Capacity Hot Stream"
151        Properties.Hot.Average.Cp       =               PP.LiquidCp(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);
152        Properties.Hot.Inlet.Cp         =               PP.LiquidCp(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);
153        Properties.Hot.Outlet.Cp        =               PP.LiquidCp(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);
154
155"Mass Density Hot Stream"
156        Properties.Hot.Average.rho      =               PP.LiquidDensity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);
157        Properties.Hot.Inlet.rho        =               PP.LiquidDensity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);
158        Properties.Hot.Outlet.rho       =               PP.LiquidDensity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);
159
160"Viscosity Hot Stream"
161        Properties.Hot.Average.Mu       =               PP.LiquidViscosity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);     
162        Properties.Hot.Inlet.Mu         =               PP.LiquidViscosity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);       
163        Properties.Hot.Outlet.Mu        =               PP.LiquidViscosity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);     
164
165"Conductivity Hot Stream"
166        Properties.Hot.Average.K        =               PP.LiquidThermalConductivity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);   
167        Properties.Hot.Inlet.K          =               PP.LiquidThermalConductivity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);     
168        Properties.Hot.Outlet.K         =               PP.LiquidThermalConductivity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);   
169
170"Heat Capacity Hot Stream"
171        Properties.Hot.Wall.Cp          =               PP.LiquidCp(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
172
173"Viscosity Hot Stream"
174        Properties.Hot.Wall.Mu          =               PP.LiquidViscosity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);     
175
176"Conductivity Hot Stream"
177        Properties.Hot.Wall.K           =               PP.LiquidThermalConductivity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);   
178       
179
180        else
181
182"Heat Capacity Hot Stream"
183        Properties.Hot.Average.Cp       =               PP.VapourCp(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);
184        Properties.Hot.Inlet.Cp         =               PP.VapourCp(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);
185        Properties.Hot.Outlet.Cp        =               PP.VapourCp(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);
186
187"Mass Density Hot Stream"
188        Properties.Hot.Average.rho      =               PP.VapourDensity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);
189        Properties.Hot.Inlet.rho        =               PP.VapourDensity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);
190        Properties.Hot.Outlet.rho       =               PP.VapourDensity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);
191
192"Viscosity Hot Stream"
193        Properties.Hot.Average.Mu       =               PP.VapourViscosity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);
194        Properties.Hot.Inlet.Mu         =               PP.VapourViscosity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);
195        Properties.Hot.Outlet.Mu        =               PP.VapourViscosity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);
196
197"Conductivity Hot Stream"
198        Properties.Hot.Average.K        =               PP.VapourThermalConductivity(Properties.Hot.Average.T,Properties.Hot.Average.P,Inlet.Hot.z);   
199        Properties.Hot.Inlet.K          =               PP.VapourThermalConductivity(Inlet.Hot.T,Inlet.Hot.P,Inlet.Hot.z);     
200        Properties.Hot.Outlet.K         =               PP.VapourThermalConductivity(Outlet.Hot.T,Outlet.Hot.P,Outlet.Hot.z);   
201
202"Heat Capacity Hot Stream"
203        Properties.Hot.Wall.Cp          =               PP.VapourCp(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
204
205"Viscosity Hot Stream"
206        Properties.Hot.Wall.Mu          =               PP.VapourViscosity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);
207
208"Conductivity Hot Stream"
209        Properties.Hot.Wall.K           =               PP.VapourThermalConductivity(Properties.Hot.Wall.Twall,Properties.Hot.Average.P,Inlet.Hot.z);   
210
211
212end
213
214#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
215#       Thermal Details
216#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
217"Hot Stream Heat Capacity"
218        Details.Ch =Inlet.Hot.F*Properties.Hot.Average.Cp;
219       
220"Cold Stream Heat Capacity"
221        Details.Cc =Inlet.Cold.F*Properties.Cold.Average.Cp;
222
223"Minimum Heat Capacity"
224        Details.Cmin  = min([Details.Ch,Details.Cc]);
225
226"Maximum Heat Capacity"
227        Details.Cmax  = max([Details.Ch,Details.Cc]);
228
229"Heat Capacity Ratio"   
230        Details.Cr*Details.Cmax   = Details.Cmin;
231       
232#--------------------------------------------------------------------
233#       Energy Balance
234#--------------------------------------------------------------------
235
236"Energy Balance Hot Stream"
237        Details.Q = Inlet.Hot.F*(Inlet.Hot.h-Outlet.Hot.h);
238
239"Energy Balance Cold Stream"
240        Details.Q = Inlet.Cold.F*(Outlet.Cold.h - Inlet.Cold.h);
241
242#--------------------------------------------------------------------
243#       Material Balance
244#--------------------------------------------------------------------
245
246"Flow Mass Inlet Cold Stream"
247        Properties.Cold.Inlet.Fw        =  sum(M*Inlet.Cold.z)*Inlet.Cold.F;
248
249"Flow Mass Outlet Cold Stream"
250        Properties.Cold.Outlet.Fw       =  sum(M*Outlet.Cold.z)*Outlet.Cold.F;
251
252"Flow Mass Inlet Hot Stream"
253        Properties.Hot.Inlet.Fw         =  sum(M*Inlet.Hot.z)*Inlet.Hot.F;
254
255"Flow Mass Outlet Hot Stream"   
256        Properties.Hot.Outlet.Fw        =  sum(M*Outlet.Hot.z)*Outlet.Hot.F;
257
258"Molar Balance Hot Stream"
259        Inlet.Hot.F  = Outlet.Hot.F;
260       
261"Molar Balance Cold Stream"
262        Inlet.Cold.F = Outlet.Cold.F;
263
264#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
265#       Constraints
266#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
267"Hot Stream Molar Fraction Constraint"
268        Outlet.Hot.z=Inlet.Hot.z;
269       
270"Cold Stream Molar Fraction Constraint"
271        Outlet.Cold.z=Inlet.Cold.z;
272       
273if Inner.PressureDrop.Re < 2300
274
275        then
276"Inner Side Friction Factor - laminar Flow"
277        Inner.PressureDrop.fi*Inner.PressureDrop.Re = 16;
278
279        else
280"Inner Side Friction Factor - Turbulent Flow"
281        (Inner.PressureDrop.fi-0.0035)*(Inner.PressureDrop.Re^0.42) = 0.264;
282
283end     
284
285
286if Outer.PressureDrop.Re < 2300
287
288        then
289"Inner Side Friction Factor - laminar Flow"
290        Outer.PressureDrop.fi*Outer.PressureDrop.Re = 16;
291
292        else
293"Inner Side Friction Factor - Turbulent Flow"
294        (Outer.PressureDrop.fi - 0.0035)*(Outer.PressureDrop.Re^0.42) = 0.264;
295
296end
297
298end
299
300Model DoublePipe                                        as DoublePipe_Basic
301
302ATTRIBUTES
303        Pallete         = false;
304        Brief           = "Double Pipe";
305        Info            =
306        "write some information";
307       
308PARAMETERS
309
310        HotSide                                                 as Switcher             (Brief="Hot Side in the Exchanger",Valid=["inner","outer"],Default="outer");
311        innerFlowRegime                                 as Switcher             (Brief="Inner Flow Regime ",Valid=["laminar","transition","turbulent"],Default="laminar");
312        outerFlowRegime                                 as Switcher             (Brief="Outer Flow Regime ",Valid=["laminar","transition","turbulent"],Default="laminar");
313
314        InnerLaminarCorrelation         as Switcher             (Brief="Heat Transfer Correlation in Laminar Flow for the Inner Side",Valid=["Hausen","Schlunder"],Default="Hausen");
315        InnerTransitionCorrelation  as Switcher         (Brief="Heat Transfer Correlation in Transition Flow for the Inner Side",Valid=["Gnielinski","ESDU"],Default="Gnielinski");
316        InnerTurbulentCorrelation  as Switcher                  (Brief="Heat Transfer Correlation in Turbulent Flow for the Inner Side",Valid=["Petukhov","SiederTate"],Default="Petukhov");
317
318        OuterLaminarCorrelation         as Switcher             (Brief="Heat Transfer Correlation in Laminar Flow for the Outer Side",Valid=["Hausen","Schlunder"],Default="Hausen");
319        OuterTransitionCorrelation  as Switcher         (Brief="Heat Transfer Correlation in Transition Flow for the OuterSide",Valid=["Gnielinski","ESDU"],Default="Gnielinski");
320        OuterTurbulentCorrelation  as Switcher          (Brief="Heat Transfer Correlation in Turbulent Flow for the Outer Side",Valid=["Petukhov","SiederTate"],Default="Petukhov");
321
322        Pi                                                                      as constant             (Brief="Pi Number",Default=3.14159265);
323        DoInner                                                 as length                       (Brief="Outside Diameter of Inner Pipe",Lower=1e-6);
324        DiInner                                                 as length                       (Brief="Inside Diameter of Inner Pipe",Lower=1e-10);
325        DiOuter                                                 as length                       (Brief="Inside Diameter of Outer pipe",Lower=1e-10);
326        Lpipe                                                           as length                       (Brief="Effective Tube Length",Lower=0.1);
327        Kwall                                                           as conductivity         (Brief="Tube Wall Material Thermal Conductivity",Default=1.0);
328       
329SET
330
331        Pi      = 3.14159265;
332
333EQUATIONS
334
335#"Inner Pipe Cross Sectional Area for Flow"
336        Inner.HeatTransfer.As=Pi*DiInner*DiInner/4;
337       
338#"Outer Pipe Cross Sectional Area for Flow"
339        Outer.HeatTransfer.As=Pi*(DiOuter*DiOuter - DoInner*DoInner)/4;
340       
341#"Inner Pipe Hydraulic Diameter for Heat Transfer"
342        Inner.HeatTransfer.Dh=DiInner;
343       
344#"Outer Pipe Hydraulic Diameter for Heat Transfer"
345        Outer.HeatTransfer.Dh=(DiOuter*DiOuter-DoInner*DoInner)/DoInner;
346
347#"Inner Pipe Hydraulic Diameter for Pressure Drop"
348        Inner.PressureDrop.Dh=DiInner;
349       
350#"Outer Pipe Hydraulic Diameter for Pressure Drop"
351        Outer.PressureDrop.Dh=DiOuter-DoInner;
352
353"Exchange Surface Area"
354        Details.A=Pi*DoInner*Lpipe;
355
356
357switch innerFlowRegime
358       
359        case "laminar":
360       
361        Inner.HeatTransfer.fi   = 1/(0.79*ln(Inner.HeatTransfer.Re)-1.64)^2;
362        switch InnerLaminarCorrelation
363       
364        case "Hausen":
365        Inner.HeatTransfer.Nu = 3.665 + ((0.19*((DiInner/Lpipe)*Inner.HeatTransfer.Re*Inner.HeatTransfer.PR)^0.8)/(1+0.117*((DiInner/Lpipe)*Inner.HeatTransfer.Re*Inner.HeatTransfer.PR)^0.467));
366       
367        case "Schlunder":
368        Inner.HeatTransfer.Nu = (49.027896+4.173281*Inner.HeatTransfer.Re*Inner.HeatTransfer.PR*(DiInner/Lpipe))^(1/3);
369
370end
371       
372        when Inner.HeatTransfer.Re > 2300 switchto "transition";
373       
374        case "transition":
375       
376        Inner.HeatTransfer.fi   = 1/(0.79*ln(Inner.HeatTransfer.Re)-1.64)^2;
377        switch InnerTransitionCorrelation
378       
379        case "Gnielinski":
380        Inner.HeatTransfer.Nu*(1+(12.7*sqrt(0.125*Inner.HeatTransfer.fi)*((Inner.HeatTransfer.PR)^(2/3) -1))) = 0.125*Inner.HeatTransfer.fi*(Inner.HeatTransfer.Re-1000)*Inner.HeatTransfer.PR;
381
382        case "ESDU":
383        Inner.HeatTransfer.Nu =1;#to be implemented
384       
385end
386
387        when Inner.HeatTransfer.Re < 2300 switchto "laminar";
388        when Inner.HeatTransfer.Re > 10000 switchto "turbulent";
389
390        case "turbulent":
391
392        switch InnerTurbulentCorrelation
393       
394        case "Petukhov":
395        Inner.HeatTransfer.fi   = 1/(1.82*log(Inner.HeatTransfer.Re)-1.64)^2;
396        Inner.HeatTransfer.Nu*(1.07+(12.7*sqrt(0.125*Inner.HeatTransfer.fi)*((Inner.HeatTransfer.PR)^(2/3) -1))) = 0.125*Inner.HeatTransfer.fi*Inner.HeatTransfer.Re*Inner.HeatTransfer.PR;
397       
398        case "SiederTate":
399        Inner.HeatTransfer.Nu = 0.027*(Inner.HeatTransfer.PR)^(1/3)*(Inner.HeatTransfer.Re)^(4/5);
400        Inner.HeatTransfer.fi   = 1/(1.82*log(Inner.HeatTransfer.Re)-1.64)^2;
401       
402end
403       
404        when Inner.HeatTransfer.Re < 10000 switchto "transition";
405       
406end
407
408switch outerFlowRegime
409       
410        case "laminar":
411       
412        Outer.HeatTransfer.fi   = 1/(0.79*ln(Outer.HeatTransfer.Re)-1.64)^2;
413        switch OuterLaminarCorrelation
414       
415        case "Hausen":
416        Outer.HeatTransfer.Nu = 3.665 + ((0.19*((Outer.HeatTransfer.Dh/Lpipe)*Outer.HeatTransfer.Re*Outer.HeatTransfer.PR)^0.8)/(1+0.117*((Outer.HeatTransfer.Dh/Lpipe)*Outer.HeatTransfer.Re*Outer.HeatTransfer.PR)^0.467));
417       
418        case "Schlunder":
419        Outer.HeatTransfer.Nu = (49.027896+4.173281*Outer.HeatTransfer.Re*Outer.HeatTransfer.PR*(Outer.HeatTransfer.Dh/Lpipe))^(1/3);
420
421end
422       
423        when Outer.HeatTransfer.Re > 2300 switchto "transition";
424       
425        case "transition":
426       
427        switch OuterTransitionCorrelation
428       
429        case "Gnielinski":
430        Outer.HeatTransfer.fi   = 1/(0.79*ln(Outer.HeatTransfer.Re)-1.64)^2;
431        Outer.HeatTransfer.Nu*(1+(12.7*sqrt(0.125*Outer.HeatTransfer.fi)*((Outer.HeatTransfer.PR)^(2/3) -1))) = 0.125*Outer.HeatTransfer.fi*(Outer.HeatTransfer.Re-1000)*Outer.HeatTransfer.PR;
432
433        case "ESDU":
434        Outer.HeatTransfer.Nu =1;#to be implemented
435        Outer.HeatTransfer.fi   = 1/(0.79*ln(Outer.HeatTransfer.Re)-1.64)^2;
436end
437       
438        when Outer.HeatTransfer.Re < 2300 switchto "laminar";
439        when Outer.HeatTransfer.Re > 10000 switchto "turbulent";
440       
441        case "turbulent":
442       
443        switch OuterTurbulentCorrelation
444       
445        case "Petukhov":
446        Outer.HeatTransfer.fi   = 1/(1.82*log(Outer.HeatTransfer.Re)-1.64)^2;
447        Outer.HeatTransfer.Nu*(1.07+(12.7*sqrt(0.125*Outer.HeatTransfer.fi)*((Outer.HeatTransfer.PR)^(2/3) -1))) = 0.125*Outer.HeatTransfer.fi*Outer.HeatTransfer.Re*Outer.HeatTransfer.PR;
448       
449        case "SiederTate":
450        Outer.HeatTransfer.Nu = 0.027*(Outer.HeatTransfer.PR)^(1/3)*(Outer.HeatTransfer.Re)^(4/5);
451        Outer.HeatTransfer.fi   = 1/(1.82*log(Outer.HeatTransfer.Re)-1.64)^2;
452end
453
454        when Outer.HeatTransfer.Re < 10000 switchto "transition";
455
456end
457
458
459switch HotSide
460       
461        case "outer":
462
463"Inner Pipe Film Coefficient"
464        Inner.HeatTransfer.hcoeff = (Inner.HeatTransfer.Nu*Properties.Cold.Average.K/DiInner)*Inner.HeatTransfer.Phi;
465
466"Outer Pipe Film Coefficient"
467        Outer.HeatTransfer.hcoeff= (Outer.HeatTransfer.Nu*Properties.Hot.Average.K/Outer.HeatTransfer.Dh)*Outer.HeatTransfer.Phi;
468
469"Pressure Drop Hot Stream"
470        Outlet.Hot.P  = Inlet.Hot.P - Outer.PressureDrop.Pdrop;
471
472"Pressure Drop Cold Stream"
473        Outlet.Cold.P  = Inlet.Cold.P - Inner.PressureDrop.Pdrop;
474       
475"Outer Pipe Pressure Drop"
476        Outer.PressureDrop.Pdrop = (2*Outer.PressureDrop.fi*Lpipe*Properties.Hot.Average.rho*Outer.HeatTransfer.Vmean^2)/(Outer.PressureDrop.Dh*Outer.HeatTransfer.Phi);
477       
478"Inner Pipe Pressure Drop"
479        Inner.PressureDrop.Pdrop = (2*Inner.PressureDrop.fi*Lpipe*Properties.Cold.Average.rho*Inner.HeatTransfer.Vmean^2)/(DiInner*Inner.HeatTransfer.Phi);
480
481"Outer Pipe Phi correction"
482        Outer.HeatTransfer.Phi = (Properties.Hot.Average.Mu/Properties.Hot.Wall.Mu)^0.14;
483       
484"Inner Pipe Phi correction"
485        Inner.HeatTransfer.Phi  = (Properties.Cold.Average.Mu/Properties.Cold.Wall.Mu)^0.14;
486
487"Outer Pipe Prandtl Number"
488        Outer.HeatTransfer.PR = ((Properties.Hot.Average.Cp/Properties.Hot.Average.Mw)*Properties.Hot.Average.Mu)/Properties.Hot.Average.K;
489
490"Inner Pipe Prandtl Number"
491        Inner.HeatTransfer.PR = ((Properties.Cold.Average.Cp/Properties.Cold.Average.Mw)*Properties.Cold.Average.Mu)/Properties.Cold.Average.K;
492
493"Outer Pipe Reynolds Number for Heat Transfer"
494        Outer.HeatTransfer.Re = (Properties.Hot.Average.rho*Outer.HeatTransfer.Vmean*Outer.HeatTransfer.Dh)/Properties.Hot.Average.Mu;
495
496"Outer Pipe Reynolds Number for Pressure Drop"
497        Outer.PressureDrop.Re = (Properties.Hot.Average.rho*Outer.HeatTransfer.Vmean*Outer.PressureDrop.Dh)/Properties.Hot.Average.Mu;
498
499"Inner Pipe Reynolds Number for Heat Transfer"
500        Inner.HeatTransfer.Re = (Properties.Cold.Average.rho*Inner.HeatTransfer.Vmean*Inner.HeatTransfer.Dh)/Properties.Cold.Average.Mu;
501
502"Inner Pipe Reynolds Number for Pressure Drop"
503        Inner.PressureDrop.Re = Inner.HeatTransfer.Re;
504
505"Outer Pipe Velocity"
506        Outer.HeatTransfer.Vmean*(Outer.HeatTransfer.As*Properties.Hot.Average.rho)  = Properties.Hot.Inlet.Fw;
507
508"Inner Pipe Velocity"
509        Inner.HeatTransfer.Vmean*(Inner.HeatTransfer.As*Properties.Cold.Average.rho)  = Properties.Cold.Inlet.Fw;
510
511        case "inner":
512
513"Outer Pipe Film Coefficient"
514        Outer.HeatTransfer.hcoeff = (Outer.HeatTransfer.Nu*Properties.Cold.Average.K/Outer.HeatTransfer.Dh)*Outer.HeatTransfer.Phi;
515
516"InnerPipe Film Coefficient"
517        Inner.HeatTransfer.hcoeff= (Inner.HeatTransfer.Nu*Properties.Hot.Average.K/DiInner)*Inner.HeatTransfer.Phi;
518
519"Pressure Drop Hot Stream"
520        Outlet.Hot.P  = Inlet.Hot.P - Inner.PressureDrop.Pdrop;
521
522"Pressure Drop Cold Stream"
523        Outlet.Cold.P  = Inlet.Cold.P - Outer.PressureDrop.Pdrop;
524       
525"Outer Pipe Pressure Drop"
526        Outer.PressureDrop.Pdrop = (2*Outer.PressureDrop.fi*Lpipe*Properties.Cold.Average.rho*Outer.HeatTransfer.Vmean^2)/(Outer.PressureDrop.Dh*Outer.HeatTransfer.Phi);
527       
528"Inner Pipe Pressure Drop"
529        Inner.PressureDrop.Pdrop        = (2*Inner.PressureDrop.fi*Lpipe*Properties.Hot.Average.rho*Inner.HeatTransfer.Vmean^2)/(DiInner*Inner.HeatTransfer.Phi);
530
531"Outer Pipe Phi correction"
532        Outer.HeatTransfer.Phi          = (Properties.Cold.Average.Mu/Properties.Cold.Wall.Mu)^0.14;
533       
534"Inner Pipe Phi correction"
535        Inner.HeatTransfer.Phi          = (Properties.Hot.Average.Mu/Properties.Hot.Wall.Mu)^0.14;
536       
537"Outer Pipe Prandtl Number"
538        Outer.HeatTransfer.PR           = ((Properties.Cold.Average.Cp/Properties.Cold.Average.Mw)*Properties.Cold.Average.Mu)/Properties.Cold.Average.K;
539
540"Inner Pipe Prandtl Number"
541        Inner.HeatTransfer.PR           = ((Properties.Hot.Average.Cp/Properties.Hot.Average.Mw)*Properties.Hot.Average.Mu)/Properties.Hot.Average.K;
542
543"Outer Pipe Reynolds Number for Heat Transfer"
544        Outer.HeatTransfer.Re           = (Properties.Cold.Average.rho*Outer.HeatTransfer.Vmean*Outer.HeatTransfer.Dh)/Properties.Cold.Average.Mu;
545
546"Outer Pipe Reynolds Number for Pressure Drop"
547        Outer.PressureDrop.Re           = (Properties.Cold.Average.rho*Outer.HeatTransfer.Vmean*Outer.PressureDrop.Dh)/Properties.Cold.Average.Mu;
548
549"Inner Pipe Reynolds Number for Pressure Drop"
550        Inner.PressureDrop.Re           = Inner.HeatTransfer.Re;
551
552"Inner Pipe Reynolds Number for Heat Transfer"
553        Inner.HeatTransfer.Re           = (Properties.Hot.Average.rho*Inner.HeatTransfer.Vmean*Inner.HeatTransfer.Dh)/Properties.Hot.Average.Mu;
554
555"Outer Pipe Velocity"
556        Outer.HeatTransfer.Vmean*(Outer.HeatTransfer.As*Properties.Cold.Average.rho)= Properties.Cold.Inlet.Fw;
557       
558"Inner Pipe Velocity"
559        Inner.HeatTransfer.Vmean*(Inner.HeatTransfer.As*Properties.Hot.Average.rho)     = Properties.Hot.Inlet.Fw;
560
561end
562
563"Inner Pipe Resistance"
564        Resistances.Rtube*(Inner.HeatTransfer.hcoeff*DiInner) = DoInner;
565       
566"Wall Resistance"
567        Resistances.Rwall*(2*Kwall) = DoInner*ln(DoInner/DiInner);
568
569"Outer Pipe Resistance"
570        Resistances.Rshell*(Outer.HeatTransfer.hcoeff)=1;
571
572"Overall Heat Transfer Coefficient Clean"
573        Details.Uc*(Resistances.Rtube+Resistances.Rwall+Resistances.Rshell)=1;
574
575"Overall Heat Transfer Coefficient Dirty"
576        Details.Ud*(Resistances.Rfi*(DoInner/DiInner) + Resistances.Rfo + Resistances.Rtube + Resistances.Rwall + Resistances.Rshell)=1;
577       
578end
579
580Model DoublePipe_Basic_NTU                      as DoublePipe
581
582ATTRIBUTES
583        Pallete         = false;
584        Brief           = "Basic Model Double Pipe Heat Exchanger - NTU Method";
585        Info            =
586        "write some information";
587       
588VARIABLES
589
590Eft       as positive (Brief="Effectiveness",Default=0.5,Lower=1e-12);
591
592EQUATIONS       
593
594"Energy Balance"
595        Details.Q       = Eft*Details.Cmin*(Inlet.Hot.T-Inlet.Cold.T); 
596
597
598end
599
600Model DoublePipe_Basic_LMTD                     as DoublePipe
601
602ATTRIBUTES
603        Pallete         = false;
604        Brief           = "Basic Model Double Pipe Heat Exchanger - LMTD Method";
605        Info            =
606        "write some information";
607       
608VARIABLES
609
610DT0             as temp_delta   (Brief="Temperature Difference at Inlet",Lower=1);
611DTL             as temp_delta   (Brief="Temperature Difference at Outlet",Lower=1);
612LMTD            as temp_delta   (Brief="Logarithmic Mean Temperature Difference",Lower=1);
613
614EQUATIONS
615#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
616#                       Log Mean Temperature Difference
617#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
618
619if abs(DT0 - DTL) > 0.05*max(abs([DT0,DTL]))
620       
621        then
622"Log Mean Temperature Difference"
623        LMTD*ln(DT0/DTL) = (DT0-DTL);
624
625        else
626       
627if DT0*DTL equal 0
628       
629        then
630"Log Mean Temperature Difference"
631        LMTD = 0.5*(DT0+DTL);
632
633        else
634"Log Mean Temperature Difference"
635        LMTD = 0.5*(DT0+DTL)*(1-(DT0-DTL)^2/(DT0*DTL)*(1+(DT0-DTL)^2/(DT0*DTL)/2)/12);
636       
637end
638       
639end
640
641"Exchange Surface Area"
642        Details.Q = Details.Ud*Pi*DoInner*Lpipe*LMTD;
643
644end
645
646Model DoublePipe_LMTD                                   as DoublePipe_Basic_LMTD
647
648ATTRIBUTES
649        Pallete         = true;
650        Brief           = "Double Pipe Heat Exchanger - LMTD Method";
651        Info            =
652        "write some information";
653
654PARAMETERS
655
656        FlowDirection   as Switcher(Brief="Flow Direction",Valid=["counter","cocurrent"],Default="cocurrent");
657
658EQUATIONS
659
660switch FlowDirection
661
662        case "cocurrent":
663"Temperature Difference at Inlet - Cocurrent Flow"
664        DT0 = Inlet.Hot.T - Inlet.Cold.T;
665
666"Temperature Difference at Outlet - Cocurrent Flow"
667        DTL = Outlet.Hot.T - Outlet.Cold.T;
668
669        case "counter":
670"Temperature Difference at Inlet - Counter Flow"
671        DT0 = Inlet.Hot.T - Outlet.Cold.T;
672
673"Temperature Difference at Outlet - Counter Flow"
674        DTL = Outlet.Hot.T - Inlet.Cold.T;
675end
676       
677end
678
679Model DoublePipe_NTU                            as DoublePipe_Basic_NTU
680
681ATTRIBUTES
682        Pallete         = true;
683        Brief           = "Basic Model Double Pipe Heat Exchanger - NTU Method";
684        Info            =
685        "write some information";
686
687PARAMETERS
688
689        FlowDirection as Switcher(Brief="Flow Direction",Valid=["counter","cocurrent"],Default="cocurrent");
690
691EQUATIONS
692
693if Details.Cr equal 0
694       
695        then   
696"Effectiveness"
697        Eft = 1-exp(-Details.NTU);
698       
699        else
700
701switch  FlowDirection
702
703        case "cocurrent":
704       
705"Effectiveness in Cocurrent Flow"
706        Eft*(1+Details.Cr) = (1-exp(-Details.NTU*(1+Details.Cr)));
707       
708        case "counter":
709
710if Details.Cr equal 1
711       
712        then
713"Effectiveness in Counter Flow"
714        Eft*(1+Details.NTU) = Details.NTU;
715       
716        else
717"Effectiveness in Counter Flow"
718        Eft*(1-Details.Cr*exp(-Details.NTU*(1-Details.Cr))) = (1-exp(-Details.NTU*(1-Details.Cr)));
719       
720end
721
722end
723
724
725end
726
727end
728
729Model Multitubular_Basic
730
731ATTRIBUTES
732        Pallete         = false;
733        Brief           = "Basic Model Multitubular Double Pipe Heat Exchanger";
734        Info            =
735        "write some information";
736       
737PARAMETERS
738
739                Npipe           as Integer                      (Brief="N Pipe in Series",Default=2);
740outer PP                        as Plugin                       (Brief="External Physical Properties");
741                HE                      as Plugin                       (Brief="STHE Calculations",File="heatex");
742                Pi                              as constant             (Brief="Pi Number",Default=3.14159265);
743                Hside       as Integer                  (Brief="Fluid Alocation Flag-Default:Outer",Lower=0,Upper=1);
744                DoInner         as length                       (Brief="Outside Diameter of Inner Pipe",Lower=1e-6);
745                DiInner         as length                       (Brief="Inside Diameter of Inner Pipe",Lower=1e-10);
746                DiOuter         as length                       (Brief="Inside Diameter of Outer pipe",Lower=1e-10);
747                Lpipe                   as length                       (Brief="Effective Tube Length",Lower=0.1);
748                Kwall                   as conductivity         (Brief="Tube Wall Material Thermal Conductivity",Default=1.0);
749
750VARIABLES
751
752Unity(Npipe)  as DoublePipe_Basic;
753
754SET
755        Pi      = 3.14159265;
756        Hside   = HE.FluidAlocation();
757       
758#"Inner Pipe Cross Sectional Area for Flow"
759        Unity.Inner.HeatTransfer.As=Pi*DiInner*DiInner/4;
760       
761#"Outer Pipe Cross Sectional Area for Flow"
762        Unity.Outer.HeatTransfer.As=Pi*(DiOuter*DiOuter-DoInner*DoInner)/4;
763       
764#"Inner Pipe Hydraulic Diameter for Heat Transfer"
765        Unity.Inner.HeatTransfer.Dh=DiInner;
766       
767#"Outer Pipe Hydraulic Diameter for Heat Transfer"
768        Unity.Outer.HeatTransfer.Dh=(DiOuter*DiOuter-DoInner*DoInner)/DoInner;
769
770#"Inner Pipe Hydraulic Diameter for Pressure Drop"
771        Unity.Inner.PressureDrop.Dh=DiInner;
772       
773#"Outer Pipe Hydraulic Diameter for Pressure Drop"
774        Unity.Outer.PressureDrop.Dh=DiOuter-DoInner;
775
776EQUATIONS
777
778for i in [1:Npipe]
779
780"Overall Heat Transfer Coefficient Clean"
781        Unity(i).Details.Uc*(Unity(i).Resistances.Rtube+Unity(i).Resistances.Rwall+Unity(i).Resistances.Rshell)=1;
782
783"Overall Heat Transfer Coefficient Dirty"
784        Unity(i).Details.Ud*(Unity(i).Resistances.Rfi*(DoInner/DiInner) + Unity(i).Resistances.Rfo + Unity(i).Resistances.Rtube + Unity(i).Resistances.Rwall + Unity(i).Resistances.Rshell)=1;
785
786"Exchange Surface Area"
787        Unity(i).Details.A=Pi*DoInner*Lpipe;
788       
789if Hside equal 1
790       
791        then
792       
793"Pressure Drop Hot Stream"
794        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P - Unity(i).Outer.PressureDrop.Pdrop;
795
796"Pressure Drop Cold Stream"
797        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Inner.PressureDrop.Pdrop;
798       
799"Outer Pipe Film Coefficient"
800        Unity(i).Outer.HeatTransfer.hcoeff= HE.PipeFilmCoeff(Unity(i).Outer.HeatTransfer.Re,Unity(i).Outer.HeatTransfer.PR,Unity(i).Properties.Hot.Average.K,Unity(i).Outer.HeatTransfer.Dh,Lpipe)*Unity(i).Outer.HeatTransfer.Phi;
801
802"Inner Pipe Film Coefficient"
803        Unity(i).Inner.HeatTransfer.hcoeff= HE.PipeFilmCoeff(Unity(i).Inner.HeatTransfer.Re,Unity(i).Inner.HeatTransfer.PR,Unity(i).Properties.Cold.Average.K,DiInner,Lpipe)*Unity(i).Inner.HeatTransfer.Phi;
804
805"Outer Pipe Pressure Drop"
806        Unity(i).Outer.PressureDrop.Pdrop = (2*Unity(i).Outer.PressureDrop.fi*Lpipe*Unity(i).Properties.Hot.Average.rho*Unity(i).Outer.HeatTransfer.Vmean^2)/(Unity(i).Outer.PressureDrop.Dh*Unity(i).Outer.HeatTransfer.Phi);
807       
808"Inner Pipe Pressure Drop"
809        Unity(i).Inner.PressureDrop.Pdrop = (2*Unity(i).Inner.PressureDrop.fi*Lpipe*Unity(i).Properties.Cold.Average.rho*Unity(i).Inner.HeatTransfer.Vmean^2)/(DiInner*Unity(i).Inner.HeatTransfer.Phi);
810
811"Outer Pipe Phi correction"
812        Unity(i).Outer.HeatTransfer.Phi = HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
813       
814"Inner Pipe Phi correction"
815        Unity(i).Inner.HeatTransfer.Phi  = HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
816
817"Outer Pipe Prandtl Number"
818        Unity(i).Outer.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;
819
820"Inner Pipe Prandtl Number"
821        Unity(i).Inner.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;
822
823"Outer Pipe Reynolds Number for Heat Transfer"
824        Unity(i).Outer.HeatTransfer.Re =        (Unity(i).Properties.Hot.Average.rho*Unity(i).Outer.HeatTransfer.Vmean*Unity(i).Outer.HeatTransfer.Dh)/Unity(i).Properties.Hot.Average.Mu;
825
826"Outer Pipe Reynolds Number for Pressure Drop"
827        Unity(i).Outer.PressureDrop.Re =        (Unity(i).Properties.Hot.Average.rho*Unity(i).Outer.HeatTransfer.Vmean*Unity(i).Outer.PressureDrop.Dh)/Unity(i).Properties.Hot.Average.Mu;
828
829"Inner Pipe Reynolds Number for Heat Transfer"
830        Unity(i).Inner.HeatTransfer.Re =        (Unity(i).Properties.Cold.Average.rho*Unity(i).Inner.HeatTransfer.Vmean*Unity(i).Inner.HeatTransfer.Dh)/Unity(i).Properties.Cold.Average.Mu;
831
832"Inner Pipe Reynolds Number for Pressure Drop"
833        Unity(i).Inner.PressureDrop.Re =        Unity(i).Inner.HeatTransfer.Re;
834
835"Outer Pipe Velocity"
836        Unity(i).Outer.HeatTransfer.Vmean  = Unity(i).Properties.Hot.Inlet.Fw/(Unity(i).Outer.HeatTransfer.As*Unity(i).Properties.Hot.Average.rho);
837
838"Inner Pipe Velocity"
839        Unity(i).Inner.HeatTransfer.Vmean  = Unity(i).Properties.Cold.Inlet.Fw/(Unity(i).Inner.HeatTransfer.As*Unity(i).Properties.Cold.Average.rho);
840
841        else
842       
843"Pressure Drop Hot Stream"
844        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P - Unity(i).Inner.PressureDrop.Pdrop;
845
846"Pressure Drop Cold Stream"
847        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Outer.PressureDrop.Pdrop;
848       
849"Inner Pipe Film Coefficient"
850        Unity(i).Inner.HeatTransfer.hcoeff= HE.PipeFilmCoeff(Unity(i).Inner.HeatTransfer.Re,Unity(i).Inner.HeatTransfer.PR,Unity(i).Properties.Hot.Average.K,DiInner,Lpipe)*Unity(i).Inner.HeatTransfer.Phi;
851
852"Outer Pipe Film Coefficient"
853        Unity(i).Outer.HeatTransfer.hcoeff= HE.PipeFilmCoeff(Unity(i).Outer.HeatTransfer.Re,Unity(i).Outer.HeatTransfer.PR,Unity(i).Properties.Cold.Average.K,Unity(i).Outer.HeatTransfer.Dh,Lpipe)*Unity(i).Outer.HeatTransfer.Phi;
854       
855"Outer Pipe Pressure Drop"
856        Unity(i).Outer.PressureDrop.Pdrop = (2*Unity(i).Outer.PressureDrop.fi*Lpipe*Unity(i).Properties.Cold.Average.rho*Unity(i).Outer.HeatTransfer.Vmean^2)/(Unity(i).Outer.PressureDrop.Dh*Unity(i).Outer.HeatTransfer.Phi);
857       
858"Inner Pipe Pressure Drop"
859        Unity(i).Inner.PressureDrop.Pdrop       = (2*Unity(i).Inner.PressureDrop.fi*Lpipe*Unity(i).Properties.Hot.Average.rho*Unity(i).Inner.HeatTransfer.Vmean^2)/(DiInner*Unity(i).Inner.HeatTransfer.Phi);
860
861"Outer Pipe Phi correction"
862        Unity(i).Outer.HeatTransfer.Phi         = HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
863       
864"Inner Pipe Phi correction"
865        Unity(i).Inner.HeatTransfer.Phi         = HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
866       
867"Outer Pipe Prandtl Number"
868        Unity(i).Outer.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;
869
870"Inner Pipe Prandtl Number"
871        Unity(i).Inner.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;
872
873"Outer Pipe Reynolds Number for Heat Transfer"
874        Unity(i).Outer.HeatTransfer.Re          = (Unity(i).Properties.Cold.Average.rho*Unity(i).Outer.HeatTransfer.Vmean*Unity(i).Outer.HeatTransfer.Dh)/Unity(i).Properties.Cold.Average.Mu;
875
876"Outer Pipe Reynolds Number for Pressure Drop"
877        Unity(i).Outer.PressureDrop.Re          = (Unity(i).Properties.Cold.Average.rho*Unity(i).Outer.HeatTransfer.Vmean*Unity(i).Outer.PressureDrop.Dh)/Unity(i).Properties.Cold.Average.Mu;
878
879"Inner Pipe Reynolds Number for Pressure Drop"
880        Unity(i).Inner.PressureDrop.Re          = Unity(i).Inner.HeatTransfer.Re;
881
882"Inner Pipe Reynolds Number for Heat Transfer"
883        Unity(i).Inner.HeatTransfer.Re          = (Unity(i).Properties.Hot.Average.rho*Unity(i).Inner.HeatTransfer.Vmean*Unity(i).Inner.HeatTransfer.Dh)/Unity(i).Properties.Hot.Average.Mu;
884
885"Outer Pipe Velocity"
886        Unity(i).Outer.HeatTransfer.Vmean       = Unity(i).Properties.Cold.Inlet.Fw/(Unity(i).Outer.HeatTransfer.As*Unity(i).Properties.Cold.Average.rho);
887
888"Inner Pipe Velocity"
889        Unity(i).Inner.HeatTransfer.Vmean       = Unity(i).Properties.Hot.Inlet.Fw/(Unity(i).Inner.HeatTransfer.As*Unity(i).Properties.Hot.Average.rho);
890
891end
892
893"Inner Pipe Resistance"
894        Unity(i).Resistances.Rtube*(Unity(i).Inner.HeatTransfer.hcoeff*DiInner) = DoInner;
895       
896"Wall Resistance"
897        Unity(i).Resistances.Rwall=DoInner*ln(DoInner/DiInner)/(2*Kwall);
898
899"Outer Pipe Resistance"
900        Unity(i).Resistances.Rshell*(Unity(i).Outer.HeatTransfer.hcoeff)=1;
901       
902end
903
904
905end
906
907Model Multitubular_Basic_LMTD           as Multitubular_Basic
908
909ATTRIBUTES
910        Pallete         = false;
911        Brief           = "Basic Model for Multitubular Double Pipe Heat Exchanger- LMTD Method";
912        Info            =
913        "write some information";
914
915VARIABLES
916
917DT0(Npipe)      as temp_delta   (Brief="Temperature Difference at Inlet",Lower=1);
918DTL(Npipe)                      as temp_delta   (Brief="Temperature Difference at Outlet",Lower=1);
919LMTD(Npipe)             as temp_delta   (Brief="Logarithmic Mean Temperature Difference",Lower=1);
920
921EQUATIONS
922#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
923#                       Log Mean Temperature Difference
924#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
925for i in [1:Npipe]
926       
927if abs(DT0(i) - DTL(i)) > 0.05*max(abs([DT0(i),DTL(i)]))
928       
929        then
930"Log Mean Temperature Difference"
931        LMTD(i)= (DT0(i)-DTL(i))/ln(DT0(i)/DTL(i));
932
933        else
934       
935if DT0(i)*DTL(i) equal 0
936       
937        then
938"Log Mean Temperature Difference"
939        LMTD(i) = 0.5*(DT0(i)+DTL(i));
940       
941        else
942"Log Mean Temperature Difference"
943        LMTD(i) = 0.5*(DT0(i)+DTL(i))*(1-(DT0(i)-DTL(i))^2/(DT0(i)*DTL(i))*(1+(DT0(i)-DTL(i))^2/(DT0(i)*DTL(i))/2)/12);
944       
945end
946       
947end
948
949"Exchange Surface Area"
950        Unity(i).Details.Q = Unity(i).Details.Ud*Unity(i).Details.A*LMTD(i);
951
952end
953
954end
955
956Model Multitubular_Counter_NTU          as Multitubular_Basic
957
958ATTRIBUTES
959        Pallete         = true;
960        Brief           = "Multitubular Double Pipe Heat Exchanger in counter flow - NTU Method";
961        Info            =
962        "write some information";
963       
964VARIABLES
965
966Eft(Npipe)        as positive (Brief="Effectiveness",Default=0.05,Lower=1e-8);
967
968CONNECTIONS
969
970Unity([1:Npipe-1]).Outlet.Hot   to Unity([2:Npipe]).Inlet.Hot;
971Unity([2:Npipe]).Outlet.Cold    to Unity([1:Npipe-1]).Inlet.Cold;
972
973EQUATIONS
974
975for i in [1:Npipe]
976
977if Unity(i).Details.Cr equal 0
978       
979        then   
980"Effectiveness"
981        Eft(i) = 1-exp(-Unity(i).Details.NTU);
982       
983        else
984
985if Unity(i).Details.Cr equal 1
986       
987        then
988"Effectiveness in Counter Flow"
989        Eft(i) = Unity(i).Details.NTU/(1+Unity(i).Details.NTU);
990       
991        else
992"Effectiveness in Counter Flow"
993        Eft(i)*(1-Unity(i).Details.Cr*exp(-Unity(i).Details.NTU*(1-Unity(i).Details.Cr))) = (1-exp(-Unity(i).Details.NTU*(1-Unity(i).Details.Cr)));
994       
995end
996
997
998end
999
1000"Energy Balance"
1001        Unity(i).Details.Q      = Eft(i)*Unity(i).Details.Cmin*(Unity(i).Inlet.Hot.T-Unity(i).Inlet.Cold.T);
1002       
1003end
1004
1005end
1006
1007Model Multitubular_Cocurrent_NTU        as Multitubular_Basic
1008
1009ATTRIBUTES
1010        Pallete         = true;
1011        Brief           = "Multitubular Double Pipe Heat Exchanger in cocurrent flow - NTU Method";
1012        Info            =
1013        "write some information";
1014       
1015VARIABLES
1016
1017Eft(Npipe)        as positive (Brief="Effectiveness",Default=0.05,Lower=1e-8);
1018
1019CONNECTIONS
1020
1021Unity([1:Npipe-1]).Outlet.Hot   to Unity([2:Npipe]).Inlet.Hot;
1022Unity([1:Npipe-1]).Outlet.Cold  to Unity([2:Npipe]).Inlet.Cold;
1023
1024EQUATIONS
1025
1026for i in [1:Npipe]
1027
1028if Unity(i).Details.Cr equal 0
1029       
1030        then   
1031"Effectiveness"
1032        Eft(i) = 1-exp(-Unity(i).Details.NTU);
1033       
1034        else
1035"Effectiveness in Cocurrent Flow"
1036        Eft(i) = (1-exp(-Unity(i).Details.NTU*(1+Unity(i).Details.Cr)))/(1+Unity(i).Details.Cr);
1037
1038end
1039
1040"Energy Balance"
1041        Unity(i).Details.Q      = Eft(i)*Unity(i).Details.Cmin*(Unity(i).Inlet.Hot.T-Unity(i).Inlet.Cold.T);
1042       
1043end
1044
1045end
1046
1047Model Multitubular_Counter_LMTD         as Multitubular_Basic_LMTD
1048
1049ATTRIBUTES
1050        Pallete         = true;
1051        Brief           = "Multitubular Double Pipe Heat Exchanger in counter flow - LMTDMethod";
1052        Info            =
1053        "write some information";
1054       
1055CONNECTIONS
1056
1057Unity([1:Npipe-1]).Outlet.Hot   to Unity([2:Npipe]).Inlet.Hot;
1058Unity([2:Npipe]).Outlet.Cold    to Unity([1:Npipe-1]).Inlet.Cold;
1059
1060EQUATIONS
1061for i in [1:Npipe]
1062       
1063"Temperature Difference at Inlet - Counter Flow"
1064        DT0(i) = Unity(i).Inlet.Hot.T - Unity(i).Outlet.Cold.T;
1065
1066"Temperature Difference at Outlet - Counter Flow"
1067        DTL(i) = Unity(i).Outlet.Hot.T - Unity(i).Inlet.Cold.T;
1068       
1069end
1070
1071end
1072
1073Model Multitubular_Cocurrent_LMTD       as Multitubular_Basic_LMTD
1074
1075ATTRIBUTES
1076        Pallete         = true;
1077        Brief           = "Multitubular Double Pipe Heat Exchanger in cocurrent flow - NTU Method";
1078        Info            =
1079        "write some information";
1080       
1081CONNECTIONS
1082
1083Unity([1:Npipe-1]).Outlet.Hot   to Unity([2:Npipe]).Inlet.Hot;
1084Unity([1:Npipe-1]).Outlet.Cold  to Unity([2:Npipe]).Inlet.Cold;
1085
1086EQUATIONS
1087
1088for i in [1:Npipe]
1089       
1090"Temperature Difference at Inlet - Cocurrent Flow"
1091        DT0(i) = Unity(i).Inlet.Hot.T - Unity(i).Inlet.Cold.T;
1092
1093"Temperature Difference at Outlet - Cocurrent Flow"
1094        DTL(i) = Unity(i).Outlet.Hot.T - Unity(i).Outlet.Cold.T;
1095       
1096end
1097
1098end
Note: See TracBrowser for help on using the repository browser.