Preprint
Article

This version is not peer-reviewed.

Evaluating Measurement Uncertainty Using Models with Arguments Subject to a Constraint

Submitted:

28 December 2025

Posted:

31 December 2025

You are already at the latest version

Abstract
Measurement models that have a chemical composition as one of the arguments require special attention when used with the law of propagation of uncertainty from the Guide to the expression of uncertainty in measurement. The constraint that the amount fractions in a composition add exactly to unity does not only affect the covariance matrix associated with the composition, but also impacts the differentiation of the measurement model to obtain the expressions and values of the sensitivity coefficients. Differentiating the measurement model with respect to each variable individually is not possible as it involves evaluating the model for infeasible inputs, leading to an undefined output. In this work, a numerical method for constrained partial derivatives is presented, enabling using the law of propagation of uncertainty for measurement models with compositions as one of their arguments. The numerical method enables treating the measurement model as a black box and using it with measurement models in the form an algorithm. The numerical method is demonstrated by showing how the uncertainty associated with composition, temperature and pressure can be propagated through an equation of state, in this case the GERG-2008 equation of state. It is shown that this propagation can be done in a few simple steps, requiring only a valid implementation of the measurement model that provides an output value for given input quantities. The numerical differentiation method applies in principle to all differentiable functions of a composition.
Keywords: 
;  ;  ;  ;  ;  ;  ;  ;  

1. Introduction

The metering of natural gas serves a variety of purposes, including billing, custody transfer, assessing conformity with contractual and legislative requirements [1,2,3]. For such assessments, it is paramount to know the uncertainty of the measurement results [4]. To obtain the measurement uncertainty for the total mass, volume or energy, it is necessary to duly propagate the measurement uncertainty [5,6,7] of, e.g., the flow rate [8,9,10,11,12,13], composition [14,15], density [16], calorific value [17,18]. It has been argued that also the dependencies between the input variables of the measurement models should be taken into account [19], which is not always done.
When calculating gas properties calculated from a composition, pressure and temperature, such as the compressibility factor, density or speed of sound, it is important to consider the covariances between the amount fractions [20]. The amount fractions of all components in a gas mixture form a composition [21] and a feature of a composition is that its amount fractions sum exactly to unity. This property of a composition has implications for the covariance matrix associated with the amount fractions and also affects the differentiation of measurement models which have a composition as one of their inputs.
The property of a composition is that its amount fractions sum to unity exactly is an example of a mathematical constraint [22,23] and it is well known from mathematics that a function with constrained arguments behaves differently from the same function while ignoring the constraint. The latter case, thus ignoring the constraint can lead to physically infeasible output. For instance, when calculating a calorific value of natural gas with a composition that adds to, say, 101 cmol mol−1 has no physical meaning, yet the model of ISO 6976 [18] permits at least mathematically to do so. When using an equation of state such as GERG-2008 [24,25] or AGA8-DC92 [26,27], it is less obvious whether it is mathematically possible to evaluate these functions while ignoring the constraint. Most valid implementations of these models refuse the input when the constraint on the composition is not met.
In the industry and elsewhere, the law of propagation of uncertainty (LPU) [5,7] is the de facto standard for propagating measurement uncertainty. The LPU is part of the methods of the Guide to the Expression of Uncertainty in Measurement (GUM) [4,5,6,28,29] for evaluating and propagating uncertainty in measurement. The LPU is widely used in standards [8,9,10,11,13,14,15,18], regulatory documents [2,30] and industry guidance documents [31,32]. Measurement uncertainty is propagated using a measurement model [29].
An equation of state, when used for instance to calculate a compressibility factor under actual conditions, can be used as a measurement model. When using these equations, there are in principle two kinds of uncertainty to be considered, the model uncertainty [29], clause 11.10] and the uncertainty due to the uncertainty of the input variables, e.g., the line pressure, temperature and gas composition. For the compressibility factor computed from the GERG-2008 equation of state, the model uncertainty is given in ISO 20765-2 [25], but a method to propagate the uncertainty from the input variables using the LPU is missing [25], clause 7.6].
For applying the LPU, values for the sensitivity coefficients are necessary. These are the first-order partial derivatives of the measurement model with respect to the input variables. ISO/IEC Guide 98-3 [5], clause 5.1.3] defines sensitivity coefficients as partial derivatives that “[...] describe how the output estimate y varies with changes in the values of the input estimates x 1 , x 2 , , x N ”. The GUM [5,6,7,29] makes silently the assumption that the input variables are independent. The guidance on obtaining the sensitivity coefficients [5], clause 5.1.3] instructs to obtain these coefficients by differentiating, one variable at a time, the measurement model. Varying one variable at a time the input of a measurement model with a composition as input not possible without running the risk of infeasible output: to satisfy the constraint, if one amount fraction changes, then at least one other should change too to ensure that the sum of the amount fractions is still one. There is however a method for obtaining partial derivatives that appreciate an equality constraint [23] and this method can in principle be used with equations of state as well.
Differentiating equations of state is cumbersome when doing that analytically. Many of these are complex, and furthermore many of the calculations are iterative [33,34,35]. For instance, calculating a compressibility factor using a cubic equation of state requires solving a cubic polynomial [33], which makes the function to be differentiated implicit. A vapour-liquid equilibrium calculation with the same simple equation of state is iterative [33]. Numerically evaluating the partial derivatives only requires a valid implementation of the calculation involving the equation of state and a method to obtain the from varying the input variables the values for the sensitivity coefficients. In this work, a numerical method for using the LPU is presented for calculations involving an equation of state. The methodology does not depend on the kind of model and is capable of dealing with models with a combination of constrained and unconstrained input variables.
The LPU requires the first-order partial derivatives of the measurement model with respect to the input variables for propagating the standard uncertainties from the input variables to the output variable(s). The GUM [5,6,7,29] makes silently the assumption that the input variables are independent. The guidance on obtaining the sensitivity coefficients [5], clause 5.1.3] instructs to obtain these coefficients by differentiating, one variable at a time, the measurement model. This method does not work if the input variables are subject to a constraint. In that situation, it is no longer possible to vary one by one the input variables to evaluate the sensitivity coefficients.
This work presents a numerical method for evaluating the sensitivity coefficients of models with constrained arguments, with the emphasis on compositions, as these are relevant for the metering of natural gas, hydrogen-enriched natural gas and hydrogen. The method is based on the work from Schay [23], who presented a neat framework for differentiating functions with the input variables subject to an equality constraint. It is shown how this method can be applied for calculating a compressibility factor using the GERG-2008 equation of state [24], which is a model that has arguments subject to a constraint (the amount fractions of the components) and independent ones (temperature and pressure).

2. Law of Propagation of Uncertainty

Measurement uncertainty is propagated using a measurement model. Much of the guidance on evaluating measurement uncertainty is still based on using the LPU for mutually independent quantities [5], equation (10)]. In this work, the form for dependent quantities is used [5], equation (13)], as arguments subject to a constraint are dependent. Consequently, it is assumed that the covariance matrix associated with the arguments subject to the constrained is developed in a fashion that is consistent with that constraint. A covariance matrix associated with a composition has specific features, one of them being that the elements on each row (and for that matter, each column) sum to zero. It was discussed previously that for duly propagating measurement uncertainty, the covariance matrix including the covariances should be used [20]. In this work, such a covariance matrix will be called ’properly formed’.
Using LPU requires calculating the partial derivatives of the measurement model, also known as sensitivity coefficients [5,7]. According to the ISO/IEC Guide 98-3  [5], clause 5.1.3], these coefficients “[...] describe how the output estimate y varies with changes in the values of the input estimates x 1 , x 2 , , x N ”. For variables that are independent, the partial derivatives are given by the gradient of the function f [22,23,36]
f = f x 1 , , f x N
where the partial derivatives in the gradient can be obtained by analytic differentiation or evaluated numerically [37]. The numerical approach, also mentioned in ISO/IEC Guide 98-3, lends itself also for very complex models, or models in the form of an algorithm. As long as there is a valid implementation of f that returns a value for the output variable y for the input variables x 1 , , x N , the partial derivatives can be evaluated numerically with sufficient reliability for using the LPU [5], clause 5.1.3].
If (a subset of) the x 1 , x N cannot be varied independently because of a relationship between them, then usually also the way in which y responds to changes in the input quantities changes [23]. For the propagation of measurement uncertainty, the behaviour of the function including any constraints on the input quantities is relevant for propagating the measurement uncertainty. The constrained partial derivatives express this behaviour and by virtue of the description of the desired properties of the sensitivity coefficients [5], clause 5.1.3], it is that these constrained partial derivatives are needed for using the LPU.
In many cases, the expressions for the sensitivity coefficients are obtained by analytic differentiation. That works also for situations with constrained input quantities [23]. It can become however prohibitively difficult for complex measurement models, such as equations of state [25,27,33] or in instances where the measurement model takes the form of an algorithm, such as in the calculation of fluid properties at vapour-liquid equilibrium [33,38]. In those cases, a numerical method is desirable, where the variation of the input variables should respect not only any boundaries on the input quantities, but also any constraints. For the amount fractions forming a composition, the boundaries are that for any amount fraction x, 0 < x < 1 (situations where x = 0 or x = 1 require a dedicated mathematical treatment and are not relevant for calculating properties of mixtures). The constraint on the other hand, formulated as a function g which is equal to zero is given by [23]
g ( x ) = i = 1 N x i 1 = 0
where x = x 1 , , x N denotes the composition, a vector holding the amount fractions of the components in the mixture. In the case of an equation of state, the function f has two more arguments, namely the pressure p and temperature T. These are not constrained, but have bounds (both are non-negative).
Numerical differentiation methods use finite differences [37,39]. These differences should be formed appreciating the constraint(s) on the arguments, to ensure physically feasible output of the function f. So, the finite differences for p and T should be such that the perturbed pressure and temperature are still valid in their own right. The perturbed composition should still meet the constraint in equation (2).

3. Constrained Differentiation

Analytic differentiation of functions with arguments subject to an equality constraint has been described by Schay [23]. In this work, his method is applied to differentiating functions with a composition, but his method applies to all differentiable functions with constrained arguments, including multivariate ones.
Let d x denote a small change (perturbation) of the constrained input quantities x , then the change in the output of a function f, δ y is given by [23]
δ y = f P d x
where P is the orthogonal projection matrix that depends solely on the constraint g, for a composition given in equation (2). The projection P is for a scalar function g given by [23]
P = I n n
where I denotes the N × N identity matrix and n the unit normal vector ( g ) / | g | . For the constraint in equation (2),
n = 1 N [ 1 , , 1 ]
and the projection matrix equals P = I 1 N 1 where 1 is an N × N matrix with ones. Equation (3) shows how the constrained partial derivatives are different from their unconstrained counterparts. A change in the function value equals
δ y = f d x
in the unconstrained case. Equation (6) is the fundament under the LPU [5,7], when only the first terms of the Taylor expansion of the measurement model f are considered.
To illustrate the difference between the two sets of partial derivatives, consider the calculation of the calorific value of a natural gas as described in ISO 6976. The formula for calculating the calorific value ( H mix ) takes the form [18]
H mix = i = 1 N x i H i
where H i denotes the calorific value of component i ( i = 1 , , N ), x i its amount fraction and N the number of components in the gas mixture. The calorific values are unconstrained in this measurement model, whereas the amount fractions of all components in the mixtures are constrained as discussed previously. The constrained partial derivatives with respect to x i , formally denoted by the operator * x i , are [23]
* H mix x i = H i bar H
where
bar H = 1 N i = 1 N H i .
Both the constrained partial derivatives of equation (8) and their counterparts ignoring the constraint lead to exactly the same standard uncertainty u ( H ) as the calculations in ISO 6976 [18]. The proof rests on the properties of the covariance matrix associated with the composition [20,21].
Let the Jacobian J be defined as the gradient of the multivariate, differentiable function f , i.e., [36,37]
J i j = f i x j
then the covariance matrix associated with the output vector y is obtained as [7], clause 6.2.1]
V y ( 0 ) = J V x J .
The proof that instead of J a sensitivity matrix can be used composed of constrained partial derivatives can be given as follows. From the equality constraint g, it follows that the constraint is in the form of an ( N 1 ) -dimensional hyperplane H . For compositions, the constraint is given in equation (2) and the normal vector n in equation (5). Let the matrix D be defined as
D = d 1 , , d N 1 , n ,
where d i denote ( N 1 ) independent directions in the hyperplane H , each perpendicular to the normal vector of the constraint (equation (5)).
Now, equation (9) can be written as
V y ( 0 ) = ( J D ) ( D 1 V x D T ) ( J D ) .
Let V D = D 1 V x D T . Let L denote the Cholesky factor of V x , e N = [ 0 , , 0 , 1 ] and 0 = [ 0 , , 0 , 0 ] . The constraint n x = κ , where κ is some exactly known constant implies that
0 = var ( κ ) = var ( n x ) = n var ( x ) n = n V x n = n L L n = L n 2
As L n = 0 and from the properties of the covariance matrix is follows
V x n = 0 .
From the definition of D it is evident that
D n = e N and D e N = n .
So,
V D e N = ( D 1 V x D ) e N = 0 .
This result implies that the last column, and by symmetry the last row, of V D contain only zeros. Let V ˜ D be the matrix V D without the last column and row.
Let a directional derivative f d at x be defined as [40]
f d ( x ) = lim ε 0 f ( x + ε d ) f ( x ) ε
where d denotes the direction. Now, it is shown that the method does not rely on a particular choice of vectors d 1 , , d N 1 by looking at the product J D = J D . From calculus, for the directional derivative f d of f in direction d it holds that [40], section 12.1]
f d = J d ,
so that
J D = J D = ( f d 1 , , f d N 1 , f n ) .
Note that all columns of J D can be calculated using (19) or (20) except the last one if x is limited to values in H . However, as the last row and column of V d are zero, knowledge about the last column of J D is not needed. Let
J ˜ D = ( f d 1 , , f d N 1 ) .
The result of the generalized algorithm equals
V y ( 1 ) = J ˜ D V ˜ D J ˜ D
Further below, it will be explained in more detail the correspondence with the version of the algorithm presented in Section 4. Using the fact that the last row and column of V D only contain zeros, it becomes clear that
V y ( 1 ) = J ˜ D V ˜ D J ˜ D = J D V D J D = V y ( 0 ) ,
which shows that the constrained partial differentiation yields the same covariance matrix as using the LPU (see equation (9)) with the Jacobian. As no assumptions on the d i , 1 i N 1 were made except for their independence and perpendicularity to n , the result of the algorithm is independent on the particular choice for the d i . The choice between using the unconstrained and constrained partial derivatives does however matter for ill-formed covariance matrices, see also Appendix A.
So, the issue in using the partial derivatives for constrained variables is in this instance not so much in that they could not be used when propagating measurement uncertainty using the LPU. The issues are in two other directions, viz.,
  • ISO/IEC Guide 98-3  [5], clause 5.2.1] states about the sensitivity coefficients that they “[...] describe how the output estimate y varies with changes in the values of the input estimates x 1 , , x N "
  • when using numerical differentiation, the measurement model f may not exist outside the boundaries of the constraint on the arguments.
If the MCM [6,7] is used to obtain values for the sensitivity coefficients, for example for constructing an uncertainty budget, it is affected in a similar manner as using the LPU, for it is generally not possible to vary just one quantity while keeping all others constant, as described in Annex B.1 of ISO/IEC Guide 98-3/Supplement 1  [6].

4. Numerical Constrained Differentiation

Numerical differentiation [36,37] is a practical alternative for analytic differentiation to obtain values for the sensitivity coefficients. This method is introduced here to enable propagating measurement uncertainty through involved models, such as the GERG-2008 [24] and the AGA8-DC92 [26,27] equations of state, and algorithms.
At first glance, it is not straightforward to perturb a composition and still satisfy the condition given in equation (2). Consider a normalised direction vector q . For constrained differentiation with respect to compositions, it is required that x + ε q is also a valid composition for a sufficiently small ε . In this case, the constraint (2) can be expressed as g ( x ) = e x 1 = 0 where e = [ 1 , , 1 ] . x + ε q is a valid composition if q is orthogonal to e . From the requirement that x + ε q is a valid composition, it follows that the sum of the elements of q is zero.
To illustrate how a composition x can be perturbed by a small shift, let us consider a ternary mixture ( N = 3 ), x = x 1 , x 2 , x 3 . A change in x 1 should be compensated by changes in x 2 , x 3 or both, so that the perturbed input vector x + δ x should again be a composition. Consequently, the sum of the elements of the perturbation δ x should be zero. Amongst the infinitely many options to satisfy this condition, one option is to orthogonally project the vectors 0 , d x 2 , 0 and 0 , 0 , d x 3 onto the hyperplane H containing x and with as normal vector n , the gradient of the constraint. Using the resulting projection P (see also equation (4)) yields the normalized perturbation directions
q 2 = 1 5 1 , 2 , 1 q 3 = 1 5 1 , 1 , 2 )
such that it becomes physically meaningful and mathematically feasible to assess the change in the property of interest when the composition is changed from x to either of the compositions
δ x 2 = x + ε 2 q 2 δ x 3 = x + ε 3 q 3
where ε 2 and ε 3 are some sufficiently small numbers1.
Given a function f having as one of its arguments a composition x , the derivatives with respect to amount fractions of the components in the composition can be obtained numerically as follows.
For the numerical differentiation, instead of computing the limit in equation (13), a finite, small value for ε q will be used instead
f q ( x ) b j = f ( x + ε q ) f ( x ) ε
To evaluate the partial derivative exactly at the value of the estimates x , the directional derivative can be approximated by
f q ( x ) b j = f ( x + ε q ) f ( x ε q ) 2 ε
For the numerical evaluation of the constrained partial derivatives, the following algorithm can be used:
  • Choose a small value for ε so that 0 < x i + ε < 1 for all components i
  • Choose an orthogonal matrix Q with columns q 1 , , q N 1 , which are all perpendicular to the vector e
  • Compute the directional derivatives [ f q 1 , , f q N 1 ] = b using equation (19), or (20) for symmetric partial derivatives
  • Now,
    C = b Q .
    where C denotes the sensitivity matrix in the sense of ISO/IEC Guide 98-3  and ISO/IEC Guide 98-3/Supplement 2  [5,7]. (In the case of a scalar function fm C takes the form of a row vector, or, equivalently, an N × 1 matrix.)
The algorithm can be readily further generalised to multivariate functions f , which can be used for propagating measurement uncertainty using the LPU from ISO/IEC Guide 98-3/Supplement 2  [7].
The algorithm is based on the consideration that if the directions d i (see equation (10)) are chosen normalized and mutually orthogonal, the matrix D = Q 0 becomes orthogonal so that D 1 = Q 0 . This matrix Q 0 enables formulating the particularly form of the algorithm, cf. equation (21). In more detail, the matrix Q from the algorithm in Section 4 corresponds to the first N 1 columns of Q 0 such that
Q 0 = Q n
and let
b = J ˜ Q 0 = J Q = J Q .
From equation (9), it follows that
V y ( 0 ) = J V x J = J Q n Q T n V x Q n Q T n J = J Q n Q T V x Q 0 0 0 Q T n J = J Q Q T V x Q ( J Q ) T = b Q T V x Q b = C V x C .
so the algorithm provides a sensitivity matrix C that meets the descriptions in the GUM [5,7]. In the case that J cannot be evaluated because the function f is not defined outside the region defined by the constraint, the covariance matrix associated with y cannot be defined and evaluated by means of equation (9). In this case however, the sensitivity matrix defined in equation (21) can be used instead. This case is currently not covered by the GUM [5,7].
A complementary viewpoint is obtained by considering the orthogonal projection P which was introduced in equation (4). Noting that an orthogonal projection fulfils P = P and P 2 = P , it follows from equation (12) that for a well-formed covariance matrix [20,21] it holds that
V x = P V x P .
As a consequence,
V y = J V x J T = J P V x P J T = C ˜ V x C ˜ ,
where
C ˜ = J P = ( P J ) .
This matrix C ˜ as orthogonal projection of J on H offers an alternative definition to the matrix C = b Q as constructed in the algorithm. In the next section it is shown that K ˜ is actually identical to K if V x is of rank N 1 .
If the degeneracy of V x is solely due to the constraint, then V x has rank N 1 and its unique Cholesky factor L has also rank N 1 . Assume that by specific choices of the matrix Q, the projection operator of equation (22) or any other method two constrained sensitivity matrices C 1 and C 2 would have been obtained, i.e.,
V y = C 1 V x C 1 = C 2 V x C 2
C 1 n = 0
C 2 n = 0 .
Then ( C 1 C 2 ) L = 0 , and as L has rank N 1 and L n = 0 , it must hold that C 1 C 2 = α n for some scalar α . In view of equations () and () this is only possible if α = 0 , i.e., if C 1 = C 2 . As the factors C 1 and C 2 occur twice in (23), the uniqueness is actually up to a sign, so, C 1 = ± C 2 .
Therefore, if V x has rank N 1 , the constrained sensitivity matrix is essentially unique and equal to C ˜ from equation (22), i.e., the orthogonal projection of the Jacobian applied from the right side or, equivalently, the transpose of the orthogonal projection of the transposed Jacobian.
The matrix Q can be obtained in different ways. One such way is using a matrix derived from the Helmert matrix [41], which is available as the function ilrBase in the R package ’compositions’ [42]. Alternatively, the (modified) Gram-Schmidt algorithm can be used [43]. For a composition, the following orthogonal matrix can be used. For each column j = 1 , , N , the first j elements are equal to
1 j ( j + 1 )
and the following element is equal to
j j ( j + 1 )
The remaining elements are zero. For N = 5 , using these formulæ,
Q = 0.70711 0.40825 0.28868 0.22361 0.70711 0.40825 0.28868 0.22361 0 0.81650 0.28868 0.22361 0 0 0.86603 0.22361 0 0 0 0.89443
Using the matrix Q from (26) and the composition of a five-component natural gas in Table 1, the sensitivity coefficients are evaluated for the molar mass of the natural gas using the model of ISO 6976 [18]. The molar mass is given by [18]
M mix = i = 1 N x i M i
where x i denotes the (normalised) amount fraction of component i, M i its molar mass and M mix the molar mass of the mixture. The numerical method given in equations (21) and (26) are compared with the values obtained using the analytic formula, viz. [23],
* bar M x i = M i 1 N j = 1 N M j
In Table 1, the sensitivity coefficients are given using the numerical method ( c num ) versus analytic differentiation including the constraint on the x i ( c an ). The sensitivity coefficients are obtained using equation (19).
The sensitivity coefficients in the ultimate two columns of Table 1 are identical up to four decimal figures, which is sufficient for the propagation of measurement uncertainty using the LPU. In the numerical evaluation of the sensitivity coefficients, ε was chosen to be 1 % of the smallest amount fraction in the composition. This choice ensures that x ± δ x are valid compositions. According to ISO/IEC Guide 98-3 [44], clause 5.1.3 NOTE 2], a perturbation in the order of a standard uncertainty is adequate for the purpose of propagating measurement uncertainty. This choice of ε just does that. The only concern can be that for compositions involving components at the μmol mol−1-level, this choice may lead to unacceptable cancellation in the calculation of the differences.
Using a constant value of ε and the first order formula (19), there are in total N calls to the function f needed. For equations like equation (27), this feature is not important, but the more involved the evaluation of f is, the more important this deliberation gets. The differences between the sensitivity coefficients using equation (19) and the ones obtained using analytic differentiation are in the order of 10−12 g mol−1. Using equation (20) instead, thus obtaining the symmetric partial derivatives, the errors are slightly smaller in absolute value but still in the order of 10−12 g mol−1. This computation requires 2 N calls to the function f. Table 2 shows the same comparison, but now for an 11-component natural gas mixture. The differences between the numerically evaluated sensitivity coefficients and the ones obtained through analytic differentiation are in the order of 10−9 g mol−1. This performance is also sufficient for propagating the measurement uncertainty when computing the molar calorific value H or the compressibility factor Z.
The calculations can be readily performed in any kind of software, from mainstream spreadsheet software to environments like R [45] or Python [46]. The arguments of a function f that do not belong to the composition can be handled as usual. They can be evaluated numerically directly using the approach described in GUM:1995 [5], clause 5.1.3 NOTE 2].

5. Propagation of Measurement Uncertainty Through the GERG-2008 Equation of State

To illustrate the method, the computation of the compressibility factor Z using the GERG-2008 equation of state [24,25] is revisited. Apart from the model uncertainty stated in ISO 20765-2 [25], the uncertainty associated with the measured composition x , pressure p and temperature T is propagated using the LPU for dependent input quantities from ISO/IEC Guide 98-3 [5]. The normalised natural gas composition is given in Table 3 [20]. The correlation matrix associated with the composition is
R x = 1 0.0635 0.0703 0.0367 0.1543 0.0635 1 0.0605 0.0320 0.1341 0.0703 0.0605 1 0.2531 0.8782 0.0367 0.0320 0.2531 1 0.1609 0.1543 0.1341 0.8782 0.1609 1
The actual conditions are T = 300.00 K and p = 6.20 M Pa . The standard uncertainty associated with the temperature is u ( T ) = 0.20 K and that associated with the pressure is u ( p ) = 0.05 M Pa . The normalised composition x , expressed in amount fractions, is given in Table 3. The associated correlation matrix R x is shown in equation (28). The covariance matrix V x can obtained as [7], definition 3.21]
V x = D R x D
where D = diag { u ( x 1 ) , , u ( x N ) } . To propagate the measurement uncertainty associated with the composition, actual temperature and pressure using the GERG-2008 equation of state, equations (19) and (21) are used to obtain the sensitivity coefficients for the composition. For the temperature and pressure, the process from ISO/IEC Guide 98-3 [5], clause 5.1.3 NOTE 2] can be used. So, evaluating the equation of state for x , T + δ T , p and a second time for x , T , p + δ p , enables evaluating these two partial derivatives, which are approximated by
f T = f ( x , T + δ T , p ) f ( x , T , p ) δ T ,
and
f p = f ( x , T , p + δ p ) f ( x , T , p ) δ p .
In these expressions, x denotes the composition in Table 3. If desired, they can also be obtained exactly at the value of the estimate like shown in equations (19) and (20) for differentiating f with respect to the amount fractions. For the composition in Table 3 and setting ε equal to 0.01 times the smallest amount fraction in x ( = 0.0002421 mol / mol , see Table 4), and using the perturbation directions as defined in (26), the following compositions and compressibility factors are obtained (see Table 4). From these, the compressibility factors at 300.0 K and 6.20 M Pa were calculated (see Table 5).
From the quotients δ Z / ε in the ultimate row of Table 5, using equation (21), the sensitivity coefficients can be computed (see Table 6).
Using equations (30) and (31), the sensitivity coefficients for temperature and pressure can be obtained. Setting δ T = 0.2 K and δ p = 0.00372 M Pa , the compressibility factor at a temperature T + δ T is 0.870025. The compressibility factor at a pressure p + δ p is 0.869601. From these and the compressibility factor at actual conditions (see Table 5, column labelled x 0 ), the sensitivity coefficients can be obtained, whose values are -1.9326e-8 / Pa and that with respect to temperature 1.7609 / K . The value of the compressibility factor Z is 0.869672 with a standard uncertainty u ( Z ) of 0.000375. This standard uncertainty does not include the model uncertainty, which is stated to be 0.1 % relative. Considering that most predicted compressibility factors will lie within ± 0.1 % of the predicted value, this relative uncertainty is interpreted as an expanded uncertainty with a coverage probability of 95 %. Assuming a normal distribution, the relative standard uncertainty is 0.05 %, so 0.000435. Combined with the uncertainty contribution from propagating the uncertainty associated with the composition, pressure and temperature provides a standard uncertainty u ( Z ) of 0.000574. Expressed as a relative standard uncertainty, it is 0.066 %. So, the magnitude of the model uncertainty is about the same as that arising due to the composition, pressure and temperature measurements.

6. Conclusions

In this work, it was shown how functions with constrained arguments can be numerically differentiated to obtain values for the sensitivity coefficients needed for propagating measurement uncertainty. The proposed procedure was demonstrated on the calculation of the compressibility factor of natural gas at metering conditions using the GERG-2008 equation of state, for which duly propagating the measurement uncertainty from the composition, pressure and temperature is challenging. The numerical differentiation method does not depend on a particular choice of the directions chosen for the differentiation and provides a sensitivity matrix that provides the same covariance matrix for the output quantities of the measurement model as the Jacobian would, if that matrix can be obtained. The method is applicable to all differentiable functions of a composition and can thus be applied to all models used in, e.g., physical chemistry that rely on the composition and is thereby a leap step forward not only for custody transfer and billing, but also for engineering as a whole where safety margins need to be established. The numerical method for obtaining the sensitivity coefficients extends the guidance of the GUM, which (silently) assumes that the partial derivatives can be formed by varying one by one the input quantities of the measurement model. This way of differentiating functions is neither possible in models having a composition as argument, nor for any other measurement models where the arguments are subject to a mathematical constraint. The GUM should be revised in the sense that either its scope should be narrowed to measurement models where the input quantities are unconstrained, or, better, it should duly deal with this kind of measurement models. The utility of the developed numerical method goes way beyond using it for models with chemical compositions only. It was proved that the constrained and unconstrained partial derivatives with respect to the amount fractions of models in standards like ISO 6976 for calculating the calorific value, molar mass and compressibility factor of a mixture provide the same output when propagating measurement uncertainty, provided that a properly formed covariance matrix is used for the input composition. As many of the standards like ISO 6976 do not explicitly require using such a covariance matrix, it matters what partial derivatives are used with the LPU. The constrained partial derivatives provide uncertainties that are closer to the ones obtained with a properly formed covariance matrix, so these are to be preferred. The (unconstrained) partial derivatives in these standards do not live up to the explanations in ISO/IEC Guide 98-3 regarding what they are supposed to express and hence are technically flawed. The numerical procedure is easy to implement on any platform that supports matrix multiplication, which includes mainstream spreadsheet software. The formulæ for the orthogonal matrix needed to perturb the composition can be readily implemented too. It is founded on the same footing as the guidance provided in ISO/IEC Guide 98-3 [5], and can be used with the LPU from ISO/IEC Guide 98-3 and ISO/IEC Guide 98-3/Supplement 2 [7]. In the examples developed, the asymmetric partial derivatives were very close to the symmetric ones, so the former can be used as well. The GUM [5,7] presumes that the symmetric ones are used though. In the example given for the compressibility factor from the GERG-2008 equation of state, the uncertainty contribution from propagating the uncertainty associated with the temperature, pressure and composition measurements was of the same magnitude as the model uncertainty for density and the compression factor as given in ISO 20765-2. The example shows how to meet the requirement in clause 7.6 of this standard that requires that the uncertainty of the input quantities to the equation of state should be duly propagated.

Author Contributions

Conceptualization, AvdV and GK; methodology, AvdV; validation, AvdV, GK , and KF; formal analysis, AvdV and GK ; investigation, AvdV and GK ; writing—original draft preparation, AvdV; writing—review and editing, AvdV, GK and KF; funding acquisition, AvdV and KF. All authors have read and agreed to the published version of the manuscript.,

Funding

The project 21GRD05 Met4H2 has received funding from the European Partnership on Metrology, co-financed by the European Union’s Horizon Europe Research and Innovation Programme and by the Participating States. VSL has received in part funding from the Ministry of Economic Affairs of the Netherlands for this work. The APC (article processing fee) was kindly funded by MDPI.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

This work did not create any novel research data.

Conflicts of Interest

The first author is member of JCGM WG1 Guide to the expression of Uncertainty in Measurement, ISO/TC193 Natural gas and ISO/TC193/SC1 Analysis of natural gas. The opinions expressed here do not necessarily represent the views of said committees or any working groups related thereto. The funders had no role in the design of the work; in the writing of the manuscript; or in the decision to publish the results.

Abbreviations

The following abbreviations are used in this manuscript:
GUM Guide to the Expression of Uncertainty in Measurement
ISO International Organisation for Standardisation
JCGM Joint Committee for Guides in Metrology
LPU law of propagation of uncertainty
MCM Monte Carlo method
MDPI Multidisciplinary Digital Publishing Institute

Appendix A. Ill-Formed Covariance Matrices

In practice, the covariance matrix of a composition x may just be given as a diagonal matrix V x ( d ) . This poor practice was discussed previously [20] and one might wonder what would happen if the sensitivity matrix from equation (21) is used. Then the covariance matrix V y ( 2 ) associated with the output vector y is given by
V y ( 2 ) = C V x ( d ) C .
Using P 2 = P it holds that
V y ( 2 ) = C V x C = J P V x ( d ) P J = C P V x ( d ) P C .
This outcome can be interpreted as that the covariance matrix V y ( 2 ) is calculated based on a modified, well-formed covariance matrix
V x ( m ) = P V x ( d ) P .
However, this is probably not the covariance matrix that best represents the physical situation, as the diagonal entries of V x ( m ) have shrunk compared to those of V x ( d ) . In the case of, e.g., N = 2 , if
V x ( d ) = u 2 0 0 u 2
then
V x ( m ) = u 2 / 2 u 2 / 2 u 2 / 2 u 2 / 2
while the physically correct covariance matrix V x ( c ) is most probably
V x ( c ) = u 2 u 2 u 2 u 2 ,

References

  1. ISO 15112 Natural gas — Energy determination. ISO, International Organization for Standardization, Geneva, Switzerland, 2018. Third edition.
  2. OIML R 140 Measuring systems for gaseous fuel. OIML, International Organization for Legal Metrology, Paris, France, 2007.
  3. EN 1776 Gas infrastructure — Gas measuring systems — Functional requirements. CEN, European Committee for Standardization, Brussels, Belgium, 2015. Second edition.
  4. ISO/IEC Guide 98-4 Uncertainty of measurement — The role of measurement uncertainty in conformity assessment. ISO, International Organization for Standardization, Geneva, Switzerland, 2012. First edition.
  5. ISO/IEC Guide 98-3 Uncertainty of measurement — Part 3: Guide to the expression of uncertainty in measurement (GUM:1995). ISO, International Organization for Standardization, Geneva, Switzerland, 2008. First edition.
  6. ISO/IEC Guide 98-3:2008/Suppl 1:2008 Uncertainty of measurement — Part 3: Guide to the expression of uncertainty in measurement (GUM:1995) — Supplement 1: Propagation of distributions using a Monte Carlo method. ISO, International Organization for Standardization, Geneva, Switzerland, 2008. First edition.
  7. ISO/IEC Guide 98-3:2008/Suppl 2:2011 Uncertainty of measurement — Part 3: Guide to the expression of uncertainty in measurement (GUM:1995) — Supplement 2: Extension to any number of output quantities. ISO, International Organization for Standardization, Geneva, Switzerland, 2011. First edition.
  8. ISO 5167-1 Measurement of fluid flow by means of pressure differential devices inserted in circular cross-section conduits running full — Part 1: General principles and requirements. ISO, International Organization for Standardization, Geneva, Switzerland, 2003. Second edition.
  9. ISO 5167-2 Measurement of fluid flow by means of pressure differential devices inserted in circular cross-section conduits running full — Part 2: Orifice plates. ISO, International Organization for Standardization, Geneva, Switzerland, 2003. First edition.
  10. ISO 5167-3 Measurement of fluid flow by means of pressure differential devices inserted in circular cross-section conduits running full — Part 3: Nozzles and Venturi nozzles. ISO, International Organization for Standardization, Geneva, Switzerland, 2020. Second edition.
  11. ISO 5167-4 Measurement of fluid flow by means of pressure differential devices inserted in circular cross-section conduits running full — Part 4: Venturi tubes. ISO, International Organization for Standardization, Geneva, Switzerland, 2022. Second edition.
  12. ISO 9300 Measurement of gas flow by means of critical flow Venturi nozzles. ISO, International Organization for Standardization, Geneva, Switzerland, 2005. Second edition.
  13. ISO 5168 Measurement of fluid flow — Procedures for the evaluation of uncertainties. ISO, International Organization for Standardization, Geneva, Switzerland, 2005. Second edition.
  14. ISO 6974–1 Natural gas — Determination of composition with defined uncertainty by gas chromatography — Part 1: Guidelines for tailored analysis. ISO, International Organization for Standardization, Geneva, Switzerland, 2012. Second edition.
  15. ISO 6974–2 Natural gas — Determination of composition with defined uncertainty by gas chromatography — Part 2: Measuring-system characteristics and statistics for processing of data. ISO, International Organization for Standardization, Geneva, Switzerland, 2012. Second edition.
  16. ISO 15970 Natural gas — Measurement of properties — Volumetric properties: density, pressure, temperature and compression factor. Iso, International Organization for Standardization, Geneva, Switzerland, 2008. First edition.
  17. ISO 15971 Natural gas — Measurement of properties — Calorific value and Wobbe index. ISO, International Organization for Standardization, Geneva, Switzerland, 2008. First edition.
  18. ISO 6976 Natural gas — Calculation of calorific values, density, relative density and Wobbe indices from composition. ISO, International Organization for Standardization, Geneva, Switzerland, 2016.
  19. van der Veen, A.M.H.; Folgerø, K.; Gugole, F. Measurement Uncertainty in the Totalisation of Quantity and Energy Measurement in Gas Grids. Gases 2025, 5, 7. [CrossRef]
  20. van der Veen, A.M.H. Credible Uncertainties for Natural Gas Properties Calculated from Normalised Natural Gas Composition Data. Methane 2025, 4, 1. [CrossRef]
  21. Aitchison, J. The Statistical Analysis of Compositional Data; The Blackburn Press, 2003.
  22. Boas, M.L. Mathematical Methods in the Physical Sciences; John Wiley & Sons Inc, 2005.
  23. Schay, G. Constrained differentiation. Mathematical and Computer Modelling 1995, 21, 83–88. [CrossRef]
  24. Kunz, O.; Wagner, W. The GERG-2008 Wide-Range Equation of State for Natural Gases and Other Mixtures: An Expansion of GERG-2004. Journal of Chemical & Engineering Data 2012, 57, 3032–3091. [CrossRef]
  25. ISO 20765-2 Natural gas — Calculation of thermodynamic properties — Part 2: Single-phase properties (gas, liquid, and dense fluid) for extended ranges of application. ISO, International Organization for Standardization, Geneva, Switzerland, 2008. First edition.
  26. ISO 12213–1 Natural gas — Calculation of compression factor — Part 1: Introduction and guidelines. ISO, International Organization for Standardization, Geneva, Switzerland, 2006. Second edition.
  27. ISO 12213–2 Natural gas — Calculation of compression factor — Part 2: Calculation using molar-composition analysis. ISO, International Organization for Standardization, Geneva, Switzerland, 2006. Second edition.
  28. ISO/IEC Guide 98-1 Uncertainty of measurement — Part 1: Introduction. ISO/IEC, International Organization for Standardization, Geneva, Switzerland, 2024. Second edition.
  29. ISO/IEC Guide 98-6 Uncertainty of measurement — Part 6: Developing and using measurement models. ISO, International Organization for Standardization, Geneva, Switzerland, 2021. First edition.
  30. OIML R 137-1 & 2 Gas meters — Part 1: Metrological and technical requirements & Part 2: Metrological controls and performance tests. OIML, International Organization for Legal Metrology, Paris, France, 2012.
  31. Frøysa, K.E.; Øverås Lied, G. Handbook for uncertainty calculations for gas flow metering stations. Documentation of uncertainty models and internet tool. Technical Report NORCE-20-A101422-RA-1, NORCE Norwegian Research Centre AS, 2020. Accessed 2025-02-02.
  32. GIIGNL. LNG custody transfer handbook. Technical report, International association of LNG importers, Neuilly-sur-Seine, France, 2021. 6th edition.
  33. Poling, B.E.; Prausnitz, J.M. The Properties of Gases and Liquids, fifth edition ed.; McGraw-Hill Education, 2000.
  34. Span, R. Multiparameter equations of state; Springer: Berlin, 2000. Literaturverz. S. [341] - 362.
  35. Mollerup, J.; Michelsen, M. Calculation of thermodynamic equilibrium properties. Fluid Phase Equilibria 1992, 74, 1–15. [CrossRef]
  36. Mathews, J.H. Numerical methods for mathematics, science, and engineering, 2. ed ed.; Prentice-Hall: Englewood Cliffs, NJ, 1992. 1. Aufl. u.d.T.: Mathews, John H.: Numerical methods for computer science, engineering, and mathematics. - Literaturverz. S. 594 - 603.
  37. Nocedal, J.; Wright, S. Numerical Optimization (Springer Series in Operations Research and Financial Engineering), 2nd edition ed.; Springer, 2006.
  38. van der Veen, A.M. Evaluating measurement uncertainty in fluid phase equilibrium calculations. Metrologia 2018, 55, S60–S69. [CrossRef]
  39. Press, W.H.; Flannery, B.P.; Teukolsky, S.A.; Vetterling, W.T. Numerical Recipes in C: The Art of Scientific Computing, second edition ed.; Cambridge University Press, 1992.
  40. Taylor, A.E.; Mann, W.R. Advanced calculus, 3. ed. ed.; Wiley: New York [u.a.], 1983.
  41. K. Gerald van den Boogaart, R.T.D. Analyzing Compositional Data with R; Springer-Verlag GmbH, 2013.
  42. van den Boogaart, K.G.; Tolosana-Delgado, R.; Bren, M. compositions: Compositional Data Analysis, 2024. R package version 2.0-8.
  43. Golub, G.H.; Loan, C.F.V. Matrix Computations; J. Hopkins Uni. Press, 2013.
  44. BIPM.; IEC.; IFCC.; ILAC.; ISO.; IUPAC.; IUPAP.; OIML. Evaluation of measurement data — Guide to the expression of uncertainty in measurement, JCGM 100:2008, GUM:1995 with minor corrections, 2008.
  45. R Core Team. R: A Language and Environment for Statistical Computing. R Foundation for Statistical Computing, Vienna, Austria, 2025.
  46. Van Rossum, G.; Drake Jr, F.L. Python tutorial; Centrum voor Wiskunde en Informatica Amsterdam, The Netherlands, 1995.
1
The cases that x 0 equals [ 1 , 0 , 0 ] , [ 0 , 1 , 0 ] or [ 0 , 0 , 1 ] would require a different definition of q 2 and q 3 .
Table 1. Amount fractions, molar masses and sensitivity coefficients with respect to the amount fractions for a five-component natural gas composition, computed numerically ( c num ) and analytically ( c an )
Table 1. Amount fractions, molar masses and sensitivity coefficients with respect to the amount fractions for a five-component natural gas composition, computed numerically ( c num ) and analytically ( c an )
Component x M c num c an
mol mol−1 g mol−1 g mol−1 g mol−1
Nitrogen 0.0328 28.0134 -4.4326 -4.4326
Carbon dioxide 0.0242 44.0095 11.5635 11.5635
Methane 0.8434 16.0425 -16.4035 -16.4035
Ethane 0.0659 30.0690 -2.3770 -2.3770
Propane 0.0338 44.0956 11.6496 11.6496
Table 2. Amount fractions, molar masses and sensitivity coefficient with respect to the amount fractions for an eleven-component natural gas composition
Table 2. Amount fractions, molar masses and sensitivity coefficient with respect to the amount fractions for an eleven-component natural gas composition
Component x M c num c ana
mol mol−1 g mol−1 g mol−1 g mol−1
Nitrogen 0.130841 28.0134 -24.8135 -24.8135
Carbon dioxide 0.025217 44.0095 -8.8174 -8.8174
Methane 0.807295 16.04246 -36.7845 -36.7845
Ethane 0.030572 30.06904 -22.7579 -22.7579
Propane 0.004048 44.09562 -8.7313 -8.7313
i-Butane 0.000845 58.1222 5.2953 5.2953
n-Butane 0.000845 58.1222 5.2953 5.2953
neo-Pentane 0.000025 72.14878 19.3219 19.3219
i-Pentane 0.000150 72.14878 19.3219 19.3219
n-Pentane 0.000112 72.14878 19.3219 19.3219
n-Hexane 0.000048 86.17536 33.3484 33.3484
Table 3. Normalised composition of a natural gas containing 5 components, expressed in amount fractions ( c mol / mol )
Table 3. Normalised composition of a natural gas containing 5 components, expressed in amount fractions ( c mol / mol )
Component x u ( x ) u rel ( x )
cmol mol−1 cmol mol−1
c mol / mol c mol / mol
Nitrogen 3.280 0.022 0.67 %
Carbon dioxide 2.421 0.019 0.77 %
Methane 84.335 0.111 0.13 %
Ethane 6.587 0.044 0.67 %
Propane 3.378 0.110 3.27 %
Table 4. Compositions used to calculate the partial derivatives with respect to the compressibility factor calculated using the GERG-2008 equation of state ( mol / mol )
Table 4. Compositions used to calculate the partial derivatives with respect to the compressibility factor calculated using the GERG-2008 equation of state ( mol / mol )
Component x 0 x 0 + δ x 1 x 0 + δ x 2 x 0 + δ x 3 x 0 + δ x 4
Nitrogen 0.03280 0.03263 0.03270 0.03273 0.03275
Carbon dioxide 0.02421 0.02438 0.02411 0.02414 0.02416
Methane 0.84334 0.84334 0.84354 0.84327 0.84329
Ethane 0.06587 0.06587 0.06587 0.06608 0.06582
Propane 0.03378 0.03378 0.03378 0.03378 0.03400
Table 5. Compressibility factors from the GERG-2008 equation of state and the values of the directional derivatives b j with respect to the measured composition x
Table 5. Compressibility factors from the GERG-2008 equation of state and the values of the directional derivatives b j with respect to the measured composition x
Component x x + δ x x + δ x x 0 + δ x 3 x 0 + δ x 4
Z 0.86967 0.869622 0.869671 0.869609 0.869574
b j -0.20849 -0.00794 -0.26203 -0.4088
Table 6. Values of the sensitivity coefficients for the compressibility factor calculated using the GERG-2008 equation of state using asymmetric (top) and symmetric directional derivatives
Table 6. Values of the sensitivity coefficients for the compressibility factor calculated using the GERG-2008 equation of state using asymmetric (top) and symmetric directional derivatives
Component N2 CO2 CH4 C2H6 C3H8
Index i 1 2 3 4 5
Z / x i 0.31772 0.02287 0.160571 -0.13552 -0.36564
Z / x i 0.31766 0.02285 0.160540 -0.13550 -0.36554
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.
Copyright: This open access article is published under a Creative Commons CC BY 4.0 license, which permit the free download, distribution, and reuse, provided that the author and preprint are cited in any reuse.
Prerpints.org logo

Preprints.org is a free preprint server supported by MDPI in Basel, Switzerland.

Subscribe

Disclaimer

Terms of Use

Privacy Policy

Privacy Settings

© 2026 MDPI (Basel, Switzerland) unless otherwise stated