/[ascend]/trunk/models/sensitivity_test.a4c
ViewVC logotype

Annotation of /trunk/models/sensitivity_test.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 468 - (hide annotations) (download) (as text)
Mon Apr 17 03:20:06 2006 UTC (16 years, 7 months ago) by ben.allan
File MIME type: text/x-ascend
File size: 2026 byte(s)
new file.
1 ben.allan 468 (*********************************************************************\
2     sensitivity_test.asc
3     by Ben Allan
4     Part of the Ascend Library
5    
6     This file is part of the Ascend modeling library.
7    
8     Copyright (C) 1996
9    
10     The Ascend modeling library is free software; you can redistribute
11     it and/or modify it under the terms of the GNU General Public License as
12     published by the Free Software Foundation; either version 2 of the
13     License, or (at your option) any later version.
14    
15     The Ascend Language Interpreter is distributed in hope that it will be
16     useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
17     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18     General Public License for more details.
19    
20     You should have received a copy of the GNU General Public License along with
21     the program; if not, write to the Free Software Foundation, Inc., 675
22     Mass Ave, Cambridge, MA 02139 USA. Check the file named COPYING.
23    
24     This module is used to calculate the sensitity matrix dX/dU where
25     X is a vector OF vapor compositions and U is a vector OF liquid
26     compositions. This sensitivity matrix is THEN used to calculate
27     J, the Jacobian, as described IN Fidkowski et al. (1995).
28    
29     \*********************************************************************)
30    
31     REQUIRE "system.a4l";
32    
33     IMPORT PackSolve_Init FROM "libsensitivity";
34    
35     MODEL sensitivity_test;
36     nc IS_A integer_constant;
37     X[1..nc] IS_A solver_var;
38     U[1..nc], Unew[1..nc] IS_A solver_var;
39     dx_du[1..nc][1..nc] IS_A solver_var;
40     (* system *)
41     k,x,y,u IS_A solver_var;
42     k*x - y = 7;
43     y = u^2;
44     (* dx/du = 2*u/k *)
45     nc:==1;
46     u,U[1] ARE_THE_SAME;
47     x,X[1] ARE_THE_SAME;
48     METHODS
49     METHOD values;
50     END values;
51     METHOD clear;
52     END clear;
53     METHOD specify;
54     u.fixed := TRUE;
55     k.fixed := TRUE;
56     END specify;
57     METHOD reset;
58     RUN clear;
59     RUN specify;
60     END reset;
61     METHOD analyze;
62     EXTERNAL do_sensitivity(SELF,U[1..nc],X[1..nc],dx_du[1..nc][1..nc]);
63     END analyze;
64     END sensitivity_test;
65    

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22