source: branches/gui/sample/miscellaneous/tenprobs/prob03.mso @ 715

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

Fix some examples.

File size: 6.3 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* 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*--------------------------------------------------------------------*#
48using "types";
49
50
51#*---------------------------------------------------------------------
52*       Simple polynomial equation
53*--------------------------------------------------------------------*#
54
55FlowSheet 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;
88end
89
90
91#*---------------------------------------------------------------------
92*       Clausius-Clapeyron equation
93*--------------------------------------------------------------------*#
94
95FlowSheet 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;
113end
114
115
116#*---------------------------------------------------------------------
117*       Antoine equation
118*--------------------------------------------------------------------*#
119
120FlowSheet 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;
139end
140
141
142#*---------------------------------------------------------------------
143*       Parameter estimation to simple polynomial equation
144*--------------------------------------------------------------------*#
145
146Estimation 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        Dynamic = false;
174end
175
176
177#*---------------------------------------------------------------------
178*       Parameter estimation to Clausius-Clapeyron equation
179*--------------------------------------------------------------------*#
180
181Estimation est_clau as clausius_clapeyron
182        ESTIMATE
183        # PAR   START   LOWER   UPPER   UNIT
184        A               10              -3              100;
185        B               1e3             200             5e3             'K';
186
187        EXPERIMENTS
188        # FILE                WEIGTH
189        "prob03.dat"                    1;
190        # Data from Perry (1999), Table 2-8
191       
192        # Solution: A=8.75, B=2035.33K
193
194        OPTIONS
195        NLPSolver(
196                File = "ipopt_emso",
197#               File = "complex",
198                ObjTol = 1e-6);
199        Dynamic = false;
200end
201
202
203#*---------------------------------------------------------------------
204*       Parameter estimation to Antoine equation
205*--------------------------------------------------------------------*#
206
207Estimation est_ant as antoine
208        ESTIMATE
209        # PAR   START   LOWER   UPPER   UNIT
210        A               10              -3              100;
211        B               1e3             200             5e3             'K';
212        C               20              -200    200             'K';
213
214        EXPERIMENTS
215        # FILE                WEIGTH
216        "prob03.dat"                    1;
217        # Data from Perry (1999), Table 2-8
218       
219        # Solution: A=5.73, B=665.42, C=152.47-273.15
220
221        OPTIONS
222        NLPSolver(
223                File = "ipopt_emso",
224#               File = "complex",
225                ObjTol = 1e-6);
226        Dynamic = false;
227end
Note: See TracBrowser for help on using the repository browser.