source: trunk/eml/streams.mso @ 310

Last change on this file since 310 was 310, checked in by Argimiro Resende Secchi, 16 years ago

Creating energy_stream and set its use.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 7.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* Model of basic streams
17*----------------------------------------------------------------------
18* Author: Paula B. Staudt and Rafael de P. Soares
19* $Id: streams.mso 310 2007-07-13 21:28:33Z arge $
20*---------------------------------------------------------------------*#
21
22using "types";
23
24Model stream
25        ATTRIBUTES
26        Pallete = false;
27        Brief = "General Material Stream";
28        Info =
29        "This is the basic building block for the EML models.
30        Every model should have input and output streams derived
31        from this model.";
32       
33        PARAMETERS
34        outer NComp as Integer (Brief = "Number of chemical components", Lower = 1);
35
36        VARIABLES
37        F as flow_mol;
38        T as temperature;
39        P as pressure;
40        z(NComp) as fraction(Brief = "Overall Molar Fraction");
41        h as enth_mol;
42        v as fraction(Brief = "Vapourisation fraction");
43end
44
45Model liquid_stream as stream
46        ATTRIBUTES
47        Pallete = false;
48        Brief = "Liquid Material Stream";
49        Info =
50        "Model for liquid material streams.
51        This model should be used only when the phase of the stream
52        is known ''a priori''.";
53
54        PARAMETERS
55        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
56       
57        EQUATIONS
58        "Liquid Enthalpy"
59        h = PP.LiquidEnthalpy(T, P, z);
60        "Liquid stream"
61        v = 0;
62end
63
64Model vapour_stream as stream
65        ATTRIBUTES
66        Pallete = false;
67        Brief = "Vapour Material Stream";
68        Info =
69        "Model for vapour material streams.
70        This model should be used only when the phase of the stream
71        is known ''a priori''.";
72
73        PARAMETERS
74        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
75       
76        EQUATIONS
77        "Vapour Enthalpy"
78        h = PP.VapourEnthalpy(T, P, z);
79        "Vapour stream"
80        v = 1;
81end
82
83Model streamPH as stream
84        ATTRIBUTES
85        Brief = "Stream with built-in flash calculation";
86        Info = "
87        This model should be used when the vaporization fraction
88        is unknown.
89       
90        The built-in flash calculation will determine the stream
91        state as a function of the overall composition '''z''', the
92        pressure '''P''' and the enthalpy '''h'''.
93       
94        Additionally, the liquid composition '''x''' and the vapor
95        composition '''y''' are calculated.     
96        ";
97        Pallete = false;
98       
99        PARAMETERS
100        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
101       
102        VARIABLES
103        x(NComp) as fraction(Brief = "Liquid Molar Fraction");
104        y(NComp) as fraction(Brief = "Vapour Molar Fraction");
105       
106        EQUATIONS
107        "Flash Calculation"
108        [v, x, y] = PP.FlashPH(P, h, z);
109        "Enthalpy"
110        h = (1-v)*PP.LiquidEnthalpy(T, P, x) +
111                v*PP.VapourEnthalpy(T, P, y);
112end
113
114Model source
115        ATTRIBUTES
116        Icon = "icon/Source";
117        Brief = "Material stream source";
118        Info = "
119        This model should be used for boundary streams.
120        Usually these streams are known and come from another process
121        units.
122
123        The user should specify:
124         * Total molar (mass or volumetric) flow
125         * Temperature
126         * Pressure
127         * Molar (mass or volumetric) composition
128       
129        No matter the specification set, the model will calculate some
130        additional properties:
131         * Mass density
132         * Mass flow
133         * Mass compostions
134         * Specific volume
135         * Vapour fraction
136         * Volumetric flow
137         * Liquid and Vapour compositions
138        ";
139
140        PARAMETERS
141        outer PP                        as Plugin               (Brief = "External Physical Properties", Type="PP");
142        outer NComp             as Integer              (Brief = "Number of chemical components", Lower = 1);
143                  M(NComp)      as molweight    (Brief = "Component Mol Weight");
144                  rhoModel              as Switcher             (Brief = "Density model", Valid = ["volume", "correlation"], Default="volume");
145       
146        SET
147
148        M   = PP.MolecularWeight();
149
150        VARIABLES
151        out Outlet                      as stream;
152        x(NComp)                        as fraction                     (Brief = "Liquid Molar Fraction");
153        y(NComp)                        as fraction                     (Brief = "Vapour Molar Fraction");
154        hl                                      as enth_mol;
155        hv                                      as enth_mol;
156        zmass(NComp)            as fraction                     (Brief = "Mass Fraction");
157        Mw                                      as molweight            (Brief = "Average Mol Weight");
158        vm                                      as volume_mol           (Brief = "Molar Volume");       
159        rho                                     as dens_mass            (Brief = "Stream Mass Density");
160        rhom                            as dens_mol                     (Brief = "Stream Molar Density");
161        Fw                                      as flow_mass            (Brief = "Stream Mass Flow");
162        Fvol                    as flow_vol         (Brief = "Volumetric Flow");
163       
164        EQUATIONS
165        "Flash Calculation"
166        [Outlet.v, x, y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z);
167       
168        "Overall Enthalpy"
169        Outlet.h = (1-Outlet.v)*PP.LiquidEnthalpy(Outlet.T, Outlet.P, x) +
170                Outlet.v*PP.VapourEnthalpy(Outlet.T, Outlet.P, y);
171       
172        hl = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x);
173        hv = PP.VapourEnthalpy(Outlet.T, Outlet.P, y);
174       
175        "Average Molecular Weight"
176        Mw = sum(M*Outlet.z);
177
178        switch rhoModel
179                case "volume":
180        "Molar Density"
181                rhom * vm = 1;
182               
183                case "correlation":
184        "Mass Density"
185                rho*((1-Outlet.v)/PP.LiquidDensity(Outlet.T,Outlet.P,x) + Outlet.v/PP.VapourDensity(Outlet.T,Outlet.P,y)) = 1;
186        end
187       
188        "Mass or Molar Density"
189        rhom * Mw = rho;
190
191        "Flow Mass"
192        Fw      =  Mw*Outlet.F;
193
194        "Molar Volume"
195        vm = (1-Outlet.v)*PP.LiquidVolume(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourVolume(Outlet.T,Outlet.P,y);
196       
197        "Volumetric Flow"
198        Fvol = Outlet.F*vm ;
199       
200        "Mass Fraction"
201        zmass = M*Outlet.z / Mw;       
202       
203end
204
205Model sink
206        ATTRIBUTES
207        Icon = "icon/Sink";
208        Brief = "Material stream sink";
209        Info = "
210        This model should be used for boundary streams when additional
211        information about the stream is desired.
212
213        Some of the additional informations calculated by this models are:
214         * Mass density
215         * Mass flow
216         * Mass compostions
217         * Specific volume
218         * Vapour fraction
219         * Volumetric flow
220         * Liquid and Vapour compositions
221        ";
222
223        PARAMETERS
224        outer PP                        as Plugin               (Brief = "External Physical Properties", Type="PP");
225        outer NComp             as Integer              (Brief = "Number of chemical components", Lower = 1);
226                  M(NComp)      as molweight    (Brief = "Component Mol Weight");
227                  rhoModel              as Switcher             (Brief = "Density model", Valid = ["volume", "correlation"], Default="volume");
228       
229        SET
230
231        M   = PP.MolecularWeight();
232       
233        VARIABLES
234        in Inlet                as stream;
235        v                               as fraction;
236        x(NComp)                as fraction             (Brief = "Liquid Molar Fraction");
237        y(NComp)                as fraction             (Brief = "Vapour Molar Fraction");
238        zmass(NComp)    as fraction             (Brief = "Mass Fraction");
239        Mw                              as molweight    (Brief = "Average Mol Weight");
240        vm                              as volume_mol   (Brief = "Molar Volume");       
241        rho                             as dens_mass    (Brief = "Stream Mass Density");
242        rhom                    as dens_mol             (Brief = "Stream Molar Density");
243        Fw                              as flow_mass    (Brief = "Stream Mass Flow");
244        Fvol            as flow_vol     (Brief = "Volumetric Flow");
245       
246        EQUATIONS
247        "Flash Calculation"
248        [v, x, y] = PP.FlashPH(Inlet.P, Inlet.h, Inlet.z);
249       
250        "Average Molecular Weight"
251        Mw = sum(M*Inlet.z);
252
253        switch rhoModel
254                case "volume":
255        "Molar Density"
256                rhom * vm = 1;
257               
258                case "correlation":
259        "Mass Density"
260                rho * ((1-v)/PP.LiquidDensity(Inlet.T,Inlet.P,x) + v/PP.VapourDensity(Inlet.T,Inlet.P,y)) = 1;
261        end
262       
263        "Mass or Molar Density"
264        rhom * Mw = rho;
265
266        "Flow Mass"
267        Fw      =  Mw*Inlet.F;
268
269        "Molar Volume"
270        vm = (1-v)*PP.LiquidVolume(Inlet.T, Inlet.P, x) + v*PP.VapourVolume(Inlet.T,Inlet.P,y);
271       
272        "Volumetric Flow"
273        Fvol = Inlet.F*vm ;
274       
275        "Mass Fraction"
276        zmass = M*Inlet.z / Mw;
277       
278end
279
280Model energy_stream
281        ATTRIBUTES
282        Pallete = false;
283        Brief = "General Energy Stream";
284        Info =
285        "This is the basic building block for the EML models.
286        Every model should have input and output energy streams
287        derived from this model.";
288
289        VARIABLES
290        Q as heat_rate(Brief="Energy rate");
291end
292
293Model energy_source
294        ATTRIBUTES
295        Icon = "icon/energy_source";
296        Brief = "Enegry stream source";
297
298        VARIABLES
299        out Outlet                      as energy_stream;
300end
Note: See TracBrowser for help on using the repository browser.