source: trunk/eml/heat_exchangers/HairpinIncr.mso @ 986

Last change on this file since 986 was 986, checked in by Argimiro Resende Secchi, 6 years ago
  • Property svn:executable set to *
File size: 39.0 KB
Line 
1#*-------------------------------------------------------------------
2* EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC.
3*
4* This LIBRARY is free software; you can distribute it and/or modify
5* it under the therms of the ALSOC FREE LICENSE as available at
6* http://www.enq.ufrgs.br/alsoc.
7*
8* EMSO Copyright (C) 2004 - 2007 ALSOC, original code
9* from http://www.rps.eng.br Copyright (C) 2002-2004.
10* All rights reserved.
11*
12* EMSO is distributed under the therms of the ALSOC LICENSE as
13* available at http://www.enq.ufrgs.br/alsoc.
14*--------------------------------------------------------------------
15* 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
53
54Fw              as flow_mass            (Brief="Stream Mass Flow");
55rho             as dens_mass            (Brief="Stream Density" ,Default=1000, Lower=1e-3, Upper=5e5, Symbol = "\rho");
56
57end
58
59Model Properties_Wall
60       
61ATTRIBUTES
62        Pallete = false;
63        Brief = "Incremental Physical properties of the streams at wall temperature.";
64        Info =
65        "to be documented.";
66
67PARAMETERS
68
69outer N                         as Integer      (Brief="Number of zones", Default = 2);
70
71VARIABLES
72
73        Mu(N)           as viscosity            (Brief="Stream Incremental Viscosity",Default=1, Lower=1e-5, Upper=1e5, Symbol = "\mu");
74        Twall(N)        as temperature  (Brief="Incremental Wall Temperature",Lower=50);
75
76end
77
78Model Physical_Properties
79       
80ATTRIBUTES
81        Pallete = false;
82        Brief = "to be documented";
83        Info =
84        "to be documented";
85       
86VARIABLES
87        Inlet           as Properties_In_Out    (Brief="Properties at Inlet Stream", Symbol = "^{in}");
88        Average         as Properties_Average   (Brief="Properties at Average Temperature", Symbol = "^{avg}");
89        Outlet          as Properties_In_Out    (Brief="Properties at Outlet Stream", Symbol = "^{out}");
90        Wall                    as Properties_Wall                      (Brief="Properties at Wall Temperature", Symbol = "^{wall}");
91
92end
93
94Model Details_Main
95       
96ATTRIBUTES
97        Pallete = false;
98        Brief = "to be documented";
99        Info =
100        "to be documented";
101
102PARAMETERS
103
104outer N                         as Integer      (Brief="Number of zones", Default = 2);
105
106VARIABLES
107        A                               as area                                                 (Brief="Total Exchange Surface Area");
108        Q(N)                    as power                                                (Brief="Incremental Duty", Default=7000, Lower=1e-8, Upper=1e10);
109        Qtotal          as power                                                (Brief="Total Duty", Default=7000, Lower=1e-8, Upper=1e10);
110        Uc                      as heat_trans_coeff             (Brief="Average Overall Heat Transfer Coefficient Clean",Default=1,Lower=1e-6,Upper=1e10);
111        Ud(N)           as heat_trans_coeff             (Brief="Incremental Overall Heat Transfer Coefficient Dirty",Default=1,Lower=1e-6,Upper=1e10);
112
113end
114
115Model Hairpin_HeatTransfer
116       
117ATTRIBUTES
118        Pallete = false;
119        Brief = "to be documented";
120        Info =
121        "to be documented";
122
123PARAMETERS
124
125As                                      as area                 (Brief="Cross Sectional Area for Flow",Default=0.05,Lower=1e-8);
126Dh                                      as length               (Brief="Hydraulic Diameter of Pipe for Heat Transfer",Lower=1e-8);
127outer N                         as Integer      (Brief="Number of zones", Default = 2);
128outer Npoints           as Integer      (Brief="Number of incremental points", Default = 3);
129
130VARIABLES
131
132Tlocal(Npoints) as temperature                          (Brief="Incremental Local  Temperature",Lower=50);
133Re(N)                           as positive                                     (Brief="Incremental Reynolds Number",Default=100,Lower=1);
134hcoeff(N)                       as heat_trans_coeff             (Brief="Incremental Film Coefficient",Default=1,Lower=1e-12, Upper=1e6, DisplayUnit = 'W/m^2/K');
135fi(N)                           as fricfactor                                   (Brief="Incremental Friction Factor", Default=0.05, Lower=1e-10, Upper=2000);
136Nu(N)                           as positive                                     (Brief="Incremental Nusselt Number",Default=0.5,Lower=1e-8);
137PR(N)                           as positive                                     (Brief="Incremental Prandtl Number",Default=0.5,Lower=1e-8);
138Phi(N)                          as positive                                     (Brief="Incremental Phi Correction",Default=1,Lower=1e-3);
139Vmean(N)                as velocity                                     (Brief="Incremental Tube Velocity",Lower=1e-8);
140Enth(Npoints)   as enth_mol                             (Brief="Incremental Stream Enthalpy");
141
142end
143
144Model Hairpin_PressureDrop
145
146ATTRIBUTES
147        Pallete = false;
148        Brief = "to be documented";
149        Info =
150        "to be documented";
151
152PARAMETERS
153
154Dh                                      as length               (Brief="Hydraulic Diameter of Pipe for Pressure Drop",Lower=1e-6);
155outer N                         as Integer      (Brief="Number of zones", Default = 2);
156outer Npoints           as Integer      (Brief="Number of incremental points", Default = 3);
157
158VARIABLES
159
160Plocal(Npoints)         as pressure             (Brief="Incremental Local  Pressure",Default=1, Lower=1e-10, Upper=2e4, DisplayUnit='kPa');
161Pd_fric(Npoints)                as press_delta  (Brief="Incremental Pressure Drop for friction",Default=1e-3, Lower=0,DisplayUnit='kPa', Symbol ="\Delta P_{fric}");
162fi(N)                                           as fricfactor           (Brief="Incremental Friction Factor", Default=0.05, Lower=1e-10, Upper=2000);
163Re(N)                                           as positive                     (Brief="Incremental Reynolds Number",Default=100,Lower=1);
164
165end     
166
167Model Main_Hairpin
168       
169ATTRIBUTES
170        Pallete = false;
171        Brief = "to be documented";
172        Info =
173        "to be documented";
174       
175VARIABLES
176
177HeatTransfer    as Hairpin_HeatTransfer         (Brief="Double Pipe Heat Transfer");
178PressureDrop    as Hairpin_PressureDrop         (Brief="Double Pipe Pressure Drop");
179Properties              as Physical_Properties          (Brief="Double Pipe Properties");
180
181end
182
183Model Results_Hairpin
184       
185ATTRIBUTES
186        Pallete = false;
187        Brief = "to be documented";
188        Info =
189        "to be documented";
190       
191VARIABLES
192Pdnozzle_in             as press_delta                          (Brief="Inlet Nozzle Pressure Drop",Default=0.01, Lower=1e-10,DisplayUnit='kPa');
193Pdnozzle_out            as press_delta                          (Brief="Outlet Nozzle Pressure Drop",Default=0.01, Lower=1e-10,DisplayUnit='kPa');
194Pdrop                                   as press_delta                          (Brief="Total Pressure Drop",Default=0.01, Lower=0,DisplayUnit='kPa', Symbol ="\Delta P");
195Vnozzle_in                      as velocity                                     (Brief="Inlet Nozzle Velocity",Default=1, Upper=1e5);
196Vnozzle_out             as velocity                                     (Brief="Outlet Nozzle Velocity",Default=1, Upper=1e5);
197RVsquare_in                     as positive                                     (Brief ="Inlet Nozzle rho-V^2", Default=1, Upper=1e6, Unit = 'kg/s^2/m');
198RVsquare_out            as positive                                     (Brief ="Outlet Nozzle rho-V^2", Default=1, Upper=1e6, Unit = 'kg/s^2/m');
199hcoeff                                  as heat_trans_coeff             (Brief="Average Film Coefficient",Default=1,Lower=1e-12, Upper=1e6, DisplayUnit = 'W/m^2/K');
200
201end
202
203Model Summary_Hairpin
204       
205ATTRIBUTES
206        Pallete = false;
207        Brief = "to be documented";
208        Info =
209        "to be documented";
210       
211VARIABLES
212A                                       as area                                         (Brief="Total Exchange Surface Area");
213Qtotal                  as power                                                (Brief="Total Duty", Default=7000, Lower=1e-8, Upper=1e10);
214Inner                   as Results_Hairpin      (Brief="Inner Side Summary");
215Outer                   as Results_Hairpin      (Brief="Outer Side Summary");
216
217end
218
219Model HairpinIncr_basic
220
221ATTRIBUTES
222        Pallete         = false;
223        Brief           = "Incremental Hairpin Heat Exchanger. ";
224        Info            =
225"Incremental approach for Hairpin heat exchanger. ";
226
227PARAMETERS
228
229outer PP                                        as Plugin               (Brief="External Physical Properties", Type="PP");
230outer NComp                             as Integer      (Brief="Number of Components");
231outer   N                                       as Integer      (Brief="Number of zones", Default = 2);
232outer   Npoints                         as Integer      (Brief="Number of incremental points", Default = 3);
233       
234        M(NComp)        as molweight    (Brief="Component Mol Weight");
235       
236        HotSide                         as Switcher     (Brief="Flag for Fluid Alocation ",Valid=["outer","inner"],Default="outer");
237        innerFlowRegime         as Switcher     (Brief="Inner Flow Regime ",Valid=["laminar","transition","turbulent"],Default="laminar");
238        outerFlowRegime         as Switcher     (Brief="Outer Flow Regime ",Valid=["laminar","transition","turbulent"],Default="laminar");
239
240        InnerLaminarCorrelation         as Switcher     (Brief="Heat Transfer Correlation in Laminar Flow for the Inner Side",Valid=["Hausen","Schlunder"],Default="Hausen");
241        InnerTransitionCorrelation  as Switcher (Brief="Heat Transfer Correlation in Transition Flow for the Inner Side",Valid=["Gnielinski","Hausen"],Default="Gnielinski");
242        InnerTurbulentCorrelation   as Switcher (Brief="Heat Transfer Correlation in Turbulent Flow for the Inner Side",Valid=["Petukhov","SiederTate"],Default="Petukhov");
243
244        OuterLaminarCorrelation         as Switcher     (Brief="Heat Transfer Correlation in Laminar Flow for the Outer Side",Valid=["Hausen","Schlunder"],Default="Hausen");
245        OuterTransitionCorrelation  as Switcher (Brief="Heat Transfer Correlation in Transition Flow for the OuterSide",Valid=["Gnielinski","Hausen"],Default="Gnielinski");
246        OuterTurbulentCorrelation   as Switcher (Brief="Heat Transfer Correlation in Turbulent Flow for the Outer Side",Valid=["Petukhov","SiederTate"],Default="Petukhov");
247
248outer   Pi                              as constant             (Brief="Pi Number",Default=3.14159265, Symbol = "\pi");
249outer   DoInner         as length                       (Brief="Outside Diameter of Inner Pipe",Lower=1e-6);
250outer   DiInner         as length                       (Brief="Inside Diameter of Inner Pipe",Lower=1e-10);
251outer   DiOuter         as length                       (Brief="Inside Diameter of Outer pipe",Lower=1e-10);
252outer   Lpipe           as length                       (Brief="Effective Tube Length of one segment of Pipe",Lower=0.1, Symbol = "L_{pipe}");
253outer   Kwall           as conductivity         (Brief="Tube Wall Material Thermal Conductivity",Default=1.0, Symbol = "K_{wall}");
254outer   Rfi                     as positive             (Brief="Inside Fouling Resistance",Unit='m^2*K/kW',Default=1e-6,Lower=0);
255outer   Rfo                     as positive             (Brief="Outside Fouling Resistance",Unit='m^2*K/kW',Default=1e-6,Lower=0);
256
257VARIABLES
258
259in  InletInner          as stream               (Brief="Inlet Inner Stream", PosX=0, PosY=0.5225, Symbol="_{inInner}");
260in  InletOuter          as stream               (Brief="Inlet Outer Stream", PosX=0.2805, PosY=0, Symbol="_{inOuter}");
261
262out OutletInner         as streamPH     (Brief="Outlet Inner Stream", PosX=1, PosY=0.5225, Symbol="_{outInner}");
263out OutletOuter         as streamPH     (Brief="Outlet Outer Stream", PosX=0.7264, PosY=1, Symbol="_{outOuter}");
264
265        Details         as Details_Main         (Brief="Some Details in the Heat Exchanger", Symbol=" ");
266        Inner           as Main_Hairpin         (Brief="Inner Side of the Heat Exchanger", Symbol="_{Inner}");
267        Outer           as Main_Hairpin         (Brief="Outer Side of the Heat Exchanger", Symbol="_{Outer}");
268
269        Lincr(Npoints)          as length               (Brief = "Incremental Tube Length", Symbol = "L_{incr}");
270
271SET
272
273#"Component Molecular Weight"
274        M  = PP.MolecularWeight();
275
276#"Inner Pipe Cross Sectional Area for Flow"
277        Inner.HeatTransfer.As=0.25*Pi*DiInner*DiInner;
278
279#"Outer Pipe Cross Sectional Area for Flow"
280        Outer.HeatTransfer.As=0.25*Pi*(DiOuter*DiOuter - DoInner*DoInner);
281
282#"Inner Pipe Hydraulic Diameter for Heat Transfer"
283        Inner.HeatTransfer.Dh=DiInner;
284       
285#"Outer Pipe Hydraulic Diameter for Heat Transfer"
286        Outer.HeatTransfer.Dh=(DiOuter*DiOuter-DoInner*DoInner)/DoInner;
287
288#"Inner Pipe Hydraulic Diameter for Pressure Drop"
289        Inner.PressureDrop.Dh=DiInner;
290       
291#"Outer Pipe Hydraulic Diameter for Pressure Drop"
292        Outer.PressureDrop.Dh=DiOuter-DoInner;
293
294EQUATIONS
295
296"Outer  Stream Average Temperature"
297        Outer.Properties.Average.T(1:N) = 0.5*Outer.HeatTransfer.Tlocal(1:N) + 0.5*Outer.HeatTransfer.Tlocal(2:Npoints);
298
299"Inner Stream Average Temperature"
300        Inner.Properties.Average.T(1:N)  = 0.5*Inner.HeatTransfer.Tlocal(1:N) + 0.5*Inner.HeatTransfer.Tlocal(2:Npoints);
301
302"Outer Stream Average Pressure"
303        Outer.Properties.Average.P(1:N) = 0.5*Outer.PressureDrop.Plocal(1:N) + 0.5*Outer.PressureDrop.Plocal(2:Npoints);
304
305"Inner Stream Average Pressure"
306        Inner.Properties.Average.P(1:N) = 0.5*Inner.PressureDrop.Plocal(1:N) + 0.5*Inner.PressureDrop.Plocal(2:Npoints);
307
308"Inner Stream Wall Temperature"
309        Inner.Properties.Wall.Twall =   0.5*Outer.Properties.Average.T + 0.5*Inner.Properties.Average.T;
310
311"Outer Stream Wall Temperature"
312        Outer.Properties.Wall.Twall =   0.5*Outer.Properties.Average.T + 0.5*Inner.Properties.Average.T;
313
314"Outer Stream Average Molecular Weight"
315        Outer.Properties.Average.Mw = sum(M*InletOuter.z);
316
317"Inner Stream Average Molecular Weight"
318        Inner.Properties.Average.Mw = sum(M*InletInner.z);
319
320if InletInner.v equal 0
321
322then
323"Inlet Mass Density Inner Stream"
324        Inner.Properties.Inlet.rho              =       PP.LiquidDensity(InletInner.T,InletInner.P,InletInner.z);
325
326"Outlet Mass Density Inner Stream"
327        Inner.Properties.Outlet.rho     =       PP.LiquidDensity(OutletInner.T,OutletInner.P,OutletInner.z);
328
329else
330"Inlet Mass Density Inner Stream"
331        Inner.Properties.Inlet.rho              =       PP.VapourDensity(InletInner.T,InletInner.P,InletInner.z);
332       
333"Outlet Mass Density Inner Stream"
334        Inner.Properties.Outlet.rho     =       PP.VapourDensity(OutletInner.T,OutletInner.P,OutletInner.z);
335
336end
337
338if InletOuter.v equal 0
339
340then
341"Inlet Mass Density Outer Stream"
342        Outer.Properties.Inlet.rho              =               PP.LiquidDensity(InletOuter.T,InletOuter.P,InletOuter.z);
343
344"Outlet Mass Density Outer Stream"
345        Outer.Properties.Outlet.rho     =               PP.LiquidDensity(OutletOuter.T,OutletOuter.P,OutletOuter.z);
346
347else
348"Inlet Mass Density Outer Stream"
349        Outer.Properties.Inlet.rho              =               PP.VapourDensity(InletOuter.T,InletOuter.P,InletOuter.z);
350       
351"Outlet Mass Density Outer Stream"
352        Outer.Properties.Outlet.rho     =               PP.VapourDensity(OutletOuter.T,OutletOuter.P,OutletOuter.z);
353
354end
355
356for i in [1:N] do
357
358if InletInner.v equal 0
359       
360        then   
361
362"Average Heat Capacity Inner Stream"
363        Inner.Properties.Average.Cp(i)  =       PP.LiquidCp(Inner.Properties.Average.T(i),Inner.Properties.Average.P(i),InletInner.z);
364
365"Average Mass Density Inner Stream"
366        Inner.Properties.Average.rho(i)         =       PP.LiquidDensity(Inner.Properties.Average.T(i),Inner.Properties.Average.P(i),InletInner.z);
367
368"Average Viscosity Inner Stream"
369        Inner.Properties.Average.Mu(i)  =       PP.LiquidViscosity(Inner.Properties.Average.T(i),Inner.Properties.Average.P(i),InletInner.z);
370
371"Average        Conductivity Inner Stream"
372        Inner.Properties.Average.K(i)           =       PP.LiquidThermalConductivity(Inner.Properties.Average.T(i),Inner.Properties.Average.P(i),InletInner.z);
373
374"Viscosity Inner Stream at wall temperature"
375        Inner.Properties.Wall.Mu(i)             =       PP.LiquidViscosity(Inner.Properties.Wall.Twall(i),Inner.Properties.Average.P(i),InletInner.z);
376
377        else
378
379"Average Heat Capacity InnerStream"
380        Inner.Properties.Average.Cp(i)  =       PP.VapourCp(Inner.Properties.Average.T(i),Inner.Properties.Average.P(i),InletInner.z);
381
382"Average Mass Density Inner Stream"
383        Inner.Properties.Average.rho(i)         =       PP.VapourDensity(Inner.Properties.Average.T(i),Inner.Properties.Average.P(i),InletInner.z);
384
385"Average Viscosity Inner Stream"
386        Inner.Properties.Average.Mu(i)  =       PP.VapourViscosity(Inner.Properties.Average.T(i),Inner.Properties.Average.P(i),InletInner.z);
387
388"Average Conductivity Inner Stream"
389        Inner.Properties.Average.K(i)           =       PP.VapourThermalConductivity(Inner.Properties.Average.T(i),Inner.Properties.Average.P(i),InletInner.z);
390
391"Viscosity Inner Stream at wall temperature"
392        Inner.Properties.Wall.Mu(i)             =       PP.VapourViscosity(Inner.Properties.Wall.Twall(i),Inner.Properties.Average.P(i),InletInner.z);
393
394end
395
396if InletOuter.v equal 0
397
398        then
399
400"Average Heat Capacity Outer Stream"
401        Outer.Properties.Average.Cp(i)  =               PP.LiquidCp(Outer.Properties.Average.T(i),Outer.Properties.Average.P(i),InletOuter.z);
402
403"Average Mass Density Outer Stream"
404        Outer.Properties.Average.rho(i) =               PP.LiquidDensity(Outer.Properties.Average.T(i),Outer.Properties.Average.P(i),InletOuter.z);
405
406"Average Viscosity Outer Stream"
407        Outer.Properties.Average.Mu(i)  =               PP.LiquidViscosity(Outer.Properties.Average.T(i),Outer.Properties.Average.P(i),InletOuter.z);   
408
409"Average Conductivity Outer Stream"
410        Outer.Properties.Average.K(i)   =               PP.LiquidThermalConductivity(Outer.Properties.Average.T(i),Outer.Properties.Average.P(i),InletOuter.z);
411
412"Viscosity Outer Stream at wall temperature"
413        Outer.Properties.Wall.Mu(i)             =               PP.LiquidViscosity(Outer.Properties.Wall.Twall(i),Outer.Properties.Average.P(i),InletOuter.z); 
414
415
416        else
417
418"Average Heat Capacity Outer Stream"
419        Outer.Properties.Average.Cp(i)  =               PP.VapourCp(Outer.Properties.Average.T(i),Outer.Properties.Average.P(i),InletOuter.z);
420
421"Average Mass Density Outer Stream"
422        Outer.Properties.Average.rho(i) =               PP.VapourDensity(Outer.Properties.Average.T(i),Outer.Properties.Average.P(i),InletOuter.z);
423
424"Average Viscosity Outer Stream"
425        Outer.Properties.Average.Mu(i)  =               PP.VapourViscosity(Outer.Properties.Average.T(i),Outer.Properties.Average.P(i),InletOuter.z);
426
427"Average Conductivity Outer Stream"
428        Outer.Properties.Average.K(i)   =               PP.VapourThermalConductivity(Outer.Properties.Average.T(i),Outer.Properties.Average.P(i),InletOuter.z);
429
430"Viscosity Outer Stream at wall temperature"
431        Outer.Properties.Wall.Mu(i)             =               PP.VapourViscosity(Outer.Properties.Wall.Twall(i),Outer.Properties.Average.P(i),InletOuter.z);
432
433end
434
435end
436
437"Flow Mass Inlet Inner Stream"
438        Inner.Properties.Inlet.Fw               =  sum(M*InletInner.z)*InletInner.F;
439
440"Flow Mass Outlet Inner Stream"
441        Inner.Properties.Outlet.Fw              =  sum(M*OutletInner.z)*OutletInner.F;
442
443"Flow Mass Inlet Outer Stream"
444        Outer.Properties.Inlet.Fw               =  sum(M*InletOuter.z)*InletOuter.F;
445
446"Flow Mass Outlet Outer Stream"
447        Outer.Properties.Outlet.Fw      =  sum(M*OutletOuter.z)*OutletOuter.F;
448
449"Molar Balance Outer Stream"
450        OutletOuter.F = InletOuter.F;
451       
452"Molar Balance Inner Stream"
453        OutletInner.F = InletInner.F;
454
455"Outer Stream Molar Fraction Constraint"
456        OutletOuter.z=InletOuter.z;
457       
458"InnerStream Molar Fraction Constraint"
459        OutletInner.z=InletInner.z;
460
461"Total Exchange Surface Area for one segment of pipe"
462        Details.A=Pi*DoInner*Lpipe;
463
464"Pipe Initial Length from Left to Right"
465        Lincr(1) = 0*'m';
466
467for i in [1:N] do
468
469"Incremental Length"
470        Lincr(i+1) = i*abs(Lpipe)/N;
471
472end
473
474for i in [1:N] do
475
476switch innerFlowRegime
477       
478        case "laminar":
479       
480"Inner Side Friction Factor for Pressure Drop - laminar Flow"
481        Inner.PressureDrop.fi(i)*Inner.PressureDrop.Re(i) = 16;
482       
483        when Inner.PressureDrop.Re(i) > 2300 switchto "transition";
484
485        case "transition":
486       
487"using Turbulent Flow - to be implemented"
488        (Inner.PressureDrop.fi(i)-0.0035)*(Inner.PressureDrop.Re(i)^0.42) = 0.264;
489
490        when Inner.PressureDrop.Re(i) < 2300 switchto "laminar";
491        when Inner.PressureDrop.Re(i) > 10000 switchto "turbulent";
492
493        case "turbulent":
494
495"Inner Side Friction Factor - Turbulent Flow"
496        (Inner.PressureDrop.fi(i)-0.0035)*(Inner.PressureDrop.Re(i)^0.42) = 0.264;
497
498        when Inner.PressureDrop.Re(i) < 10000 switchto "transition";
499       
500end     
501
502end
503
504for i in [1:N] do
505
506switch outerFlowRegime
507       
508        case "laminar":
509       
510"Outer Side Friction Factor - laminar Flow"
511        Outer.PressureDrop.fi(i)*Outer.PressureDrop.Re(i) = 16;
512       
513        when Outer.PressureDrop.Re(i) > 2300 switchto "transition";
514
515        case "transition":
516       
517"using Turbulent Flow - Transition Flow must be implemented"
518        (Outer.PressureDrop.fi(i)-0.0035)*(Outer.PressureDrop.Re(i)^0.42) = 0.264;
519
520        when Outer.PressureDrop.Re(i) < 2300 switchto "laminar";
521        when Outer.PressureDrop.Re(i) > 10000 switchto "turbulent";
522
523        case "turbulent":
524
525"Outer Side Friction Factor - Turbulent Flow"
526        (Outer.PressureDrop.fi(i)-0.0035)*(Outer.PressureDrop.Re(i)^0.42) = 0.264;
527
528        when Outer.PressureDrop.Re(i) < 10000 switchto "transition";
529       
530end
531
532end
533
534for i in [1:N] do
535
536switch innerFlowRegime
537       
538        case "laminar":
539       
540"Inner Side Friction Factor for Heat Transfer - laminar Flow"
541        Inner.HeatTransfer.fi(i)   = 1/(0.79*ln(Inner.HeatTransfer.Re(i))-1.64)^2;
542       
543switch InnerLaminarCorrelation
544       
545        case "Hausen":
546
547"Nusselt Number"
548        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));
549       
550        case "Schlunder":
551
552"Nusselt Number"
553        Inner.HeatTransfer.Nu(i) = (49.027896+4.173281*Inner.HeatTransfer.Re(i)*Inner.HeatTransfer.PR(i)*(DiInner/Lpipe))^(1/3);
554
555end
556       
557        when Inner.HeatTransfer.Re(i) > 2300 switchto "transition";
558       
559        case "transition":
560       
561"Inner Side Friction Factor for Heat Transfer - transition Flow"
562        Inner.HeatTransfer.fi(i)   = 1/(0.79*ln(Inner.HeatTransfer.Re(i))-1.64)^2;
563       
564switch InnerTransitionCorrelation
565       
566        case "Gnielinski":
567       
568"Nusselt Number"
569        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);
570
571        case "Hausen":
572
573"Nusselt Number"
574        Inner.HeatTransfer.Nu(i) =0.116*(Inner.HeatTransfer.Re(i)^(0.667)-125)*Inner.HeatTransfer.PR(i)^(0.333)*(1+(DiInner/Lpipe)^0.667);
575       
576end
577
578        when Inner.HeatTransfer.Re(i) < 2300 switchto "laminar";
579        when Inner.HeatTransfer.Re(i) > 10000 switchto "turbulent";
580
581        case "turbulent":
582
583switch InnerTurbulentCorrelation
584       
585        case "Petukhov":
586       
587"Inner Side Friction Factor for Heat Transfer - turbulent Flow"
588        Inner.HeatTransfer.fi(i)   = 1/(1.82*log(Inner.HeatTransfer.Re(i))-1.64)^2;
589
590"Nusselt Number"
591        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);
592       
593        case "SiederTate":
594
595"Nusselt Number"
596        Inner.HeatTransfer.Nu(i) = 0.027*(Inner.HeatTransfer.PR(i))^(1/3)*(Inner.HeatTransfer.Re(i))^(4/5);
597
598"Inner Side Friction Factor for Heat Transfer - turbulent Flow"
599        Inner.HeatTransfer.fi(i)   = 1/(1.82*log(Inner.HeatTransfer.Re(i))-1.64)^2;
600       
601end
602       
603        when Inner.HeatTransfer.Re(i) < 10000 switchto "transition";
604       
605end
606
607end
608
609for i in [1:N] do
610
611switch outerFlowRegime
612       
613        case "laminar":
614       
615"Outer Side Friction Factor for Heat Transfer - laminar Flow"
616        Outer.HeatTransfer.fi(i)   = 1/(0.79*ln(Outer.HeatTransfer.Re(i))-1.64)^2;
617       
618switch OuterLaminarCorrelation
619       
620        case "Hausen":
621
622"Nusselt Number"
623        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));
624       
625        case "Schlunder":
626
627"Nusselt Number"
628        Outer.HeatTransfer.Nu(i) = (49.027896+4.173281*Outer.HeatTransfer.Re(i)*Outer.HeatTransfer.PR(i)*(Outer.HeatTransfer.Dh/Lpipe))^(1/3);
629
630end
631       
632        when Outer.HeatTransfer.Re(i) > 2300 switchto "transition";
633       
634        case "transition":
635       
636switch OuterTransitionCorrelation
637       
638        case "Gnielinski":
639
640"Outer Side Friction Factor for Heat Transfer - transition Flow"
641        Outer.HeatTransfer.fi(i)   = 1/(0.79*ln(Outer.HeatTransfer.Re(i))-1.64)^2;
642
643"Nusselt Number"
644        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);
645
646        case "Hausen":
647
648"Nusselt Number"
649        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);
650
651"Outer Side Friction Factor for Heat Transfer - transition Flow"
652        Outer.HeatTransfer.fi(i)   = 1/(0.79*ln(Outer.HeatTransfer.Re(i))-1.64)^2;
653       
654end
655       
656        when Outer.HeatTransfer.Re(i) < 2300 switchto "laminar";
657        when Outer.HeatTransfer.Re(i) > 10000 switchto "turbulent";
658       
659        case "turbulent":
660       
661switch OuterTurbulentCorrelation
662       
663        case "Petukhov":
664
665"Outer Side Friction Factor for Heat Transfer - turbulent Flow"
666        Outer.HeatTransfer.fi(i)   = 1/(1.82*log(Outer.HeatTransfer.Re(i))-1.64)^2;
667       
668"Nusselt Number"
669        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);
670       
671        case "SiederTate":
672
673"Nusselt Number"
674        Outer.HeatTransfer.Nu(i) = 0.027*(Outer.HeatTransfer.PR(i))^(1/3)*(Outer.HeatTransfer.Re(i))^(4/5);
675
676"Outer Side Friction Factor for Heat Transfer - turbulent Flow"
677        Outer.HeatTransfer.fi(i)   = 1/(1.82*log(Outer.HeatTransfer.Re(i))-1.64)^2;
678       
679end
680
681        when Outer.HeatTransfer.Re(i) < 10000 switchto "transition";
682
683end
684
685end
686
687for i in [2:N] do
688
689"Incremental Enthalpy Inner Stream"
690        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);
691
692"Incremental Enthalpy Outer Stream"
693        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);
694
695end
696
697"Inner Pipe Film Coefficient"
698        Inner.HeatTransfer.hcoeff = (Inner.HeatTransfer.Nu*Inner.Properties.Average.K/DiInner)*Inner.HeatTransfer.Phi;
699
700"Outer Pipe Film Coefficient"
701        Outer.HeatTransfer.hcoeff= (Outer.HeatTransfer.Nu*Outer.Properties.Average.K/Outer.HeatTransfer.Dh)*Outer.HeatTransfer.Phi;
702
703"Outer Pipe Phi correction"
704        Outer.HeatTransfer.Phi = (Outer.Properties.Average.Mu/Outer.Properties.Wall.Mu)^0.14;
705       
706"Inner Pipe Phi correction"
707        Inner.HeatTransfer.Phi  = (Inner.Properties.Average.Mu/Inner.Properties.Wall.Mu)^0.14;
708
709"Outer Pipe Prandtl Number"
710        Outer.HeatTransfer.PR = ((Outer.Properties.Average.Cp/Outer.Properties.Average.Mw)*Outer.Properties.Average.Mu)/Outer.Properties.Average.K;
711
712"Inner Pipe Prandtl Number"
713        Inner.HeatTransfer.PR = ((Inner.Properties.Average.Cp/Inner.Properties.Average.Mw)*Inner.Properties.Average.Mu)/Inner.Properties.Average.K;
714
715"Outer Pipe Reynolds Number for Heat Transfer"
716        Outer.HeatTransfer.Re = (Outer.Properties.Average.rho*Outer.HeatTransfer.Vmean*Outer.HeatTransfer.Dh)/Outer.Properties.Average.Mu;
717
718"Outer Pipe Reynolds Number for Pressure Drop"
719        Outer.PressureDrop.Re = (Outer.Properties.Average.rho*Outer.HeatTransfer.Vmean*Outer.PressureDrop.Dh)/Outer.Properties.Average.Mu;
720
721"Inner Pipe Reynolds Number for Heat Transfer"
722        Inner.HeatTransfer.Re = (Inner.Properties.Average.rho*Inner.HeatTransfer.Vmean*Inner.HeatTransfer.Dh)/Inner.Properties.Average.Mu;
723
724"Inner Pipe Reynolds Number for Pressure Drop"
725        Inner.PressureDrop.Re = Inner.HeatTransfer.Re;
726
727"Outer Pipe Velocity"
728        Outer.HeatTransfer.Vmean*(Outer.HeatTransfer.As*Outer.Properties.Average.rho)  = Outer.Properties.Inlet.Fw;
729
730"Inner Pipe Velocity"
731        Inner.HeatTransfer.Vmean*(Inner.HeatTransfer.As*Inner.Properties.Average.rho)  = Inner.Properties.Inlet.Fw;
732
733"Average Overall Heat Transfer Coefficient Clean"
734        Details.Uc*((DoInner/(sum(Inner.HeatTransfer.hcoeff)/N*DiInner) )+(DoInner*ln(DoInner/DiInner)/(2*Kwall))+(1/(sum(Outer.HeatTransfer.hcoeff)/N)))=1;
735
736"Overall Heat Transfer Coefficient Dirty"
737        Details.Ud=1/(Rfi*(DoInner/DiInner) +  Rfo + (DoInner/(Inner.HeatTransfer.hcoeff*DiInner) )+(DoInner*ln(DoInner/DiInner)/(2*Kwall))+(1/(Outer.HeatTransfer.hcoeff)));
738
739"Total Duty"
740        Details.Qtotal = sum(Details.Q);
741
742end
743
744Model UpperPipe_basic as HairpinIncr_basic
745
746ATTRIBUTES
747        Pallete         = false;
748        Brief   = "Incremental Hairpin Heat Exchanger. ";
749        Info            =
750"Incremental approach for Hairpin heat exchanger. ";
751
752EQUATIONS
753
754switch HotSide
755
756        case "outer":
757
758"Energy Balance Outer Stream"
759        Details.Q(1:N) = InletOuter.F*(Outer.HeatTransfer.Enth(2:Npoints) - Outer.HeatTransfer.Enth(1:N));
760
761"Energy Balance Inner Stream"
762        Details.Q(1:N) = -InletInner.F*(Inner.HeatTransfer.Enth(1:N)    -       Inner.HeatTransfer.Enth(2:Npoints));
763
764"Incremental Duty"
765        Details.Q = Details.Ud*Pi*DoInner*(Lpipe/N)*(Outer.Properties.Average.T - Inner.Properties.Average.T);
766
767        when InletInner.T > InletOuter.T switchto "inner";
768
769        case "inner":
770
771"Energy Balance Hot Stream"
772        Details.Q(1:N) = InletInner.F*(Inner.HeatTransfer.Enth(1:N)-Inner.HeatTransfer.Enth(2:Npoints));
773
774"Energy Balance Cold Stream"
775        Details.Q(1:N) = -InletOuter.F*(Outer.HeatTransfer.Enth(2:Npoints) - Outer.HeatTransfer.Enth(1:N));
776       
777"Incremental Duty"
778        Details.Q = Details.Ud*Pi*DoInner*(Lpipe/N)*(Inner.Properties.Average.T - Outer.Properties.Average.T);
779       
780        when InletInner.T < InletOuter.T switchto "outer";
781
782end
783
784"Enthalpy of Inner Side - Inlet Boundary"
785        Inner.HeatTransfer.Enth(1) = InletInner.h;
786
787"Enthalpy of inner Side - Outlet Boundary"
788        Inner.HeatTransfer.Enth(Npoints) = OutletInner.h;
789
790"Temperature of Inner Side - Inlet Boundary"
791        Inner.HeatTransfer.Tlocal(1) = InletInner.T;
792
793"Temperature of Inner Side - Outlet Boundary"
794        Inner.HeatTransfer.Tlocal(Npoints) = OutletInner.T;
795
796"Pressure of Inner Side - Inlet Boundary"
797        Inner.PressureDrop.Plocal(1) = InletInner.P;
798
799"Pressure of Inner Side - Outlet Boundary"
800        Inner.PressureDrop.Plocal(Npoints) = OutletInner.P;
801
802"Enthalpy of Outer Side - Inlet Boundary"
803        Outer.HeatTransfer.Enth(Npoints) = InletOuter.h;
804
805"Enthalpy of Outer Side - Outlet Boundary"
806        Outer.HeatTransfer.Enth(1) = OutletOuter.h;
807
808"Temperature of Outer Side - Inlet Boundary"
809        Outer.HeatTransfer.Tlocal(Npoints) = InletOuter.T;
810
811"Temperature of Outer Side - Outlet Boundary"
812        Outer.HeatTransfer.Tlocal(1) = OutletOuter.T;
813
814"Pressure of Outer Side - Inlet Boundary"
815        Outer.PressureDrop.Plocal(Npoints) = InletOuter.P;
816
817"Pressure of Outer Side - Outlet Boundary"
818        Outer.PressureDrop.Plocal(1) = OutletOuter.P;
819
820for i in [1:N] do
821
822"Outer Pipe Pressure Drop for friction"                 
823        Outer.PressureDrop.Pd_fric(i) = (2*Outer.PressureDrop.fi(i)*Lincr(1+Npoints-i)*Outer.Properties.Average.rho(i)*Outer.HeatTransfer.Vmean(i)^2)/(Outer.PressureDrop.Dh*Outer.HeatTransfer.Phi(i));
824
825end
826
827"Outer Pipe Pressure Drop for friction"
828        Outer.PressureDrop.Pd_fric(Npoints) = 0*'kPa';
829
830"Inner Pipe Pressure Drop for friction"
831        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);
832
833"Inner Pipe Pressure Drop for friction"
834        Inner.PressureDrop.Pd_fric(1) = 0*'kPa';
835
836end
837
838Model LowerPipe_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
846EQUATIONS
847
848switch HotSide
849
850        case "outer":
851
852"Energy Balance Outer Stream in counter flow"
853        Details.Q(1:N) = InletOuter.F*(Outer.HeatTransfer.Enth(1:N) - Outer.HeatTransfer.Enth(2:Npoints));
854
855"Energy Balance Inner Stream"
856        Details.Q(1:N) = -InletInner.F*(Inner.HeatTransfer.Enth(2:Npoints)      -       Inner.HeatTransfer.Enth(1:N));
857
858"Incremental Duty"
859        Details.Q = Details.Ud*Pi*DoInner*(Lpipe/N)*(Outer.Properties.Average.T - Inner.Properties.Average.T);
860        #Details.Q = 0.6;
861
862        when InletInner.T > InletOuter.T switchto "inner";
863
864        case "inner":
865
866"Energy Balance Hot Stream"
867        Details.Q(1:N) = InletInner.F*(Inner.HeatTransfer.Enth(2:Npoints)-Inner.HeatTransfer.Enth(1:N));
868
869"Energy Balance Cold Stream in counter flow"
870        Details.Q(1:N) = -InletOuter.F*(Outer.HeatTransfer.Enth(1:N) - Outer.HeatTransfer.Enth(2:Npoints));
871
872"Incremental Duty"
873        Details.Q = Details.Ud*Pi*DoInner*(Lpipe/N)*(Inner.Properties.Average.T - Outer.Properties.Average.T);
874
875        when InletInner.T < InletOuter.T switchto "outer";
876
877end
878
879"Enthalpy of Outer Side - Inlet Boundary"
880        Outer.HeatTransfer.Enth(1) = InletOuter.h;
881
882"Enthalpy of Outer Side - Outlet Boundary"
883        Outer.HeatTransfer.Enth(Npoints) = OutletOuter.h;
884
885"Temperature of OuterSide - Inlet Boundary"
886        Outer.HeatTransfer.Tlocal(1) = InletOuter.T;
887
888"Temperature of Outer Side - Outlet Boundary"
889        Outer.HeatTransfer.Tlocal(Npoints) = OutletOuter.T;
890
891"Pressure of Outer Side - Inlet Boundary"
892        Outer.PressureDrop.Plocal(1) = InletOuter.P;
893
894"Pressure of Outer Side - Outlet Boundary"
895        Outer.PressureDrop.Plocal(Npoints) = OutletOuter.P;
896
897"Enthalpy of Inner Side - Inlet Boundary"
898        Inner.HeatTransfer.Enth(Npoints) = InletInner.h;
899
900"Enthalpy of Inner Side - Outlet Boundary"
901        Inner.HeatTransfer.Enth(1) = OutletInner.h;
902
903"Temperature of Inner Side - Inlet Boundary"
904        Inner.HeatTransfer.Tlocal(Npoints) = InletInner.T;
905
906"Temperature of Inner Side - Outlet Boundary"
907        Inner.HeatTransfer.Tlocal(1) = OutletInner.T;
908
909"Pressure of Inner Side - Inlet Boundary"
910        Inner.PressureDrop.Plocal(Npoints) = InletInner.P;
911
912"Pressure of Inner Side - Outlet Boundary"
913        Inner.PressureDrop.Plocal(1) = OutletInner.P;
914
915for i in [1:N] do
916
917"Inner Pipe Pressure Drop for friction"                 
918        Inner.PressureDrop.Pd_fric(i) = (2*Inner.PressureDrop.fi(i)*Lincr(1+Npoints-i)*Inner.Properties.Average.rho(i)*Inner.HeatTransfer.Vmean(i)^2)/(DiInner*Inner.HeatTransfer.Phi(i));
919
920end
921
922"Inner Pipe Pressure Drop for friction"
923        Inner.PressureDrop.Pd_fric(Npoints) = 0*'kPa';
924
925"Outer Pipe Pressure Drop for friction"
926        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);
927
928"Outer Pipe Pressure Drop for friction"
929        Outer.PressureDrop.Pd_fric(1) = 0*'kPa';
930
931end
932
933Model HairpinIncr
934
935ATTRIBUTES
936        Pallete         = true;
937        Icon = "icon/hairpin";
938        Brief           = "Incremental Hairpin Heat Exchanger. ";
939        Info            =
940"Incremental approach for Hairpin heat exchanger.
941OBS: LEFT = 0 e N = N, RIGTH= L e N=1
942";
943
944PARAMETERS
945
946outer PP                as Plugin               (Brief="External Physical Properties", Type="PP");
947outer NComp     as Integer      (Brief="Number of Components");
948        Pi                                      as constant     (Brief="Pi Number",Default=3.14159265, Symbol = "\pi");
949        N                               as Integer      (Brief="Number of zones", Default = 2);
950        Npoints                 as Integer      (Brief="Number of incremental points", Default = 3);
951
952DoInner         as length                       (Brief="Outside Diameter of Inner Pipe",Lower=1e-6);
953DiInner         as length                       (Brief="Inside Diameter of Inner Pipe",Lower=1e-10);
954DiOuter         as length                       (Brief="Inside Diameter of Outer pipe",Lower=1e-10);
955Lpipe           as length                       (Brief="Effective Tube Length of one segment of Pipe",Lower=0.1, Symbol = "L_{pipe}");
956Kwall           as conductivity         (Brief="Tube Wall Material Thermal Conductivity",Default=1.0, Symbol = "K_{wall}");
957Rfi                     as positive             (Brief="Inside Fouling Resistance",Unit='m^2*K/kW',Default=1e-6,Lower=0);
958Rfo                     as positive             (Brief="Outside Fouling Resistance",Unit='m^2*K/kW',Default=1e-6,Lower=0);
959
960Donozzle_Inner          as length       (Brief="Inner Side Outlet Nozzle Diameter",Default = 0.036,Lower=1e-6);
961Dinozzle_Inner          as length       (Brief="Inner Side Inlet Nozzle Diameter",Default = 0.036,Lower=1e-6);
962
963Donozzle_Outer          as length               (Brief="Outer Side Outlet Nozzle Diameter",Default = 0.036,Lower=1e-6);
964Dinozzle_Outer  as length               (Brief="Outer Side Inlet Nozzle Diameter",Default = 0.036,Lower=1e-6);
965
966InnerKinlet             as positive             (Brief="Inner Side Inlet Nozzle Pressure Loss Coeff",Default=1.1);
967InnerKoutlet    as positive             (Brief="Inner Side Outlet Nozzle Pressure Loss Coeff",Default=0.7);
968OuterKinlet             as positive             (Brief="Outer Side Inlet Nozzle Pressure Loss Coeff",Default=1.1);
969OuterKoutlet    as positive             (Brief="Outer Side Outlet Nozzle Pressure Loss Coeff",Default=0.7);
970
971SET
972
973#"Pi Number"
974        Pi      = 3.14159265;
975
976#"Number of incremental points"
977        Npoints  = N+1;
978
979VARIABLES
980
981Summary          as Summary_Hairpin     (Brief="Results for The Whole Heat Exchanger");
982
983UpperPipe       as UpperPipe_basic              (Brief="Upper Pipe Results");
984LowerPipe       as LowerPipe_basic              (Brief="Lower Pipe Results");
985
986CONNECTIONS
987
988        LowerPipe.OutletInner           to UpperPipe.InletInner;
989        UpperPipe.OutletOuter           to LowerPipe.InletOuter;
990
991EQUATIONS
992
993"Total Exchange Surface Area"
994        Summary.A = LowerPipe.Details.A+UpperPipe.Details.A;
995
996"Total Duty"
997        Summary.Qtotal = LowerPipe.Details.Qtotal+UpperPipe.Details.Qtotal;
998
999"Total Pressure Drop Inner Side"
1000        Summary.Inner.Pdrop     = Summary.Inner.Pdnozzle_in+Summary.Inner.Pdnozzle_out+LowerPipe.Inner.PressureDrop.Pd_fric(1)
1001        +UpperPipe.Inner.PressureDrop.Pd_fric(Npoints);
1002
1003"Total Pressure Drop Outer Side"
1004        Summary.Outer.Pdrop     = Summary.Outer.Pdnozzle_in+Summary.Outer.Pdnozzle_out+LowerPipe.Outer.PressureDrop.Pd_fric(Npoints)
1005        +UpperPipe.Outer.PressureDrop.Pd_fric(1);
1006
1007for i in [1:N] do
1008
1009"Outer Pipe Local Pressure"# FIXME: NOZZLE PRESSURE DROP MUST BE ADDED
1010        UpperPipe.Outer.PressureDrop.Plocal(i) =        UpperPipe.Outer.PressureDrop.Plocal(Npoints) - UpperPipe.Outer.PressureDrop.Pd_fric(i);
1011
1012"Inner Pipe Local Pressure"# FIXME: NOZZLE PRESSURE DROP MUST BE ADDED
1013        UpperPipe.Inner.PressureDrop.Plocal(i+1) =      UpperPipe.Inner.PressureDrop.Plocal(1) - UpperPipe.Inner.PressureDrop.Pd_fric(i+1);
1014
1015"Inner Pipe Local Pressure"# FIXME: NOZZLE PRESSURE DROP MUST BE ADDED
1016        LowerPipe.Inner.PressureDrop.Plocal(i) =        LowerPipe.Inner.PressureDrop.Plocal(Npoints) - LowerPipe.Inner.PressureDrop.Pd_fric(i);
1017
1018"Outer Pipe Local Pressure"# FIXME: NOZZLE PRESSURE DROP MUST BE ADDED
1019        LowerPipe.Outer.PressureDrop.Plocal(i+1) =      LowerPipe.Outer.PressureDrop.Plocal(1) - LowerPipe.Outer.PressureDrop.Pd_fric(i+1);
1020
1021end
1022
1023"Velocity Inner Side Inlet Nozzle"
1024        Summary.Inner.Vnozzle_in        = UpperPipe.Inner.Properties.Inlet.Fw/(UpperPipe.Inner.Properties.Inlet.rho*(0.25*Pi*Dinozzle_Inner^2));
1025
1026"Velocity Inner Side Outlet Nozzle"
1027        Summary.Inner.Vnozzle_out       = LowerPipe.Inner.Properties.Outlet.Fw/(LowerPipe.Inner.Properties.Outlet.rho*(0.25*Pi*Donozzle_Inner^2));
1028
1029"Velocity Outer Side Inlet Nozzle"
1030        Summary.Outer.Vnozzle_in        = LowerPipe.Outer.Properties.Inlet.Fw/(LowerPipe.Outer.Properties.Inlet.rho*(0.25*Pi*Dinozzle_Outer^2));
1031
1032"Velocity Outer Side Outlet Nozzle"
1033        Summary.Outer.Vnozzle_out       = UpperPipe.Outer.Properties.Outlet.Fw/(UpperPipe.Outer.Properties.Outlet.rho*(0.25*Pi*Donozzle_Outer^2));
1034
1035"Pressure Drop Inner Side Inlet Nozzle"
1036        Summary.Inner.Pdnozzle_in       = 0.5*InnerKinlet*UpperPipe.Inner.Properties.Inlet.rho*Summary.Inner.Vnozzle_in^2;
1037
1038"Pressure Drop Inner Side Outlet Nozzle"
1039        Summary.Inner.Pdnozzle_out      = 0.5*InnerKoutlet*LowerPipe.Inner.Properties.Outlet.rho*Summary.Inner.Vnozzle_out^2;
1040
1041"Pressure Drop Outer Side Inlet Nozzle"
1042        Summary.Outer.Pdnozzle_in       = 0.5*OuterKinlet*LowerPipe.Outer.Properties.Inlet.rho*Summary.Outer.Vnozzle_in^2;
1043
1044"Pressure Drop Outer Side Outlet Nozzle"
1045        Summary.Outer.Pdnozzle_out      = 0.5*OuterKoutlet*UpperPipe.Outer.Properties.Outlet.rho*Summary.Outer.Vnozzle_out^2;
1046
1047"Inner Side Inlet Nozzle rho-V^2"
1048        Summary.Inner.RVsquare_in = UpperPipe.Inner.Properties.Inlet.rho*(Summary.Inner.Vnozzle_in)^2;
1049
1050"Inner Side Outlet Nozzle rho-V^2"
1051        Summary.Inner.RVsquare_out = LowerPipe.Inner.Properties.Outlet.rho*(Summary.Inner.Vnozzle_out)^2;
1052
1053"Outer Side Inlet Nozzle rho-V^2"
1054        Summary.Outer.RVsquare_in = LowerPipe.Outer.Properties.Inlet.rho*(Summary.Outer.Vnozzle_in)^2;
1055
1056"Outer Side Outlet Nozzle rho-V^2"
1057        Summary.Outer.RVsquare_out = UpperPipe.Outer.Properties.Outlet.rho*(Summary.Outer.Vnozzle_out)^2;
1058
1059"Average Film Coefficient Outer Side"
1060        Summary.Outer.hcoeff = sum(UpperPipe.Outer.HeatTransfer.hcoeff+LowerPipe.Outer.HeatTransfer.hcoeff)/(2*N);
1061
1062"Average Film Coefficient Inner Side"
1063        Summary.Inner.hcoeff = sum(UpperPipe.Inner.HeatTransfer.hcoeff+LowerPipe.Inner.HeatTransfer.hcoeff)/(2*N);
1064
1065end
Note: See TracBrowser for help on using the repository browser.