/[ascend]/trunk/base/generic/packages/kvalues.asc
ViewVC logotype

Contents of /trunk/base/generic/packages/kvalues.asc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 27 - (show annotations) (download)
Thu Dec 9 18:22:50 2004 UTC (17 years, 1 month ago) by aw0a
File MIME type: text/plain
File size: 2227 byte(s)
Correcting package checkin
1 IMPORT KValues_Init FROM libkvalues;
2
3 ATOM comp_atom REFINES generic_real;
4 component IS_A symbol;
5 END comp_atom;
6
7 MODEL component_data;
8 ncomps IS_A integer;
9 ncomps := 3;
10 components[1..ncomps] IS_A symbol;
11
12 components[1] := 'benzene';
13 components[2] := 'hexane';
14 components[3] := 'chloro';
15 END component_data;
16
17 MODEL test1;
18
19 liq, feed, vap IS_A generic_real;
20 T, P IS_A generic_real;
21 x[1..5] IS_A generic_real;
22 y[1..3] IS_A generic_real;
23 data IS_A component_data;
24
25
26 gnew:
27 bubblepnt(
28 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 INITIALIZATION
37
38 PROCEDURE mytest;
39 END mytest;
40
41 PROCEDURE specify;
42 x[1].fixed := TRUE;
43 x[2].fixed := TRUE;
44 x[1] := 0.3;
45 x[2] := 0.5;
46 x[3] := 1.0 - (x[1] + x[2]);
47
48 y[1].fixed := FALSE;
49 y[2].fixed := FALSE;
50 y[3].fixed := FALSE;
51
52 T.fixed := TRUE;
53 T := 300.0;
54 P.fixed := TRUE;
55 P := 760.0;
56 END specify;
57
58 END test1;
59
60
61 MODEL test2;
62
63 t1 IS_A test1;
64
65 END test2;
66
67
68
69 MODEL test1_normal;
70
71 comp IS_A set OF integer;
72 a[comp],b[comp],c[comp] IS_A real;
73 comp := [1..3];
74 a[1] := 15.5381; b[1] := 2032.73; c[1] := -33.15;
75 a[2] := 15.8333; b[2] := 2477.07; c[2] := -39.94;
76 a[3] := 15.8737; b[3] := 2911.32; c[3] := -56.51;
77
78
79 T, P IS_A generic_real;
80 psat[1..3] IS_A generic_real;
81 x[1..3] IS_A comp_atom;
82 x[1].component := 'benzene';
83 x[2].component := 'hexane';
84 x[3].component := 'chloro';
85 y[1..3] IS_A generic_real;
86
87
88 FOR i IN comp
89 CREATE
90 pres[i]: ln(psat[i]) = a[i] - b[i]/(T + c[i]);
91 END;
92
93 FOR i IN comp
94 CREATE
95 raoult[i]: P*y[i] = psat[i]*x[i];
96 END;
97 h4: x[1] + x[2] + x[3] = 1.0;
98 h5: x[2] * 0.1805 = y[3];
99
100 INITIALIZATION
101
102 PROCEDURE specify;
103 x[1].fixed := TRUE;
104 x[3].fixed := TRUE;
105 x[1] := 0.3;
106 x[2] := 0.5;
107 x[3] := 1.0 - (x[1] + x[2]);
108
109 y[1].fixed := FALSE;
110 y[2].fixed := FALSE;
111 y[3].fixed := FALSE;
112
113 T.fixed := TRUE;
114 T := 300.0;
115 P.fixed := TRUE;
116 P := 760.0;
117 END specify;
118
119 END test1_normal;
120
121
122
123 MODEL test2_normal;
124
125 t1 IS_A test1_normal;
126
127 END test2_normal;
128

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