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

Last change on this file since 147 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
RevLine 
[78]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*---------------------------------------------------------------------
[26]17* Model of a Multistream Heat Exchanger
[1]18*
[26]19*       Streams:
[131]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
[1]24*
[26]25*       Purpose:
[131]26*               * Heat Transfer between multiple hot and cold streams.
[1]27*
28*----------------------------------------------------------------------
29* Author: Gerson Balbueno Bicca
30* $Id: Mheatex.mso 147 2007-01-31 19:02:46Z bicca $
31*--------------------------------------------------------------------*#
[45]32
[1]33using "streams.mso";
34
[45]35Model Inlet_Main_Stream         
[135]36
37ATTRIBUTES
38        Pallete = false;
39        Brief = "Inlet material streams for Hot and Cold side";
40        Info =
41        "write some information";
42       
[1]43PARAMETERS
[45]44
[140]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
[1]48VARIABLES
49
[135]50        Hot  (Nhot)     as stream (Brief="Inlet Hot Streams");
51        Cold (Ncold)    as stream (Brief="Inlet Cold Streams");
[1]52       
53end
54
[45]55Model Outlet_Main_Stream       
[135]56
57ATTRIBUTES
58        Pallete = false;
59        Brief = "Outlet material streams for Hot and Cold side";
60        Info =
61        "write some information";
62       
[45]63PARAMETERS
64
[140]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
[1]68VARIABLES
[147]69
70Hot  (Nhot)     as streamPH (Brief="Outlet Hot Streams");
71Cold (Ncold)    as streamPH (Brief="Outlet Cold Streams");
[1]72       
73end
74
75Model Mheatex
[135]76       
77ATTRIBUTES
[139]78        Pallete = true;
[135]79        Brief = "Multistream heat exchangers";
80        Info =
81        "Heat Transfer between multiple hot and cold streams";
82       
[1]83PARAMETERS
84
[144]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);
[45]90       
[1]91VARIABLES
92
[135]93in      Inlet   as Inlet_Main_Stream    (Brief="Inlet Streams");               
94out     Outlet  as Outlet_Main_Stream (Brief="Outlet Streams");
[1]95
[135]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);
[131]100        DTL             as temp_delta   (Brief="Temperature Difference at Outlet",Lower=1);
101       
[1]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
[131]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);
[26]131
[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
[144]149switch FlowDirection
[1]150       
[140]151case    "cocurrent":
152
[131]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       
[140]159case "counter":
[1]160       
[131]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       
[1]167end
168
169end
Note: See TracBrowser for help on using the repository browser.