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

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