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

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

updated models and samples for the new language

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.3 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 135 2007-01-25 20:00:26Z 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
45        Ncold   as Integer      (Brief="Number of Inlet Cold Streams",Lower=1);
46        Nhot    as Integer      (Brief="Number of Inlet Hot Streams",Lower=1);
[1]47       
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
[135]65        Ncold   as Integer      (Brief="Number of Outlet Cold Streams",Lower=1);
66        Nhot    as Integer      (Brief="Number of Outlet Hot Streams",Lower=1);
[45]67       
[1]68VARIABLES
[135]69# Must be streamPH
70        Hot  (Nhot)     as liquid_stream (Brief="Outlet Hot Streams");
71        Cold (Ncold)    as liquid_stream (Brief="Outlet Cold Streams");
[1]72       
73end
74
75Model Mheatex
[135]76       
77ATTRIBUTES
78        Pallete = false;
79        Brief = "Multistream heat exchangers";
80        Info =
81        "Heat Transfer between multiple hot and cold streams";
82       
[1]83PARAMETERS
84
[131]85outer PP                as Plugin       (Brief="Physical Properties");
[135]86outer   NComp   as Integer      (Brief="Number of Components");
87        HE                      as Plugin       (Brief="Cold Box Calculations",File="heatex");
88        Side                    as Integer      (Brief="Flow Direction",Lower=0,Upper=1);
89        Ncold                   as Integer      (Brief="Number of Inlet Cold Streams",Lower=1);
90        Nhot                    as Integer      (Brief="Number of Inlet Hot Streams",Lower=1);
[45]91       
[1]92VARIABLES
93
[135]94in      Inlet   as Inlet_Main_Stream    (Brief="Inlet Streams");               
95out     Outlet  as Outlet_Main_Stream (Brief="Outlet Streams");
[1]96
[135]97        Q               as power                (Brief="Heat Transfer");
98        LMTD            as temp_delta   (Brief="Logarithmic Mean Temperature Difference");
99        UA              as positive             (Brief="UA product",Unit="W/K");
100        DT0             as temp_delta   (Brief="Temperature Difference at Inlet",Lower=1);
[131]101        DTL             as temp_delta   (Brief="Temperature Difference at Outlet",Lower=1);
102       
[45]103SET
104
[100]105# Flow Direction
[135]106        Side = HE.FlowDir();
[45]107
[100]108# Inlet Ncold Parameters
109        Inlet.Ncold  = Ncold;
110       
111# Outlet Ncold Parameters
112        Outlet.Ncold = Ncold;
[45]113
[100]114# Inlet Nhot Parameters
115        Inlet.Nhot  = Nhot;
116       
117# Outlet Nhot Parameters
118        Outlet.Nhot = Nhot ;
[45]119
[1]120EQUATIONS
121
122"Hot Flow"
123        Outlet.Hot.F = Inlet.Hot.F;     
124
125"Cold Flow"
126        Outlet.Cold.F = Inlet.Cold.F;
127       
128"Hot Composition"
129        Outlet.Hot.z = Inlet.Hot.z;
130       
131"Cold Composition"
132        Outlet.Cold.z = Inlet.Cold.z;
133       
134"Heat Duty Hot Stream"
135        Q =  sum(Inlet.Hot.F*(Inlet.Hot.h- Outlet.Hot.h));
136       
137"Heat Duty Cold Stream"
138        Q = -sum(Inlet.Cold.F*(Inlet.Cold.h- Outlet.Cold.h));
139       
140"Heat Duty"
141        Q=UA*LMTD;
142
[131]143       
144if abs(DT0 - DTL) > 0.05*max(abs([DT0,DTL]))
145       
146        then
147"Log Mean Temperature Difference"
148        LMTD= (DT0-DTL)/ln(DT0/DTL);
[26]149
[131]150        else
151       
152if DT0*DTL equal 0
153       
154        then
155"Log Mean Temperature Difference"
156        LMTD = 0.5*(DT0+DTL);
157       
158        else
159"Log Mean Temperature Difference"
160        LMTD = 0.5*(DT0+DTL)*(1-(DT0-DTL)^2/(DT0*DTL)*(1+(DT0-DTL)^2/(DT0*DTL)/2)/12);
161       
162end
163       
164end     
165
166
[1]167if Side equal 0
168       
169        then
170       
[131]171"Temperature Difference at Inlet"
172        DT0 = max(Inlet.Hot.T) - min(Inlet.Cold.T);
173
174"Temperature Difference at Outlet"
175        DTL = min(Outlet.Hot.T) - max(Outlet.Cold.T);
176       
[1]177        else
178       
[131]179"Temperature Difference at Inlet"
180        DT0 = max(Inlet.Hot.T) - max(Outlet.Cold.T);
181
182"Temperature Difference at Outlet"
183        DTL = min(Outlet.Hot.T) - min(Inlet.Cold.T);
184       
[1]185end
186
187end
Note: See TracBrowser for help on using the repository browser.