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 757 2009-06-03 20:07:22Z bicca $ |
---|
20 | *---------------------------------------------------------------------*# |
---|
21 | |
---|
22 | using "types"; |
---|
23 | |
---|
24 | Model stream |
---|
25 | |
---|
26 | ATTRIBUTES |
---|
27 | Pallete = false; |
---|
28 | Brief = "General Material Stream"; |
---|
29 | Info = |
---|
30 | "This is the basic building block for the EML models. |
---|
31 | Every model should have input and output streams derived |
---|
32 | from this model."; |
---|
33 | |
---|
34 | PARAMETERS |
---|
35 | outer NComp as Integer (Brief = "Number of chemical components", Lower = 1); |
---|
36 | |
---|
37 | VARIABLES |
---|
38 | F as flow_mol (Brief = "Stream Molar Flow Rate"); |
---|
39 | T as temperature (Brief = "Stream Temperature"); |
---|
40 | P as pressure (Brief = "Stream Pressure"); |
---|
41 | h as enth_mol (Brief = "Stream Enthalpy"); |
---|
42 | v as fraction (Brief = "Vapourization fraction"); |
---|
43 | z(NComp) as fraction (Brief = "Stream Molar Fraction"); |
---|
44 | end |
---|
45 | |
---|
46 | Model liquid_stream as stream |
---|
47 | |
---|
48 | ATTRIBUTES |
---|
49 | Pallete = false; |
---|
50 | Brief = "Liquid Material Stream"; |
---|
51 | Info = |
---|
52 | "Model for liquid material streams. |
---|
53 | This model should be used only when the phase of the stream |
---|
54 | is known ''a priori''."; |
---|
55 | |
---|
56 | PARAMETERS |
---|
57 | outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); |
---|
58 | |
---|
59 | EQUATIONS |
---|
60 | "Liquid Enthalpy" |
---|
61 | h = PP.LiquidEnthalpy(T, P, z); |
---|
62 | |
---|
63 | "Liquid stream" |
---|
64 | v = 0; |
---|
65 | end |
---|
66 | |
---|
67 | Model vapour_stream as stream |
---|
68 | |
---|
69 | ATTRIBUTES |
---|
70 | Pallete = false; |
---|
71 | Brief = "Vapour Material Stream"; |
---|
72 | Info = |
---|
73 | "Model for vapour material streams. |
---|
74 | This model should be used only when the phase of the stream |
---|
75 | is known ''a priori''."; |
---|
76 | |
---|
77 | PARAMETERS |
---|
78 | outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); |
---|
79 | |
---|
80 | EQUATIONS |
---|
81 | "Vapour Enthalpy" |
---|
82 | h = PP.VapourEnthalpy(T, P, z); |
---|
83 | |
---|
84 | "Vapour stream" |
---|
85 | v = 1; |
---|
86 | end |
---|
87 | |
---|
88 | Model streamPH as stream |
---|
89 | |
---|
90 | ATTRIBUTES |
---|
91 | Brief = "Stream with built-in flash calculation"; |
---|
92 | Info = " |
---|
93 | This model should be used when the vaporization fraction |
---|
94 | is unknown. |
---|
95 | |
---|
96 | The built-in flash calculation will determine the stream |
---|
97 | state as a function of the overall composition '''z''', the |
---|
98 | pressure '''P''' and the enthalpy '''h'''. |
---|
99 | |
---|
100 | Additionally, the liquid composition '''x''' and the vapor |
---|
101 | composition '''y''' are calculated. |
---|
102 | "; |
---|
103 | Pallete = false; |
---|
104 | |
---|
105 | PARAMETERS |
---|
106 | outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); |
---|
107 | |
---|
108 | VARIABLES |
---|
109 | x(NComp) as fraction (Brief = "Liquid Molar Fraction",Hidden=true); |
---|
110 | y(NComp) as fraction (Brief = "Vapour Molar Fraction",Hidden=true); |
---|
111 | |
---|
112 | EQUATIONS |
---|
113 | "Flash Calculation" |
---|
114 | [v, x, y] = PP.FlashPH(P, h, z); |
---|
115 | |
---|
116 | "Enthalpy" |
---|
117 | h = (1-v)*PP.LiquidEnthalpy(T, P, x) + v*PP.VapourEnthalpy(T, P, y); |
---|
118 | |
---|
119 | end |
---|
120 | |
---|
121 | Model streamPHS as streamPH |
---|
122 | |
---|
123 | ATTRIBUTES |
---|
124 | Brief = "Stream with built-in flash calculation"; |
---|
125 | Info = " |
---|
126 | This model should be used when the vaporization fraction |
---|
127 | is unknown. |
---|
128 | |
---|
129 | The built-in flash calculation will determine the stream |
---|
130 | state as a function of the overall composition '''z''', the |
---|
131 | pressure '''P''' and the enthalpy '''h'''. |
---|
132 | |
---|
133 | Additionally, the liquid composition '''x''', the vapor |
---|
134 | composition '''y''' and the stream entropy are calculated. |
---|
135 | "; |
---|
136 | Pallete = false; |
---|
137 | |
---|
138 | PARAMETERS |
---|
139 | outer PP as Plugin(Brief = "External Physical Properties", Type="PP"); |
---|
140 | |
---|
141 | VARIABLES |
---|
142 | s as entr_mol (Brief = "Stream Entropy"); |
---|
143 | |
---|
144 | EQUATIONS |
---|
145 | |
---|
146 | "Entropy" |
---|
147 | s = (1-v)*PP.LiquidEntropy(T, P, x) + v*PP.VapourEntropy(T, P, y); |
---|
148 | |
---|
149 | end |
---|
150 | |
---|