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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1475 - (show annotations) (download) (as text)
Mon Jun 4 15:13:28 2007 UTC (13 years, 4 months ago) by kchittur
File MIME type: text/x-ascend
File size: 2073 byte(s)


1 REQUIRE "thermodynamics.a4l";
2
3 IMPORT "johnpye/extpy/extpy";
4 IMPORT "kchittur/zplot";
5
6 MODEL pengrobinson(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.07780;
22 sigma :== 2.414213562;
23 eps :== 0.414213562;
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 = (1.0 + (0.37464+1.54226*omega-0.26992*omega^2)*(1.0-Tr^(0.5)))^2;
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
39
40 METHODS
41 METHOD default_self;
42 RUN ClearAll;
43 RUN specify;
44 RUN values;
45 END default_self;
46
47 METHOD specify;
48 P.fixed := TRUE;
49 T.fixed := TRUE;
50 T_degC.fixed := FALSE;
51 END specify;
52 METHOD values;
53 P := 12.0 {bar};
54 T := 298.15 {K};
55 Z.lower_bound := 0.0;
56 Z.upper_bound := 10.0;
57 Z.nominal := 0.1;
58 END values;
59
60 END pengrobinson;
61 MODEL testpengrobinson;
62
63 c1 IS_A symbol_constant;
64 c1 :== 'ethylene';
65 cd IS_A components_data([c1],c1);
66 Tr, Pr IS_A factor;
67 P IS_A pressure;
68 T IS_A temperature;
69 V IS_A molar_volume;
70 Z IS_A factor;
71 tpeng IS_A pengrobinson(P,T,V,Z,cd.data[c1]);
72
73 eqTr: Tr = T/cd.data[c1].Tc;
74 eqPr: Pr = P/cd.data[c1].Pc;
75
76 METHODS
77 METHOD default_self;
78 RUN ClearAll;
79 RUN specify;
80 RUN values;
81 END default_self;
82
83 METHOD specify;
84 P.fixed := TRUE;
85 V.fixed := FALSE;
86 Z.fixed := FALSE;
87 T.fixed := TRUE;
88 RUN tpeng.specify;
89 END specify;
90 METHOD values;
91 P := 12.0 {bar};
92 T := 298.15 {K};
93 RUN tpeng.values;
94 END values;
95
96 METHOD on_load;
97 RUN default_self;
98 END on_load;
99
100 METHOD fancyplot;
101 EXTERNAL zplot(SELF);
102 END fancyplot;
103
104 END testpengrobinson;

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