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 | * 3. Vapor pressure data representation by polynomials and equations |
---|
17 | *---------------------------------------------------------------------- |
---|
18 | * |
---|
19 | * Description: |
---|
20 | * This problem is part of a collection of 10 representative |
---|
21 | * problems in Chemical Engineering for solution by numerical methods |
---|
22 | * developed for Cutlip (1998). |
---|
23 | * |
---|
24 | * Subject: |
---|
25 | * * Mathematical Methods |
---|
26 | * * Thermodynamics |
---|
27 | * |
---|
28 | * Concepts utilized: |
---|
29 | * Use of polynomials, a modified Clausis-Clapeyron, and the |
---|
30 | * Antoine equations to model vapor pressure versus temperature data. |
---|
31 | * |
---|
32 | * Numerical method: |
---|
33 | * * Nonlinear regression |
---|
34 | * |
---|
35 | * Reference: |
---|
36 | * * CUTLIP et al. A collection of 10 numerical problems in |
---|
37 | * chemical engineering solved by various mathematical software |
---|
38 | * packages. Comp. Appl. in Eng. Education. v. 6, 169-180, 1998. |
---|
39 | * * More informations and a detailed description of all problems |
---|
40 | * is available online in http://www.polymath-software.com/ASEE |
---|
41 | * |
---|
42 | *---------------------------------------------------------------------- |
---|
43 | * Author: Rodolfo Rodrigues |
---|
44 | * GIMSCOP/UFRGS - Group of Integration, Modeling, Simulation, |
---|
45 | * Control, and Optimization of Processes |
---|
46 | * $Id$ |
---|
47 | *--------------------------------------------------------------------*# |
---|
48 | using "types"; |
---|
49 | |
---|
50 | |
---|
51 | #*--------------------------------------------------------------------- |
---|
52 | * Simple polynomial equation |
---|
53 | *--------------------------------------------------------------------*# |
---|
54 | |
---|
55 | FlowSheet simple_polynomial |
---|
56 | PARAMETERS |
---|
57 | # N as Integer (Brief="Number of polynomial terms", Default=5); |
---|
58 | # a(N) as Real (Brief="Parameters (coefficients) to be determined", Default=1e-2); |
---|
59 | |
---|
60 | a1 as Real (Default=100); |
---|
61 | a2 as Real (Default=1); |
---|
62 | a3 as Real (Default=1e-2); |
---|
63 | a4 as Real (Default=1e-4); |
---|
64 | a5 as Real (Default=1e-6); |
---|
65 | |
---|
66 | VARIABLES |
---|
67 | P as pressure (Brief="Vapor pressure", DisplayUnit='mmHg', Upper=1e4); |
---|
68 | T as temperature (Brief="Temperature"); # T(K) |
---|
69 | |
---|
70 | EQUATIONS |
---|
71 | # "Polynomial expression" # P(mmHg) and T(K) |
---|
72 | # P/'mmHg' = sum(a*(T/'K' - 273.15)^[0:N-1]); |
---|
73 | |
---|
74 | "Polynomial expression" # P(mmHg) and T(K) |
---|
75 | # P/'mmHg' = a1 + (T/'K' - 273.15)*(a2 + (T/'K' - 273.15)*(a3 + |
---|
76 | # (T/'K' - 273.15)*(a4 + a5*(T/'K' - 273.15)))); |
---|
77 | P/'mmHg' = a1 + a2*(T/'K' - 273.15) + a3*(T/'K' - 273.15)^2 + |
---|
78 | a4*(T/'K' - 273.15)^3 + a5*(T/'K' - 273.15)^4; |
---|
79 | |
---|
80 | # SET |
---|
81 | # a = [100 1 1e-2 1e-4 1e-6]; |
---|
82 | |
---|
83 | SPECIFY |
---|
84 | T = 300*'K'; |
---|
85 | |
---|
86 | OPTIONS |
---|
87 | Dynamic = false; |
---|
88 | end |
---|
89 | |
---|
90 | |
---|
91 | #*--------------------------------------------------------------------- |
---|
92 | * Clausius-Clapeyron equation |
---|
93 | *--------------------------------------------------------------------*# |
---|
94 | |
---|
95 | FlowSheet clausius_clapeyron |
---|
96 | PARAMETERS |
---|
97 | A as Real (Brief="Parameters to be determined", Default=10); |
---|
98 | B as temperature (Brief="Parameters to be determined", Default=1e3); |
---|
99 | |
---|
100 | VARIABLES |
---|
101 | P as pressure (Brief="Vapor pressure", DisplayUnit='mmHg', Upper=1e4); |
---|
102 | T as temperature (Brief="Temperature"); # T(K) |
---|
103 | |
---|
104 | EQUATIONS |
---|
105 | "Clausis-Clapeyron equation" # P(mmHg) and T(°C) |
---|
106 | P/'mmHg' = exp(A - B/T); |
---|
107 | |
---|
108 | SPECIFY |
---|
109 | T = 300*'K'; |
---|
110 | |
---|
111 | OPTIONS |
---|
112 | Dynamic = false; |
---|
113 | end |
---|
114 | |
---|
115 | |
---|
116 | #*--------------------------------------------------------------------- |
---|
117 | * Antoine equation |
---|
118 | *--------------------------------------------------------------------*# |
---|
119 | |
---|
120 | FlowSheet antoine |
---|
121 | PARAMETERS |
---|
122 | A as Real (Brief="Parameters to be determined", Default=10); |
---|
123 | B as temperature (Brief="Parameters to be determined", Default=1e3); |
---|
124 | C as temperature (Brief="Parameters to be determined", Default=20); |
---|
125 | |
---|
126 | VARIABLES |
---|
127 | P as pressure (Brief="Vapor pressure", DisplayUnit='mmHg', Upper=1e4); |
---|
128 | T as temperature (Brief="Temperature"); # T(K) |
---|
129 | |
---|
130 | EQUATIONS |
---|
131 | "Antoine equation" # P(mmHg) and T(K) |
---|
132 | P/'mmHg' = exp(A - B/(T + C)); |
---|
133 | |
---|
134 | SPECIFY |
---|
135 | T = 300*'K'; |
---|
136 | |
---|
137 | OPTIONS |
---|
138 | Dynamic = false; |
---|
139 | end |
---|
140 | |
---|
141 | |
---|
142 | #*--------------------------------------------------------------------- |
---|
143 | * Parameter estimation to simple polynomial equation |
---|
144 | *--------------------------------------------------------------------*# |
---|
145 | |
---|
146 | Estimation est_pol as simple_polynomial |
---|
147 | ESTIMATE |
---|
148 | # PAR START LOWER UPPER UNIT |
---|
149 | #* a(1) 100 0 1e3; |
---|
150 | a(2) 1 0 10; |
---|
151 | a(3) 1e-2 0 10; |
---|
152 | a(4) 1e-4 0 10; |
---|
153 | a(5) 1e-6 0 10; |
---|
154 | *# |
---|
155 | a1 100 0 1e3; |
---|
156 | a2 1 0 10; |
---|
157 | a3 1e-2 0 10; |
---|
158 | a4 1e-4 0 10; |
---|
159 | a5 1e-6 0 10; |
---|
160 | |
---|
161 | EXPERIMENTS |
---|
162 | # FILE WEIGTH |
---|
163 | "prob03.dat" 1; |
---|
164 | # Data from Perry (1999), Table 2-8 |
---|
165 | |
---|
166 | # Solution: a=[24.75, 1.61, 3.56e-2, 4.13e-4, 4.23e-6] |
---|
167 | |
---|
168 | OPTIONS |
---|
169 | NLPSolver( |
---|
170 | # File = "ipopt_emso", |
---|
171 | File = "complex", |
---|
172 | ObjTol = 1e-6, |
---|
173 | AcceptableObjTol = 1e-6); |
---|
174 | Dynamic = false; |
---|
175 | end |
---|
176 | |
---|
177 | |
---|
178 | #*--------------------------------------------------------------------- |
---|
179 | * Parameter estimation to Clausius-Clapeyron equation |
---|
180 | *--------------------------------------------------------------------*# |
---|
181 | |
---|
182 | Estimation est_clau as clausius_clapeyron |
---|
183 | ESTIMATE |
---|
184 | # PAR START LOWER UPPER UNIT |
---|
185 | A 10 -3 100; |
---|
186 | B 1e3 200 5e3 'K'; |
---|
187 | |
---|
188 | EXPERIMENTS |
---|
189 | # FILE WEIGTH |
---|
190 | "prob03.dat" 1; |
---|
191 | # Data from Perry (1999), Table 2-8 |
---|
192 | |
---|
193 | # Solution: A=8.75, B=2035.33K |
---|
194 | |
---|
195 | OPTIONS |
---|
196 | NLPSolver( |
---|
197 | File = "ipopt_emso", |
---|
198 | # File = "complex", |
---|
199 | ObjTol = 1e-6, |
---|
200 | AcceptableObjTol = 1e-6); |
---|
201 | Dynamic = false; |
---|
202 | end |
---|
203 | |
---|
204 | |
---|
205 | #*--------------------------------------------------------------------- |
---|
206 | * Parameter estimation to Antoine equation |
---|
207 | *--------------------------------------------------------------------*# |
---|
208 | |
---|
209 | Estimation est_ant as antoine |
---|
210 | ESTIMATE |
---|
211 | # PAR START LOWER UPPER UNIT |
---|
212 | A 10 -3 100; |
---|
213 | B 1e3 200 5e3 'K'; |
---|
214 | C 20 -200 200 'K'; |
---|
215 | |
---|
216 | EXPERIMENTS |
---|
217 | # FILE WEIGTH |
---|
218 | "prob03.dat" 1; |
---|
219 | # Data from Perry (1999), Table 2-8 |
---|
220 | |
---|
221 | # Solution: A=5.73, B=665.42, C=152.47-273.15 |
---|
222 | |
---|
223 | OPTIONS |
---|
224 | NLPSolver( |
---|
225 | File = "ipopt_emso", |
---|
226 | # File = "complex", |
---|
227 | ObjTol = 1e-6, |
---|
228 | AcceptableObjTol = 1e-6); |
---|
229 | Dynamic = false; |
---|
230 | end |
---|