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

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

updated models for the new language

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