FE-AGA8-Part2-DLL (

- AGA8 Report No. 8, Part 2

*Thermodynamic Properties of Natural Gas and Related Gases -*

GERGâ€“2008 Equation of State

First Edition April 2017

PROPERTIES | |||
---|---|---|---|

Property | Set property value | Get property value | |

I | X(I): mole fraction for | ||

0 | Methane | void SetMoleFraction(short I, double X(I)) | double GetMoleFraction(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 SetPressureMPa(double newP) | double GetPressureMPa() | |

Temperature [K] | void SetTemperatureK(double newT) | double GetTemperatureK() | |

^{*}Ranges of application (RAP) |
void SetRangeOfApplication(short newRAP) | short GetRangeOfApplication() | |

Protection key | void SetKeyCode(long newValue) | n/a | |

Density [kg/m^{3}] | void SetDensity(double newD) | double GetDensity() | |

Reduced density | void SetReducedDensity(double newRD) | double GetReducedDensity() | |

Molar mass [kg/kmol] | n/a | double GetMolarMass() | |

Molar density [kg⋅mole/m^{3}] | n/a | double GetMolarDensity() | |

Compressibility factor | n/a | double GetCompressibilityFactor() | |

Molar Gibbs free energy [kj/kmol] | n/a | double GetMolarGibsFreeEnergy() | |

Molar internal energy [kJ/kmol] | n/a | double GetMolarInternalEnergy () | |

Specific internal energy [kJ/kg] | n/a | double GetSpecificInternalEnergy () | |

Molar enthalpy [kJ/kmol] | n/a | double GetMolarEnthalpy () | |

Specific enthalpy [kJ/kg] | n/a | double GetSpecificEnthalpy () | |

Molar entropy [kJ/(kmol⋅K)] | n/a | double GetMolarEntropy () | |

Specific entropy [kJ/(kg⋅K)] | n/a | double GetSpecificEntropy () | |

Molar isochoric heat capacity [kJ/(kmol⋅K)] | n/a | double GetMolarIsochoricHeatCapacity () | |

Specific isochoric heat capacity [kJ/(kg⋅K)] | n/a | double GetSpecificIsochoricHeatCapacity () | |

Molar isobaric heat capacity [kJ/(kmol⋅K)] | n/a | double GetMolarIsobaricHeatCapacity () | |

Specific isobaric heat capacity [kJ/(kg⋅K)] | n/a | double GetSpecificIsobaricHeatCapacity () | |

Joule-Thomson coefficient [K/MPa] | n/a | double GetJouleThomsonCoefficient () | |

Isentropic exponent | n/a | double GetIsentropicExponent () | |

Speed of sound [m/s] | n/a | double GetSpeedOfSound () | |

^{**}Error status | n/a | long GetErrorFlag() | |

^{***}Error report | n/a | BSTR GetErrorReport() |

FUNCTION | |
---|---|

long Calculate(short iCalc); Calculates the properties and returns long error status | |

short iCalc - defines method of calculation | Input parameters to selected method of calculation |

iCalc=0 (or any iCalc≠1 & ≠2) | Pressure, temperature and mole fractions |

iCalc=1 | Mass-based density, temperature and mole fractions |

iCalc=2 | Reduced density, temperature and mole fractions |

^{***}ERROR REPORT |
---|

The property "BSTR GetErrorReport()" is used to get an error report in a textual form.## Example 1The Error report is illustrated by a calculation example using gas mixture denoted by Gas 5 in the Table B.1 of Annex B of AGA8 Report No. 8, Part 2 with the corresponding pressure (31.4347MPa) and temperature (350K). The calculation method based on pressure, temperature and mole fractions(iCalc=0) is selected. In the first example the calculation is performed with "No range limits" (RAP=2). Upon completion of the method there were no errors and the property "BSTR GetErrorReport()" returns the 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 completion of the calculation. ## Example 2Example 2 is the same as the Example 1, except "Full range" (RAP=1) is selected instead of "No range limits" (RAP=2). Upon completion of the calculation method the range violation errors were set and the property "BSTR GetErrorReport()" returns the following error report string:ErrBit03: Mole fraction of Methane out of range defined by RAP ErrBit14: Mole fraction of Oxygen out of range defined by RAP ErrBit18: Mole fraction of Helium out of range defined by RAP ErrBit19: Mole fraction of Argon out of range defined by RAP The following is a user interface to a VB program displaying error status after failing to complete the calculation. |