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

Last change on this file since 157 was 147, checked in by gerson bicca, 16 years ago

testing the new language

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.1 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 147 2007-01-31 19:02:46Z bicca $
31*--------------------------------------------------------------------*#
32
33using "streams.mso";
34
35Model Inlet_Main_Stream         
36
37ATTRIBUTES
38        Pallete = false;
39        Brief = "Inlet material streams for Hot and Cold side";
40        Info =
41        "write some information";
42       
43PARAMETERS
44
45outer   Ncold   as Integer      (Brief="Number of Inlet Cold Streams",Lower=1);
46outer   Nhot    as Integer      (Brief="Number of Inlet Hot Streams",Lower=1);
47
48VARIABLES
49
50        Hot  (Nhot)     as stream (Brief="Inlet Hot Streams");
51        Cold (Ncold)    as stream (Brief="Inlet Cold Streams");
52       
53end
54
55Model Outlet_Main_Stream       
56
57ATTRIBUTES
58        Pallete = false;
59        Brief = "Outlet material streams for Hot and Cold side";
60        Info =
61        "write some information";
62       
63PARAMETERS
64
65outer   Ncold   as Integer      (Brief="Number of Outlet Cold Streams",Lower=1);
66outer   Nhot    as Integer      (Brief="Number of Outlet Hot Streams",Lower=1);
67
68VARIABLES
69
70Hot  (Nhot)     as streamPH (Brief="Outlet Hot Streams");
71Cold (Ncold)    as streamPH (Brief="Outlet Cold Streams");
72       
73end
74
75Model Mheatex
76       
77ATTRIBUTES
78        Pallete = true;
79        Brief = "Multistream heat exchangers";
80        Info =
81        "Heat Transfer between multiple hot and cold streams";
82       
83PARAMETERS
84
85outer PP                                        as Plugin       (Brief="Physical Properties");
86outer   NComp                           as Integer      (Brief="Number of Components");
87        FlowDirection                   as Switcher(Brief="Flow Direction",Valid=["counter","cocurrent"],Default="cocurrent");
88        Ncold                                           as Integer      (Brief="Number of Inlet Cold Streams",Lower=1);
89        Nhot                                            as Integer      (Brief="Number of Inlet Hot Streams",Lower=1);
90       
91VARIABLES
92
93in      Inlet   as Inlet_Main_Stream    (Brief="Inlet Streams");               
94out     Outlet  as Outlet_Main_Stream (Brief="Outlet Streams");
95
96        Q               as power                (Brief="Heat Transfer");
97        LMTD            as temp_delta   (Brief="Logarithmic Mean Temperature Difference");
98        UA              as positive             (Brief="UA product",Unit="W/K");
99        DT0             as temp_delta   (Brief="Temperature Difference at Inlet",Lower=1);
100        DTL             as temp_delta   (Brief="Temperature Difference at Outlet",Lower=1);
101       
102EQUATIONS
103
104"Hot Flow"
105        Outlet.Hot.F = Inlet.Hot.F;     
106
107"Cold Flow"
108        Outlet.Cold.F = Inlet.Cold.F;
109       
110"Hot Composition"
111        Outlet.Hot.z = Inlet.Hot.z;
112       
113"Cold Composition"
114        Outlet.Cold.z = Inlet.Cold.z;
115       
116"Heat Duty Hot Stream"
117        Q =  sum(Inlet.Hot.F*(Inlet.Hot.h- Outlet.Hot.h));
118       
119"Heat Duty Cold Stream"
120        Q = -sum(Inlet.Cold.F*(Inlet.Cold.h- Outlet.Cold.h));
121       
122"Heat Duty"
123        Q=UA*LMTD;
124
125       
126if abs(DT0 - DTL) > 0.05*max(abs([DT0,DTL]))
127       
128        then
129"Log Mean Temperature Difference"
130        LMTD= (DT0-DTL)/ln(DT0/DTL);
131
132        else
133       
134if DT0*DTL equal 0
135       
136        then
137"Log Mean Temperature Difference"
138        LMTD = 0.5*(DT0+DTL);
139       
140        else
141"Log Mean Temperature Difference"
142        LMTD = 0.5*(DT0+DTL)*(1-(DT0-DTL)^2/(DT0*DTL)*(1+(DT0-DTL)^2/(DT0*DTL)/2)/12);
143       
144end
145       
146end     
147
148
149switch FlowDirection
150       
151case    "cocurrent":
152
153"Temperature Difference at Inlet"
154        DT0 = max(Inlet.Hot.T) - min(Inlet.Cold.T);
155
156"Temperature Difference at Outlet"
157        DTL = min(Outlet.Hot.T) - max(Outlet.Cold.T);
158       
159case "counter":
160       
161"Temperature Difference at Inlet"
162        DT0 = max(Inlet.Hot.T) - max(Outlet.Cold.T);
163
164"Temperature Difference at Outlet"
165        DTL = min(Outlet.Hot.T) - min(Inlet.Cold.T);
166       
167end
168
169end
Note: See TracBrowser for help on using the repository browser.