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