source: trunk/eml/streams.mso @ 311

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

Creating simple source and sink devices.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 9.0 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 311 2007-07-14 00:17:11Z 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 simple_source
206        ATTRIBUTES
207        Icon = "icon/Source";
208        Brief = "Simple material stream source";
209        Info = "
210        This model should be used for boundary streams.
211        Usually these streams are known and come from another process
212        units.
213
214        The user should specify:
215         * Total molar flow
216         * Temperature
217         * Pressure
218         * Molar composition
219        ";
220
221        PARAMETERS
222        outer PP                        as Plugin               (Brief = "External Physical Properties", Type="PP");
223        outer NComp             as Integer              (Brief = "Number of chemical components", Lower = 1);
224       
225        VARIABLES
226        out Outlet                      as stream;
227        x(NComp)                        as fraction                     (Brief = "Liquid Molar Fraction");
228        y(NComp)                        as fraction                     (Brief = "Vapour Molar Fraction");
229        hl                                      as enth_mol;
230        hv                                      as enth_mol;
231       
232        EQUATIONS
233        "Flash Calculation"
234        [Outlet.v, x, y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z);
235       
236        "Overall Enthalpy"
237        Outlet.h = (1-Outlet.v)*PP.LiquidEnthalpy(Outlet.T, Outlet.P, x) +
238                Outlet.v*PP.VapourEnthalpy(Outlet.T, Outlet.P, y);
239
240        hl = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x);
241        hv = PP.VapourEnthalpy(Outlet.T, Outlet.P, y);
242end
243
244Model sink
245        ATTRIBUTES
246        Icon = "icon/Sink";
247        Brief = "Material stream sink";
248        Info = "
249        This model should be used for boundary streams when additional
250        information about the stream is desired.
251
252        Some of the additional informations calculated by this models are:
253         * Mass density
254         * Mass flow
255         * Mass compostions
256         * Specific volume
257         * Vapour fraction
258         * Volumetric flow
259         * Liquid and Vapour compositions
260        ";
261
262        PARAMETERS
263        outer PP                        as Plugin               (Brief = "External Physical Properties", Type="PP");
264        outer NComp             as Integer              (Brief = "Number of chemical components", Lower = 1);
265                  M(NComp)      as molweight    (Brief = "Component Mol Weight");
266                  rhoModel              as Switcher             (Brief = "Density model", Valid = ["volume", "correlation"], Default="volume");
267       
268        SET
269
270        M   = PP.MolecularWeight();
271       
272        VARIABLES
273        in Inlet                as stream;
274        v                               as fraction;
275        x(NComp)                as fraction             (Brief = "Liquid Molar Fraction");
276        y(NComp)                as fraction             (Brief = "Vapour Molar Fraction");
277        zmass(NComp)    as fraction             (Brief = "Mass Fraction");
278        Mw                              as molweight    (Brief = "Average Mol Weight");
279        vm                              as volume_mol   (Brief = "Molar Volume");       
280        rho                             as dens_mass    (Brief = "Stream Mass Density");
281        rhom                    as dens_mol             (Brief = "Stream Molar Density");
282        Fw                              as flow_mass    (Brief = "Stream Mass Flow");
283        Fvol            as flow_vol     (Brief = "Volumetric Flow");
284       
285        EQUATIONS
286        "Flash Calculation"
287        [v, x, y] = PP.FlashPH(Inlet.P, Inlet.h, Inlet.z);
288       
289        "Average Molecular Weight"
290        Mw = sum(M*Inlet.z);
291
292        switch rhoModel
293                case "volume":
294        "Molar Density"
295                rhom * vm = 1;
296               
297                case "correlation":
298        "Mass Density"
299                rho * ((1-v)/PP.LiquidDensity(Inlet.T,Inlet.P,x) + v/PP.VapourDensity(Inlet.T,Inlet.P,y)) = 1;
300        end
301       
302        "Mass or Molar Density"
303        rhom * Mw = rho;
304
305        "Flow Mass"
306        Fw      =  Mw*Inlet.F;
307
308        "Molar Volume"
309        vm = (1-v)*PP.LiquidVolume(Inlet.T, Inlet.P, x) + v*PP.VapourVolume(Inlet.T,Inlet.P,y);
310       
311        "Volumetric Flow"
312        Fvol = Inlet.F*vm ;
313       
314        "Mass Fraction"
315        zmass = M*Inlet.z / Mw;
316       
317end
318
319Model simple_sink
320        ATTRIBUTES
321        Icon = "icon/Sink";
322        Brief = "Simple material stream sink";
323        Info = "
324        This model should be used for boundary streams when no additional
325        information about the stream is desired.
326        ";
327       
328        VARIABLES
329        in Inlet                as stream;
330end
331
332Model energy_stream
333        ATTRIBUTES
334        Pallete = false;
335        Brief = "General Energy Stream";
336        Info =
337        "This is the basic building block for the EML models.
338        Every model should have input and output energy streams
339        derived from this model.";
340
341        VARIABLES
342        Q as heat_rate(Brief="Energy rate");
343end
344
345Model energy_source
346        ATTRIBUTES
347        Icon = "icon/energy_source";
348        Brief = "Enegry stream source";
349
350        VARIABLES
351        out Outlet                      as energy_stream;
352end
Note: See TracBrowser for help on using the repository browser.