FE-ISO20765-1-DLL


FE-ISO20765-1-DLL (felib.iso20765x1) is a component of felib.dll.
Felib.iso20765x1 performs the calculation of thermodynamic and volumetric properties of natural gas completely in accordance with:

ISO-20765-1:2005: Natural gas - Calculation of thermodynamic properties -
  • Part 1: Gas phase properties for transmission and distribution applications, and
ISO 12213-2:2006; EN ISO 12213-2:2009: Natural gas - Calculation of compression factor -
  • Part 2: Calculation using molar-composition analysis

Description of felib.iso20765x1 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 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 Set­PressureMPa­(double newP) double Get­PressureMPa­()
Temperature [K] void Set­TemperatureK­(double newT) double Get­TemperatureK­()
Protection key void SetKeyCode(long nNewValue) n/a
Error status n/a long Get­Error­Flag()
Error report n/a BSTR GetError­Report()
Molar mass [kg/kmol] n/a double GetMolar­Mass()
Molar density [kg⋅mole/m3] n/a double GetMolar­Density()
Mass density [kg/m3] n/a double Get­Density()
Compression factor n/a double Get­Compression­()
Relative density at T2=273.15[K], p2=0.101325[MPa] n/a double Get­Relative­Density()
Superior calorific value on a volumetric basis at T1=298.15[K], T2=273.15[K], p1=p2=0.101325[MPa] n/a double Get­Superior­Calorific­Value()
Molar internal energy [kJ/kmol] n/a double Get­Molar­Internal­Energy ()
Specific internal energy [kJ/kg] n/a double Get­Specific­Internal­Energy ()
Molar enthalpy [kJ/kmol] n/a double Get­Molar­Enthalpy ()
Specific enthalpy [kJ/kg] n/a double Get­Specific­Enthalpy ()
Molar entropy [kJ/(kmol⋅K)] n/a double Get­Molar­Entropy ()
Specific entropy [kJ/(kg⋅K)] n/a double Get­Specific­Entropy ()
Molar isochoric heat capacity [kJ/(kmol⋅K)] n/a double Get­Molar­Isochoric­Heat­Capacity ()
Specific isochoric heat capacity [kJ/(kg⋅K)] n/a double Get­Specific­Isochoric­Heat­Capacity ()
Molar isobaric heat capacity [kJ/(kmol⋅K)] n/a double Get­Molar­Isobaric­Heat­Capacity ()
Specific isobaric heat capacity [kJ/(kg⋅K)] n/a double Get­Specific­Isobaric­Heat­Capacity ()
Joule-Thomson coefficient [K/MPa] n/a double Get­Joule­Thomson­Coefficient ()
Isentropic exponent n/a double Get­Isentropic­Exponent ()
Speed of sound [m/s] n/a double Get­Speed­Of­Sound ()
FUNCTION
Function prototype long CalculateIso20765x1(); calculates the properties and returns long int representing error status
ERROR STATUS
long Ge­tError­Flag() Description of Error/Warning flags.
Bit 0 =1 (000001H) Error: There exists at least one mole fraction <0 or >1.
Bit 1 =1 (000002H) Error: Total sum of mole fractions <0.98 or >1.02.
Bit 2 =1 (000004H) Warning: 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) Error: Mole fraction of Methane <0.7 or >1.0.
Bit 4 =1 (000010H) Error: Mole fraction of Nitrogen >0.2.
Bit 5 =1 (000020H) Error: Mole fraction of Carbon Dioxide >0.2.
Bit 6 =1 (000040H) Error: Mole fraction of Ethane >0.1.
Bit 7 =1 (000080H) Error: Mole fraction of Propane >0.035.
Bit 8 =1 (000100H) Error: Mole fraction of Water >0.00015.
Bit 9 =1 (000200H) Error: Mole fraction of Hydrogen sulfide >0.0002.
Bit 10 =1 (000400H) Error: Mole fraction of Hydrogen >0.10.
Bit 11 =1 (000800H) Error: Mole fraction of Carbon monoxide >0.03.
Bit 12 =1 (001000H) Error: Mole fraction of Oxygen >0.0002.
Bit 13=1 (002000H) Error: Mole fraction of Butanes (n-Butane + i-Butane) >0.015.
Bit 14 =1 (004000H) Error: Mole fraction of Pentanes (n-pentane + i-Pentane) >0.005.
Bit 15 =1 (008000H) Error: Mole fraction of Hexanes (n-Hexane) >0.001.
Bit 16 =1 (010000H) Error: Mole fraction of Heptanes (n-Heptane) >0.0005.
Bit 17 =1 (020000H) Error: Mole fraction of octanes plus higher hydrocarbons (n-Octane + n-Nonane + n-Decane) >0.0005.
Bit 18 =1 (040000H) Error: Mole fraction of Helium >0.005.
Bit 19 =1 (080000H) Error: Mole fraction of Argon >0.0002
Bit 20 =1 (100000H) Error: Pressure <10-7 or >30 MPa.
Bit 21 =1 (200000H) Error: Temperature <250 or >350 K.
Bit 22 =1 (400000H) Error: Relative density <0.55 or >0.90.
Bit 23 =1 (800000H) Error: Superior calorific value <20 MJ/m3 or >48 MJ/m3.
Bit 24 =1 (1000000H) Error: Invalid protection key.
Bit 25,... Bit 25 and all higher bits are unused.