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

Annotation of /trunk/models/kvalues.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 576 - (hide annotations) (download) (as text)
Tue May 9 03:42:08 2006 UTC (18 years, 1 month ago) by johnpye
File MIME type: text/x-ascend
File size: 2167 byte(s)
Changed all cases of *.fixed := {TRUE,FALSE} to 'FIX' and 'FREE' statements.
1 ben.allan 422 (* still not working. working on it. baa *)
2 johnpye 534 IMPORT "kvalues";
3 ben.allan 421
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 johnpye 576 FIX x[1];
44     FIX x[2];
45 ben.allan 421 x[1] := 0.3;
46     x[2] := 0.5;
47     x[3] := 1.0 - (x[1] + x[2]);
48    
49 johnpye 576 FREE y[1];
50     FREE y[2];
51     FREE y[3];
52 ben.allan 421
53 johnpye 576 FIX T;
54 ben.allan 421 T := 300.0;
55 johnpye 576 FIX P;
56 ben.allan 421 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 johnpye 576 FIX x[1];
106     FIX x[3];
107 ben.allan 421 x[1] := 0.3;
108     x[2] := 0.5;
109     x[3] := 1.0 - (x[1] + x[2]);
110    
111 johnpye 576 FREE y[1];
112     FREE y[2];
113     FREE y[3];
114 ben.allan 421
115 johnpye 576 FIX T;
116 ben.allan 421 T := 300.0;
117 johnpye 576 FIX P;
118 ben.allan 421 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;
130    

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