GasComponents: R6 class for natural gas composition input

GasComponentsR Documentation

R6 class for natural gas composition input

Description

R6 class for natural gas composition input

R6 class for natural gas composition input

Details

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).

Public fields

fractions

Numeric vector (length 60) of mole fractions [mol/mol].

uncertainties

Numeric vector (length 60) of standard uncertainties.

correlations

60x60 correlation matrix (default: identity matrix).

Methods

Public methods


Method new()

Create a new GasComponents object. Initialises fractions and uncertainties to zero and correlations to the 60x60 identity matrix.

Usage
GasComponents$new()

Method getFraction()

Get the mole fraction of a single component.

Usage
GasComponents$getFraction(name)
Arguments
name

Component name (English) or integer index 1–60.

Returns

Numeric scalar.


Method getUncertainty()

Get the standard uncertainty of a single component.

Usage
GasComponents$getUncertainty(name)
Arguments
name

Component name (English) or integer index 1–60.

Returns

Numeric scalar.


Method getCorrelation()

Get the correlation between two components.

Usage
GasComponents$getCorrelation(name1, name2)
Arguments
name1

First component name or index.

name2

Second component name or index.

Returns

Numeric scalar in \[-1, 1\].


Method setFraction()

Set the mole fraction of a single component.

Usage
GasComponents$setFraction(name, value)
Arguments
name

Component name or index.

value

Mole fraction [mol/mol].


Method setUncertainty()

Set the standard uncertainty of a single component.

Usage
GasComponents$setUncertainty(name, value)
Arguments
name

Component name or index.

value

Standard uncertainty.


Method setCorrelation()

Set the correlation between two components.

Usage
GasComponents$setCorrelation(name1, name2, value)
Arguments
name1

First component name or index.

name2

Second component name or index.

value

Correlation coefficient in \[-1, 1\].


Method setFractionArray()

Set all mole fractions at once.

Usage
GasComponents$setFractionArray(x)
Arguments
x

Numeric vector of length 60.


Method setUncertaintyArray()

Set all uncertainties at once.

Usage
GasComponents$setUncertaintyArray(u)
Arguments
u

Numeric vector of length 60.


Method setCorrelationMatrix()

Set the full correlation matrix.

Usage
GasComponents$setCorrelationMatrix(r)
Arguments
r

60x60 numeric matrix; values must lie in \[-1, 1\].


Method clone()

The objects of this class are cloneable with this method.

Usage
GasComponents$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


ISO6976.2016 documentation built on April 9, 2026, 5:09 p.m.