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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2071 - (hide 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 kchittur 1457 REQUIRE "thermodynamics.a4l";
2    
3     IMPORT "johnpye/extpy/extpy";
4 kchittur 1475 IMPORT "kchittur/zplot";
5    
6 kchittur 1457 MODEL pengrobinson(P WILL_BE pressure;
7 jpye 1806 T WILL_BE temperature;
8     V WILL_BE molar_volume;
9     Z WILL_BE factor;
10     data WILL_BE td_component_constants;
11     );
12 kchittur 1457
13 jose 2071 R IS_A molar_gas_constant;
14 jpye 1806 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 kchittur 1457
19 jpye 1806 PSI, OMEGA, sigma, eps IS_A real_constant;
20 kchittur 1457
21 jpye 1806 PSI :== 0.45724;
22     OMEGA :== 0.07780;
23     sigma :== 2.414213562;
24     eps :== 0.414213562;
25 kchittur 1457
26 jpye 1806 Pc = data.Pc;
27     Tc = data.Tc;
28     omega = data.omega;
29 kchittur 1457
30 jpye 1806 eq1: Tr = T/Tc;
31     eq2: Pr = P/Pc;
32     eq3: T_degC = T/1{K} - 273.15;
33 kchittur 1457
34 jpye 1806 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 kchittur 1457
40    
41     METHODS
42     METHOD default_self;
43 jpye 1806 RUN ClearAll;
44     RUN specify;
45     RUN values;
46 kchittur 1457 END default_self;
47    
48 jpye 1806 METHOD specify;
49 kchittur 1457 P.fixed := TRUE;
50     T.fixed := TRUE;
51     T_degC.fixed := FALSE;
52 jpye 1806 END specify;
53     METHOD values;
54 kchittur 1457 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 jpye 1806 END values;
60 kchittur 1457
61     END pengrobinson;
62 jpye 1806
63 kchittur 1457 MODEL testpengrobinson;
64    
65 jpye 1806 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 kchittur 1457
75 jpye 1806 eqTr: Tr = T/cd.data[c1].Tc;
76     eqPr: Pr = P/cd.data[c1].Pc;
77 kchittur 1457
78     METHODS
79     METHOD default_self;
80 jpye 1806 RUN ClearAll;
81     RUN specify;
82     RUN values;
83 kchittur 1457 END default_self;
84    
85     METHOD specify;
86 jpye 1806 P.fixed := TRUE;
87     V.fixed := FALSE;
88     Z.fixed := FALSE;
89     T.fixed := TRUE;
90     RUN tpeng.specify;
91 kchittur 1457 END specify;
92     METHOD values;
93 jpye 1806 P := 12.0 {bar};
94     T := 298.15 {K};
95     RUN tpeng.values;
96 kchittur 1457 END values;
97    
98     METHOD on_load;
99 jpye 1806 RUN default_self;
100 kchittur 1457 END on_load;
101    
102     METHOD fancyplot;
103 jpye 1806 EXTERNAL zplot(SELF);
104 kchittur 1457 END fancyplot;
105    
106     END testpengrobinson;

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