FE-AGA8-2017-1-DLL


FE-AGA8-2017-1-DLL (felib.aga8xq1704p1) is a component of felib.dll.
Felib.aga8xq1704p1 performs the calculation of thermodynamic and volumetric properties of natural gas. The calculation procedure is based on AGA-8 DETAIL Equation of State and is completely in accordance with:

AGA Report No. 8, Part 1: Thermodynamic Properties of Natural Gas and Related Gases
DETAIL and GROSS Equations of State

Third Edition, April 2017 (A revision of AGA Report No. 8, 2nd edition, 1994)

Description of felib.aga8xq1704p1 class interface: properties (variables), method (function) and error status flags.

PROPERTIES
Property Set property value Get property value
I X(I): mole fraction for
0 Methane void Set­Component­Molar­Fraction­(short I, double X(I) double Get­Component­Molar­Fraction­(short I)
1 Nitrogen
2 Carbon dioxide
3 Ethane
4 Propane
5 i-Butane
6 n-Butane
7 i-Pentane
8 n-Pentane
9 n-Hexane
10 n-Heptane
11 n-Octane
12 n-Nonane
13 n-Decane
14 Hydrogen
15 Oxygen
16 Carbon monoxide
17 Water
18 Hydrogen sylfide
19 Helium
20 Argon
Pressure [MPa] void Set­PressureMPa­(double newP) double Get­PressureMPa­()
Temperature [K] void Set­TemperatureK­(double newT) double Get­TemperatureK­()
Protection key void Set­Key­Code­(long newValue) n/a
Molar mass [kg/kmol] n/a double Get­Molar­Mass()
Molar density [kg⋅mole/m3] n/a double Get­Molar­Density()
Density [kg/m3] void SetDensity(double newD) double Get­Density()
Compressibility factor n/a double Get­Compressibility­Factor­()
Relative density n/a double Get­Relative­Density­()
Reduced density void Set­Reduced­Density­(double newRD) double Get­Reduced­Density­()
Gross heating value [MJ/m^3] void Set­Gross­Heating­Value­(double newHV) double Get­Gross­Heating­Value­()
Molar Helmholtz energy [j/mol] n/a double Get­Molar­Helmholtz­Energy­()
Molar Helmholtz energy of ideal-gas [j/mol] n/a double Get­Molar­Ideal­Gas­Helmholtz­Energy­()
Molar residual Helmholtz energy [j/mol] n/a double Get­Molar­Ideal­Gas­Helmholtz­Energy­()
Molar entropy [J/(mol⋅K)] n/a double Get­Molar­Entropy()
Molar energy [J/mol] n/a double Get­Molar­Energy()
Molar enthalpy [J/mol] n/a double Get­Molar­Enthalpy ()
Molar Gibbs energy [J/mol] n/a double Get­Molar­Gibs­Energy­()
Molar isochoric heat capacity [J/(mol⋅K)] n/a double Get­Molar­Isochoric­HC­()
Molar isobaric heat capacity [J/(mol⋅K)] n/a double Get­Molar­Isobaric­HC­()
Speed of sound [m/s] n/a double Get­Speed­Of­Sound­()
Joule-Thomson coefficient [K/MPa] n/a double Get­Joule­Thomson­Coefficient­()
Isentropic exponent n/a double Get­Isentropic­Exponent ()
Specific entropy [kJ/(kg⋅K)] n/a double Get­Specific­Entropy­()
Specific energy [kJ/kg] n/a double Get­Specific­Energy­()
Specific enthalpy [kJ/kg] n/a double Get­Specific­Enthalpy ()
Specific isochoric heat capacity [kJ/(kg⋅K)] n/a double Get­Specific­Isochoric­HC­()
Specific isobaric heat capacity [kJ/(kg⋅K)] n/a double Get­Specific­Isobaric­HC­()
**Error status n/a long Get­Error­Flag()
***Error report n/a BSTR Get­Error­Report­()
FUNCTION
long Calculate() Calculates the properties based on DETAIL EoS and returns long error status
*Ranges of application
Parameter Expanded range Range A Range B Range C
Temperature in K 143.15 to 453.15 269.15 to 453.15 269.15 to 453.15 265.15 to 453.15
Pressure (absolute) in MPa 10-9 to 280 10-9 to 10.3 10-9 to 2.1 10-9 to 21
Gross heating value in MJ/m3 0 to 66 23.5 to 44.7 25.3 to 56 35.8 to 40.6
Relative density 0.07 to 1.52 0.554 to 0.91 0.47 to 0.91 0.554 to 0.64
Mole fractions ranges
Methane 0 to 1.0 0.6 to 1.0 0.6 to 1.0 0.6 to 1.0
Nitrogen 0 to 1.0 0 to 0.5 0 to 0.5 0 to 0.03
Carbon dioxide 0 to 1.0 0 to 0.3 0 to 0.8 0 to 0.03
Ethane 0 to 1.0 0 to 0.1 0 to 0.25 0 to 0.04
Propane 0 to 0.12 0 to 0.04 0 to 0.06 0 to 0.02
i-Butane - 0 to 0.004 0 to 0.015 0 to 0.001
n-Butane - 0 to 0.006 0 to 0.06 0 to 0.004
Total butanes 0 to 0.08 - - -
i-Pentane - 0 to 0.003 0 to 0.02 0 to 0.001
n-Pentane - 0 to 0.003 0 to 0.02 0 to 0.001
Total pentanes 0 to 0.05 0 to 0.003 0 to 0.02 -
n-Hexane - 0 to 0.0012 0 to 0.002 0 to 0.0003
n-Heptane - 0 to 0.0004 0 to 0.002 0 to 0.0001
n-Octane - 0 to 0.0003 0 to 0.002 0 to 0.00003
n-Nonane - 0 to 0.0003 0 to 0.002 0 to 0.00003
n-Decane - 0 to 0.0003 0 to 0.002 0 to 0.00003
Total hexanes plus 0 to 0.05 0 to 0.0015 - -
Total heptanes plus - 0 to 0.0004 - -
Hydrogen 0 to 1.0 0 to 0.05 0 to 1.0 0 to 0.01
Oxygen 0 to 0.21 0 to 0.002 0 to 0.01 0 to 0.002
Carbon monoxide 0 to 0.12 0 to 0.01 0 to 0.1 0 to 0.01
Water 0 to 0.02 0 to 0.0005 0 to 0.014 0 to 0.00005
Hydrogen sulfide 0 to 1.0 0 to 0.001 0 to 0.04 0 to 0.001
Helium 0 to 0.06 0 to 0.004 0 to 0.05 0 to 0.004
Argon 0 to 0.04 0 to 0.002 0 to 0.03 0 to 0.002
In each calculation all input parameters and intermediate results are first checked to determine whether their values are within the limits defined by the expanded range of application or not.
  • If the parameters do not satisfy the expanded range, the calculation terminates with no results and with the corresponding error status flags (bits) set.
  • If the parameters satisfy the expanded range they are further checked to see if they comply with at least one of the ranges A, B or C (See Table 1 in AGA Report No. 8, Part 1) and if the result is positive again then the calculation ends with no errors and the results of the calculation are valid with an uncertainty in density generally less than 0.1 %.
  • If the parameters satisfy the expanded range and do not comply with any of the ranges A, B or C (See Table 1 in AGA Report No. 8, Part 1) , the results of the calculation are still valid but warning bit is set in error status to warn the user that an uncertainty in density is not guaranteed to be within 0.1 %.
**ERROR STATUS
long Ge­tError­Flag() Description of Error/Warning flags
Bit 1 =1 (00001H) Error01: There exists at least one mole fraction <0 or >1
Bit 2 =1 (00002H) Error02: Total sum of mole fractions <0.999999 or >1.000001
Bit 3 =1 (00004H) Error03: Mole fraction of Propane >0.12
Bit 4 =1 (00008H) Error04: Mole fraction of butanes >0.08
Bit 5 =1 (00010H) Error05: Mole fraction of pentanes >0.05
Bit 6 =1 (00020H) Error06: Mole fraction of hexanes plus>0.05
Bit 7 =1 (00040H) Error07: Mole fraction of Oxygen >0.21
Bit 8 =1 (00080H) Error08: Mole fraction of Carbon monoxide >0.12
Bit 9 =1 (00100H) Error09: Mole fraction of Water >0.02
Bit 10 =1 (00200H) Error10: Mole fraction of Helium >0.06
Bit 11 =1 (00400H) Error11: Mole fraction of Argon >0.04
Bit 12 =1 (00800H) Error12: Absolute pressure <1E-9 MPa or >280 MPa
Bit 13 =1 (01000H) Error13: Temperature <143.15 K or >453.15 K
Bit 14 =1 (02000H) Error14: Relative density <0.07 K or >1.52 K
Bit 15 =1 (04000H) Error15: Gross heating value <0 or >66
Bit 16 =1 (08000) Error16: No convergence
Bit 17 =1 (10000H) Warning: None of ranges A, B or C (AGA8-Table 1) has been satisfied
Bit 18 =1 (20000H) Error17: Incorrect key code
Bit 19,... All higher bits are unused.
***ERROR REPORT
The property "BSTR GetErrorReport()" is used to get an error report in a textual form.

Example 1
The Error report is illustrated by a calculation example using gas mixture denoted by "High CO2-N2" in the Table B.1 of APPENDIX B of AGA Report No. 8, Part 1 and by applying the corresponding pressure (6 MPa) and temperature (333.15 K). Upon completion of the method there were no errors and the property "BSTR GetErrorReport()" returns the following error report string:

No errors!

The following is a user interface to a simple VB program displaying the results and error status obtained upon successful completion of the calculation.

Example1 screenshot


Example 2
Example 2 is the same as the Example 1, except the given temperature T=140 K is out of expanded range of applications. Upon completion of the calculation method the corresponding error and warning are set and the property "BSTR GetErrorReport()" returns the following error report string:

Error13: Temperature <143.15 K or >453.15 K
Warning: None of ranges A, B or C (AGA8-Table 1) has been satisfied
The following is a user interface to a VB program displaying error status after failing to complete the calculation.

Example2 screenshot