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

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