felib.iso20765x1 class

The iso20765x1 performs the calculation of thermodynamic properties of natural gas (molar and specific internal energy, molar and specific enthalpy, molar and specific entropy, molar and specific isochoric heat capacity, molar and specificspecific isobaric heat capacity, Joule-Thomson coefficient, isentropic exponent, and speed of sound), in accordance with:
International standard ISO-20765-1: Natural gas - Calculation of thermodynamic properties - Part 1: Gas phase properties for transmission and distribution applications,
as well as molar mass, molar density, density, compression factor, relative density and superior calorific value in accordance with
International standard ISO-12213-2: Natural gas - Calculation of compression factor - Part2: Calculation using molar-composition analysis

Table 1: Description of the iso20765x1 class interface: properties (variables), methods (functions) and error flags.

 PROPERTIES

 Natural gas component

Set property value

Get property value

I

 X(I) mole fraction for

0

Methane

 

void SetComponentMolarFraction(short I, double X(I))

 double GetComponentMolarFraction(short I)

1

Nitrogen

2

Carbon dioxide

3

Ethane

4

Propane

5

Water

6

Hydrogen sylfide

7

Hydrogen

8

Carbon monoxide

9

Oxygen

10

iso-Butane

11

n-Butane

12

iso-Pentane

13

n-Pentane

14

n-Hexane

15

n-Heptane

16

n-Octane

17

n-Nonane

18

n-Decane

19

Helium

20

Argon

Pressure [MPa]

void SetPressureMPa(double newP)

double GetPressureMPa()

Temperature [K]

void SetTemperatureK(double newT)

double GetTemperatureK()

Error status

-

long int GetErrorFlag()

Molar mass [kg/kmol]

-

double GetMolarMass()

Molar density [kg-mole/m3]

-

double GetMolarDensity()

Density [kg/m3]

-

double GetDensity()

Compression

-

double GetCompression()

Relative density at T2=273.15[K], p2=0.101325[MPa]

-

double GetRelativeDensity()

Superior calorific value on a volumetric basis at T1=298.15[K], T2=273.15[K], p1=p2=0.101325[MPa]

-

double GetSuperiorCalorificValue()

Molar internal energy [kJ/kmol]

-

double GetMolarInternalEnergy ()

Specific internal energy [kJ/kg]

-

double GetSpecificInternalEnergy ()

Molar enthalpy [kJ/kmol]

-

double GetMolarEnthalpy ()

Specific enthalpy [kJ/kg]

-

double GetSpecificEnthalpy ()

Molar entropy [kJ/(kmolK)]

-

double GetMolarEntropy ()

Specific entropy [kJ/(kgK)]

-

double GetSpecificEntropy ()

Molar isochoric heat capacity [kJ/(kmolK)]

-

double GetMolarIsochoricHeatCapacity ()

Specific isochoric heat capacity [kJ/(kgK)]

-

double GetSpecificIsochoricHeatCapacity ()

Molar isobaric heat capacity [kJ/(kmolK)]

-

double GetMolarIsobaricHeatCapacity ()

Specific isobaric heat capacity [kJ/(kgK)]

-

double GetSpecificIsobaricHeatCapacity ()

Joule-Thomson coefficient [K/MPa]

-

double GetJouleThomsonCoefficient ()

Isentropic exponent []

-

double GetIsentropicExponent ()

Speed of sound [m/s]

-

double GetSpeedOfSound ()

METHODS

Calculation of natural gas properties in accordance with ISO-20765-1 and ISO12213-2

long int CalculateIso20765x1(); calculates the properties and returns long int error status

ERROR STATUS

Error status bits are cleared or set upon the completion of long int CalculateIso20765x1() method as follows

Bit 0 =1 (000001H)

There exist at least one mole fraction < 0

Bit 1 =1 (000002H)

The total sum of mole fractions <0.98 or >1.02

Bit 2 =1 (000004H)

The total sum of mole fractions is not exactly equal to 1. This bit denotes only the warning that the fractions have been normalized to give the total sum of mole fractions equal to 1. If only bit 2 was set during the calculation the results are valid.

Bit 3 =1 (000008H)

The mole fraction of Methane <0.7 or >1.0

Bit 4 =1 (000010H)

The mole fraction of Nitrogen >0.2

Bit 5 =1 (000020H)

The mole fraction of Carbon Dioxide >0.2

Bit 6 =1 (000040H)

The mole fraction of Ethane >0.1

Bit 7 =1 (000080H)

The mole fraction of Propane >0.035

Bit 8 =1 (000100H)

The mole fraction of Water >0.00015

Bit 9 =1 (000200H)

The mole fraction of Hydrogen sulfide > 0.0002

Bit 10 =1 (000400H)

The mole fraction of Hydrogen >0.10

Bit 11 =1 (000800H)

The mole fraction of Carbon monoxide > 0.03

Bit 12 =1 (001000H)

The mole fraction of Oxygen >0.0002

Bit 13=1 (002000H)

The mole fraction of Butanes (n-Butane + i-Butane) >0.015

Bit 14 =1 (004000H)

The mole fraction of Pentanes (n-pentane + i-Pentane) >0.005

Bit 15 =1 (008000H)

The mole fraction of Hexanes (n-Hexane) >0.001

Bit 16 =1 (010000H)

The mole fraction of Heptanes (n-Heptane) >0.0005

Bit 17 =1 (020000H)

The mole fraction of octanes plus higher hydrocarbons (n-Octane + n-Nonane + n-Decane) >0.0005

Bit 18 =1 (040000H)

The mole fraction of Helium >0.005

Bit 19 =1 (080000H)

The mole fraction of Argon >0.0002

Bit 20 =1 (100000H)

The pressure <0.1 Pa or >30 MPa.

Bit 21 =1 (200000H)

The temperature temperature <250 K or >350 K.

Bit 22 =1 (400000H)

The relative density <0.55 or >0.90.

Bit 23 =1 (800000H)

The superior calorific value <20 MJ/m^3 or >48 MJ/m^3.

Bit 24,...

All higher bits are unused.