aga8x92dc - Instructions for use

Revision: Oct 14, 2005

 

E-mail: info@felib.com

 

aga8x92dc is the C source code implementation of the

AGA Report No. 8, Compressibility Factor of Natural Gas and Related Hydrocarbon Gases (1992)

 

The software is written in a C-language.

 

1. Function prototype

 

The following is the declaration of the function aga8x93dc:

 

void aga8x92dc(

        /* output parameters */

        unsigned long int *error_status,       /* Error status */

        float *sup_cal_value,                          /* Superior calorific value */

        float *relative_density,                       /* Relative density */

        float *compression,                             /* Compression (compressibility factor) */

        float *density,                                      /* Density [kg/m3] */

        float *molar_density,                          /* Molar density [kg-mole/m3] */

        float *mole_average,                           /* Mole average */

        /* input parameters */

        float tepmerature_K,                            /* Temperature [K] */

        float pressure_MPa,                            /* Pressure in [MPa] */

        float x20,                                                /* molar fraction of Argon */

        float x19,                                                /* molar fraction of Helium */

        float x18,                                                /* molar fraction of n-Decane */

        float x17,                                                /* molar fraction of n-Nonane */

        float x16,                                                /* molar fraction of n-Octane */

        float x15,                                                /* molar fraction of n-Heptane */

        float x14,                                                /* molar fraction of n-Hexane */

        float x13,                                                /* molar fraction of n-Pentane */

        float x12,                                                /* molar fraction of i-Pentane */

        float x11,                                                /* molar fraction of n-Butane */

        float x10,                                                /* molar fraction of i-Butane */

        float x9,                                                  /* molar fraction of Oxygen */

        float x8,                                                  /* molar fraction of Carbon Monoxide */

        float x7,                                                  /* molar fraction of Hydrogen */

        float x6,                                                  /* molar fraction of Hydrogen Sulfide */

        float x5,                                                  /* molar fraction of Water */

        float x4,                                                  /* molar fraction of Propane */

        float x3,                                                  /* molar fraction of Ethane */

        float x2,                                                  /* molar fraction of Carbon Dioxide */

        float x1,                                                  /* molar fraction of Nitrogen */

        float x0                                                   /* molar fraction of Methane */

)


2. Input and output parameters

 

The following Table shows the description of input and output parameters:

 

Table 2.1

 

Input parameters

Data type

Parameter name

Parameter description

Unit of measure

float

x0

molar fraction of Methane

dimensionless

float

x1

molar fraction of Nitrogen

"

float

x2

molar fraction of Carbon dioxide

"

float

x3

molar fraction of Ethane

"

float

x4

molar fraction of Propane

"

float

x5

molar fraction of Water

"

float

x6

molar fraction of Hydrogen sulfide

"

float

x7

molar fraction of Hydrogen

"

float

x8

molar fraction of Carbon monoxide

"

float

x9

molar fraction of Oxygen

"

float

x10

molar fraction of iso-Butane

"

float

x11

molar fraction of n-Butane

"

float

x12

molar fraction of i-Pentane

"

float

x13

molar fraction of n-Pentane

"

float

x14

molar fraction of n-Hexane

"

float

x15

molar fraction of n-Heptane

"

float

x16

molar fraction of n-Octane

"

float

x17

molar fraction of n-Nonane

"

float

x18

molar fraction of n-Decane

"

float

x19

molar fraction of Helium

"

float

x20

molar fraction of Argon

"

float

pressure_MPa

operating pressure

[MPa]

float

temperature_K

operating temperature

[K]

Output parameters

float

mole_average

gas mixture molar mass

dimensionless

float

molar_density

gas mixture molar density

[kg×mol/m3]

float

density

gas mixture density

[kg/m3]

float

compression

gas mixture compression factor

dimensionless

float

relative density

gas mixture relative density

"

float

sup_cal_value

gas mixture superior calorific value

[MJ/m3]

unsigned long int

error_status

error status

dimensionless

 


3. Parameter ranges

 

The following Table shows the wider ranges of operation for input parameters and intermediate results.

 

Table 3.1

 

Ranges of application for compression factor calculation using AGA-8/1992 equation  of state

Parameter

Extended range

Absolute pressure [MPa]

 10-8 to 275.8 MPa

Temperature [K]

140 to 678  K

Relative density

0.07 to 1.52

Superior calorific value [MJ/m3]

0 to 67.066

Mole percent of:

 

Methane [%]

0 to 100

Nitrogen [%] 

0 to 100

Carbon dioxide [%]

0 to 100

Ethane [%]

0 to 100

Propane [%]

0 to  12

Water [%]

0 to  10

Hydrogen Sulfide [%]

0 to 100

Hydrogen [%]

0 to 100

Carbon Monoxide [%]

0 to   3

Oxigen [%]

0 to   21

i-Butane + n-Butane [%]

0 to   6

i-Pentane + n-Pentane [%]

0 to   4

n‑Hexane + n‑Heptane + n‑Octane + n‑Nonane + n‑Octane [%]

0 to  10

Helium [%]

0 to   3

Argon [%]

0 to   1

 

 

 


 

4. Error status

 

After completion of the routine the error_status (unsigned long integer) will be cleared if there were no errors during the calculation, or the corresponding bits will be set if certain errors were encountered. The description of the error_status bits is given in Table 4.1.

 

Table 4.1

 

Bit number

Hexadecimal address

Description

Bit 0

=1 (000001H)

If there exist at least one molar fraction < 0 or >1, else =0.

Bit 1

=1 (000002H)

If the total sum of molar fractions <0.98 or >1.02, else =0.

Bit 2

=1 (000004H)

If the total sum of molar fractions is <0.999999 or >1.000001, else =0. This bit denotes only a warning that the fractions have been normalized to give the total sum of molar fractions equal to 1. If only bit 2 was set during the calculation the results are valid.

Bit 3

=1 (000008H)

If mole fraction of Methane >1.0, else =0.

Bit 4

=1 (000010H)

If mole fraction of Nitrogen >1.0, else =0.

Bit 5

=1 (000020H)

If mole fraction of Carbon Dioxide >1.0, else =0.

Bit 6

=1 (000040H)

If mole fraction of Ethane >>1.0, else =0.

Bit 7

=1 (000080H)

If mole fraction of Propane >0.12, else =0.

Bit 8

=1 (000100H)

If mole fraction of Water >0.10, else =0.

Bit 9

=1 (000200H)

If mole fraction of Hydrogen sulfide > >1.0, else =0.

Bit 10

=1 (000400H)

If mole fraction of Hydrogen >>1.0, else =0.

Bit 11

=1 (000800H)

If mole fraction of Carbon monoxide > 0.03, else =0.

Bit 12

=1 (001000H)

If mole fraction of Oxygen >0.21, else =0.

Bit 13

=1 (002000H)

If mole fraction of Butanes (n-Butane + i-Butane) >0.06, else =0.

Bit 14

=1 (004000H)

If mole fraction of Pentanes (n-pentane + i-Pentane) >0.04, else =0.

Bit 15

=1 (008000H)

If mole fraction of Hexanes, Heptanes, Octanes plus higher Hydrocarbons (n-Hexane, n-Heptane, n-Octane + n-Nonane, n-Decane) >0.10, else =0.

Bit 16

=1 (010000H)

If mole fraction of Helium >0.03, else =0.

Bit 17

=1 (020000H)

If mole fraction of Argon >0.01, else =0.

Bit 18

=1 (040000H)

If pressure <0.01 Pa or >275.8 MPa, else =0.

Bit 19

=1 (080000H)

If temperature <140 K or >678 K, else =0.

Bit 20

=1 (100000H)

If relative density <0.07 or >1.52, else =0.

Bit 21

=1 (200000H)

If superior calorific value <0 MJ/m3 or >67.066 MJ/m3, else =0.

Bit 22

=x (400000H)

Unused

Bit 23

=x (800000H)

Unused

Bit 24

=1 (1000000H)

If OFF-LINE calculation failed, els