source: trunk/eml/streams.mso @ 297

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

Added switcher to select a model to evaluate the mixture density.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.9 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 297 2007-06-28 12:27:02Z 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        PARAMETERS
85        outer PP as Plugin(Brief = "External Physical Properties", Type="PP");
86       
87        VARIABLES
88        x(NComp) as fraction(Brief = "Liquid Molar Fraction");
89        y(NComp) as fraction(Brief = "Vapour Molar Fraction");
90       
91        EQUATIONS
92        "Flash Calculation"
93        [v, x, y] = PP.FlashPH(P, h, z);
94        "Enthalpy"
95        h = (1-v)*PP.LiquidEnthalpy(T, P, x) +
96                v*PP.VapourEnthalpy(T, P, y);
97end
98
99Model source
100        ATTRIBUTES
101        Icon = "Source";
102        Brief = "Material stream source";
103        Info = "
104        This model should be used for boundary streams.
105        Usually these streams are known and come from another process
106        units.
107
108        The user should specify:
109         * Total molar (mass or volumetric) flow
110         * Temperature
111         * Pressure
112         * Molar (mass or volumetric) composition
113       
114        No matter the specification set, the model will calculate some
115        additional properties:
116         * Mass density
117         * Mass flow
118         * Mass compostions
119         * Specific volume
120         * Vapour fraction
121         * Volumetric flow
122         * Liquid and Vapour compositions
123        ";
124
125        PARAMETERS
126        outer PP                        as Plugin               (Brief = "External Physical Properties", Type="PP");
127        outer NComp             as Integer              (Brief = "Number of chemical components", Lower = 1);
128                  M(NComp)      as molweight    (Brief = "Component Mol Weight");
129                  rhoModel              as Switcher             (Brief = "Density model", Valid = ["volume", "correlation"], Default="volume");
130       
131        SET
132
133        M   = PP.MolecularWeight();
134
135        VARIABLES
136        out Outlet                      as stream;
137        x(NComp)                        as fraction                     (Brief = "Liquid Molar Fraction");
138        y(NComp)                        as fraction                     (Brief = "Vapour Molar Fraction");
139        hl                                      as enth_mol;
140        hv                                      as enth_mol;
141        zmass(NComp)            as fraction                     (Brief = "Mass Fraction");
142        Mw                                      as molweight            (Brief = "Average Mol Weight");
143        vm                                      as volume_mol           (Brief = "Molar Volume");       
144        rho                                     as dens_mass            (Brief = "Stream Mass Density");
145        rhom                            as dens_mol                     (Brief = "Stream Molar Density");
146        Fw                                      as flow_mass            (Brief = "Stream Mass Flow");
147        Fvol                    as flow_vol         (Brief = "Volumetric Flow");
148       
149        EQUATIONS
150        "Flash Calculation"
151        [Outlet.v, x, y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z);
152       
153        "Overall Enthalpy"
154        Outlet.h = (1-Outlet.v)*PP.LiquidEnthalpy(Outlet.T, Outlet.P, x) +
155                Outlet.v*PP.VapourEnthalpy(Outlet.T, Outlet.P, y);
156       
157        hl = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x);
158        hv = PP.VapourEnthalpy(Outlet.T, Outlet.P, y);
159       
160        "Average Molecular Weight"
161        Mw = sum(M*Outlet.z);
162
163        switch rhoModel
164                case "volume":
165        "Molar Density"
166                rhom * vm = 1;
167               
168                case "correlation":
169        "Mass Density"
170                rho*((1-Outlet.v)/PP.LiquidDensity(Outlet.T,Outlet.P,x) + Outlet.v/PP.VapourDensity(Outlet.T,Outlet.P,y)) = 1;
171        end
172       
173        "Mass or Molar Density"
174        rhom * Mw = rho;
175
176        "Flow Mass"
177        Fw      =  Mw*Outlet.F;
178
179        "Molar Volume"
180        vm = (1-Outlet.v)*PP.LiquidVolume(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourVolume(Outlet.T,Outlet.P,y);
181       
182        "Volumetric Flow"
183        Fvol = Outlet.F*vm ;
184       
185        "Mass Fraction"
186        zmass = M*Outlet.z / Mw;       
187       
188end
189
190Model sink
191        ATTRIBUTES
192        Icon = "Sink";
193        Brief = "Material stream sink";
194        Info = "
195        This model should be used for boundary streams when additional
196        information about the stream is desired.
197
198        Some of the additional informations calculated by this models are:
199         * Mass density
200         * Mass flow
201         * Mass compostions
202         * Specific volume
203         * Vapour fraction
204         * Volumetric flow
205         * Liquid and Vapour compositions
206        ";
207
208        PARAMETERS
209        outer PP                        as Plugin               (Brief = "External Physical Properties", Type="PP");
210        outer NComp             as Integer              (Brief = "Number of chemical components", Lower = 1);
211                  M(NComp)      as molweight    (Brief = "Component Mol Weight");
212                  rhoModel              as Switcher             (Brief = "Density model", Valid = ["volume", "correlation"], Default="volume");
213       
214        SET
215
216        M   = PP.MolecularWeight();
217       
218        VARIABLES
219        in Inlet                as stream;
220        v                               as fraction;
221        x(NComp)                as fraction             (Brief = "Liquid Molar Fraction");
222        y(NComp)                as fraction             (Brief = "Vapour Molar Fraction");
223        zmass(NComp)    as fraction             (Brief = "Mass Fraction");
224        Mw                              as molweight    (Brief = "Average Mol Weight");
225        vm                              as volume_mol   (Brief = "Molar Volume");       
226        rho                             as dens_mass    (Brief = "Stream Mass Density");
227        rhom                    as dens_mol             (Brief = "Stream Molar Density");
228        Fw                              as flow_mass    (Brief = "Stream Mass Flow");
229        Fvol            as flow_vol     (Brief = "Volumetric Flow");
230       
231        EQUATIONS
232        "Flash Calculation"
233        [v, x, y] = PP.FlashPH(Inlet.P, Inlet.h, Inlet.z);
234       
235        "Average Molecular Weight"
236        Mw = sum(M*Inlet.z);
237
238        switch rhoModel
239                case "volume":
240        "Molar Density"
241                rhom * vm = 1;
242               
243                case "correlation":
244        "Mass Density"
245                rho * ((1-v)/PP.LiquidDensity(Inlet.T,Inlet.P,x) + v/PP.VapourDensity(Inlet.T,Inlet.P,y)) = 1;
246        end
247       
248        "Mass or Molar Density"
249        rhom * Mw = rho;
250
251        "Flow Mass"
252        Fw      =  Mw*Inlet.F;
253
254        "Molar Volume"
255        vm = (1-v)*PP.LiquidVolume(Inlet.T, Inlet.P, x) + v*PP.VapourVolume(Inlet.T,Inlet.P,y);
256       
257        "Volumetric Flow"
258        Fvol = Inlet.F*vm ;
259       
260        "Mass Fraction"
261        zmass = M*Inlet.z / Mw;
262       
263end
Note: See TracBrowser for help on using the repository browser.