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

Contents of /trunk/models/kvalues.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 534 - (show annotations) (download) (as text)
Tue Apr 25 13:25:04 2006 UTC (14 years, 1 month ago) by johnpye
File MIME type: text/x-ascend
File size: 2307 byte(s)
Working on platform-independent pathnames for the IMPORT command.
Added 'ospath.c' to base/generic/general for this purpose.
Patched kvalues and sensitivity to use the 'IMPORT "libname";' syntax
instead of 'IMPORT registerfn FROM libname;'.
Fixed pathnames in create.nsi.
Added GPL header to coupla files.
Added quoting to 'IMPORT' syntax in ascParse.y.
Removed 'PackageOption' from Tcl/Tk related Scons options so that missing Tcl/Tk
doesn't cause breakage.
1 (* still not working. working on it. baa *)
2 IMPORT "kvalues";
3
4 ATOM comp_atom REFINES generic_real;
5 component IS_A symbol;
6 END comp_atom;
7
8
9 MODEL component_data;
10 ncomps IS_A integer_constant;
11 ncomps :== 3;
12 components[1..ncomps] IS_A symbol_constant;
13
14 components[1] :== 'benzene';
15 components[2] :== 'hexane';
16 components[3] :== 'chloro';
17 END component_data;
18
19 MODEL test1;
20
21 liq, feed, vap IS_A generic_real;
22 T, P IS_A generic_real;
23 x[1..5] IS_A generic_real;
24 y[1..3] IS_A generic_real;
25 data IS_A component_data;
26
27
28 gnew: bubblepnt( T, x[1..3], P : INPUT ;
29 y[1..3] : OUTPUT ;
30 data : DATA);
31
32 h4: x[1] + x[2] + x[3] = 1.0;
33 h5: x[2] * 0.1805 = y[3];
34
35
36 METHODS
37
38
39 METHOD mytest;
40 END mytest;
41
42 METHOD specify;
43 x[1].fixed := TRUE;
44 x[2].fixed := TRUE;
45 x[1] := 0.3;
46 x[2] := 0.5;
47 x[3] := 1.0 - (x[1] + x[2]);
48
49 y[1].fixed := FALSE;
50 y[2].fixed := FALSE;
51 y[3].fixed := FALSE;
52
53 T.fixed := TRUE;
54 T := 300.0;
55 P.fixed := TRUE;
56 P := 760.0;
57 END specify;
58
59 END test1;
60
61
62 MODEL test2;
63
64 t1 IS_A test1;
65
66 END test2;
67
68
69
70 MODEL test1_normal;
71
72 comp IS_A set OF integer_constant;
73 a[comp],b[comp],c[comp] IS_A real_constant;
74 comp :== [1..3];
75 a[1] :== 15.5381; b[1] :== 2032.73; c[1] :== -33.15;
76 a[2] :== 15.8333; b[2] :== 2477.07; c[2] :== -39.94;
77 a[3] :== 15.8737; b[3] :== 2911.32; c[3] :== -56.51;
78
79
80 T, P IS_A generic_real;
81 psat[1..3] IS_A generic_real;
82 x[1..3] IS_A comp_atom;
83 y[1..3] IS_A generic_real;
84
85
86 FOR i IN comp CREATE
87 pres[i]: ln(psat[i]) = a[i] - b[i]/(T + c[i]);
88 END FOR;
89
90 FOR i IN comp CREATE
91 raoult[i]: P*y[i] = psat[i]*x[i];
92 END FOR;
93 h4: x[1] + x[2] + x[3] = 1.0;
94 h5: x[2] * 0.1805 = y[3];
95
96 METHODS
97
98 METHOD default_self;
99 x[1].component := 'benzene';
100 x[2].component := 'hexane';
101 x[3].component := 'chloro';
102 END default_self;
103
104 METHOD specify;
105 x[1].fixed := TRUE;
106 x[3].fixed := TRUE;
107 x[1] := 0.3;
108 x[2] := 0.5;
109 x[3] := 1.0 - (x[1] + x[2]);
110
111 y[1].fixed := FALSE;
112 y[2].fixed := FALSE;
113 y[3].fixed := FALSE;
114
115 T.fixed := TRUE;
116 T := 300.0;
117 P.fixed := TRUE;
118 P := 760.0;
119 END specify;
120
121 END test1_normal;
122
123
124
125 MODEL test2_normal;
126
127 t1 IS_A test1_normal;
128
129 END test2_normal;

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