/[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 2071 - (show annotations) (download) (as text)
Fri Aug 28 02:42:47 2009 UTC (11 years, 3 months ago) by jose
File MIME type: text/x-ascend
File size: 2078 byte(s)
MERGE Jose's branch [2274]:[2584] into trunk
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
13 R IS_A molar_gas_constant;
14 Pc IS_A pressure;
15 Tc IS_A temperature;
16 T_degC IS_A factor;
17 alpha, beta, q,Tr, Pr, omega IS_A factor;
18
19 PSI, OMEGA, sigma, eps IS_A real_constant;
20
21 PSI :== 0.45724;
22 OMEGA :== 0.07780;
23 sigma :== 2.414213562;
24 eps :== 0.414213562;
25
26 Pc = data.Pc;
27 Tc = data.Tc;
28 omega = data.omega;
29
30 eq1: Tr = T/Tc;
31 eq2: Pr = P/Pc;
32 eq3: T_degC = T/1{K} - 273.15;
33
34 eq4: alpha = (1.0 + (0.37464+1.54226*omega-0.26992*omega^2)*(1.0-Tr^(0.5)))^2;
35 eq5: q = PSI*alpha/(OMEGA*Tr);
36 eq6: beta = OMEGA*Pr/Tr;
37 eq7: Z = 1.0 + beta - q*beta*(Z - beta)/((Z + eps*beta)*(Z + sigma*beta));
38 eq8: P*V = Z*R*T;
39
40
41 METHODS
42 METHOD default_self;
43 RUN ClearAll;
44 RUN specify;
45 RUN values;
46 END default_self;
47
48 METHOD specify;
49 P.fixed := TRUE;
50 T.fixed := TRUE;
51 T_degC.fixed := FALSE;
52 END specify;
53 METHOD values;
54 P := 12.0 {bar};
55 T := 298.15 {K};
56 Z.lower_bound := 0.0;
57 Z.upper_bound := 10.0;
58 Z.nominal := 0.1;
59 END values;
60
61 END pengrobinson;
62
63 MODEL testpengrobinson;
64
65 c1 IS_A symbol_constant;
66 c1 :== 'ethylene';
67 cd IS_A components_data([c1],c1);
68 Tr, Pr IS_A factor;
69 P IS_A pressure;
70 T IS_A temperature;
71 V IS_A molar_volume;
72 Z IS_A factor;
73 tpeng IS_A pengrobinson(P,T,V,Z,cd.data[c1]);
74
75 eqTr: Tr = T/cd.data[c1].Tc;
76 eqPr: Pr = P/cd.data[c1].Pc;
77
78 METHODS
79 METHOD default_self;
80 RUN ClearAll;
81 RUN specify;
82 RUN values;
83 END default_self;
84
85 METHOD specify;
86 P.fixed := TRUE;
87 V.fixed := FALSE;
88 Z.fixed := FALSE;
89 T.fixed := TRUE;
90 RUN tpeng.specify;
91 END specify;
92 METHOD values;
93 P := 12.0 {bar};
94 T := 298.15 {K};
95 RUN tpeng.values;
96 END values;
97
98 METHOD on_load;
99 RUN default_self;
100 END on_load;
101
102 METHOD fancyplot;
103 EXTERNAL zplot(SELF);
104 END fancyplot;
105
106 END testpengrobinson;

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