source: branches/tests/eml/heat_exchangers/HairpinIncr.mso @ 447

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

Updated hairpin heat exchanger with incremental approach (final testing)

File size: 47.4 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* Author: Gerson Balbueno Bicca
16* $Id: HairpinIncr.mso                                                          $
17*------------------------------------------------------------------*#
18
19using "streams";
20
21Model Properties_Average
22       
23ATTRIBUTES
24        Pallete = false;
25        Brief = "Average incremental physical properties of the streams.";
26        Info =
27        "to be documented.";
28
29PARAMETERS
30
31outer N                         as Integer      (Brief="Number of zones", Default = 2);
32
33VARIABLES
34        Mw                              as molweight                    (Brief="Average Mol Weight",Default=75, Lower=1, Upper=1e8);
35        T(N)                            as temperature          (Brief="Average  Incremental Temperature",Lower=50);
36        P(N)                            as pressure                     (Brief="Average  Incremental Pressure",Default=1, Lower=1e-10, Upper=2e4, DisplayUnit='kPa');
37        rho(N)                  as dens_mass                    (Brief="Stream Incremental Density" ,Default=1000, Lower=1e-3, Upper=5e5, Symbol = "\rho");
38        Mu(N)                   as viscosity                            (Brief="Stream Incremental Viscosity",Lower=0.0001, Symbol = "\mu");
39        Cp(N)                   as cp_mol                               (Brief="Stream Incremental Molar Heat Capacity", Upper=1e10);
40        K(N)                            as conductivity                 (Brief="Stream Incremental Thermal Conductivity", Default=1.0, Lower=1e-5, Upper=500);
41
42end
43
44Model Properties_In_Out
45       
46ATTRIBUTES
47        Pallete = false;
48        Brief = "Inlet and outlet physical properties of the streams.";
49        Info =
50        "to be documented.";
51       
52VARIABLES
53Fw              as flow_mass            (Brief="Stream Mass Flow");
54rho             as dens_mass            (Brief="Stream Density" ,Default=1000, Lower=1e-3, Upper=5e5, Symbol = "\rho");
55end
56
57Model Properties_Wall
58       
59ATTRIBUTES
60        Pallete = false;
61        Brief = "Incremental Physical properties of the streams at wall temperature.";
62        Info =
63        "to be documented.";
64
65PARAMETERS
66
67outer N                         as Integer      (Brief="Number of zones", Default = 2);
68
69VARIABLES
70        Mu(N)                   as viscosity                    (Brief="Stream Incremental Viscosity",Default=1, Lower=1e-5, Upper=1e5, Symbol = "\mu");
71        Twall(N)        as temperature  (Brief="Incremental Wall Temperature",Lower=50);
72
73end
74
75Model Physical_Properties
76       
77ATTRIBUTES
78        Pallete = false;
79        Brief = "to be documented";
80        Info =
81        "to be documented";
82       
83VARIABLES
84        Inlet                   as Properties_In_Out    (Brief="Properties at Inlet Stream", Symbol = "^{in}");
85        Average                 as Properties_Average   (Brief="Properties at Average Temperature", Symbol = "^{avg}");
86        Outlet          as Properties_In_Out            (Brief="Properties at Outlet Stream", Symbol = "^{out}");
87        Wall                            as Properties_Wall                      (Brief="Properties at Wall Temperature", Symbol = "^{wall}");
88
89end
90
91Model Details_Main
92       
93ATTRIBUTES
94        Pallete = false;
95        Brief = "to be documented";
96        Info =
97        "to be documented";
98
99PARAMETERS
100
101outer N                         as Integer      (Brief="Number of zones", Default = 2);
102
103VARIABLES
104        A                               as area                                                 (Brief="Total Exchange Surface Area");
105        Q(N)            as power                                                        (Brief="Incremental Duty", Default=7000, Lower=1e-8, Upper=1e10);
106        Qtotal          as power                                                        (Brief="Total Duty", Default=7000, Lower=1e-8, Upper=1e10);
107        #Uc(N)          as heat_trans_coeff             (Brief="Incremental Overall Heat Transfer Coefficient Clean",Default=1,Lower=1e-6,Upper=1e10);
108        Uc              as heat_trans_coeff             (Brief="Incremental Overall Heat Transfer Coefficient Clean",Default=1,Lower=1e-6,Upper=1e10);
109        Ud(N)           as heat_trans_coeff             (Brief="Incremental Overall Heat Transfer Coefficient Dirty",Default=1,Lower=1e-6,Upper=1e10);
110
111end
112
113Model Hairpin_HeatTransfer
114       
115ATTRIBUTES
116        Pallete = false;
117        Brief = "to be documented";
118        Info =
119        "to be documented";
120
121PARAMETERS
122
123As                      as area                 (Brief="Cross Sectional Area for Flow",Default=0.05,Lower=1e-8);
124Dh                      as length               (Brief="Hydraulic Diameter of Pipe for Heat Transfer",Lower=1e-8);
125outer N                         as Integer      (Brief="Number of zones", Default = 2);
126outer Npoints           as Integer      (Brief="Number of incremental points", Default = 3);
127
128VARIABLES
129
130Tlocal(Npoints)         as temperature                          (Brief="Incremental Local  Temperature",Lower=50);
131Re(N)                           as positive                                     (Brief="Incremental Reynolds Number",Default=100,Lower=1);
132hcoeff(N)                       as heat_trans_coeff             (Brief="Incremental Film Coefficient",Default=1,Lower=1e-12, Upper=1e6, DisplayUnit = 'W/m^2/K');
133fi(N)                           as fricfactor                                   (Brief="Incremental Friction Factor", Default=0.05, Lower=1e-10, Upper=2000);
134Nu(N)                           as positive                                     (Brief="Incremental Nusselt Number",Default=0.5,Lower=1e-8);
135PR(N)                           as positive                                     (Brief="Incremental Prandtl Number",Default=0.5,Lower=1e-8);
136Phi(N)                          as positive                                     (Brief="Incremental Phi Correction",Default=1,Lower=1e-3);
137Vmean(N)                as velocity                                     (Brief="Incremental Tube Velocity",Lower=1e-8);
138Enth(Npoints)           as enth_mol                             (Brief="Incremental Stream Enthalpy");
139
140end
141
142Model Hairpin_PressureDrop
143       
144ATTRIBUTES
145        Pallete = false;
146        Brief = "to be documented";
147        Info =
148        "to be documented";
149       
150PARAMETERS
151
152Dh                      as length               (Brief="Hydraulic Diameter of Pipe for Pressure Drop",Lower=1e-6);
153outer N                         as Integer      (Brief="Number of zones", Default = 2);
154outer Npoints           as Integer      (Brief="Number of incremental points", Default = 3);
155
156VARIABLES
157
158Plocal(Npoints)         as pressure             (Brief="Incremental Local  Pressure",Default=1, Lower=1e-10, Upper=2e4, DisplayUnit='kPa');
159#Pdrop                                          as press_delta  (Brief="Total Pressure Drop",Default=0.01, Lower=0,DisplayUnit='kPa', Symbol ="\Delta P");
160#Pd_fric(Npoints)               as press_delta  (Brief="Incremental Pressure Drop for friction",Default=0.01, Lower=0,DisplayUnit='kPa', Symbol ="\Delta P_{fric}");
161fi(N)                                           as fricfactor           (Brief="Incremental Friction Factor", Default=0.05, Lower=1e-10, Upper=2000);
162Re(N)                                           as positive                     (Brief="Incremental Reynolds Number",Default=100,Lower=1);
163#Pdnozzle_in            as press_delta          (Brief="Inlet Nozzle Pressure Drop",Default=0.01, Lower=0,DisplayUnit='kPa');
164#Pdnozzle_out           as press_delta          (Brief="Outlet Nozzle Pressure Drop",Default=0.01, Lower=0,DisplayUnit='kPa');
165#Vnozzle_in             as velocity                     (Brief="Inlet Nozzle Velocity",Default=1, Upper=1e5, Lower=0);
166#Vnozzle_out            as velocity                     (Brief="Outlet Nozzle Velocity",Default=1, Upper=1e5, Lower=0);
167#RVsquare_in            as positive                     (Brief = "Inlet Nozzle rho-V^2", Default=1, Upper=1e6, Unit = 'kg/s^2/m');
168#RVsquare_out           as positive                     (Brief = "Outlet Nozzle rho-V^2", Default=1, Upper=1e6, Unit = 'kg/s^2/m');
169end     
170
171Model Main_Hairpin
172       
173ATTRIBUTES
174        Pallete = false;
175        Brief = "to be documented";
176        Info =
177        "to be documented";
178       
179VARIABLES
180
181HeatTransfer    as Hairpin_HeatTransfer         (Brief="Double Pipe Heat Transfer");
182PressureDrop    as Hairpin_PressureDrop         (Brief="Double Pipe Pressure Drop");
183Properties              as Physical_Properties                          (Brief="Double Pipe Properties");
184
185end
186
187Model HairpinIncr_basic
188
189ATTRIBUTES
190        Pallete         = false;
191        Brief           = "Incremental Hairpin Heat Exchanger. ";
192        Info            =
193"Incremental approach for Hairpin heat exchanger. ";
194
195PARAMETERS
196
197outer PP                        as Plugin               (Brief="External Physical Properties", Type="PP");
198outer NComp     as Integer      (Brief="Number of Components");
199outer   N                                       as Integer      (Brief="Number of zones", Default = 2);
200 Npoints                        as Integer      (Brief="Number of incremental points", Default = 3);
201       
202        M(NComp)        as molweight    (Brief="Component Mol Weight");
203       
204        #HotSide                                        as Switcher     (Brief="Flag for Fluid Alocation ",Valid=["outer","inner"],Default="outer");
205        innerFlowRegime         as Switcher     (Brief="Inner Flow Regime ",Valid=["laminar","transition","turbulent"],Default="laminar");
206        outerFlowRegime         as Switcher     (Brief="Outer Flow Regime ",Valid=["laminar","transition","turbulent"],Default="laminar");
207
208        InnerLaminarCorrelation         as Switcher     (Brief="Heat Transfer Correlation in Laminar Flow for the Inner Side",Valid=["Hausen","Schlunder"],Default="Hausen");
209        InnerTransitionCorrelation      as Switcher     (Brief="Heat Transfer Correlation in Transition Flow for the Inner Side",Valid=["Gnielinski","Hausen"],Default="Gnielinski");
210        InnerTurbulentCorrelation   as Switcher         (Brief="Heat Transfer Correlation in Turbulent Flow for the Inner Side",Valid=["Petukhov","SiederTate"],Default="Petukhov");
211
212        OuterLaminarCorrelation         as Switcher     (Brief="Heat Transfer Correlation in Laminar Flow for the Outer Side",Valid=["Hausen","Schlunder"],Default="Hausen");
213        OuterTransitionCorrelation  as Switcher         (Brief="Heat Transfer Correlation in Transition Flow for the OuterSide",Valid=["Gnielinski","Hausen"],Default="Gnielinski");
214        OuterTurbulentCorrelation   as Switcher (Brief="Heat Transfer Correlation in Turbulent Flow for the Outer Side",Valid=["Petukhov","SiederTate"],Default="Petukhov");
215
216        Pi                              as constant             (Brief="Pi Number",Default=3.14159265, Symbol = "\pi");
217       
218outer   DoInner         as length                       (Brief="Outside Diameter of Inner Pipe",Lower=1e-6);
219outer   DiInner         as length                       (Brief="Inside Diameter of Inner Pipe",Lower=1e-10);
220outer   DiOuter         as length                       (Brief="Inside Diameter of Outer pipe",Lower=1e-10);
221outer   Lpipe           as length                       (Brief="Effective Tube Length of one segment of Pipe",Lower=0.1, Symbol = "L_{pipe}");
222outer   Kwall           as conductivity         (Brief="Tube Wall Material Thermal Conductivity",Default=1.0, Symbol = "K_{wall}");
223outer   Rfi                     as positive             (Brief="Inside Fouling Resistance",Unit='m^2*K/kW',Default=1e-6,Lower=0);
224outer   Rfo                     as positive             (Brief="Outside Fouling Resistance",Unit='m^2*K/kW',Default=1e-6,Lower=0);
225
226#outer  Donozzle_Inner  as length       (Brief="Inner Side Outlet Nozzle Diameter",Default = 0.036,Lower=10e-6);
227#outer  Dinozzle_Inner          as length       (Brief="Inner Side Inlet Nozzle Diameter",Default = 0.036,Lower=10e-6);
228
229#outer  Donozzle_Outer  as length               (Brief="Outer Side Outlet Nozzle Diameter",Default = 0.036,Lower=10e-6);
230#outer  Dinozzle_Outer  as length               (Brief="Outer Side Inlet Nozzle Diameter",Default = 0.036,Lower=10e-6);
231
232VARIABLES
233
234in  InletInner          as stream               (Brief="Inlet Inner Stream", PosX=0, PosY=0.5225, Symbol="_{inInner}");
235in  InletOuter          as stream               (Brief="Inlet Outer Stream", PosX=0.2805, PosY=0, Symbol="_{inOuter}");
236
237out OutletInner         as streamPH     (Brief="Outlet Inner Stream", PosX=1, PosY=0.5225, Symbol="_{outInner}");
238out OutletOuter         as streamPH     (Brief="Outlet Outer Stream", PosX=0.7264, PosY=1, Symbol="_{outOuter}");
239
240        Details         as Details_Main         (Brief="Some Details in the Heat Exchanger", Symbol=" ");
241        Inner           as Main_Hairpin         (Brief="Inner Side of the Heat Exchanger", Symbol="_{Inner}");
242        Outer           as Main_Hairpin         (Brief="Outer Side of the Heat Exchanger", Symbol="_{Outer}");
243
244        Lincr(Npoints)          as length               (Brief = "Incremental Tube Length", Symbol = "L_{incr}");
245
246SET
247
248#"Number of incremental points"
249        Npoints  = N+1;
250
251#"Component Molecular Weight"
252        M  = PP.MolecularWeight();
253
254#"Pi Number"
255        Pi      = 3.14159265;
256
257#"Inner Pipe Cross Sectional Area for Flow"
258        Inner.HeatTransfer.As=0.25*Pi*DiInner*DiInner;
259
260#"Outer Pipe Cross Sectional Area for Flow"
261        Outer.HeatTransfer.As=0.25*Pi*(DiOuter*DiOuter - DoInner*DoInner);
262
263#"Inner Pipe Hydraulic Diameter for Heat Transfer"
264        Inner.HeatTransfer.Dh=DiInner;
265       
266#"Outer Pipe Hydraulic Diameter for Heat Transfer"
267        Outer.HeatTransfer.Dh=(DiOuter*DiOuter-DoInner*DoInner)/DoInner;
268
269#"Inner Pipe Hydraulic Diameter for Pressure Drop"
270        Inner.PressureDrop.Dh=DiInner;
271       
272#"Outer Pipe Hydraulic Diameter for Pressure Drop"
273        Outer.PressureDrop.Dh=DiOuter-DoInner;
274
275EQUATIONS
276
277"Outer  Stream Average Temperature"
278        Outer.Properties.Average.T(1:N) = 0.5*Outer.HeatTransfer.Tlocal(1:N) + 0.5*Outer.HeatTransfer.Tlocal(2:Npoints);
279
280"Inner Stream Average Temperature"
281        Inner.Properties.Average.T(1:N)  = 0.5*Inner.HeatTransfer.Tlocal(1:N) + 0.5*Inner.HeatTransfer.Tlocal(2:Npoints);
282       
283"Outer Stream Average Pressure"
284        Outer.Properties.Average.P(1:N) = 0.5*Outer.PressureDrop.Plocal(1:N) + 0.5*Outer.PressureDrop.Plocal(2:Npoints);
285       
286"Inner Stream Average Pressure"
287        Inner.Properties.Average.P(1:N) = 0.5*Inner.PressureDrop.Plocal(1:N) + 0.5*Inner.PressureDrop.Plocal(2:Npoints);
288
289"Inner Stream Wall Temperature"
290        Inner.Properties.Wall.Twall =   0.5*Outer.Properties.Average.T + 0.5*Inner.Properties.Average.T;
291
292"Outer Stream Wall Temperature"
293        Outer.Properties.Wall.Twall =   0.5*Outer.Properties.Average.T + 0.5*Inner.Properties.Average.T;
294
295"Outer Stream Average Molecular Weight"
296        Outer.Properties.Average.Mw = sum(M*InletOuter.z);
297
298"Inner Stream Average Molecular Weight"
299        Inner.Properties.Average.Mw = sum(M*InletInner.z);
300
301if InletInner.v equal 0
302
303then
304"Inlet Mass Density Inner Stream"
305        Inner.Properties.Inlet.rho              =       PP.LiquidDensity(InletInner.T,InletInner.P,InletInner.z);
306
307"Outlet Mass Density Inner Stream"
308        Inner.Properties.Outlet.rho     =       PP.LiquidDensity(OutletInner.T,OutletInner.P,OutletInner.z);
309
310else
311"Inlet Mass Density Inner Stream"
312        Inner.Properties.Inlet.rho              =       PP.VapourDensity(InletInner.T,InletInner.P,InletInner.z);
313       
314"Outlet Mass Density Inner Stream"
315        Inner.Properties.Outlet.rho     =       PP.VapourDensity(OutletInner.T,OutletInner.P,OutletInner.z);
316
317end
318
319if InletOuter.v equal 0
320
321then
322"Inlet Mass Density Outer Stream"
323        Outer.Properties.Inlet.rho              =               PP.LiquidDensity(InletOuter.T,InletOuter.P,InletOuter.z);
324
325"Outlet Mass Density Outer Stream"
326        Outer.Properties.Outlet.rho     =               PP.LiquidDensity(OutletOuter.T,OutletOuter.P,OutletOuter.z);
327
328else
329"Inlet Mass Density Outer Stream"
330        Outer.Properties.Inlet.rho              =               PP.VapourDensity(InletOuter.T,InletOuter.P,InletOuter.z);
331       
332"Outlet Mass Density Outer Stream"
333        Outer.Properties.Outlet.rho     =               PP.VapourDensity(OutletOuter.T,OutletOuter.P,OutletOuter.z);
334
335end
336
337for i in [1:N]
338
339if InletInner.v equal 0
340       
341        then   
342
343"Average Heat Capacity Inner Stream"
344        Inner.Properties.Average.Cp(i)  =       PP.LiquidCp(Inner.Properties.Average.T(i),Inner.Properties.Average.P(i),InletInner.z);
345
346"Average Mass Density Inner Stream"
347        Inner.Properties.Average.rho(i)         =       PP.LiquidDensity(Inner.Properties.Average.T(i),Inner.Properties.Average.P(i),InletInner.z);
348
349"Average Viscosity Inner Stream"
350        Inner.Properties.Average.Mu(i)  =       PP.LiquidViscosity(Inner.Properties.Average.T(i),Inner.Properties.Average.P(i),InletInner.z);
351
352"Average        Conductivity Inner Stream"
353        Inner.Properties.Average.K(i)           =       PP.LiquidThermalConductivity(Inner.Properties.Average.T(i),Inner.Properties.Average.P(i),InletInner.z);
354
355"Viscosity Inner Stream at wall temperature"
356        Inner.Properties.Wall.Mu(i)             =       PP.LiquidViscosity(Inner.Properties.Wall.Twall(i),Inner.Properties.Average.P(i),InletInner.z);
357
358        else
359
360"Average Heat Capacity InnerStream"
361        Inner.Properties.Average.Cp(i)  =       PP.VapourCp(Inner.Properties.Average.T(i),Inner.Properties.Average.P(i),InletInner.z);
362
363"Average Mass Density Inner Stream"
364        Inner.Properties.Average.rho(i)         =       PP.VapourDensity(Inner.Properties.Average.T(i),Inner.Properties.Average.P(i),InletInner.z);
365
366"Average Viscosity Inner Stream"
367        Inner.Properties.Average.Mu(i)  =       PP.VapourViscosity(Inner.Properties.Average.T(i),Inner.Properties.Average.P(i),InletInner.z);
368
369"Average Conductivity Inner Stream"
370        Inner.Properties.Average.K(i)           =       PP.VapourThermalConductivity(Inner.Properties.Average.T(i),Inner.Properties.Average.P(i),InletInner.z);
371
372"Viscosity Inner Stream at wall temperature"
373        Inner.Properties.Wall.Mu(i)             =       PP.VapourViscosity(Inner.Properties.Wall.Twall(i),Inner.Properties.Average.P(i),InletInner.z);
374
375end
376
377if InletOuter.v equal 0
378
379        then
380
381"Average Heat Capacity Outer Stream"
382        Outer.Properties.Average.Cp(i)  =               PP.LiquidCp(Outer.Properties.Average.T(i),Outer.Properties.Average.P(i),InletOuter.z);
383
384"Average Mass Density Outer Stream"
385        Outer.Properties.Average.rho(i) =               PP.LiquidDensity(Outer.Properties.Average.T(i),Outer.Properties.Average.P(i),InletOuter.z);
386
387"Average Viscosity Outer Stream"
388        Outer.Properties.Average.Mu(i)  =               PP.LiquidViscosity(Outer.Properties.Average.T(i),Outer.Properties.Average.P(i),InletOuter.z);   
389
390"Average Conductivity Outer Stream"
391        Outer.Properties.Average.K(i)   =               PP.LiquidThermalConductivity(Outer.Properties.Average.T(i),Outer.Properties.Average.P(i),InletOuter.z);
392
393"Viscosity Outer Stream at wall temperature"
394        Outer.Properties.Wall.Mu(i)             =               PP.LiquidViscosity(Outer.Properties.Wall.Twall(i),Outer.Properties.Average.P(i),InletOuter.z); 
395
396
397        else
398
399"Average Heat Capacity Outer Stream"
400        Outer.Properties.Average.Cp(i)  =               PP.VapourCp(Outer.Properties.Average.T(i),Outer.Properties.Average.P(i),InletOuter.z);
401
402"Average Mass Density Outer Stream"
403        Outer.Properties.Average.rho(i) =               PP.VapourDensity(Outer.Properties.Average.T(i),Outer.Properties.Average.P(i),InletOuter.z);
404
405"Average Viscosity Outer Stream"
406        Outer.Properties.Average.Mu(i)  =               PP.VapourViscosity(Outer.Properties.Average.T(i),Outer.Properties.Average.P(i),InletOuter.z);
407
408"Average Conductivity Outer Stream"
409        Outer.Properties.Average.K(i)   =               PP.VapourThermalConductivity(Outer.Properties.Average.T(i),Outer.Properties.Average.P(i),InletOuter.z);
410
411"Viscosity Outer Stream at wall temperature"
412        Outer.Properties.Wall.Mu(i)             =               PP.VapourViscosity(Outer.Properties.Wall.Twall(i),Outer.Properties.Average.P(i),InletOuter.z);
413
414end
415
416end
417
418"Flow Mass Inlet Inner Stream"
419        Inner.Properties.Inlet.Fw               =  sum(M*InletInner.z)*InletInner.F;
420
421"Flow Mass Outlet Inner Stream"
422        Inner.Properties.Outlet.Fw              =  sum(M*OutletInner.z)*OutletInner.F;
423
424"Flow Mass Inlet Outer Stream"
425        Outer.Properties.Inlet.Fw               =  sum(M*InletOuter.z)*InletOuter.F;
426
427"Flow Mass Outlet Outer Stream"
428        Outer.Properties.Outlet.Fw      =  sum(M*OutletOuter.z)*OutletOuter.F;
429
430"Molar Balance Outer Stream"
431        OutletOuter.F = InletOuter.F;
432       
433"Molar Balance Inner Stream"
434        OutletInner.F = InletInner.F;
435
436"Outer Stream Molar Fraction Constraint"
437        OutletOuter.z=InletOuter.z;
438       
439"InnerStream Molar Fraction Constraint"
440        OutletInner.z=InletInner.z;
441
442"Total Exchange Surface Area for one segment of pipe"
443        Details.A=Pi*DoInner*Lpipe;
444
445
446"Pipe Initial Length from Left to Right"
447        Lincr(1) = 0*'m';
448
449for i in [1:N]
450
451"Incremental Length"
452        Lincr(i+1) = i*abs(Lpipe)/N;
453
454end
455
456for i in [1:N]
457
458switch innerFlowRegime
459       
460        case "laminar":
461       
462"Inner Side Friction Factor for Pressure Drop - laminar Flow"
463        Inner.PressureDrop.fi(i)*Inner.PressureDrop.Re(i) = 16;
464       
465        when Inner.PressureDrop.Re(i) > 2300 switchto "transition";
466
467        case "transition":
468       
469"using Turbulent Flow - to be implemented"
470        (Inner.PressureDrop.fi(i)-0.0035)*(Inner.PressureDrop.Re(i)^0.42) = 0.264;
471
472        when Inner.PressureDrop.Re(i) < 2300 switchto "laminar";
473        when Inner.PressureDrop.Re(i) > 10000 switchto "turbulent";
474
475        case "turbulent":
476
477"Inner Side Friction Factor - Turbulent Flow"
478        (Inner.PressureDrop.fi(i)-0.0035)*(Inner.PressureDrop.Re(i)^0.42) = 0.264;
479
480        when Inner.PressureDrop.Re(i) < 10000 switchto "transition";
481       
482end     
483
484end
485
486for i in [1:N]
487
488switch outerFlowRegime
489       
490        case "laminar":
491       
492"Outer Side Friction Factor - laminar Flow"
493        Outer.PressureDrop.fi(i)*Outer.PressureDrop.Re(i) = 16;
494       
495        when Outer.PressureDrop.Re(i) > 2300 switchto "transition";
496
497        case "transition":
498       
499"using Turbulent Flow - Transition Flow must be implemented"
500        (Outer.PressureDrop.fi(i)-0.0035)*(Outer.PressureDrop.Re(i)^0.42) = 0.264;
501
502        when Outer.PressureDrop.Re(i) < 2300 switchto "laminar";
503        when Outer.PressureDrop.Re(i) > 10000 switchto "turbulent";
504
505        case "turbulent":
506
507"Outer Side Friction Factor - Turbulent Flow"
508        (Outer.PressureDrop.fi(i)-0.0035)*(Outer.PressureDrop.Re(i)^0.42) = 0.264;
509
510        when Outer.PressureDrop.Re(i) < 10000 switchto "transition";
511       
512end
513
514end
515
516for i in [1:N]
517
518switch innerFlowRegime
519       
520        case "laminar":
521       
522"Inner Side Friction Factor for Heat Transfer - laminar Flow"
523        Inner.HeatTransfer.fi(i)   = 1/(0.79*ln(Inner.HeatTransfer.Re(i))-1.64)^2;
524       
525switch InnerLaminarCorrelation
526       
527        case "Hausen":
528
529"Nusselt Number"
530        Inner.HeatTransfer.Nu(i) = 3.665 + ((0.19*((DiInner/Lpipe)*Inner.HeatTransfer.Re(i)*Inner.HeatTransfer.PR(i))^0.8)/(1+0.117*((DiInner/Lpipe)*Inner.HeatTransfer.Re(i)*Inner.HeatTransfer.PR(i))^0.467));
531       
532        case "Schlunder":
533
534"Nusselt Number"
535        Inner.HeatTransfer.Nu(i) = (49.027896+4.173281*Inner.HeatTransfer.Re(i)*Inner.HeatTransfer.PR(i)*(DiInner/Lpipe))^(1/3);
536
537end
538       
539        when Inner.HeatTransfer.Re(i) > 2300 switchto "transition";
540       
541        case "transition":
542       
543"Inner Side Friction Factor for Heat Transfer - transition Flow"
544        Inner.HeatTransfer.fi(i)   = 1/(0.79*ln(Inner.HeatTransfer.Re(i))-1.64)^2;
545       
546switch InnerTransitionCorrelation
547       
548        case "Gnielinski":
549       
550"Nusselt Number"
551        Inner.HeatTransfer.Nu(i)*(1+(12.7*sqrt(0.125*Inner.HeatTransfer.fi(i))*((Inner.HeatTransfer.PR(i))^(2/3) -1))) = 0.125*Inner.HeatTransfer.fi(i)*(Inner.HeatTransfer.Re(i)-1000)*Inner.HeatTransfer.PR(i);
552
553        case "Hausen":
554
555"Nusselt Number"
556        Inner.HeatTransfer.Nu(i) =0.116*(Inner.HeatTransfer.Re(i)^(0.667)-125)*Inner.HeatTransfer.PR(i)^(0.333)*(1+(DiInner/Lpipe)^0.667);
557       
558end
559
560        when Inner.HeatTransfer.Re(i) < 2300 switchto "laminar";
561        when Inner.HeatTransfer.Re(i) > 10000 switchto "turbulent";
562
563        case "turbulent":
564
565switch InnerTurbulentCorrelation
566       
567        case "Petukhov":
568       
569"Inner Side Friction Factor for Heat Transfer - turbulent Flow"
570        Inner.HeatTransfer.fi(i)   = 1/(1.82*log(Inner.HeatTransfer.Re(i))-1.64)^2;
571
572"Nusselt Number"
573        Inner.HeatTransfer.Nu(i)*(1.07+(12.7*sqrt(0.125*Inner.HeatTransfer.fi(i))*((Inner.HeatTransfer.PR(i))^(2/3) -1))) = 0.125*Inner.HeatTransfer.fi(i)*Inner.HeatTransfer.Re(i)*Inner.HeatTransfer.PR(i);
574       
575        case "SiederTate":
576
577"Nusselt Number"
578        Inner.HeatTransfer.Nu(i) = 0.027*(Inner.HeatTransfer.PR(i))^(1/3)*(Inner.HeatTransfer.Re(i))^(4/5);
579
580"Inner Side Friction Factor for Heat Transfer - turbulent Flow"
581        Inner.HeatTransfer.fi(i)   = 1/(1.82*log(Inner.HeatTransfer.Re(i))-1.64)^2;
582       
583end
584       
585        when Inner.HeatTransfer.Re(i) < 10000 switchto "transition";
586       
587end
588
589end
590
591for i in [1:N]
592
593switch outerFlowRegime
594       
595        case "laminar":
596       
597"Outer Side Friction Factor for Heat Transfer - laminar Flow"
598        Outer.HeatTransfer.fi(i)   = 1/(0.79*ln(Outer.HeatTransfer.Re(i))-1.64)^2;
599       
600switch OuterLaminarCorrelation
601       
602        case "Hausen":
603
604"Nusselt Number"
605        Outer.HeatTransfer.Nu(i) = 3.665 + ((0.19*((Outer.HeatTransfer.Dh/Lpipe)*Outer.HeatTransfer.Re(i)*Outer.HeatTransfer.PR(i))^0.8)/(1+0.117*((Outer.HeatTransfer.Dh/Lpipe)*Outer.HeatTransfer.Re(i)*Outer.HeatTransfer.PR(i))^0.467));
606       
607        case "Schlunder":
608
609"Nusselt Number"
610        Outer.HeatTransfer.Nu(i) = (49.027896+4.173281*Outer.HeatTransfer.Re(i)*Outer.HeatTransfer.PR(i)*(Outer.HeatTransfer.Dh/Lpipe))^(1/3);
611
612end
613       
614        when Outer.HeatTransfer.Re(i) > 2300 switchto "transition";
615       
616        case "transition":
617       
618switch OuterTransitionCorrelation
619       
620        case "Gnielinski":
621
622"Outer Side Friction Factor for Heat Transfer - transition Flow"
623        Outer.HeatTransfer.fi(i)   = 1/(0.79*ln(Outer.HeatTransfer.Re(i))-1.64)^2;
624
625"Nusselt Number"
626        Outer.HeatTransfer.Nu(i)*(1+(12.7*sqrt(0.125*Outer.HeatTransfer.fi(i))*((Outer.HeatTransfer.PR(i))^(2/3) -1))) = 0.125*Outer.HeatTransfer.fi(i)*(Outer.HeatTransfer.Re(i)-1000)*Outer.HeatTransfer.PR(i);
627
628        case "Hausen":
629
630"Nusselt Number"
631        Outer.HeatTransfer.Nu(i) =      0.116*(Outer.HeatTransfer.Re(i)^(0.667)-125)*Outer.HeatTransfer.PR(i)^(0.333)*(1+(Outer.HeatTransfer.Dh/Lpipe)^0.667);
632
633
634"Outer Side Friction Factor for Heat Transfer - transition Flow"
635        Outer.HeatTransfer.fi(i)   = 1/(0.79*ln(Outer.HeatTransfer.Re(i))-1.64)^2;
636       
637end
638       
639        when Outer.HeatTransfer.Re(i) < 2300 switchto "laminar";
640        when Outer.HeatTransfer.Re(i) > 10000 switchto "turbulent";
641       
642        case "turbulent":
643       
644switch OuterTurbulentCorrelation
645       
646        case "Petukhov":
647
648"Outer Side Friction Factor for Heat Transfer - turbulent Flow"
649        Outer.HeatTransfer.fi(i)   = 1/(1.82*log(Outer.HeatTransfer.Re(i))-1.64)^2;
650       
651"Nusselt Number"
652        Outer.HeatTransfer.Nu(i)*(1.07+(12.7*sqrt(0.125*Outer.HeatTransfer.fi(i))*((Outer.HeatTransfer.PR(i))^(2/3) -1))) = 0.125*Outer.HeatTransfer.fi(i)*Outer.HeatTransfer.Re(i)*Outer.HeatTransfer.PR(i);
653       
654        case "SiederTate":
655
656"Nusselt Number"
657        Outer.HeatTransfer.Nu(i) = 0.027*(Outer.HeatTransfer.PR(i))^(1/3)*(Outer.HeatTransfer.Re(i))^(4/5);
658
659"Outer Side Friction Factor for Heat Transfer - turbulent Flow"
660        Outer.HeatTransfer.fi(i)   = 1/(1.82*log(Outer.HeatTransfer.Re(i))-1.64)^2;
661       
662end
663
664        when Outer.HeatTransfer.Re(i) < 10000 switchto "transition";
665
666end
667
668end
669
670"Inner Pipe Film Coefficient"
671        Inner.HeatTransfer.hcoeff = (Inner.HeatTransfer.Nu*Inner.Properties.Average.K/DiInner)*Inner.HeatTransfer.Phi;
672
673"Outer Pipe Film Coefficient"
674        Outer.HeatTransfer.hcoeff= (Outer.HeatTransfer.Nu*Outer.Properties.Average.K/Outer.HeatTransfer.Dh)*Outer.HeatTransfer.Phi;
675
676"Outer Pipe Phi correction"
677        Outer.HeatTransfer.Phi = (Outer.Properties.Average.Mu/Outer.Properties.Wall.Mu)^0.14;
678       
679"Inner Pipe Phi correction"
680        Inner.HeatTransfer.Phi  = (Inner.Properties.Average.Mu/Inner.Properties.Wall.Mu)^0.14;
681
682"Outer Pipe Prandtl Number"
683        Outer.HeatTransfer.PR = ((Outer.Properties.Average.Cp/Outer.Properties.Average.Mw)*Outer.Properties.Average.Mu)/Outer.Properties.Average.K;
684
685"Inner Pipe Prandtl Number"
686        Inner.HeatTransfer.PR = ((Inner.Properties.Average.Cp/Inner.Properties.Average.Mw)*Inner.Properties.Average.Mu)/Inner.Properties.Average.K;
687
688"Outer Pipe Reynolds Number for Heat Transfer"
689        Outer.HeatTransfer.Re = (Outer.Properties.Average.rho*Outer.HeatTransfer.Vmean*Outer.HeatTransfer.Dh)/Outer.Properties.Average.Mu;
690
691"Outer Pipe Reynolds Number for Pressure Drop"
692        Outer.PressureDrop.Re = (Outer.Properties.Average.rho*Outer.HeatTransfer.Vmean*Outer.PressureDrop.Dh)/Outer.Properties.Average.Mu;
693
694"Inner Pipe Reynolds Number for Heat Transfer"
695        Inner.HeatTransfer.Re = (Inner.Properties.Average.rho*Inner.HeatTransfer.Vmean*Inner.HeatTransfer.Dh)/Inner.Properties.Average.Mu;
696
697"Inner Pipe Reynolds Number for Pressure Drop"
698        Inner.PressureDrop.Re = Inner.HeatTransfer.Re;
699
700"Outer Pipe Velocity"
701        Outer.HeatTransfer.Vmean*(Outer.HeatTransfer.As*Outer.Properties.Average.rho)  = Outer.Properties.Inlet.Fw;
702
703"Inner Pipe Velocity"
704        Inner.HeatTransfer.Vmean*(Inner.HeatTransfer.As*Inner.Properties.Average.rho)  = Inner.Properties.Inlet.Fw;
705
706"Overall Heat Transfer Coefficient Clean"
707        #Details.Uc*((DoInner/(Inner.HeatTransfer.hcoeff*DiInner) )+(DoInner*ln(DoInner/DiInner)/(2*Kwall))+(1/(Outer.HeatTransfer.hcoeff)))=1;
708        Details.Uc*((DoInner/(sum(Inner.HeatTransfer.hcoeff)/N*DiInner) )+(DoInner*ln(DoInner/DiInner)/(2*Kwall))+(1/(sum(Outer.HeatTransfer.hcoeff)/N)))=1;
709
710"Overall Heat Transfer Coefficient Dirty"
711        Details.Ud=1/(Rfi*(DoInner/DiInner) +  Rfo + (DoInner/(Inner.HeatTransfer.hcoeff*DiInner) )+(DoInner*ln(DoInner/DiInner)/(2*Kwall))+(1/(Outer.HeatTransfer.hcoeff)));
712
713"Total Duty"
714        Details.Qtotal = sum(Details.Q);
715
716for i in [2:N]
717
718"Incremental Enthalpy Inner Stream"
719        Inner.HeatTransfer.Enth(i) = (1-InletInner.v)*PP.LiquidEnthalpy(Inner.HeatTransfer.Tlocal(i), Inner.PressureDrop.Plocal(i), InletInner.z) + InletInner.v*PP.VapourEnthalpy(Inner.HeatTransfer.Tlocal(i), Inner.PressureDrop.Plocal(i), InletInner.z);
720
721"Incremental Enthalpy Outer Stream"
722        Outer.HeatTransfer.Enth(i) = (1-InletOuter.v)*PP.LiquidEnthalpy(Outer.HeatTransfer.Tlocal(i), Outer.PressureDrop.Plocal(i), InletOuter.z) + InletOuter.v*PP.VapourEnthalpy(Outer.HeatTransfer.Tlocal(i), Outer.PressureDrop.Plocal(i), InletOuter.z);
723
724end
725
726#*switch HotSide
727
728        case "outer":
729
730"Energy Balance Outer Stream in counter flow"
731        Details.Q(1:N) = InletOuter.F*(Outer.HeatTransfer.Enth(2:Npoints) - Outer.HeatTransfer.Enth(1:N));
732
733"Energy Balance Inner Stream"
734        Details.Q(1:N) = -InletInner.F*(Inner.HeatTransfer.Enth(1:N)    -       Inner.HeatTransfer.Enth(2:Npoints));
735
736        when InletInner.T > InletOuter.T switchto "inner";
737
738        case "inner":
739
740"Energy Balance Hot Stream"
741        Details.Q(1:N) = InletInner.F*(Inner.HeatTransfer.Enth(1:N)-Inner.HeatTransfer.Enth(2:Npoints));
742
743"Energy Balance Cold Stream in counter flow"
744        Details.Q(1:N) = -InletOuter.F*(Outer.HeatTransfer.Enth(2:Npoints) - Outer.HeatTransfer.Enth(1:N));
745
746        when InletInner.T < InletOuter.T switchto "outer";
747
748end
749
750switch HotSide
751
752        case "outer":
753
754"Incremental Duty"
755        Details.Q = Details.Ud*Pi*DoInner*(Lpipe/N)*(Outer.Properties.Average.T - Inner.Properties.Average.T);
756
757        when InletInner.T > InletOuter.T switchto "inner";
758
759        case "inner":
760
761"Incremental Duty"
762        Details.Q = Details.Ud*Pi*DoInner*(Lpipe/N)*(Inner.Properties.Average.T - Outer.Properties.Average.T);
763
764        when InletInner.T < InletOuter.T switchto "outer";
765
766end
767
768"Enthalpy of Inner Side - Inlet Boundary"
769        Inner.HeatTransfer.Enth(1) = InletInner.h;
770
771"Enthalpy of inner Side - Outlet Boundary"
772        Inner.HeatTransfer.Enth(Npoints) = OutletInner.h;
773
774"Temperature of Inner Side - Inlet Boundary"
775        Inner.HeatTransfer.Tlocal(1) = InletInner.T;
776
777"Temperature of Inner Side - Outlet Boundary"
778        Inner.HeatTransfer.Tlocal(Npoints) = OutletInner.T;
779
780"Pressure of Inner Side - Inlet Boundary"
781        Inner.PressureDrop.Plocal(1) = InletInner.P;
782
783"Pressure of Inner Side - Outlet Boundary"
784        Inner.PressureDrop.Plocal(Npoints) = OutletInner.P;
785
786"Enthalpy of Outer Side - Inlet Boundary"
787        Outer.HeatTransfer.Enth(Npoints) = InletOuter.h;
788
789"Enthalpy of Outer Side - Outlet Boundary"
790        Outer.HeatTransfer.Enth(1) = OutletOuter.h;
791
792"Temperature of Outer Side - Inlet Boundary"
793        Outer.HeatTransfer.Tlocal(Npoints) = InletOuter.T;
794
795"Temperature of Outer Side - Outlet Boundary"
796        Outer.HeatTransfer.Tlocal(1) = OutletOuter.T;
797
798"Pressure of Outer Side - Inlet Boundary"
799        Outer.PressureDrop.Plocal(Npoints) = InletOuter.P;
800
801"Pressure of Outer Side - Outlet Boundary"
802        Outer.PressureDrop.Plocal(1) = OutletOuter.P;
803
804for i in [1:N]
805
806"Outer Pipe Pressure Drop for friction"                 
807        Outer.PressureDrop.Pd_fric(i) = (2*Outer.PressureDrop.fi(i)*Lincr(1+N-i)*Outer.Properties.Average.rho(i)*Outer.HeatTransfer.Vmean(i)^2)/(Outer.PressureDrop.Dh*Outer.HeatTransfer.Phi(i));
808
809end
810
811"Outer Pipe Pressure Drop for friction"
812        Outer.PressureDrop.Pd_fric(Npoints) = 0*'kPa';
813
814for i in [1:N]
815   
816"Outer Pipe Local Pressure"# FIXME: NOZZLE PRESSURE DROP MUST BE ADDED
817        #Outer.PressureDrop.Plocal(i) = Outer.PressureDrop.Plocal(Npoints) - Outer.PressureDrop.Pd_fric(i+1);
818        Outer.PressureDrop.Plocal(i) =  InletOuter.P;
819
820end
821
822"Inner Pipe Pressure Drop for friction"
823        Inner.PressureDrop.Pd_fric(2:Npoints) = (2*Inner.PressureDrop.fi*Lincr(2:Npoints)*Inner.Properties.Average.rho*Inner.HeatTransfer.Vmean^2)/(DiInner*Inner.HeatTransfer.Phi);
824
825"Inner Pipe Pressure Drop for friction"
826        Inner.PressureDrop.Pd_fric(1) = 0*'kPa';
827
828for i in [1:N]
829
830"Inner Pipe Local Pressure"# FIXME: NOZZLE PRESSURE DROP MUST BE ADDED
831#       Inner.PressureDrop.Plocal(i+1) =        Inner.PressureDrop.Plocal(1) - Inner.PressureDrop.Pd_fric(i+1);
832        Inner.PressureDrop.Plocal(i+1) =        InletInner.P;
833
834end*#
835
836end
837
838Model UpperPipe_basic as HairpinIncr_basic
839
840ATTRIBUTES
841        Pallete         = false;
842        Brief           = "Incremental Hairpin Heat Exchanger. ";
843        Info            =
844"Incremental approach for Hairpin heat exchanger. ";
845
846PARAMETERS
847
848outer PP                as Plugin               (Brief="External Physical Properties", Type="PP");
849outer NComp     as Integer      (Brief="Number of Components");
850        HotSide         as Switcher     (Brief="Flag for Fluid Alocation ",Valid=["outer","inner"],Default="outer");
851
852        Pi                              as constant     (Brief="Pi Number",Default=3.14159265, Symbol = "\pi");
853outer   N       as Integer      (Brief="Number of zones", Default = 2);
854 Npoints                as Integer      (Brief="Number of incremental points", Default = 3);
855       
856
857outer   DoInner         as length                       (Brief="Outside Diameter of Inner Pipe",Lower=1e-6);
858outer   DiInner         as length                       (Brief="Inside Diameter of Inner Pipe",Lower=1e-10);
859outer   DiOuter         as length                       (Brief="Inside Diameter of Outer pipe",Lower=1e-10);
860outer   Lpipe           as length                       (Brief="Effective Tube Length of one segment of Pipe",Lower=0.1, Symbol = "L_{pipe}");
861outer   Kwall           as conductivity         (Brief="Tube Wall Material Thermal Conductivity",Default=1.0, Symbol = "K_{wall}");
862outer   Rfi                     as positive             (Brief="Inside Fouling Resistance",Unit='m^2*K/kW',Default=1e-6,Lower=0);
863outer   Rfo                     as positive             (Brief="Outside Fouling Resistance",Unit='m^2*K/kW',Default=1e-6,Lower=0);
864
865#Donozzle_Inner  as length      (Brief="Inner Side Outlet Nozzle Diameter",Default = 0.036,Lower=10e-6);
866#Dinozzle_Inner         as length       (Brief="Inner Side Inlet Nozzle Diameter",Default = 0.036,Lower=10e-6);
867
868#Donozzle_Outer  as length              (Brief="Outer Side Outlet Nozzle Diameter",Default = 0.036,Lower=10e-6);
869#Dinozzle_Outer         as length               (Brief="Outer Side Inlet Nozzle Diameter",Default = 0.036,Lower=10e-6);
870
871#InnerKinlet    as positive                     (Brief="Inner Side Inlet Nozzle Pressure Loss Coeff",Default=1.1);
872#InnerKoutlet   as positive                     (Brief="Inner Side Outlet Nozzle Pressure Loss Coeff",Default=0.7);
873
874#OuterKinlet            as positive             (Brief="Outer Side Inlet Nozzle Pressure Loss Coeff",Default=1.1);
875#OuterKoutlet   as positive             (Brief="Outer Side Outlet Nozzle Pressure Loss Coeff",Default=0.7);
876
877SET
878
879#"Pi Number"
880        Pi      = 3.14159265;
881
882#"Number of incremental points"
883        Npoints  = N+1;
884
885EQUATIONS
886
887switch HotSide
888
889        case "outer":
890
891"Energy Balance Outer Stream in counter flow"
892        Details.Q(1:N) = InletOuter.F*(Outer.HeatTransfer.Enth(2:Npoints) - Outer.HeatTransfer.Enth(1:N));
893
894"Energy Balance Inner Stream"
895        Details.Q(1:N) = -InletInner.F*(Inner.HeatTransfer.Enth(1:N)    -       Inner.HeatTransfer.Enth(2:Npoints));
896
897"Incremental Duty"
898        Details.Q = Details.Ud*Pi*DoInner*(Lpipe/N)*(Outer.Properties.Average.T - Inner.Properties.Average.T);
899        #Details.Q = 0.6;
900       
901        when InletInner.T > InletOuter.T switchto "inner";
902
903        case "inner":
904
905"Energy Balance Hot Stream"
906        Details.Q(1:N) = InletInner.F*(Inner.HeatTransfer.Enth(1:N)-Inner.HeatTransfer.Enth(2:Npoints));
907
908"Energy Balance Cold Stream in counter flow"
909        Details.Q(1:N) = -InletOuter.F*(Outer.HeatTransfer.Enth(2:Npoints) - Outer.HeatTransfer.Enth(1:N));
910       
911"Incremental Duty"
912        Details.Q = Details.Ud*Pi*DoInner*(Lpipe/N)*(Inner.Properties.Average.T - Outer.Properties.Average.T);
913       
914        when InletInner.T < InletOuter.T switchto "outer";
915
916end
917
918"Enthalpy of Inner Side - Inlet Boundary"
919        Inner.HeatTransfer.Enth(1) = InletInner.h;
920
921"Enthalpy of inner Side - Outlet Boundary"
922        Inner.HeatTransfer.Enth(Npoints) = OutletInner.h;
923
924"Temperature of Inner Side - Inlet Boundary"
925        Inner.HeatTransfer.Tlocal(1) = InletInner.T;
926
927"Temperature of Inner Side - Outlet Boundary"
928        Inner.HeatTransfer.Tlocal(Npoints) = OutletInner.T;
929
930"Pressure of Inner Side - Inlet Boundary"
931        Inner.PressureDrop.Plocal(1) = InletInner.P;
932
933"Pressure of Inner Side - Outlet Boundary"
934        Inner.PressureDrop.Plocal(Npoints) = OutletInner.P;
935
936"Enthalpy of Outer Side - Inlet Boundary"
937        Outer.HeatTransfer.Enth(Npoints) = InletOuter.h;
938
939"Enthalpy of Outer Side - Outlet Boundary"
940        Outer.HeatTransfer.Enth(1) = OutletOuter.h;
941
942"Temperature of Outer Side - Inlet Boundary"
943        Outer.HeatTransfer.Tlocal(Npoints) = InletOuter.T;
944
945"Temperature of Outer Side - Outlet Boundary"
946        Outer.HeatTransfer.Tlocal(1) = OutletOuter.T;
947
948"Pressure of Outer Side - Inlet Boundary"
949        Outer.PressureDrop.Plocal(Npoints) = InletOuter.P;
950
951"Pressure of Outer Side - Outlet Boundary"
952        Outer.PressureDrop.Plocal(1) = OutletOuter.P;
953
954#for i in [1:N]
955
956#"Outer Pipe Pressure Drop for friction"                       
957#       Outer.PressureDrop.Pd_fric(i) = (2*Outer.PressureDrop.fi(i)*Lincr(1+N-i)*Outer.Properties.Average.rho(i)*Outer.HeatTransfer.Vmean(i)^2)/(Outer.PressureDrop.Dh*Outer.HeatTransfer.Phi(i));
958
959#end
960
961#"Outer Pipe Pressure Drop for friction"
962#       Outer.PressureDrop.Pd_fric(Npoints) = 0*'kPa';
963
964for i in [1:N]
965   
966"Outer Pipe Local Pressure"# FIXME: NOZZLE PRESSURE DROP MUST BE ADDED
967        #Outer.PressureDrop.Plocal(i) = Outer.PressureDrop.Plocal(Npoints) - Outer.PressureDrop.Pd_fric(i+1);
968        Outer.PressureDrop.Plocal(i) =  InletOuter.P;
969
970end
971
972#"Inner Pipe Pressure Drop for friction"
973#       Inner.PressureDrop.Pd_fric(2:Npoints) = (2*Inner.PressureDrop.fi*Lincr(2:Npoints)*Inner.Properties.Average.rho*Inner.HeatTransfer.Vmean^2)/(DiInner*Inner.HeatTransfer.Phi);
974
975#"Inner Pipe Pressure Drop for friction"
976#       Inner.PressureDrop.Pd_fric(1) = 0*'kPa';
977
978for i in [1:N]
979
980"Inner Pipe Local Pressure"# FIXME: NOZZLE PRESSURE DROP MUST BE ADDED
981#       Inner.PressureDrop.Plocal(i+1) =        Inner.PressureDrop.Plocal(1) - Inner.PressureDrop.Pd_fric(i+1);
982        Inner.PressureDrop.Plocal(i+1) =        InletInner.P;
983
984end
985
986end
987
988Model LowerPipe_basic as HairpinIncr_basic
989
990ATTRIBUTES
991        Pallete         = false;
992        Brief           = "Incremental Hairpin Heat Exchanger. ";
993        Info            =
994"Incremental approach for Hairpin heat exchanger. ";
995
996PARAMETERS
997
998outer PP                as Plugin               (Brief="External Physical Properties", Type="PP");
999outer NComp     as Integer      (Brief="Number of Components");
1000        HotSide         as Switcher     (Brief="Flag for Fluid Alocation ",Valid=["outer","inner"],Default="outer");
1001
1002        Pi                              as constant     (Brief="Pi Number",Default=3.14159265, Symbol = "\pi");
1003outer   N       as Integer      (Brief="Number of zones", Default = 2);
1004 Npoints                as Integer      (Brief="Number of incremental points", Default = 3);
1005       
1006
1007outer   DoInner         as length                       (Brief="Outside Diameter of Inner Pipe",Lower=1e-6);
1008outer   DiInner         as length                       (Brief="Inside Diameter of Inner Pipe",Lower=1e-10);
1009outer   DiOuter         as length                       (Brief="Inside Diameter of Outer pipe",Lower=1e-10);
1010outer   Lpipe           as length                       (Brief="Effective Tube Length of one segment of Pipe",Lower=0.1, Symbol = "L_{pipe}");
1011outer   Kwall           as conductivity         (Brief="Tube Wall Material Thermal Conductivity",Default=1.0, Symbol = "K_{wall}");
1012outer   Rfi                     as positive             (Brief="Inside Fouling Resistance",Unit='m^2*K/kW',Default=1e-6,Lower=0);
1013outer   Rfo                     as positive             (Brief="Outside Fouling Resistance",Unit='m^2*K/kW',Default=1e-6,Lower=0);
1014
1015#Donozzle_Inner  as length      (Brief="Inner Side Outlet Nozzle Diameter",Default = 0.036,Lower=10e-6);
1016#Dinozzle_Inner         as length       (Brief="Inner Side Inlet Nozzle Diameter",Default = 0.036,Lower=10e-6);
1017
1018#Donozzle_Outer  as length              (Brief="Outer Side Outlet Nozzle Diameter",Default = 0.036,Lower=10e-6);
1019#Dinozzle_Outer         as length               (Brief="Outer Side Inlet Nozzle Diameter",Default = 0.036,Lower=10e-6);
1020
1021#InnerKinlet    as positive                     (Brief="Inner Side Inlet Nozzle Pressure Loss Coeff",Default=1.1);
1022#InnerKoutlet   as positive                     (Brief="Inner Side Outlet Nozzle Pressure Loss Coeff",Default=0.7);
1023
1024#OuterKinlet            as positive             (Brief="Outer Side Inlet Nozzle Pressure Loss Coeff",Default=1.1);
1025#OuterKoutlet   as positive             (Brief="Outer Side Outlet Nozzle Pressure Loss Coeff",Default=0.7);
1026
1027SET
1028
1029#"Pi Number"
1030        Pi      = 3.14159265;
1031
1032#"Number of incremental points"
1033        Npoints  = N+1;
1034
1035EQUATIONS
1036
1037switch HotSide
1038
1039        case "outer":
1040
1041"Energy Balance Outer Stream in counter flow"
1042        Details.Q(1:N) = InletOuter.F*(Outer.HeatTransfer.Enth(1:N) - Outer.HeatTransfer.Enth(2:Npoints));
1043
1044"Energy Balance Inner Stream"
1045        Details.Q(1:N) = -InletInner.F*(Inner.HeatTransfer.Enth(2:Npoints)      -       Inner.HeatTransfer.Enth(1:N));
1046
1047"Incremental Duty"
1048        Details.Q = Details.Ud*Pi*DoInner*(Lpipe/N)*(Outer.Properties.Average.T - Inner.Properties.Average.T);
1049        #Details.Q = 0.6;
1050       
1051        when InletInner.T > InletOuter.T switchto "inner";
1052
1053        case "inner":
1054
1055"Energy Balance Hot Stream"
1056        Details.Q(1:N) = InletInner.F*(Inner.HeatTransfer.Enth(2:Npoints)-Inner.HeatTransfer.Enth(1:N));
1057
1058"Energy Balance Cold Stream in counter flow"
1059        Details.Q(1:N) = -InletOuter.F*(Outer.HeatTransfer.Enth(1:N) - Outer.HeatTransfer.Enth(2:Npoints));
1060       
1061"Incremental Duty"
1062        Details.Q = Details.Ud*Pi*DoInner*(Lpipe/N)*(Inner.Properties.Average.T - Outer.Properties.Average.T);
1063       
1064        when InletInner.T < InletOuter.T switchto "outer";
1065
1066end
1067
1068"Enthalpy of Inner Side - Inlet Boundary"
1069        Outer.HeatTransfer.Enth(1) = InletOuter.h;
1070
1071"Enthalpy of inner Side - Outlet Boundary"
1072        Outer.HeatTransfer.Enth(Npoints) = OutletOuter.h;
1073
1074"Temperature of Inner Side - Inlet Boundary"
1075        Outer.HeatTransfer.Tlocal(1) = InletOuter.T;
1076
1077"Temperature of Inner Side - Outlet Boundary"
1078        Outer.HeatTransfer.Tlocal(Npoints) = OutletOuter.T;
1079
1080"Pressure of Inner Side - Inlet Boundary"
1081        Outer.PressureDrop.Plocal(1) = InletOuter.P;
1082
1083"Pressure of Inner Side - Outlet Boundary"
1084        Outer.PressureDrop.Plocal(Npoints) = OutletOuter.P;
1085
1086"Enthalpy of Outer Side - Inlet Boundary"
1087        Inner.HeatTransfer.Enth(Npoints) = InletInner.h;
1088
1089"Enthalpy of Outer Side - Outlet Boundary"
1090        Inner.HeatTransfer.Enth(1) = OutletInner.h;
1091
1092"Temperature of Outer Side - Inlet Boundary"
1093        Inner.HeatTransfer.Tlocal(Npoints) = InletInner.T;
1094
1095"Temperature of Outer Side - Outlet Boundary"
1096        Inner.HeatTransfer.Tlocal(1) = OutletInner.T;
1097
1098"Pressure of Outer Side - Inlet Boundary"
1099        Inner.PressureDrop.Plocal(Npoints) = InletInner.P;
1100
1101"Pressure of Outer Side - Outlet Boundary"
1102        Inner.PressureDrop.Plocal(1) = OutletInner.P;
1103
1104#for i in [1:N]
1105
1106#"Outer Pipe Pressure Drop for friction"                       
1107#       Inner.PressureDrop.Pd_fric(i) = (2*Inner.PressureDrop.fi(i)*Lincr(1+N-i)*Inner.Properties.Average.rho(i)*Inner.HeatTransfer.Vmean(i)^2)/(DiInner*Inner.HeatTransfer.Phi(i));
1108
1109#end
1110
1111#"Outer Pipe Pressure Drop for friction"
1112        #Inner.PressureDrop.Pd_fric(Npoints) = 0*'kPa';
1113
1114for i in [1:N]
1115   
1116"Outer Pipe Local Pressure"# FIXME: NOZZLE PRESSURE DROP MUST BE ADDED
1117        #Outer.PressureDrop.Plocal(i) = Outer.PressureDrop.Plocal(Npoints) - Outer.PressureDrop.Pd_fric(i+1);
1118        Inner.PressureDrop.Plocal(i) =  InletInner.P;
1119
1120end
1121
1122#"Inner Pipe Pressure Drop for friction"
1123        #Outer.PressureDrop.Pd_fric(2:Npoints) = (2*Outer.PressureDrop.fi*Lincr(2:Npoints)*Outer.Properties.Average.rho*Outer.HeatTransfer.Vmean^2)/(Outer.PressureDrop.Dh*Outer.HeatTransfer.Phi);
1124
1125#"Inner Pipe Pressure Drop for friction"
1126        #Outer.PressureDrop.Pd_fric(1) = 0*'kPa';
1127
1128for i in [1:N]
1129
1130"Inner Pipe Local Pressure"# FIXME: NOZZLE PRESSURE DROP MUST BE ADDED
1131#       Inner.PressureDrop.Plocal(i+1) =        Inner.PressureDrop.Plocal(1) - Inner.PressureDrop.Pd_fric(i+1);
1132        Outer.PressureDrop.Plocal(i+1) =        InletOuter.P;
1133
1134end
1135
1136end
1137
1138Model HairpinIncr
1139
1140ATTRIBUTES
1141        Pallete         = true;
1142        Icon = "icon/hairpin";
1143        Brief           = "Incremental Hairpin Heat Exchanger. ";
1144        Info            =
1145"Incremental approach for Hairpin heat exchanger. ";
1146
1147PARAMETERS
1148
1149outer PP                        as Plugin               (Brief="External Physical Properties", Type="PP");
1150outer NComp     as Integer      (Brief="Number of Components");
1151        N                                       as Integer      (Brief="Number of zones", Default = 2);
1152       
1153
1154DoInner         as length                       (Brief="Outside Diameter of Inner Pipe",Lower=1e-6);
1155DiInner         as length                       (Brief="Inside Diameter of Inner Pipe",Lower=1e-10);
1156DiOuter         as length                       (Brief="Inside Diameter of Outer pipe",Lower=1e-10);
1157Lpipe           as length                       (Brief="Effective Tube Length of one segment of Pipe",Lower=0.1, Symbol = "L_{pipe}");
1158Kwall           as conductivity         (Brief="Tube Wall Material Thermal Conductivity",Default=1.0, Symbol = "K_{wall}");
1159Rfi                     as positive             (Brief="Inside Fouling Resistance",Unit='m^2*K/kW',Default=1e-6,Lower=0);
1160Rfo                     as positive             (Brief="Outside Fouling Resistance",Unit='m^2*K/kW',Default=1e-6,Lower=0);
1161
1162
1163VARIABLES
1164
1165#InnerPdrop             as press_delta  (Brief="Total Pressure Drop",Default=0.01, Lower=0,DisplayUnit='kPa', Symbol ="\Delta P");
1166#OuterPdrop             as press_delta  (Brief="Total Pressure Drop",Default=0.01, Lower=0,DisplayUnit='kPa', Symbol ="\Delta P");
1167A                               as area                         (Brief="Total Exchange Surface Area");
1168Qtotal          as power                        (Brief="Total Duty", Default=7000, Lower=1e-8, Upper=1e10);
1169
1170        UpperPipe       as UpperPipe_basic;
1171        LowerPipe       as LowerPipe_basic;
1172
1173CONNECTIONS
1174
1175        LowerPipe.OutletInner           to UpperPipe.InletInner;
1176        UpperPipe.OutletOuter           to LowerPipe.InletOuter;
1177
1178EQUATIONS
1179
1180A = LowerPipe.Details.A+UpperPipe.Details.A;
1181
1182Qtotal = LowerPipe.Details.Qtotal+UpperPipe.Details.Qtotal;
1183
1184#*OuterPdrop = LowerPipe.Outer.PressureDrop.Pdrop+UpperPipe.Outer.PressureDrop.Pdrop;
1185
1186#InnerPdrop = LowerPipe.Inner.PressureDrop.Pdrop+UpperPipe.Inner.PressureDrop.Pdrop;
1187
1188
1189
1190"Lower Pipe Total Pressure Drop Outer Stream"
1191        LowerPipe.Outer.PressureDrop.Pdrop  = 0.1;#LowerPipe.Outer.PressureDrop.Pd_fric(1)+LowerPipe.Outer.PressureDrop.Pdnozzle_in;
1192
1193"Upper Pipe Total Pressure Drop Outer Stream"
1194        UpperPipe.Outer.PressureDrop.Pdrop  = 0.1;#UpperPipe.Outer.PressureDrop.Pd_fric(1)+UpperPipe.Outer.PressureDrop.Pdnozzle_out;
1195
1196"Upper Pipe Total Pressure Drop Inner Stream"
1197        UpperPipe.Inner.PressureDrop.Pdrop  = 0.1;#UpperPipe.Inner.PressureDrop.Pd_fric(Npoints)+UpperPipe.Inner.PressureDrop.Pdnozzle_in;
1198
1199"Lower Pipe Total Pressure Drop Inner Stream"
1200        LowerPipe.Inner.PressureDrop.Pdrop  = 0.1;#LowerPipe.Inner.PressureDrop.Pd_fric(Npoints)+LowerPipe.Inner.PressureDrop.Pdnozzle_out;
1201#*
1202"Velocity Inner Side Inlet Nozzle"
1203        UpperPipe.Inner.PressureDrop.Vnozzle_in = UpperPipe.Inner.Properties.Inlet.Fw/(UpperPipe.Inner.Properties.Inlet.rho*(0.25*Pi*Dinozzle_Inner^2));
1204
1205"Velocity Inner Side Outlet Nozzle"
1206        LowerPipe.Inner.PressureDrop.Vnozzle_out        = LowerPipe.Inner.Properties.Outlet.Fw/(LowerPipe.Inner.Properties.Outlet.rho*(0.25*Pi*Donozzle_Inner^2));
1207
1208"Velocity Outer Side Inlet Nozzle"
1209        LowerPipe.Outer.PressureDrop.Vnozzle_in = LowerPipe.Outer.Properties.Inlet.Fw/(LowerPipe.Outer.Properties.Inlet.rho*(0.25*Pi*Dinozzle_Outer^2));
1210
1211"Velocity Outer Side Outlet Nozzle"
1212        UpperPipe.Outer.PressureDrop.Vnozzle_out        = UpperPipe.Outer.Properties.Outlet.Fw/(UpperPipe.Outer.Properties.Outlet.rho*(0.25*Pi*Donozzle_Outer^2));
1213
1214"Pressure Drop Inner Side Inlet Nozzle"
1215        UpperPipe.Inner.PressureDrop.Pdnozzle_in        = 0.5*InnerKinlet*UpperPipe.Inner.Properties.Inlet.rho*UpperPipe.Inner.PressureDrop.Vnozzle_in^2;
1216
1217"Pressure Drop Inner Side Outlet Nozzle"
1218        LowerPipe.Inner.PressureDrop.Pdnozzle_out       = 0.5*InnerKoutlet*LowerPipe.Inner.Properties.Outlet.rho*LowerPipe.Inner.PressureDrop.Vnozzle_out^2;
1219
1220"Pressure Drop Outer Side Inlet Nozzle"
1221        LowerPipe.Outer.PressureDrop.Pdnozzle_in        = 0.5*OuterKinlet*LowerPipe.Outer.Properties.Inlet.rho*LowerPipe.Outer.PressureDrop.Vnozzle_in^2;
1222
1223"Pressure Drop Outer Side Outlet Nozzle"
1224        UpperPipe.Outer.PressureDrop.Pdnozzle_out       = 0.5*OuterKoutlet*UpperPipe.Outer.Properties.Outlet.rho*UpperPipe.Outer.PressureDrop.Vnozzle_out^2;
1225
1226"Inner Side Inlet Nozzle rho-V^2"
1227        UpperPipe.Inner.PressureDrop.RVsquare_in = UpperPipe.Inner.Properties.Inlet.rho*(UpperPipe.Inner.PressureDrop.Vnozzle_in)^2;
1228
1229"Inner Side Outlet Nozzle rho-V^2"
1230        LowerPipe.Inner.PressureDrop.RVsquare_out = LowerPipe.Inner.Properties.Outlet.rho*(LowerPipe.Inner.PressureDrop.Vnozzle_out)^2;
1231
1232"Outer Side Inlet Nozzle rho-V^2"
1233        LowerPipe.Outer.PressureDrop.RVsquare_in = LowerPipe.Outer.Properties.Inlet.rho*(LowerPipe.Outer.PressureDrop.Vnozzle_in)^2;
1234
1235"Outer Side Outlet Nozzle rho-V^2"
1236        UpperPipe.Outer.PressureDrop.RVsquare_out = UpperPipe.Outer.Properties.Outlet.rho*(UpperPipe.Outer.PressureDrop.Vnozzle_out)^2;
1237
1238
1239
1240"Velocity Inner Side Inlet Nozzle"
1241        UpperPipe.Inner.PressureDrop.Vnozzle_out        = 0;
1242
1243"Velocity Inner Side Outlet Nozzle"
1244        LowerPipe.Inner.PressureDrop.Vnozzle_in = 0;
1245
1246"Velocity Outer Side Inlet Nozzle"
1247        LowerPipe.Outer.PressureDrop.Vnozzle_out        = 0;
1248
1249"Velocity Outer Side Outlet Nozzle"
1250        UpperPipe.Outer.PressureDrop.Vnozzle_in = 0;
1251
1252"Pressure Drop Inner Side Inlet Nozzle"
1253        UpperPipe.Inner.PressureDrop.Pdnozzle_out= 0;
1254
1255"Pressure Drop Inner Side Outlet Nozzle"
1256        LowerPipe.Inner.PressureDrop.Pdnozzle_in        = 0;
1257
1258"Pressure Drop Outer Side Inlet Nozzle"
1259        LowerPipe.Outer.PressureDrop.Pdnozzle_out       = 0;
1260
1261"Pressure Drop Outer Side Outlet Nozzle"
1262        UpperPipe.Outer.PressureDrop.Pdnozzle_in        =0;
1263
1264"Inner Side Inlet Nozzle rho-V^2"
1265        UpperPipe.Inner.PressureDrop.RVsquare_out= 0;
1266
1267"Inner Side Outlet Nozzle rho-V^2"
1268        LowerPipe.Inner.PressureDrop.RVsquare_in = 0;
1269
1270"Outer Side Inlet Nozzle rho-V^2"
1271        LowerPipe.Outer.PressureDrop.RVsquare_out = 0;
1272
1273"Outer Side Outlet Nozzle rho-V^2"
1274        UpperPipe.Outer.PressureDrop.RVsquare_in= 0;*#
1275end
Note: See TracBrowser for help on using the repository browser.