| Title: | Calorific Values and Properties of Natural Gas per ISO 6976:2016 |
|---|---|
| Description: | Calculates calorific values (gross and net), density, relative density, and Wobbe indices together with their standard uncertainties from natural gas composition, implementing the method of ISO 6976:2016 "Natural Gas — Calculation of calorific values, density, relative density and Wobbe indices from composition". Uncertainty propagation follows Annex B of that standard. Reference: International Organization for Standardization (2016) <https://www.iso.org/standard/55842.html>. |
| Authors: | Rüdiger Forster [aut, cre] |
| Maintainer: | Rüdiger Forster <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 0.1-0 |
| Built: | 2026-06-09 07:41:31 UTC |
| Source: | https://github.com/ruedigerforster/iso_6976 |
Calculates calorific values (gross and net, molar, mass and volumetric bases), density, relative density, and Wobbe indices together with their standard uncertainties from natural gas composition, following ISO 6976:2016 "Natural Gas — Calculation of calorific values, density, relative density and Wobbe indices from composition".
Uncertainty propagation is implemented according to Annex B of that standard (variance-covariance method).
**Application restrictions (ISO 6976:2016 §5):** * Combustion temperature: 0, 15, 15.55 (60 °F), 20, or 25 °C. * Volume reference temperature: 0, 15, 15.55 (60 °F), or 20 °C. * Reference pressure: 90–110 kPa. * Compression factor Z must be > 0.9.
Rüdiger Forster [email protected]
ISO 6976:2016 "Natural Gas — Calculation of calorific values, density, relative density and Wobbe indices from composition".
Useful links:
Report bugs at https://github.com/RuedigerForster/ISO_6976/issues
Computes all combustion and volumetric properties of a natural gas mixture together with their standard (or expanded) uncertainties, following the method and tables of ISO 6976:2016 and the uncertainty propagation formulae of its Annex B.
calculateProperties( compositionArray, uncertaintyArray, correlationMatrix, combustionTemperature = 25, volumeTemperature = 15, pressure = 101.325, coverage = 1 )calculateProperties( compositionArray, uncertaintyArray, correlationMatrix, combustionTemperature = 25, volumeTemperature = 15, pressure = 101.325, coverage = 1 )
compositionArray |
Numeric vector of length 60: mole fractions
\[mol/mol\] in the component order of ISO 6976:2016 Table A.2.
See |
uncertaintyArray |
Numeric vector of length 60: standard uncertainties
of the mole fractions (same units as |
correlationMatrix |
60x60 numeric matrix of correlation coefficients
between component mole fractions. Use |
combustionTemperature |
Combustion reference temperature in °C. Permitted values: 0, 15, 15.55, 20, 25. Default: 25. |
volumeTemperature |
Volume reference temperature in °C. Permitted values: 0, 15, 15.55, 20. Default: 15. |
pressure |
Reference pressure in kPa. Must be in \[90, 110\]. Default: 101.325. |
coverage |
Coverage factor |
A named list with the following elements (all numeric scalars):
| Name | Description | Unit | |———–|—————————————————–|————| | M | Molar mass | kg/kmol | | Z | Compression factor | — | | G_o | Ideal-gas relative density | — | | D_o | Ideal-gas density | kg/m³ | | G, u_G | Real-gas relative density and uncertainty | — | | D, u_D | Real-gas density and uncertainty | kg/m³ | | Hcg, u_Hcg| Molar gross calorific value and uncertainty | kJ/mol | | Hcn, u_Hcn| Molar net calorific value and uncertainty | kJ/mol | | Hmg, u_Hmg| Mass-basis gross calorific value and uncertainty | MJ/kg | | Hmn, u_Hmn| Mass-basis net calorific value and uncertainty | MJ/kg | | Hvg_o, u_Hvg_o | Ideal-gas vol. gross CV and uncertainty | MJ/m³ | | Hvn_o, u_Hvn_o | Ideal-gas vol. net CV and uncertainty | MJ/m³ | | Hvg, u_Hvg| Real-gas vol. gross CV and uncertainty | MJ/m³ | | Hvn, u_Hvn| Real-gas vol. net CV and uncertainty | MJ/m³ | | Wg_o | Ideal-gas gross Wobbe index | MJ/m³ | | Wn_o | Ideal-gas net Wobbe index | MJ/m³ | | Wg, u_Wg | Real-gas gross Wobbe index and uncertainty | MJ/m³ | | Wn, u_Wn | Real-gas net Wobbe index and uncertainty | MJ/m³ |
ISO 6976:2016 "Natural Gas — Calculation of calorific values, density, relative density and Wobbe indices from composition"
data("example1") res <- calculateProperties(example1$fractionArray, example1$uncertaintyArray, example1$correlationMatrix, combustionTemperature = 15, volumeTemperature = 15) res$M # molar mass [kg/kmol] res$Hvg # real-gas vol. gross CV [MJ/m^3] res$u_Wg # standard uncertainty of gross Wobbe indexdata("example1") res <- calculateProperties(example1$fractionArray, example1$uncertaintyArray, example1$correlationMatrix, combustionTemperature = 15, volumeTemperature = 15) res$M # molar mass [kg/kmol] res$Hvg # real-gas vol. gross CV [MJ/m^3] res$u_Wg # standard uncertainty of gross Wobbe index
Return the index of a gas component by name
componentIndex(name)componentIndex(name)
name |
Character string: component name (English). See
|
Integer index (1–60) into the composition vector.
Return the name of a gas component by index
componentName(index)componentName(index)
index |
Integer 1–60. |
Character string with the English component name.
Returns the ordered character vector of all 60 natural gas components
recognised by ISO 6976:2016 (Table A.2). The position of each name
corresponds to the index used in compositionArray,
uncertaintyArray, and correlationMatrix.
componentNames()componentNames()
Character vector of length 60.
A five-component natural gas mixture from Annex D.2 of ISO 6976:2016. Non-zero components: methane, ethane, propane, nitrogen, carbon dioxide.
A named list with three elements:
Numeric vector (length 60) of mole fractions [mol/mol].
Numeric vector (length 60) of standard uncertainties [mol/mol].
60×60 identity correlation matrix.
ISO 6976:2016 Annex D.2, Table D.2.
An eleven-component natural gas mixture including water vapour from Annex D.3 of ISO 6976:2016.
A named list with three elements (same structure as example1).
ISO 6976:2016 Annex D.3, Table D.3.
An eleven-component natural gas mixture from Annex D of ISO 6976:2016 with an identity correlation matrix (no inter-component correlations). Used to verify calculations at 15/15 °C and 25/0 °C.
A named list with three elements (same structure as example1).
ISO 6976:2016 Annex D.
The same eleven-component mixture as example3 but with a full
inter-component correlation matrix from a GC calibration covariance analysis,
as given in Annex D of ISO 6976:2016.
A named list with three elements (same structure as example1).
ISO 6976:2016 Annex D (extended correlation case).
R6 class for natural gas composition input
R6 class for natural gas composition input
GasComponents holds the mole fractions, their standard uncertainties,
and the inter-component correlation matrix for a natural gas mixture.
All three quantities are required as input to calculateProperties.
Components are identified either by their integer index (1–60, matching
ISO 6976:2016 Table A.2) or by English name (see componentNames).
fractionsNumeric vector (length 60) of mole fractions [mol/mol].
uncertaintiesNumeric vector (length 60) of standard uncertainties.
correlations60x60 correlation matrix (default: identity matrix).
new()
Create a new GasComponents object. Initialises fractions and uncertainties to zero and correlations to the 60x60 identity matrix.
GasComponents$new()
getFraction()
Get the mole fraction of a single component.
GasComponents$getFraction(name)
nameComponent name (English) or integer index 1–60.
Numeric scalar.
getUncertainty()
Get the standard uncertainty of a single component.
GasComponents$getUncertainty(name)
nameComponent name (English) or integer index 1–60.
Numeric scalar.
getCorrelation()
Get the correlation between two components.
GasComponents$getCorrelation(name1, name2)
name1First component name or index.
name2Second component name or index.
Numeric scalar in \[-1, 1\].
setFraction()
Set the mole fraction of a single component.
GasComponents$setFraction(name, value)
nameComponent name or index.
valueMole fraction [mol/mol].
setUncertainty()
Set the standard uncertainty of a single component.
GasComponents$setUncertainty(name, value)
nameComponent name or index.
valueStandard uncertainty.
setCorrelation()
Set the correlation between two components.
GasComponents$setCorrelation(name1, name2, value)
name1First component name or index.
name2Second component name or index.
valueCorrelation coefficient in \[-1, 1\].
setFractionArray()
Set all mole fractions at once.
GasComponents$setFractionArray(x)
xNumeric vector of length 60.
setUncertaintyArray()
Set all uncertainties at once.
GasComponents$setUncertaintyArray(u)
uNumeric vector of length 60.
setCorrelationMatrix()
Set the full correlation matrix.
GasComponents$setCorrelationMatrix(r)
r60x60 numeric matrix; values must lie in \[-1, 1\].
clone()
The objects of this class are cloneable with this method.
GasComponents$clone(deep = FALSE)
deepWhether to make a deep clone.
Calculate all ISO 6976:2016 properties and their uncertainties
iso6976_calc(x, u_x, r_x, t1, t2, p2, k = 1)iso6976_calc(x, u_x, r_x, t1, t2, p2, k = 1)
x |
Numeric vector of length 60: mole fractions [mol/mol] |
u_x |
Numeric vector of length 60: standard uncertainties |
r_x |
Numeric matrix 60x60: correlation matrix |
t1 |
Combustion temperature [°C]: 0, 15, 15.55, 20, or 25 |
t2 |
Volume reference temperature [°C]: 0, 15, 15.55, or 20 |
p2 |
Reference pressure [kPa]: 90–110 |
k |
Coverage factor (default 1) |
Named list of properties and uncertainties