source: branches/gui/sample/sensitivity/Test_Sense.mso @ 941

Last change on this file since 941 was 804, checked in by edsoncv, 14 years ago

Added Case study (dynamic and Steady State case) examples.
Added Sensitivity (only Steady State).

File size: 4.9 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* Sample file for Sensitivity Analysis. User can compare with equivalent
17* Case study and compare the values with perturbations (finite differences).
18*--------------------------------------------------------------------
19*
20*----------------------------------------------------------------------
21* Author: Edson Cordeiro do Valle
22*
23*--------------------------------------------------------------------*#
24
25#Model with degrees of freedom complete in the model: 2 vars. and 2 eqs.
26#Warning : The units must be consistent in order to convert it correctly in the
27#CaseStudy section
28Model CS1
29
30        VARIABLES
31        X as Real (Default=20,Lower=-10,Upper=1000, final Unit = 'm');
32        Y as Real (Default=200,Lower=-10000,Upper=100000000, final Unit = 'm^2');
33               
34        PARAMETERS
35        b0 as Real(Default=7, final Unit = 'm');       
36        b1 as Real(Default=3, final Unit = 'm');       
37
38        EQUATIONS
39        #Y = b0*X^2 +b1^2*X;
40        b0*Y = b1^2*X;
41        Y = X ^ 2;
42       
43end
44
45#Model with degrees of freedom UNCOMPLETE in the model: 2 vars. and 1 eqs.,
46# need to specify 1 var. in the flowsheet section.
47#Warning : The units must be consistent in order to convert it correctly in the
48#CaseStudy section
49Model CS_flow1
50
51        VARIABLES
52        X as Real (Default=2,Lower=-10,Upper=1000, final Unit = 'm');
53        Y as Real (Default=2,Lower=-10000,Upper=100000000, final Unit = 'm^2');
54               
55        PARAMETERS
56        b0 as Real(Default=7, final Unit = 'm');       
57        b1 as Real(Default=3, final Unit = 'm');       
58
59        EQUATIONS
60       
61        b0*Y = b1^2*X;
62
63       
64end
65
66#Model with degrees of freedom UNCOMPLETE in the model: 3 vars. and 2 eqs.,
67# need to specify 1 var. in the flowsheet section.
68#Warning : The units must be consistent in order to convert it correctly in the
69#CaseStudy section
70Model CS_flow2
71
72        VARIABLES
73        X as Real (Default=20,Lower=-10,Upper=1000, final Unit = 'm');
74        X2 as Real (Default=20,Lower=-10,Upper=1000, final Unit = 'm');
75        Y as Real (Default=200,Lower=-10000,Upper=100000000, final Unit = 'm^2');
76               
77        PARAMETERS
78        b0 as Real(Default=7, final Unit = 'm');       
79        b1 as Real(Default=3, final Unit = 'm');       
80
81        EQUATIONS
82        Y = b0*X^2/'m' +b1^2*X2/'m' -50.73*'m^2';
83        #b0*Y = b1^2*X;
84        Y = X ^ 2;
85       
86end
87#No need to specify
88FlowSheet Test_CS1 as CS1
89
90       
91        OPTIONS
92        Dynamic = false;
93       
94end
95
96FlowSheet Test_CS_flow1 as CS_flow1
97
98        SPECIFY
99        X = 5 * 'm';
100               
101        OPTIONS
102        Dynamic = false;
103       
104end
105
106
107FlowSheet Test_CS4 as CS_flow2
108
109        SPECIFY
110        X = 2.2*'m';   
111               
112        OPTIONS
113        Dynamic = false;
114       
115end
116
117
118
119Sensitivity Sense1 as Test_CS1
120
121        VARY
122 
123        b0 ;
124        b1 ;
125
126        RESPONSE
127       
128        Y ;
129
130end
131
132
133Sensitivity Sense2 as Test_CS_flow1
134
135        VARY
136
137        X;
138
139        RESPONSE
140       
141        Y ;
142
143end
144
145Sensitivity Sense3 as Test_CS4
146
147        VARY
148       
149        b0'cm';
150        X'cm';
151
152        RESPONSE
153       
154        Y 'cm^2';
155
156end
157
158Sensitivity Sense4 as Test_CS1
159
160        VARY
161       
162        b0;
163        b1;
164
165        RESPONSE
166       
167        X;
168        Y;
169
170end
171
172# Case study to compare with "Sense1" with perturbations:
173# Pick the table resulting from this CaseStudy and make:
174# d_Y/d_b0 = (Y(b0 = 7.01) - Y(b0 = 7.0))/(7.01 - 7.0)
175# d_Y/d_b1 = Y(b1 = 3.01) - Y(b1 = 3.0))/(3.01 - 3.0)
176CaseStudy CS_parameter as Test_CS1
177
178        VARY
179       
180        b0 =[ 7, 7.01];
181        b1 =[ 3, 3.01];
182
183        RESPONSE
184       
185        Y ;
186
187end
188
189# Case study to compare with "Sense2" with perturbations:
190# Pick the table resulting from this CaseStudy and make:
191# d_Y/d_b0 = (Y(b0 = 7.01) - Y(b0 = 7.0))/(7.01 - 7.0)
192# d_Y/d_X = Y(X = 5.01) - Y(X = 5.0))/(5.01 - 5.0)
193CaseStudy CS2_par_spec as Test_CS_flow1
194
195        VARY
196       
197        X = [5 , 5.01];
198        b0 =[ 7,  7.01];       
199
200        RESPONSE
201       
202        Y ;
203
204end
205# Case study to compare with "Sense3" with perturbations:
206# Pick the table resulting from this CaseStudy and make:
207# d_Y/d_b0 = (Y(b0 = 7.01) - Y(b0 = 7.0))/(7.01 - 7.0)
208# d_Y/d_X = Y(X = 221) - Y(X = 220))/(220 - 221)
209CaseStudy CS_Unit_Vary as Test_CS4
210
211        VARY
212       
213        b0 =[ 7 : 0.01: 7.01]*'cm';
214        X =[ 220 : 1: 221]*'cm';
215       
216        RESPONSE
217
218        Y'cm^2' ;
219
220end
221
222# Case study to compare with "Sense4" with perturbations:
223# Pick the table resulting from this CaseStudy and make:
224# d_Y/d_b0 = (Y(b0 = 7.01) - Y(b0 = 7.0))/(7.01 - 7.0)
225# d_Y/d_b1 = (Y(b1 = 3.01) - Y(b1 = 3.0))/(3.01 - 3.0)
226# d_X/d_b0 = (X(b0 = 7.01) - X(b0 = 7.0))/(7.01 - 7.0)
227# d_X/d_b1 = (X(b1 = 3.01) - X(b1 = 3.0))/(3.01 - 3.0)
228CaseStudy CS_Unit_Vary_All as Test_CS1
229
230        VARY
231       
232        b0 =[ 7, 7.01];
233        b1 =[ 3, 3.01];
234       
235       
236        RESPONSE
237       
238        Y;
239        X;
240
241end
Note: See TracBrowser for help on using the repository browser.