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

Last change on this file since 157 was 157, checked in by Rafael de Pelegrini Soares, 15 years ago

Heat exchangers test

  • Property svn:keywords set to Id
File size: 37.9 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 157 2007-02-07 13:44:17Z rafael $
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
333SET
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
353EQUATIONS
354
355"Exchange Surface Area"
356        Details.A=Pi*DoInner*Lpipe;
357
358
359switch innerFlowRegime
360       
361        case "laminar":
362       
363        Inner.HeatTransfer.fi   = 1/(0.79*ln(Inner.HeatTransfer.Re)-1.64)^2;
364        switch InnerLaminarCorrelation
365       
366        case "Hausen":
367        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));
368       
369        case "Schlunder":
370        Inner.HeatTransfer.Nu = (49.027896+4.173281*Inner.HeatTransfer.Re*Inner.HeatTransfer.PR*(DiInner/Lpipe))^(1/3);
371
372end
373       
374        when Inner.HeatTransfer.Re > 2300 switchto "transition";
375       
376        case "transition":
377       
378        Inner.HeatTransfer.fi   = 1/(0.79*ln(Inner.HeatTransfer.Re)-1.64)^2;
379        switch InnerTransitionCorrelation
380       
381        case "Gnielinski":
382        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;
383
384        case "ESDU":
385        Inner.HeatTransfer.Nu =1;#to be implemented
386       
387end
388
389        when Inner.HeatTransfer.Re < 2300 switchto "laminar";
390        when Inner.HeatTransfer.Re > 10000 switchto "turbulent";
391
392        case "turbulent":
393
394        switch InnerTurbulentCorrelation
395       
396        case "Petukhov":
397        Inner.HeatTransfer.fi   = 1/(1.82*log(Inner.HeatTransfer.Re)-1.64)^2;
398        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;
399       
400        case "SiederTate":
401        Inner.HeatTransfer.Nu = 0.027*(Inner.HeatTransfer.PR)^(1/3)*(Inner.HeatTransfer.Re)^(4/5);
402        Inner.HeatTransfer.fi   = 1/(1.82*log(Inner.HeatTransfer.Re)-1.64)^2;
403       
404end
405       
406        when Inner.HeatTransfer.Re < 10000 switchto "transition";
407       
408end
409
410switch outerFlowRegime
411       
412        case "laminar":
413       
414        Outer.HeatTransfer.fi   = 1/(0.79*ln(Outer.HeatTransfer.Re)-1.64)^2;
415        switch OuterLaminarCorrelation
416       
417        case "Hausen":
418        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));
419       
420        case "Schlunder":
421        Outer.HeatTransfer.Nu = (49.027896+4.173281*Outer.HeatTransfer.Re*Outer.HeatTransfer.PR*(Outer.HeatTransfer.Dh/Lpipe))^(1/3);
422
423end
424       
425        when Outer.HeatTransfer.Re > 2300 switchto "transition";
426       
427        case "transition":
428       
429        switch OuterTransitionCorrelation
430       
431        case "Gnielinski":
432        Outer.HeatTransfer.fi   = 1/(0.79*ln(Outer.HeatTransfer.Re)-1.64)^2;
433        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;
434
435        case "ESDU":
436        Outer.HeatTransfer.Nu =1;#to be implemented
437        Outer.HeatTransfer.fi   = 1/(0.79*ln(Outer.HeatTransfer.Re)-1.64)^2;
438end
439       
440        when Outer.HeatTransfer.Re < 2300 switchto "laminar";
441        when Outer.HeatTransfer.Re > 10000 switchto "turbulent";
442       
443        case "turbulent":
444       
445        switch OuterTurbulentCorrelation
446       
447        case "Petukhov":
448        Outer.HeatTransfer.fi   = 1/(1.82*log(Outer.HeatTransfer.Re)-1.64)^2;
449        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;
450       
451        case "SiederTate":
452        Outer.HeatTransfer.Nu = 0.027*(Outer.HeatTransfer.PR)^(1/3)*(Outer.HeatTransfer.Re)^(4/5);
453        Outer.HeatTransfer.fi   = 1/(1.82*log(Outer.HeatTransfer.Re)-1.64)^2;
454end
455
456        when Outer.HeatTransfer.Re < 10000 switchto "transition";
457
458end
459
460
461switch HotSide
462       
463        case "outer":
464
465"Inner Pipe Film Coefficient"
466        Inner.HeatTransfer.hcoeff = (Inner.HeatTransfer.Nu*Properties.Cold.Average.K/DiInner)*Inner.HeatTransfer.Phi;
467
468"Outer Pipe Film Coefficient"
469        Outer.HeatTransfer.hcoeff= (Outer.HeatTransfer.Nu*Properties.Hot.Average.K/Outer.HeatTransfer.Dh)*Outer.HeatTransfer.Phi;
470
471"Pressure Drop Hot Stream"
472        Outlet.Hot.P  = Inlet.Hot.P - Outer.PressureDrop.Pdrop;
473
474"Pressure Drop Cold Stream"
475        Outlet.Cold.P  = Inlet.Cold.P - Inner.PressureDrop.Pdrop;
476       
477"Outer Pipe Pressure Drop"
478        Outer.PressureDrop.Pdrop = (2*Outer.PressureDrop.fi*Lpipe*Properties.Hot.Average.rho*Outer.HeatTransfer.Vmean^2)/(Outer.PressureDrop.Dh*Outer.HeatTransfer.Phi);
479       
480"Inner Pipe Pressure Drop"
481        Inner.PressureDrop.Pdrop = (2*Inner.PressureDrop.fi*Lpipe*Properties.Cold.Average.rho*Inner.HeatTransfer.Vmean^2)/(DiInner*Inner.HeatTransfer.Phi);
482
483"Outer Pipe Phi correction"
484        Outer.HeatTransfer.Phi = (Properties.Hot.Average.Mu/Properties.Hot.Wall.Mu)^0.14;
485       
486"Inner Pipe Phi correction"
487        Inner.HeatTransfer.Phi  = (Properties.Cold.Average.Mu/Properties.Cold.Wall.Mu)^0.14;
488
489"Outer Pipe Prandtl Number"
490        Outer.HeatTransfer.PR = ((Properties.Hot.Average.Cp/Properties.Hot.Average.Mw)*Properties.Hot.Average.Mu)/Properties.Hot.Average.K;
491
492"Inner Pipe Prandtl Number"
493        Inner.HeatTransfer.PR = ((Properties.Cold.Average.Cp/Properties.Cold.Average.Mw)*Properties.Cold.Average.Mu)/Properties.Cold.Average.K;
494
495"Outer Pipe Reynolds Number for Heat Transfer"
496        Outer.HeatTransfer.Re = (Properties.Hot.Average.rho*Outer.HeatTransfer.Vmean*Outer.HeatTransfer.Dh)/Properties.Hot.Average.Mu;
497
498"Outer Pipe Reynolds Number for Pressure Drop"
499        Outer.PressureDrop.Re = (Properties.Hot.Average.rho*Outer.HeatTransfer.Vmean*Outer.PressureDrop.Dh)/Properties.Hot.Average.Mu;
500
501"Inner Pipe Reynolds Number for Heat Transfer"
502        Inner.HeatTransfer.Re = (Properties.Cold.Average.rho*Inner.HeatTransfer.Vmean*Inner.HeatTransfer.Dh)/Properties.Cold.Average.Mu;
503
504"Inner Pipe Reynolds Number for Pressure Drop"
505        Inner.PressureDrop.Re = Inner.HeatTransfer.Re;
506
507"Outer Pipe Velocity"
508        Outer.HeatTransfer.Vmean*(Outer.HeatTransfer.As*Properties.Hot.Average.rho)  = Properties.Hot.Inlet.Fw;
509
510"Inner Pipe Velocity"
511        Inner.HeatTransfer.Vmean*(Inner.HeatTransfer.As*Properties.Cold.Average.rho)  = Properties.Cold.Inlet.Fw;
512
513        case "inner":
514
515"Outer Pipe Film Coefficient"
516        Outer.HeatTransfer.hcoeff = (Outer.HeatTransfer.Nu*Properties.Cold.Average.K/Outer.HeatTransfer.Dh)*Outer.HeatTransfer.Phi;
517
518"InnerPipe Film Coefficient"
519        Inner.HeatTransfer.hcoeff= (Inner.HeatTransfer.Nu*Properties.Hot.Average.K/DiInner)*Inner.HeatTransfer.Phi;
520
521"Pressure Drop Hot Stream"
522        Outlet.Hot.P  = Inlet.Hot.P - Inner.PressureDrop.Pdrop;
523
524"Pressure Drop Cold Stream"
525        Outlet.Cold.P  = Inlet.Cold.P - Outer.PressureDrop.Pdrop;
526       
527"Outer Pipe Pressure Drop"
528        Outer.PressureDrop.Pdrop = (2*Outer.PressureDrop.fi*Lpipe*Properties.Cold.Average.rho*Outer.HeatTransfer.Vmean^2)/(Outer.PressureDrop.Dh*Outer.HeatTransfer.Phi);
529       
530"Inner Pipe Pressure Drop"
531        Inner.PressureDrop.Pdrop        = (2*Inner.PressureDrop.fi*Lpipe*Properties.Hot.Average.rho*Inner.HeatTransfer.Vmean^2)/(DiInner*Inner.HeatTransfer.Phi);
532
533"Outer Pipe Phi correction"
534        Outer.HeatTransfer.Phi          = (Properties.Cold.Average.Mu/Properties.Cold.Wall.Mu)^0.14;
535       
536"Inner Pipe Phi correction"
537        Inner.HeatTransfer.Phi          = (Properties.Hot.Average.Mu/Properties.Hot.Wall.Mu)^0.14;
538       
539"Outer Pipe Prandtl Number"
540        Outer.HeatTransfer.PR           = ((Properties.Cold.Average.Cp/Properties.Cold.Average.Mw)*Properties.Cold.Average.Mu)/Properties.Cold.Average.K;
541
542"Inner Pipe Prandtl Number"
543        Inner.HeatTransfer.PR           = ((Properties.Hot.Average.Cp/Properties.Hot.Average.Mw)*Properties.Hot.Average.Mu)/Properties.Hot.Average.K;
544
545"Outer Pipe Reynolds Number for Heat Transfer"
546        Outer.HeatTransfer.Re           = (Properties.Cold.Average.rho*Outer.HeatTransfer.Vmean*Outer.HeatTransfer.Dh)/Properties.Cold.Average.Mu;
547
548"Outer Pipe Reynolds Number for Pressure Drop"
549        Outer.PressureDrop.Re           = (Properties.Cold.Average.rho*Outer.HeatTransfer.Vmean*Outer.PressureDrop.Dh)/Properties.Cold.Average.Mu;
550
551"Inner Pipe Reynolds Number for Pressure Drop"
552        Inner.PressureDrop.Re           = Inner.HeatTransfer.Re;
553
554"Inner Pipe Reynolds Number for Heat Transfer"
555        Inner.HeatTransfer.Re           = (Properties.Hot.Average.rho*Inner.HeatTransfer.Vmean*Inner.HeatTransfer.Dh)/Properties.Hot.Average.Mu;
556
557"Outer Pipe Velocity"
558        Outer.HeatTransfer.Vmean*(Outer.HeatTransfer.As*Properties.Cold.Average.rho)= Properties.Cold.Inlet.Fw;
559       
560"Inner Pipe Velocity"
561        Inner.HeatTransfer.Vmean*(Inner.HeatTransfer.As*Properties.Hot.Average.rho)     = Properties.Hot.Inlet.Fw;
562
563end
564
565"Inner Pipe Resistance"
566        Resistances.Rtube*(Inner.HeatTransfer.hcoeff*DiInner) = DoInner;
567       
568"Wall Resistance"
569        Resistances.Rwall*(2*Kwall) = DoInner*ln(DoInner/DiInner);
570
571"Outer Pipe Resistance"
572        Resistances.Rshell*(Outer.HeatTransfer.hcoeff)=1;
573
574"Overall Heat Transfer Coefficient Clean"
575        Details.Uc*(Resistances.Rtube+Resistances.Rwall+Resistances.Rshell)=1;
576
577"Overall Heat Transfer Coefficient Dirty"
578        Details.Ud*(Resistances.Rfi*(DoInner/DiInner) + Resistances.Rfo + Resistances.Rtube + Resistances.Rwall + Resistances.Rshell)=1;
579       
580end
581
582Model DoublePipe_Basic_NTU                      as DoublePipe
583
584ATTRIBUTES
585        Pallete         = false;
586        Brief           = "Basic Model Double Pipe Heat Exchanger - NTU Method";
587        Info            =
588        "write some information";
589       
590VARIABLES
591
592Eft       as positive (Brief="Effectiveness",Default=0.5,Lower=1e-12);
593
594EQUATIONS       
595
596"Energy Balance"
597        Details.Q       = Eft*Details.Cmin*(Inlet.Hot.T-Inlet.Cold.T); 
598
599
600end
601
602Model DoublePipe_Basic_LMTD                     as DoublePipe
603
604ATTRIBUTES
605        Pallete         = false;
606        Brief           = "Basic Model Double Pipe Heat Exchanger - LMTD Method";
607        Info            =
608        "write some information";
609       
610VARIABLES
611
612DT0             as temp_delta   (Brief="Temperature Difference at Inlet",Lower=1);
613DTL             as temp_delta   (Brief="Temperature Difference at Outlet",Lower=1);
614LMTD            as temp_delta   (Brief="Logarithmic Mean Temperature Difference",Lower=1);
615
616EQUATIONS
617#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
618#                       Log Mean Temperature Difference
619#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
620
621if abs(DT0 - DTL) > 0.05*max(abs([DT0,DTL]))
622       
623        then
624"Log Mean Temperature Difference"
625        LMTD*ln(DT0/DTL) = (DT0-DTL);
626
627        else
628       
629if DT0*DTL equal 0
630       
631        then
632"Log Mean Temperature Difference"
633        LMTD = 0.5*(DT0+DTL);
634
635        else
636"Log Mean Temperature Difference"
637        LMTD = 0.5*(DT0+DTL)*(1-(DT0-DTL)^2/(DT0*DTL)*(1+(DT0-DTL)^2/(DT0*DTL)/2)/12);
638       
639end
640       
641end
642
643"Exchange Surface Area"
644        Details.Q = Details.Ud*Pi*DoInner*Lpipe*LMTD;
645
646end
647
648Model DoublePipe_LMTD                                   as DoublePipe_Basic_LMTD
649
650ATTRIBUTES
651        Pallete         = true;
652        Brief           = "Double Pipe Heat Exchanger - LMTD Method";
653        Info            =
654        "write some information";
655
656PARAMETERS
657
658        FlowDirection   as Switcher(Brief="Flow Direction",Valid=["counter","cocurrent"],Default="cocurrent");
659
660EQUATIONS
661
662switch FlowDirection
663
664        case "cocurrent":
665"Temperature Difference at Inlet - Cocurrent Flow"
666        DT0 = Inlet.Hot.T - Inlet.Cold.T;
667
668"Temperature Difference at Outlet - Cocurrent Flow"
669        DTL = Outlet.Hot.T - Outlet.Cold.T;
670
671        case "counter":
672"Temperature Difference at Inlet - Counter Flow"
673        DT0 = Inlet.Hot.T - Outlet.Cold.T;
674
675"Temperature Difference at Outlet - Counter Flow"
676        DTL = Outlet.Hot.T - Inlet.Cold.T;
677end
678       
679end
680
681Model DoublePipe_NTU                            as DoublePipe_Basic_NTU
682
683ATTRIBUTES
684        Pallete         = true;
685        Brief           = "Basic Model Double Pipe Heat Exchanger - NTU Method";
686        Info            =
687        "write some information";
688
689PARAMETERS
690
691        FlowDirection as Switcher(Brief="Flow Direction",Valid=["counter","cocurrent"],Default="cocurrent");
692
693EQUATIONS
694
695if Details.Cr equal 0
696       
697        then   
698"Effectiveness"
699        Eft = 1-exp(-Details.NTU);
700       
701        else
702
703switch  FlowDirection
704
705        case "cocurrent":
706       
707"Effectiveness in Cocurrent Flow"
708        Eft*(1+Details.Cr) = (1-exp(-Details.NTU*(1+Details.Cr)));
709       
710        case "counter":
711
712if Details.Cr equal 1
713       
714        then
715"Effectiveness in Counter Flow"
716        Eft*(1+Details.NTU) = Details.NTU;
717       
718        else
719"Effectiveness in Counter Flow"
720        Eft*(1-Details.Cr*exp(-Details.NTU*(1-Details.Cr))) = (1-exp(-Details.NTU*(1-Details.Cr)));
721       
722end
723
724end
725
726
727end
728
729end
730
731Model Multitubular_Basic
732
733ATTRIBUTES
734        Pallete         = false;
735        Brief           = "Basic Model Multitubular Double Pipe Heat Exchanger";
736        Info            =
737        "write some information";
738       
739PARAMETERS
740
741                Npipe           as Integer                      (Brief="N Pipe in Series",Default=2);
742outer PP                        as Plugin                       (Brief="External Physical Properties");
743                HE                      as Plugin                       (Brief="STHE Calculations",File="heatex");
744                Pi                              as constant             (Brief="Pi Number",Default=3.14159265);
745                Hside       as Integer                  (Brief="Fluid Alocation Flag-Default:Outer",Lower=0,Upper=1);
746                DoInner         as length                       (Brief="Outside Diameter of Inner Pipe",Lower=1e-6);
747                DiInner         as length                       (Brief="Inside Diameter of Inner Pipe",Lower=1e-10);
748                DiOuter         as length                       (Brief="Inside Diameter of Outer pipe",Lower=1e-10);
749                Lpipe                   as length                       (Brief="Effective Tube Length",Lower=0.1);
750                Kwall                   as conductivity         (Brief="Tube Wall Material Thermal Conductivity",Default=1.0);
751
752VARIABLES
753
754Unity(Npipe)  as DoublePipe_Basic;
755
756SET
757        Pi      = 3.14159265;
758        Hside   = HE.FluidAlocation();
759       
760#"Inner Pipe Cross Sectional Area for Flow"
761        Unity.Inner.HeatTransfer.As=Pi*DiInner*DiInner/4;
762       
763#"Outer Pipe Cross Sectional Area for Flow"
764        Unity.Outer.HeatTransfer.As=Pi*(DiOuter*DiOuter-DoInner*DoInner)/4;
765       
766#"Inner Pipe Hydraulic Diameter for Heat Transfer"
767        Unity.Inner.HeatTransfer.Dh=DiInner;
768       
769#"Outer Pipe Hydraulic Diameter for Heat Transfer"
770        Unity.Outer.HeatTransfer.Dh=(DiOuter*DiOuter-DoInner*DoInner)/DoInner;
771
772#"Inner Pipe Hydraulic Diameter for Pressure Drop"
773        Unity.Inner.PressureDrop.Dh=DiInner;
774       
775#"Outer Pipe Hydraulic Diameter for Pressure Drop"
776        Unity.Outer.PressureDrop.Dh=DiOuter-DoInner;
777
778EQUATIONS
779
780for i in [1:Npipe]
781
782"Overall Heat Transfer Coefficient Clean"
783        Unity(i).Details.Uc*(Unity(i).Resistances.Rtube+Unity(i).Resistances.Rwall+Unity(i).Resistances.Rshell)=1;
784
785"Overall Heat Transfer Coefficient Dirty"
786        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;
787
788"Exchange Surface Area"
789        Unity(i).Details.A=Pi*DoInner*Lpipe;
790       
791if Hside equal 1
792       
793        then
794       
795"Pressure Drop Hot Stream"
796        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P - Unity(i).Outer.PressureDrop.Pdrop;
797
798"Pressure Drop Cold Stream"
799        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Inner.PressureDrop.Pdrop;
800       
801"Outer Pipe Film Coefficient"
802        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;
803
804"Inner Pipe Film Coefficient"
805        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;
806
807"Outer Pipe Pressure Drop"
808        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);
809       
810"Inner Pipe Pressure Drop"
811        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);
812
813"Outer Pipe Phi correction"
814        Unity(i).Outer.HeatTransfer.Phi = HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
815       
816"Inner Pipe Phi correction"
817        Unity(i).Inner.HeatTransfer.Phi  = HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
818
819"Outer Pipe Prandtl Number"
820        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;
821
822"Inner Pipe Prandtl Number"
823        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;
824
825"Outer Pipe Reynolds Number for Heat Transfer"
826        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;
827
828"Outer Pipe Reynolds Number for Pressure Drop"
829        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;
830
831"Inner Pipe Reynolds Number for Heat Transfer"
832        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;
833
834"Inner Pipe Reynolds Number for Pressure Drop"
835        Unity(i).Inner.PressureDrop.Re =        Unity(i).Inner.HeatTransfer.Re;
836
837"Outer Pipe Velocity"
838        Unity(i).Outer.HeatTransfer.Vmean  = Unity(i).Properties.Hot.Inlet.Fw/(Unity(i).Outer.HeatTransfer.As*Unity(i).Properties.Hot.Average.rho);
839
840"Inner Pipe Velocity"
841        Unity(i).Inner.HeatTransfer.Vmean  = Unity(i).Properties.Cold.Inlet.Fw/(Unity(i).Inner.HeatTransfer.As*Unity(i).Properties.Cold.Average.rho);
842
843        else
844       
845"Pressure Drop Hot Stream"
846        Unity(i).Outlet.Hot.P  = Unity(i).Inlet.Hot.P - Unity(i).Inner.PressureDrop.Pdrop;
847
848"Pressure Drop Cold Stream"
849        Unity(i).Outlet.Cold.P  = Unity(i).Inlet.Cold.P - Unity(i).Outer.PressureDrop.Pdrop;
850       
851"Inner Pipe Film Coefficient"
852        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;
853
854"Outer Pipe Film Coefficient"
855        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;
856       
857"Outer Pipe Pressure Drop"
858        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);
859       
860"Inner Pipe Pressure Drop"
861        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);
862
863"Outer Pipe Phi correction"
864        Unity(i).Outer.HeatTransfer.Phi         = HE.PhiCorrection(Unity(i).Properties.Cold.Average.Mu,Unity(i).Properties.Cold.Wall.Mu);
865       
866"Inner Pipe Phi correction"
867        Unity(i).Inner.HeatTransfer.Phi         = HE.PhiCorrection(Unity(i).Properties.Hot.Average.Mu,Unity(i).Properties.Hot.Wall.Mu);
868       
869"Outer Pipe Prandtl Number"
870        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;
871
872"Inner Pipe Prandtl Number"
873        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;
874
875"Outer Pipe Reynolds Number for Heat Transfer"
876        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;
877
878"Outer Pipe Reynolds Number for Pressure Drop"
879        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;
880
881"Inner Pipe Reynolds Number for Pressure Drop"
882        Unity(i).Inner.PressureDrop.Re          = Unity(i).Inner.HeatTransfer.Re;
883
884"Inner Pipe Reynolds Number for Heat Transfer"
885        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;
886
887"Outer Pipe Velocity"
888        Unity(i).Outer.HeatTransfer.Vmean       = Unity(i).Properties.Cold.Inlet.Fw/(Unity(i).Outer.HeatTransfer.As*Unity(i).Properties.Cold.Average.rho);
889
890"Inner Pipe Velocity"
891        Unity(i).Inner.HeatTransfer.Vmean       = Unity(i).Properties.Hot.Inlet.Fw/(Unity(i).Inner.HeatTransfer.As*Unity(i).Properties.Hot.Average.rho);
892
893end
894
895"Inner Pipe Resistance"
896        Unity(i).Resistances.Rtube*(Unity(i).Inner.HeatTransfer.hcoeff*DiInner) = DoInner;
897       
898"Wall Resistance"
899        Unity(i).Resistances.Rwall=DoInner*ln(DoInner/DiInner)/(2*Kwall);
900
901"Outer Pipe Resistance"
902        Unity(i).Resistances.Rshell*(Unity(i).Outer.HeatTransfer.hcoeff)=1;
903       
904end
905
906
907end
908
909Model Multitubular_Basic_LMTD           as Multitubular_Basic
910
911ATTRIBUTES
912        Pallete         = false;
913        Brief           = "Basic Model for Multitubular Double Pipe Heat Exchanger- LMTD Method";
914        Info            =
915        "write some information";
916
917VARIABLES
918
919DT0(Npipe)      as temp_delta   (Brief="Temperature Difference at Inlet",Lower=1);
920DTL(Npipe)                      as temp_delta   (Brief="Temperature Difference at Outlet",Lower=1);
921LMTD(Npipe)             as temp_delta   (Brief="Logarithmic Mean Temperature Difference",Lower=1);
922
923EQUATIONS
924#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
925#                       Log Mean Temperature Difference
926#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
927for i in [1:Npipe]
928       
929if abs(DT0(i) - DTL(i)) > 0.05*max(abs([DT0(i),DTL(i)]))
930       
931        then
932"Log Mean Temperature Difference"
933        LMTD(i)= (DT0(i)-DTL(i))/ln(DT0(i)/DTL(i));
934
935        else
936       
937if DT0(i)*DTL(i) equal 0
938       
939        then
940"Log Mean Temperature Difference"
941        LMTD(i) = 0.5*(DT0(i)+DTL(i));
942       
943        else
944"Log Mean Temperature Difference"
945        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);
946       
947end
948       
949end
950
951"Exchange Surface Area"
952        Unity(i).Details.Q = Unity(i).Details.Ud*Unity(i).Details.A*LMTD(i);
953
954end
955
956end
957
958Model Multitubular_Counter_NTU          as Multitubular_Basic
959
960ATTRIBUTES
961        Pallete         = true;
962        Brief           = "Multitubular Double Pipe Heat Exchanger in counter flow - NTU Method";
963        Info            =
964        "write some information";
965       
966VARIABLES
967
968Eft(Npipe)        as positive (Brief="Effectiveness",Default=0.05,Lower=1e-8);
969
970CONNECTIONS
971
972Unity([1:Npipe-1]).Outlet.Hot  to Unity([2:Npipe]).Inlet.Hot;
973Unity([2:Npipe]).Outlet.Cold     to Unity([1:Npipe-1]).Inlet.Cold;
974
975EQUATIONS
976
977for i in [1:Npipe]
978
979if Unity(i).Details.Cr equal 0
980       
981        then   
982"Effectiveness"
983        Eft(i) = 1-exp(-Unity(i).Details.NTU);
984       
985        else
986
987if Unity(i).Details.Cr equal 1
988       
989        then
990"Effectiveness in Counter Flow"
991        Eft(i) = Unity(i).Details.NTU/(1+Unity(i).Details.NTU);
992       
993        else
994"Effectiveness in Counter Flow"
995        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)));
996       
997end
998
999
1000end
1001
1002"Energy Balance"
1003        Unity(i).Details.Q      = Eft(i)*Unity(i).Details.Cmin*(Unity(i).Inlet.Hot.T-Unity(i).Inlet.Cold.T);
1004       
1005end
1006
1007end
1008
1009Model Multitubular_Cocurrent_NTU        as Multitubular_Basic
1010
1011ATTRIBUTES
1012        Pallete         = true;
1013        Brief           = "Multitubular Double Pipe Heat Exchanger in cocurrent flow - NTU Method";
1014        Info            =
1015        "write some information";
1016       
1017VARIABLES
1018
1019Eft(Npipe)        as positive (Brief="Effectiveness",Default=0.05,Lower=1e-8);
1020
1021CONNECTIONS
1022
1023Unity([1:Npipe-1]).Outlet.Hot   to Unity([2:Npipe]).Inlet.Hot;
1024Unity([1:Npipe-1]).Outlet.Cold  to Unity([2:Npipe]).Inlet.Cold;
1025
1026EQUATIONS
1027
1028for i in [1:Npipe]
1029
1030if Unity(i).Details.Cr equal 0
1031       
1032        then   
1033"Effectiveness"
1034        Eft(i) = 1-exp(-Unity(i).Details.NTU);
1035       
1036        else
1037"Effectiveness in Cocurrent Flow"
1038        Eft(i) = (1-exp(-Unity(i).Details.NTU*(1+Unity(i).Details.Cr)))/(1+Unity(i).Details.Cr);
1039
1040end
1041
1042"Energy Balance"
1043        Unity(i).Details.Q      = Eft(i)*Unity(i).Details.Cmin*(Unity(i).Inlet.Hot.T-Unity(i).Inlet.Cold.T);
1044       
1045end
1046
1047end
1048
1049Model Multitubular_Counter_LMTD         as Multitubular_Basic_LMTD
1050
1051ATTRIBUTES
1052        Pallete         = true;
1053        Brief           = "Multitubular Double Pipe Heat Exchanger in counter flow - LMTDMethod";
1054        Info            =
1055        "write some information";
1056       
1057CONNECTIONS
1058
1059Unity([1:Npipe-1]).Outlet.Hot   to Unity([2:Npipe]).Inlet.Hot;
1060Unity([2:Npipe]).Outlet.Cold    to Unity([1:Npipe-1]).Inlet.Cold;
1061
1062EQUATIONS
1063for i in [1:Npipe]
1064       
1065"Temperature Difference at Inlet - Counter Flow"
1066        DT0(i) = Unity(i).Inlet.Hot.T - Unity(i).Outlet.Cold.T;
1067
1068"Temperature Difference at Outlet - Counter Flow"
1069        DTL(i) = Unity(i).Outlet.Hot.T - Unity(i).Inlet.Cold.T;
1070       
1071end
1072
1073end
1074
1075Model Multitubular_Cocurrent_LMTD       as Multitubular_Basic_LMTD
1076
1077ATTRIBUTES
1078        Pallete         = true;
1079        Brief           = "Multitubular Double Pipe Heat Exchanger in cocurrent flow - NTU Method";
1080        Info            =
1081        "write some information";
1082       
1083CONNECTIONS
1084
1085Unity([1:Npipe-1]).Outlet.Hot   to Unity([2:Npipe]).Inlet.Hot;
1086Unity([1:Npipe-1]).Outlet.Cold  to Unity([2:Npipe]).Inlet.Cold;
1087
1088EQUATIONS
1089
1090for i in [1:Npipe]
1091       
1092"Temperature Difference at Inlet - Cocurrent Flow"
1093        DT0(i) = Unity(i).Inlet.Hot.T - Unity(i).Inlet.Cold.T;
1094
1095"Temperature Difference at Outlet - Cocurrent Flow"
1096        DTL(i) = Unity(i).Outlet.Hot.T - Unity(i).Outlet.Cold.T;
1097       
1098end
1099
1100end
Note: See TracBrowser for help on using the repository browser.