source: branches/newlanguage/eml/heat_exchangers/Mheatex.mso @ 131

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

updated

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.7 KB
Line 
1#*-------------------------------------------------------------------
2* EMSO Model Library (EML) Copyright (C) 2004 - 2007 ALSOC.
3*
4* This LIBRARY is free software; you can distribute it and/or modify
5* it under the therms of the ALSOC FREE LICENSE as available at
6* http://www.enq.ufrgs.br/alsoc.
7*
8* EMSO Copyright (C) 2004 - 2007 ALSOC, original code
9* from http://www.rps.eng.br Copyright (C) 2002-2004.
10* All rights reserved.
11*
12* EMSO is distributed under the therms of the ALSOC LICENSE as
13* available at http://www.enq.ufrgs.br/alsoc.
14*
15*
16*---------------------------------------------------------------------
17* Model of a Multistream Heat Exchanger
18*
19*       Streams:
20*               * Hot Inlet streams ....        at least one Hot material stream
21*               * Cold Inlet streams ....       at least one Cold material stream
22*               * Hot Outlet streams  ....      one material stream for each Hot Inlet
23*               * Cold Outlet streams  ....     one material stream for each Cold Inlet
24*
25*       Purpose:
26*               * Heat Transfer between multiple hot and cold streams.
27*
28*----------------------------------------------------------------------
29* Author: Gerson Balbueno Bicca
30* $Id: Mheatex.mso 131 2007-01-24 13:39:47Z bicca $
31*--------------------------------------------------------------------*#
32
33using "streams.mso";
34
35Model Inlet_Main_Stream         
36#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
37#       Inlet Streams
38#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
39PARAMETERS
40
41        Ncold   as Integer      (Brief="Number of Inlet Cold Streams",Lower=1);
42        Nhot    as Integer      (Brief="Number of Inlet Hot Streams",Lower=1);
43       
44VARIABLES
45
46        Hot  (Nhot)     as stream;# Inlet Hot Streams
47        Cold (Ncold)    as stream;# Inlet Cold Streams
48       
49end
50
51Model Outlet_Main_Stream       
52#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
53#       Outlet Streams
54#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
55PARAMETERS
56
57        Ncold   as Integer      (Brief="Number of Inlet Cold Streams",Lower=1);
58        Nhot    as Integer      (Brief="Number of Inlet Hot Streams",Lower=1);
59       
60VARIABLES
61
62        Hot  (Nhot)     as liquid_stream;# Outlet Hot Streams
63        Cold (Ncold)    as liquid_stream;# Outlet Cold Streams
64       
65end
66
67Model Mheatex
68#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
69#       Multistream Heat Exchanger Basic Calculation
70#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
71PARAMETERS
72
73outer PP                as Plugin       (Brief="Physical Properties");
74outer   NComp   as Integer              (Brief="Number of Components");
75#       HE              as Plugin       (Brief="Cold Box Calculations",File="heatex");
76        Side    as Integer              (Brief="Flow Direction",Lower=0,Upper=1);
77        Ncold   as Integer              (Brief="Number of Inlet Cold Streams",Lower=1);
78        Nhot    as Integer              (Brief="Number of Inlet Hot Streams",Lower=1);
79       
80VARIABLES
81
82in  Inlet       as Inlet_Main_Stream;           # Inlet Hot Streams
83out Outlet      as Outlet_Main_Stream;          # Outlet Hot Streams
84
85        Q       as power                (Brief="Heat Transfer");
86        LMTD    as temp_delta   (Brief="Logarithmic Mean Temperature Difference");
87        UA      as positive     (Unit="W/K");
88        DT0     as temp_delta   (Brief="Temperature Difference at Inlet",Lower=1);
89        DTL             as temp_delta   (Brief="Temperature Difference at Outlet",Lower=1);
90       
91SET
92
93# Flow Direction
94#       Side = HE.FlowDir();
95
96# Inlet Ncold Parameters
97        Inlet.Ncold  = Ncold;
98       
99# Outlet Ncold Parameters
100        Outlet.Ncold = Ncold;
101
102# Inlet Nhot Parameters
103        Inlet.Nhot  = Nhot;
104       
105# Outlet Nhot Parameters
106        Outlet.Nhot = Nhot ;
107
108EQUATIONS
109
110"Hot Flow"
111        Outlet.Hot.F = Inlet.Hot.F;     
112
113"Cold Flow"
114        Outlet.Cold.F = Inlet.Cold.F;
115       
116"Hot Composition"
117        Outlet.Hot.z = Inlet.Hot.z;
118       
119"Cold Composition"
120        Outlet.Cold.z = Inlet.Cold.z;
121       
122
123
124for i in [1:Nhot]
125
126"Vapourisation Fraction Hot Stream"
127        Outlet.Hot(i).v = PP.VapourFraction(Outlet.Hot(i).T,Outlet.Hot(i).P,Outlet.Hot(i).z);           
128       
129end     
130
131
132for j in [1:Ncold]
133       
134"Vapourisation Fraction Cold Stream"
135        Outlet.Cold(j).v = PP.VapourFraction(Outlet.Cold(j).T,Outlet.Cold(j).P,Outlet.Cold(j).z);
136       
137end
138       
139
140"Heat Duty Hot Stream"
141        Q =  sum(Inlet.Hot.F*(Inlet.Hot.h- Outlet.Hot.h));
142       
143"Heat Duty Cold Stream"
144        Q = -sum(Inlet.Cold.F*(Inlet.Cold.h- Outlet.Cold.h));
145       
146"Heat Duty"
147        Q=UA*LMTD;
148
149       
150if abs(DT0 - DTL) > 0.05*max(abs([DT0,DTL]))
151       
152        then
153"Log Mean Temperature Difference"
154        LMTD= (DT0-DTL)/ln(DT0/DTL);
155
156        else
157       
158if DT0*DTL equal 0
159       
160        then
161"Log Mean Temperature Difference"
162        LMTD = 0.5*(DT0+DTL);
163       
164        else
165"Log Mean Temperature Difference"
166        LMTD = 0.5*(DT0+DTL)*(1-(DT0-DTL)^2/(DT0*DTL)*(1+(DT0-DTL)^2/(DT0*DTL)/2)/12);
167       
168end
169       
170end     
171
172
173if Side equal 0
174       
175        then
176       
177"Temperature Difference at Inlet"
178        DT0 = max(Inlet.Hot.T) - min(Inlet.Cold.T);
179
180"Temperature Difference at Outlet"
181        DTL = min(Outlet.Hot.T) - max(Outlet.Cold.T);
182       
183        else
184       
185"Temperature Difference at Inlet"
186        DT0 = max(Inlet.Hot.T) - max(Outlet.Cold.T);
187
188"Temperature Difference at Outlet"
189        DTL = min(Outlet.Hot.T) - min(Inlet.Cold.T);
190       
191end
192
193end
Note: See TracBrowser for help on using the repository browser.