source: trunk/eml/streams.mso @ 437

Last change on this file since 437 was 352, checked in by Argimiro Resende Secchi, 15 years ago

Adding more symbol for latex.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 10.5 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 352 2007-08-30 05:39: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                   (Brief = "Stream Molar Flow Rate");
38        T as temperature                (Brief = "Stream Temperature");
39        P as pressure                   (Brief = "Stream Pressure");
40        z(NComp) as fraction    (Brief = "Stream Molar Fraction");
41        h as enth_mol                   (Brief = "Stream Enthalpy");
42        v as fraction                   (Brief = "Vapourization 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        s as entr_mol                   (Brief = "Stream Entropy");
106
107        EQUATIONS
108        "Flash Calculation"
109        [v, x, y] = PP.FlashPH(P, h, z);
110       
111        "Enthalpy"
112        h = (1-v)*PP.LiquidEnthalpy(T, P, x) +
113                v*PP.VapourEnthalpy(T, P, y);
114       
115        "Entropy"
116        s = (1-v)*PP.LiquidEntropy(T, P, x) +
117                v*PP.VapourEntropy(T, P, y);
118end
119
120Model source
121        ATTRIBUTES
122        Pallete = true;
123        Icon = "icon/Source";
124        Brief = "Material stream source";
125        Info = "
126        This model should be used for boundary streams.
127        Usually these streams are known and come from another process
128        units.
129
130        The user should specify:
131         * Total molar (mass or volumetric) flow
132         * Temperature
133         * Pressure
134         * Molar (mass or volumetric) composition
135       
136        No matter the specification set, the model will calculate some
137        additional properties:
138         * Mass density
139         * Mass flow
140         * Mass compostions
141         * Specific volume
142         * Vapour fraction
143         * Volumetric flow
144         * Liquid and Vapour compositions
145        ";
146
147        PARAMETERS
148        outer PP                        as Plugin               (Brief = "External Physical Properties", Type="PP");
149        outer NComp             as Integer              (Brief = "Number of chemical components", Lower = 1);
150                  M(NComp)      as molweight    (Brief = "Component Mol Weight");
151                  rhoModel              as Switcher             (Brief = "Density model", Valid = ["volume", "correlation"], Default="volume");
152       
153        SET
154
155        M   = PP.MolecularWeight();
156
157        VARIABLES
158        out Outlet                      as stream                       (Brief = "Outlet stream", PosX=1, PosY=0.5256, Symbol="_{out}");
159        x(NComp)                        as fraction                     (Brief = "Liquid Molar Fraction");
160        y(NComp)                        as fraction                     (Brief = "Vapour Molar Fraction");
161        hl                                      as enth_mol                     (Brief = "Liquid Enthalpy");
162        hv                                      as enth_mol                     (Brief = "Vapour Enthalpy");
163        s                                       as entr_mol                     (Brief = "Stream Entropy");
164        sl                                      as entr_mol                     (Brief = "Liquid Entropy");
165        sv                                      as entr_mol                     (Brief = "Vapour Entropy");     
166        zmass(NComp)            as fraction                     (Brief = "Mass Fraction");
167        Mw                                      as molweight            (Brief = "Average Mol Weight");
168        vm                                      as volume_mol           (Brief = "Molar Volume");       
169        rho                                     as dens_mass            (Brief = "Stream Mass Density");
170        rhom                            as dens_mol                     (Brief = "Stream Molar Density");
171        Fw                                      as flow_mass            (Brief = "Stream Mass Flow");
172        Fvol                    as flow_vol         (Brief = "Volumetric Flow");
173       
174        EQUATIONS
175        "Flash Calculation"
176        [Outlet.v, x, y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z);
177       
178        "Overall Enthalpy"
179        Outlet.h = (1-Outlet.v)*hl + Outlet.v*hv;
180
181        "Liquid Enthalpy"
182        hl = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x);
183
184        "Vapour Enthalpy"
185        hv = PP.VapourEnthalpy(Outlet.T, Outlet.P, y);
186
187        "Overall Entropy"
188        s = (1-Outlet.v)*sl + Outlet.v*sv;
189
190        "Liquid Entropy"
191        sl = PP.LiquidEntropy(Outlet.T, Outlet.P, x);
192       
193        "Vapour Entropy"
194        sv = PP.VapourEntropy(Outlet.T, Outlet.P, y);
195
196        "Average Molecular Weight"
197        Mw = sum(M*Outlet.z);
198
199        switch rhoModel
200                case "volume":
201        "Molar Density"
202                rhom * vm = 1;
203               
204                case "correlation":
205        "Mass Density"
206                rho*((1-Outlet.v)/PP.LiquidDensity(Outlet.T,Outlet.P,x) + Outlet.v/PP.VapourDensity(Outlet.T,Outlet.P,y)) = 1;
207        end
208       
209        "Mass or Molar Density"
210        rhom * Mw = rho;
211
212        "Flow Mass"
213        Fw      =  Mw*Outlet.F;
214
215        "Molar Volume"
216        vm = (1-Outlet.v)*PP.LiquidVolume(Outlet.T, Outlet.P, x) + Outlet.v*PP.VapourVolume(Outlet.T,Outlet.P,y);
217       
218        "Volumetric Flow"
219        Fvol = Outlet.F*vm ;
220       
221        "Mass Fraction"
222        zmass = M*Outlet.z / Mw;       
223       
224end
225
226Model simple_source
227        ATTRIBUTES
228        Pallete = true;
229        Icon = "icon/Source";
230        Brief = "Simple material stream source";
231        Info = "
232        This model should be used for boundary streams.
233        Usually these streams are known and come from another process
234        units.
235
236        The user should specify:
237         * Total molar flow
238         * Temperature
239         * Pressure
240         * Molar composition
241        ";
242
243        PARAMETERS
244        outer PP                        as Plugin               (Brief = "External Physical Properties", Type="PP");
245        outer NComp             as Integer              (Brief = "Number of chemical components", Lower = 1);
246       
247        VARIABLES
248        out Outlet                      as stream               (Brief = "Outlet stream", PosX=1, PosY=0.5256, Symbol="_{out}");
249        x(NComp)                        as fraction             (Brief = "Liquid Molar Fraction");
250        y(NComp)                        as fraction             (Brief = "Vapour Molar Fraction");
251        hl                                      as enth_mol             (Brief = "Liquid Enthalpy");
252        hv                                      as enth_mol             (Brief = "Vapour Enthalpy");
253        s                                       as entr_mol             (Brief = "Stream Entropy");
254        sl                                      as entr_mol             (Brief = "Liquid Entropy");
255        sv                                      as entr_mol             (Brief = "Vapour Entropy");     
256
257        EQUATIONS
258        "Flash Calculation"
259        [Outlet.v, x, y] = PP.Flash(Outlet.T, Outlet.P, Outlet.z);
260       
261        "Overall Enthalpy"
262        Outlet.h = (1-Outlet.v)*hl + Outlet.v*hv;
263
264        "Liquid Enthalpy"
265        hl = PP.LiquidEnthalpy(Outlet.T, Outlet.P, x);
266
267        "Vapour Enthalpy"
268        hv = PP.VapourEnthalpy(Outlet.T, Outlet.P, y);
269       
270        "Overall Entropy"
271        s = (1-Outlet.v)*sl + Outlet.v*sv;
272
273        "Liquid Entropy"
274        sl = PP.LiquidEntropy(Outlet.T, Outlet.P, x);
275       
276        "Vapour Entropy"
277        sv = PP.VapourEntropy(Outlet.T, Outlet.P, y);
278end
279
280Model sink
281        ATTRIBUTES
282        Pallete = true;
283        Icon = "icon/Sink";
284        Brief = "Material stream sink";
285        Info = "
286        This model should be used for boundary streams when additional
287        information about the stream is desired.
288
289        Some of the additional informations calculated by this models are:
290         * Mass density
291         * Mass flow
292         * Mass compostions
293         * Specific volume
294         * Vapour fraction
295         * Volumetric flow
296         * Liquid and Vapour compositions
297        ";
298
299        PARAMETERS
300        outer PP                        as Plugin               (Brief = "External Physical Properties", Type="PP");
301        outer NComp             as Integer              (Brief = "Number of chemical components", Lower = 1);
302                  M(NComp)      as molweight    (Brief = "Component Mol Weight");
303                  rhoModel              as Switcher             (Brief = "Density model", Valid = ["volume", "correlation"], Default="volume");
304       
305        SET
306
307        M   = PP.MolecularWeight();
308       
309        VARIABLES
310        in Inlet                as stream               (Brief = "Inlet Stream", PosX=0, PosY=0.5308, Symbol="_{in}");
311        v                               as fraction             (Brief = "Vapourization fraction");
312        x(NComp)                as fraction             (Brief = "Liquid Molar Fraction");
313        y(NComp)                as fraction             (Brief = "Vapour Molar Fraction");
314        zmass(NComp)    as fraction             (Brief = "Mass Fraction");
315        Mw                              as molweight    (Brief = "Average Mol Weight");
316        vm                              as volume_mol   (Brief = "Molar Volume");       
317        rho                             as dens_mass    (Brief = "Stream Mass Density");
318        rhom                    as dens_mol             (Brief = "Stream Molar Density");
319        Fw                              as flow_mass    (Brief = "Stream Mass Flow");
320        Fvol            as flow_vol     (Brief = "Volumetric Flow");
321        s                               as entr_mol             (Brief = "Stream Entropy");
322
323        EQUATIONS
324        "Flash Calculation"
325        [v, x, y] = PP.FlashPH(Inlet.P, Inlet.h, Inlet.z);
326       
327        "Average Molecular Weight"
328        Mw = sum(M*Inlet.z);
329
330        switch rhoModel
331                case "volume":
332        "Molar Density"
333                rhom * vm = 1;
334               
335                case "correlation":
336        "Mass Density"
337                rho * ((1-v)/PP.LiquidDensity(Inlet.T,Inlet.P,x) + v/PP.VapourDensity(Inlet.T,Inlet.P,y)) = 1;
338        end
339       
340        "Mass or Molar Density"
341        rhom * Mw = rho;
342
343        "Flow Mass"
344        Fw      =  Mw*Inlet.F;
345
346        "Molar Volume"
347        vm = (1-v)*PP.LiquidVolume(Inlet.T, Inlet.P, x) + v*PP.VapourVolume(Inlet.T,Inlet.P,y);
348       
349        "Volumetric Flow"
350        Fvol = Inlet.F*vm ;
351       
352        "Mass Fraction"
353        zmass = M*Inlet.z / Mw;
354       
355        "Overall Entropy"
356        s = (1-v)*PP.LiquidEntropy(Inlet.T, Inlet.P, x) +
357                v*PP.VapourEntropy(Inlet.T, Inlet.P, y);
358end
359
360Model simple_sink
361        ATTRIBUTES
362        Pallete = true;
363        Icon = "icon/Sink";
364        Brief = "Simple material stream sink";
365        Info = "
366        This model should be used for boundary streams when no additional
367        information about the stream is desired.
368        ";
369       
370        VARIABLES
371        in Inlet                as stream       (Brief = "Inlet Stream", PosX=0, PosY=0.5308, Symbol="_{in}");
372end
373
374Model energy_stream
375        ATTRIBUTES
376        Pallete = false;
377        Brief = "General Energy Stream";
378        Info =
379        "This is the basic building block for the EML models.
380        Every model should have input and output energy streams
381        derived from this model.";
382
383        VARIABLES
384        Q as heat_rate(Brief="Energy rate");
385end
386
387Model energy_source
388        ATTRIBUTES
389        Pallete = true;
390        Icon = "icon/energy_source";
391        Brief = "Enegry stream source";
392
393        VARIABLES
394        out OutletQ             as energy_stream (Brief = "Outlet energy stream", PosX=1, PosY=0.5349, Symbol="_{out}");
395end
Note: See TracBrowser for help on using the repository browser.