felib.iso12213x3 class

The iso12213x3 performs the calculation of compression, density, molar density and molar mass using simplified gas analysis in accordance with:

ISO12213-3: Natural gas - Calculation of compression factor - Part3: Calculation using physical properties.

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

 PROPERTIES

DESCRIPTION SET PROPERTY VALUE GET PROPERTY VALUE
Pressure [bar] void SetPressureBar(double newValue) double GetPressureBar()
Temperature [C] void SetTemperatureDegC(double newValue) double GetTemperatureDegC()
Mole fraction of carbon dioxide void SetMoleFractionCO2(double newValue) double GetMoleFractionCO2()
Mole fraction of hydrogen void SetMoleFractionH2(double newValue) double GetMoleFractionH2()
Relative density at T2=273.15[K], p2=1.01325[bar] void SetRelativeDensity(double newValue) double GetRelativeDensity()
Superior calorific value at T1=298.15[K], T2=273.15[K], p1=p2=1.01325[bar] void SetSuperiorCalorificValue(double newValue) double GetSuperiorCalorificValue()
Error status

-

long int GetErrorStatus()
Compression (see Figure)

-

double GetCompression()
Density [kg/m3] (see Figure)

-

double GetDensity()
Molar density [kg-mole/m3]

-

double GetMolarDensity()
Molar mass

-

double GetMolarMass()

METHODS

Calculation of SGERG-88 virial equation for natural gases (ISO12213-3) long int CalculateIso12213x3(); calculates compression, density, molar density and molar mass and returns long int error status

ERROR STATUS

Error status bits are cleared or set upon the completion of long CalculateIso12213x3() method as follows
Bit 0 =1 (0001H) The pressure <0.000001 bar or > 120.0 bar.
Bit 1 =1 (0002H) The temperature <-23.0 C or > 65.0 C.
Bit 2 =1 (0004H) d>(0.55+0.97*mfrCO2-0.45*mfrH2)
d - density
mfrCO2 - mole fraction of carbon dioxide
mfrH2 - mole fraction of hydrogen
Bit 3 =1 (0008H) No convergence in iteration with molar heating value
Bit 4 =1 (0010H) No convergence in iteration with the second virial coefficient
Bit 5 =1 (0020H) Calculated mole fraction of N2 (mfrN2) out of range: -0.01<mfrN2<0.5
Bit 6 =1 (0040H) Sum of mole fractions of N2 (mfrN2) and CO2 (mfrCO2) out of range: (mfrN2+mfrCO2)<0.5
Bit 7 =1 (0080H) The internal consistency of the input data for the third iteration loop does not satisfy the condition relating relative density and mole fractions:
d>(0.55+0.4*mfrN2+0.97*mfrCO2-0.45*mfrH2)
mfrN2 - mole fraction for nitrogen
mfrCO2 - mole fraction for carbon dioxide
mfrH2 - mole fraction of hydrogen
Bit 8 =1 (0100H) No solution - square root of negative value (B11*B33<0) (see ISO12213-3)
Bit 9 =1 (0200H) No solution - exponentiation of negative value
Bit 10 =1 (0400H) No convergence
Bit 11 =1 (0800H) Mole fraction of Carbon dioxide <0 or > 0.3
Bit 12 =1 (1000H) Mole fraction of Nitrogen <0 or >0.1
Bit 13 =1 (2000H) Superior calorific value <20 MJ/m or > 48 MJ/m
Bit 14 =1 (4000H) Relative density > 0.55 or < 0.9
Bit 15,... All higher bits are unused.