source: trunk/eml/streams.mso @ 293

Last change on this file since 293 was 290, checked in by Rafael de Pelegrini Soares, 16 years ago

Better documentation for source and sink models

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.2 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 290 2007-06-20 17:55:46Z rafael $
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       
130        SET
131
132        M   = PP.MolecularWeight();
133
134        VARIABLES
135        out Outlet as stream;
136        x(NComp) as fraction(Brief = "Liquid Molar Fraction");
137        y(NComp) as fraction(Brief = "Vapour Molar Fraction");
138        hl as enth_mol;
139        hv as enth_mol;
140        zmass(NComp)    as fraction                     (Brief = "Mass Fraction");
141        Mw                                      as molweight            (Brief="Average Mol Weight");
142        vm                                      as volume_mol   (Brief="Molar Volume");
143        rho                                     as dens_mass            (Brief="Stream Density");
144        Fw                                      as flow_mass            (Brief="Stream Mass Flow");
145        Fvol                            as flow_vol         (Brief = "Volumetric Flow");
146       
147        EQUATIONS
148        "Flash Calculation"
149        [Outlet.v, x, y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z);
150       
151        "Overall Enthalpy"
152        Outlet.h = (1-Outlet.v)*PP.LiquidEnthalpy(Outlet.T, Outlet.P, x) +
153                Outlet.v*PP.VapourEnthalpy(Outlet.T, Outlet.P, y);
154       
155        hl = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x);
156        hv = PP.VapourEnthalpy(Outlet.T, Outlet.P, y);
157       
158        "Average Molecular Weight"
159        Mw = sum(M*Outlet.z);
160
161        "Mass Density"
162        rho =   (1-Outlet.v)*PP.LiquidDensity(Outlet.T,Outlet.P,x) + Outlet.v*PP.VapourDensity(Outlet.T,Outlet.P,y);
163
164        "Flow Mass"
165        Fw      =  Mw*Outlet.F;
166
167        "Molar Volume"
168        vm = (1-Outlet.v)*PP.LiquidVolume(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourVolume(Outlet.T,Outlet.P,y);
169       
170        "Volumetric Flow"
171        Fvol = Outlet.F*vm ;
172       
173"Mass Fraction"
174        zmass = M*Outlet.z / Mw;       
175       
176end
177
178Model sink
179        ATTRIBUTES
180        Icon = "Sink";
181        Brief = "Material stream sink";
182        Info = "
183        This model should be used for boundary streams when additional
184        information about the stream is desired.
185
186        Some of the additional informations calculated by this models are:
187         * Mass density
188         * Mass flow
189         * Mass compostions
190         * Specific volume
191         * Vapour fraction
192         * Volumetric flow
193         * Liquid and Vapour compositions
194        ";
195
196        PARAMETERS
197        outer PP                        as Plugin               (Brief = "External Physical Properties", Type="PP");
198        outer NComp             as Integer              (Brief = "Number of chemical components", Lower = 1);
199                        M(NComp)  as molweight  (Brief="Component Mol Weight");
200       
201        SET
202
203        M   = PP.MolecularWeight();
204       
205        VARIABLES
206        in Inlet as stream;
207        v as fraction;
208        x(NComp)        as fraction                     (Brief = "Liquid Molar Fraction");
209        y(NComp)        as fraction                     (Brief = "Vapour Molar Fraction");
210        zmass(NComp)    as fraction     (Brief = "Mass Fraction");
211        Mw                      as molweight            (Brief="Average Mol Weight");
212        vm                      as volume_mol   (Brief="Molar Volume");
213        rho                     as dens_mass            (Brief="Stream Density");
214        Fw                      as flow_mass            (Brief="Stream Mass Flow");
215        Fvol          as flow_vol          (Brief = "Volumetric Flow");
216       
217        EQUATIONS
218        "Flash Calculation"
219        [v, x, y] = PP.FlashPH(Inlet.P, Inlet.h, Inlet.z);
220       
221        "Average Molecular Weight"
222        Mw = sum(M*Inlet.z);
223
224        "Mass Density"
225        rho =   (1-v)*PP.LiquidDensity(Inlet.T,Inlet.P,x) + v*PP.VapourDensity(Inlet.T,Inlet.P,y);
226
227        "Flow Mass"
228        Fw      =  Mw*Inlet.F;
229
230        "Molar Volume"
231        vm = (1-v)*PP.LiquidVolume(Inlet.T, Inlet.P, x) + v*PP.VapourVolume(Inlet.T,Inlet.P,y);
232       
233        "Volumetric Flow"
234        Fvol = Inlet.F*vm ;
235       
236        "Mass Fraction"
237        zmass = M*Inlet.z / Mw;
238       
239end
Note: See TracBrowser for help on using the repository browser.