/[ascend]/trunk/models/kchittur/eos-rk.a4c
ViewVC logotype

Contents of /trunk/models/kchittur/eos-rk.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1805 - (show annotations) (download) (as text)
Mon Jul 21 08:48:03 2008 UTC (12 years, 3 months ago) by jpye
File MIME type: text/x-ascend
File size: 1881 byte(s)
Little bit of indenting for clarity (hope it's ok, Krishnan).
Added 'EXTERNAL' keyword in lang-def for gedit.
1 REQUIRE "thermodynamics.a4l";
2
3 IMPORT "johnpye/extpy/extpy";
4 IMPORT "kchittur/zplot";
5
6 MODEL rk(P WILL_BE pressure;
7 T WILL_BE temperature;
8 V WILL_BE molar_volume;
9 Z WILL_BE factor;
10 data WILL_BE td_component_constants;);
11
12 R IS_A gas_constant;
13 Pc IS_A pressure;
14 Tc IS_A temperature;
15 T_degC IS_A factor;
16 alpha, beta, q,Tr, Pr, omega IS_A factor;
17
18 PSI, OMEGA, sigma, eps IS_A real_constant;
19
20 PSI :== 0.42748;
21 OMEGA :== 0.08664;
22 sigma :== 1.0;
23 eps :== 0.0;
24
25 Pc = data.Pc;
26 Tc = data.Tc;
27 omega = data.omega;
28
29 eq1: Tr = T/Tc;
30 eq2: Pr = P/Pc;
31 eq3: T_degC = T/1{K} - 273.15;
32
33 eq4: alpha = Tr^(0.5);
34 eq5: q = PSI*alpha/(OMEGA*Tr);
35 eq6: beta = OMEGA*Pr/Tr;
36 eq7: Z = 1.0 + beta - q*beta*(Z - beta)/((Z + eps*beta)*(Z + sigma*beta));
37 eq8: P*V = Z*R*T;
38 METHODS
39 METHOD default_self;
40 RUN ClearAll;
41 RUN specify;
42 RUN values;
43 END default_self;
44 METHOD specify;
45 P.fixed := TRUE;
46 T_degC.fixed := FALSE;
47 T.fixed := TRUE;
48 END specify;
49 METHOD values;
50 P := 12.0 {bar};
51 T := 298.15 {K};
52 Z.lower_bound := 0.0;
53 Z.upper_bound := 10.0;
54 Z.nominal := 1.0;
55 END values;
56 END rk;
57
58 MODEL testrk;
59 c1 IS_A symbol_constant;
60 c1 :== 'ethylene';
61 cd IS_A components_data([c1],c1);
62 Tr, Pr IS_A factor;
63 P IS_A pressure;
64 T IS_A temperature;
65 V IS_A molar_volume;
66 Z IS_A factor;
67 trk IS_A rk(P,T,V,Z,cd.data[c1]);
68
69 eqTr: Tr = T/cd.data[c1].Tc;
70 eqPr: Pr = P/cd.data[c1].Pc;
71
72 METHODS
73 METHOD default_self;
74 RUN ClearAll;
75 RUN specify;
76 RUN values;
77 END default_self;
78
79 METHOD specify;
80 P.fixed := TRUE;
81 V.fixed := FALSE;
82 Z.fixed := FALSE;
83 T.fixed := TRUE;
84 RUN trk.specify;
85 END specify;
86 METHOD values;
87 P := 12.0 {bar};
88 T := 298.15 {K};
89 RUN trk.values;
90 END values;
91
92 METHOD on_load;
93 RUN default_self;
94 END on_load;
95
96 METHOD fancyplot;
97 EXTERNAL zplot(SELF);
98 END fancyplot;
99
100 END testrk;

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