Next Article in Journal
Sensor Driven Resource Optimization Framework for Intelligent Fog Enabled IoHT Systems
Previous Article in Journal
TGN-MCDS: A Temporal Graph Network-Based Algorithm for Cluster-Head Optimization in Large-Scale FANETs
error_outline You can access the new MDPI.com website here. Explore and share your feedback with us.
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A Natural Gas Energy Metering Method Based on Density-Sound Velocity Correlation

1
College of Metrology Measurement and Instrument, China Jiliang University, Hangzhou 310018, China
2
Flow and Energy Metrology & Testing Institute, Energy Environment and Life Health Metrology Center, Zhejiang Institute of Quality Sciences, Hangzhou 310018, China
3
College of Metrology & Measurement Engineering, China Jiliang University College of Modern Science and Technology, Yiwu 322002, China
*
Author to whom correspondence should be addressed.
Sensors 2026, 26(1), 343; https://doi.org/10.3390/s26010343
Submission received: 15 November 2025 / Revised: 25 December 2025 / Accepted: 31 December 2025 / Published: 5 January 2026
(This article belongs to the Section Industrial Sensors)

Abstract

This paper proposes a method for metering natural gas energy based on the correlation between density and sound velocity. The technique integrates physical property correlation models with measured parameters, such as temperature, pressure, sound velocity, and density, to accurately predict the compression factor and the ideal volume calorific value of natural gas under operating conditions. The volume flow is corrected using the compression factor, which enables precise metering of natural gas energy through the adjusted volume flow and calorific value. To develop a high-precision physical property correlation model, a natural gas dataset comprising 10,000 sample sets is first constructed for model training and testing. Multiple machine learning algorithms are then employed to build predictive models. Analysis of the experimental results led to the development of a model-switching strategy based on the ranges of input features, which substantially enhanced prediction accuracy. For the compression factor model, the mean absolute error (MAE), root mean square error (RMSE), mean absolute percentage error (MAPE), and coefficient of determination (R2) were 0.00118, 0.0030, 0.14%, and 0.9987, respectively. The corresponding indicators for the calorific value model were 0.1583, 0.331, 0.44%, and 0.9736. The proposed method is finally validated using a natural gas real-flow test bench. The results demonstrated maximum prediction errors of 0.061% and 1.19% for the compression factor and calorific value, respectively, while the maximum relative energy error across four gas samples was 1.21%. These results indicate that the method can effectively achieve accurate natural gas energy metering in practical operating conditions.

1. Introduction

Energy metering, which accounts for both the quality and quantity of natural gas, has gradually become the mainstream method for settlement in natural gas trading [1,2]. Accurate measurement of natural gas volume and calorific value is critical to ensuring the reliability of energy metering [3,4]. However, factors such as temperature, pressure, composition, and the proportion of each component in natural gas can influence its volume and calorific value, making high-precision energy metering a significant challenge. Currently, energy metering predominantly relies on gas component analysis methods [5]. These methods are used on gas chromatograph analyzers as the core equipment, which are associated with high costs, long measurement cycles, and operational complexity [6]. Consequently, gas chromatograph-based energy metering is difficult to implement on a large scale, and its accuracy can be compromised in gas sources with substantial component fluctuations.
Related studies have highlighted the advantages of using physical property correlation technology to determine energy metering parameters, including lower costs, higher speeds, and minimal environmental requirements [7,8]. This approach utilizes the inherent relationships between the physical properties of natural gas and the parameters needed for energy metering. By measuring key physical properties, it is possible to predict related parameters and thus achieve energy metering [9]. For instance, the Southwest Research Institute (SWRI) proposed a correlation-based method to directly determine the calorific value of natural gas using sound velocity, pressure, temperature, and inert gas content (Nitrogen(N2), Carbon dioxide(CO2)) as input parameters for ultrasonic flow meters [10]. Additionally, optical methods for determining calorific value have also received significant attention. Kojima et al. [11] proposed a method correlating natural gas sound velocity with the visible light spectrum to determine calorific value; preliminary verification by RIKEN Corporation in Japan re-ported relative deviations of –0.45% to 0.38% compared to theoretical values. In a similar manner, Kamimoto et al. [12] applied Raman spectroscopy and tunable diode laser absorption spectroscopy (TDLAS) to explore the relationships between spectral absorption and calorific value for mixed gases. Ying et al. [13] developed a Raman analysis approach, incorporating a spectral automatic decomposition algorithm and a quantitative analysis model, further improving the accuracy of natural gas calorific value determination. Overall, physical property correlation technology has become a valuable tool in natural gas energy metering, effectively reducing dependence on traditional gas chromatographs. Research and applications to date have primarily focused on calorific value determination. However, in practical pipeline transportation, natural gas often exists under medium- to high-pressure conditions, where it experiences a certain degree of compression. Consequently, accurate determination of the compression factor is equally critical for volumetric metering. According to relevant standards [14], traditional compression factor calculations require detailed information about gas composition. Physical property correlation technology, which often lacks detailed composition data, faces limitations in its application for energy metering under these conditions.
Intelligent learning algorithms, with their capabilities for non-linear modeling, automatic extraction of high-dimensional features, and data-driven adaptive learning, overcome the limitations of traditional methods in handling complex non-linear and multi-variable problems. As a result, they have become essential tools for addressing real-world challenges [15,16,17]. In energy metering, these algorithms are essential for constructing predictive models related to physical property correlation technology, thus advancing the application and development of this technology. Karpash et al. [18] proposed a neural network-based method to predict the calorific value of natural gas, using nitrogen concentration, carbon dioxide concentration, and sound velocity as input parameters to estimate calorific values under standard temperature and pressure conditions. By training the network on a database of 95 natural gas mixture samples, the model achieved a relative error of only 2.4% compared to standard calorific values. Chamkalani et al. [19] developed a CSA-LSSVM model for predicting the compression factor of both sulfur-containing natural gas and conventional natural gas, utilizing a dataset of 4756 natural gas samples. Rigorous statistical validation confirmed the model’s reliability, providing a robust solution for compression factor prediction. Farzaneh-Gord et al. [20] trained an artificial neural network with 30,000 randomly composed natural gas samples, using pressure, temperature, and the Joule-Thomson (JT) coefficient as inputs to predict the compression factor. Finally, validation with regional natural gas data against the GERG-2008 results demonstrated an overall average absolute percentage deviation (AAPD) of less than 0.7%. In their study, Shaghayegh et al. [21] combined a genetic algorithm (GA) with temperature, pressure, nitrogen, and carbon dioxide concentrations to predict natural gas components and thermodynamic properties. The predicted values deviated by less than 0.8% from the standard AGA8Eos calculations. Farzaneh Gord et al. [22] further optimized the traditional three-input neural network by incorporating calorific value alongside temperature, pressure, and density to predict the natural gas compression factor. The enhanced model achieved a mean absolute percentage error (MAPE) of 0.2%, a root mean square error (RMSE) of 0.0028, and a coefficient of determination (R2) of 0.9943, demonstrating the effectiveness and reliability of this optimization strategy. Hu et al. [23] addressed the issue of quality fluctuations in complex natural gas pipelines by establishing a deep learning model for the prediction of dynamic calorific value. This model efficiently extracted influential factors and provided rapid predictions from real-time data, achieving a calorific value prediction accuracy that exceeds 99% while requiring only 1% of the processing time of conventional physical models. Dong et al. [24] proposed a multilayer perceptron neural network (MLPNN) approach using temperature, pressure, and sound velocity measured by an ultrasonic flow meter for energy metering. Based on 1003 real data points, the MLPNN model achieved maximum relative errors of −0.44%, 1.90%, and 2.39% for the compression factor, calorific value, and daily cumulative energy, respectively.
In summary, intelligent learning algorithms provide significant advantages in predicting the thermal and physical properties of natural gas, providing strong support for advancing the application of physical property correlation technology in energy metering. Nevertheless, current research exhibits several limitations. Many proposed prediction models rely on the concentrations of non-calorific components, such as carbon dioxide and nitrogen, as input parameters. Detecting these components in practical energy metering scenarios is often difficult and costly. Second, most studies have focused on predicting individual thermal property parameters, with relatively limited systematic research on natural gas across the entire energy metering process. Third, the majority of models are trained using high-quality natural gas samples. When faced with significant variations in natural gas composition or elevated levels of non-calorific gases, predictive accuracy and generalization notably decrease, restricting limiting the models’ ability to adapt to dynamic changes in thermal properties under complex operating conditions.
This paper proposes a natural gas energy metering method based on the correlation between density and sound velocity to address these challenges. The technique highlights physical parameters that are easy to measure while effectively characterizing the compression factor and calorific value of natural gas across various operating conditions. This approach aims to reduce metering errors arising from the ‘one-to-many’ phenomenon in physical properties and energy metering parameters. A theoretical database is constructed using on standard methods, providing data support for training intelligent learning models. By evaluating and comparing the predictive performance of multiple algorithms, the most effective model is identified and optimized, and its accuracy is subsequently validated through real-flow natural gas experiments. This method allows for real-time, convenient, and reliable metering of natural gas energy, providing a practical and strong pathway for the broader application of physical property correlation technology in energy metering.

2. Materials and Methods

Figure 1 illustrates the implementation process of a natural gas energy metering method based on the correlation between density and sound velocity. First, temperature and pressure sensors, ultrasonic flow meters, and vibrating density meters are installed in the gas pipeline to acquire real-time measurements of temperature, pressure, sound velocity, and density. These measurements are then used to calculate the isentropic index. These physical parameters are preprocessed and input into the compression factor prediction model to determine the compression factor, which, combined with the density measurement, is used to calculate the molecular weight of the gas. Finally, the pre-processed temperature, pressure, sound velocity, density, isentropic index, compression factor, and molecular weight are input into the calorific value prediction model to estimate the standard ideal volume calorific value. Multiplying this value by the standard volume, obtained from the corrected standard flow rate integral, yields the total natural gas energy and completes the metering process.

2.1. Feature Correlation Analysis

2.1.1. Analysis of Key Parameters for Energy Metering

Accurate energy metering requires precise determination of both the gas volume and the calorific value per unit volume (hereinafter referred to as ‘calorific value’). The product of these two quantities represents the energy released from the complete combustion of natural gas. The principle is expressed in Equation (1):
E = t 0 t n e s ( t ) d t = t 0 t n q s ( t ) H s ( t ) d t ,
where E is the total energy of the natural gas (MJ); t 0 and t n are the initial and final moments, respectively (s); e s ( t ) is the instantaneous energy flow as a function of time (MJ/s); q s ( t ) is the volume flow rate as a function of time (m3); and H s ( t ) is the calorific value as a function of time (MJ/m3); The subscript s denotes standard reference conditions (hereinafter referred to as ‘standard conditions’), considering a temperature of 293.15 K and a pressure of 101.325 kPa.
Since actual pipeline conditions (“operating conditions”) differ from standard conditions, the volume flow rate must be corrected accordingly. Furthermore, the compressibility of natural gas causes deviations between the volume of real gas and the volume of ideal gas (Z = V(actual)/V(ideal)) [25]. Therefore, a compression factor, along with gas state parameters under operating conditions, is introduced to correct the flow value, as illustrated in Equation (2):
q s = f q o = P o T s T o P s Z s Z o q o ,
where q denotes the volume flow rate, m3/h; f is the dimensionless volume flow correction parameter; P is the pressure, MPa; T is the thermodynamic temperature, K; and Z is the dimensionless compression factor. The subscript o indicates the operating conditions.
Natural gas is primarily a methane-dominated mixture. Standards specify the ideal calorific value of each component under standard conditions [26]. The overall calorific value is calculated using Equation (3):
H s = H s o / Z s = [ i = 1 n ( H s , i o x i ) ] / Z s ,
where H s o is the ideal calorific value under standard conditions, MJ/m3; H s is the calorific value under standard conditions, MJ/m3; H s , i o is the ideal calorific value of each component in the natural gas under standard conditions, MJ/m3; x i is the molar fraction of each component, %mol/mol; and n is the total number of components in natural gas.
Combining Equations (1)–(3) yields the total energy expression, as shown in Equation (4):
E = t 0 t n e s ( t ) d t = t 0 t n q s H s d t = t 0 t n P o T s T o P s H s o Z o q o d t ,
Equation (4) highlights that eliminating reliance on gas chromatography for energy metering requires accurate prediction of the compression factor under operating conditions and the calorific value under standard conditions. In this study, measurable natural gas properties that can characterize both factors are selected as input parameters for the intelligent learning algorithm, enabling precise prediction and complete energy metering.

2.1.2. Compression Factor Feature Correlation Analysis

This study selects the temperature, pressure, density, and sound velocity of natural gas under operating conditions as key measurable physical properties. These properties are not only straightforward to measure but also allow for high-frequency data acquisition. Temperature and pressure can be monitored in real time using dedicated sensors, while density and sound velocity can be measured online via a vibrating gas density meter and an ultrasonic flow meter, respectively [27,28,29]. These two quantities are expressed by Equations (5) and (6) below:
ρ o = M / V m = ( P o M ) / ( Z o R u T o ) ,
c o = Z o κ o R u M T o ,
where ρ is the gas density, g/m3; M is the molecular weight (molar mass), g/mol; V m is the molar volume, m3/mol; R u is the universal gas constant, set as 8.314   J / ( mol K ) ; c is the sound velocity, m/s; and κ is the dimensionless isentropic index.
Considering Equations (5) and (6), based on the four measurable physical properties, the isentropic index under operating conditions can be further correlated and determined, as shown in Equation (7) below:
κ o = c o 2 ρ o / P o ,
For ideal gases, the isentropic index is typically 1.67 for monatomic gases, 1.40 for diatomic gases, and ranges from 1.1 to 1.3 for polyatomic gases. Under conventional physical conditions, the complexity of a gas molecule increases with the number of constituent atoms, resulting in to a smaller isentropic index. Therefore, the isentropic index can be used to characterize the molecular composition of a gas under specific conditions. Monoatomic gases behave as ideal gases at normal temperature and pressure because of negligible intermolecular forces and molecular volumes, leading to a compression factor close to 1. As molecular complexity increases, intermolecular interactions strengthen, and the compression factor of polyatomic gases deviates more significantly from unity than that of monatomic or diatomic gases. In summary, a positive correlation exists between the isentropic index and the compression factor: a lower isentropic index indicates a more complex molecular structure and a greater deviation of the compression factor from the ideal state, and vice versa.
Figure 2 presents the isentropic indices and compression factors for common natural gas components. To maintain heavy hydrocarbon gases in the gaseous state, environmental conditions are set at 101.325 kPa and 343 K. Comparison of the isentropic indices and compression factors under these conditions shows a clear positive correlation across typical natural gas components. This observation suggests that the compression factor can be reliably approximated by measuring the isentropic index.

2.1.3. Correlation Analysis of Calorific Value Characteristics

Based on the temperature, pressure, sound velocity, density, and isentropic index of natural gas under various operating conditions, the compression factor can be estimated. This value, along with the measured density and Equation (5), enables for the calculation of the molecular weight, as shown in Equation (8):
M = ( ρ o Z o R u T o ) / P o ,
According to relevant standards [26], the molecular weights and calorific values of common natural gas components under standard conditions are depicted in Figure 3. From the figure, it is evident that the calorific value of natural gas originates primarily from alkane-type components (C1~C6), while non-alkane components (N2, CO2) contribute no calorific value.
The calorific values of the individual gases shown in Figure 3 are normalized by their molecular weights, as presented in Table 1 below. The data indicate that among the common natural gas components, the calorific values of alkane gases show minimal variation, while non-alkane gases have zero calorific values. Consequently, the overall calorific value of natural gas demonstrates an approximately linear correlation with the molecular weight of its alkane constituents.
The direct measurement of the molecular weight of alkane gases in natural gas presents technical challenges without a thorough understanding of its specific composition. However, the isentropic index provides a useful alternative: non-alkane gases typically exhibit significantly higher isentropic indices than alkane gases, making the isentropic index a key parameter for characterizing the alkane content. In summary, a reliable prediction model for natural gas properties can be constructed using the isentropic index in combination with molecular weight, thereby enabling accurate calorific value estimation.

2.1.4. Hypothetical Calculation Example and Process Description

Based on the preceding analysis, it is possible to achieve real-time measurement of parameters such as temperature, pressure, density, sound velocity, and flow rate by leveraging the intrinsic correlations between various physical parameters of natural gas and utilizing industrial sensing instruments such as temperature/pressure transmitters, vibrating density meters, and ultrasonic flow meters. This allows for the calculation of core energy measurement parameters such as compression factor and calo-rific value, which completes the natural gas energy measurement process.
To explain the aforementioned implementation process, this paper presents a hypothetical calculation example using simplified numerical values, as shown in Figure 4. Assume that the temperature, pressure, flow rate, and composition of natural gas passing through metering station A remain constant over an hour. The detailed molar fraction information for each component of natural gas is as follows (unit: %mol/mol), Nitrogen(N2): 1.28, Carbon dioxide(CO2): 1.92, Methane(CH4): 95.56, Ethane(C2H6): 0.46, Propane(C3H8): 0.15, Butane(n-C4H10): 0.12, Isobutane(i-C4H10): 0.15, Pentane(n-C5H12): 0.12, Isopentane(i-C5H12): 0.13, Neopentane(neo-C5H12): 0.09, and Hextane(C6H14): 0.02. Physical property parameters measured by industrial sensor instruments are as follows: Temperature (TA): 293.15 K, Pressure (PA): 0.4 MPa, Flow rate (QA): 10,000 m3/h, Density ( ρ A ): 2.8395 kg/m3, Sound velocity (cA): 428.08 m/s. Ts and Ps denote the temperature and pressure under standard conditions, with default values of 293.15 K and 101.325 kPa.
The hypothetical calculation example follows this computational process:
(1) First, based on the real-time measured natural gas physical property data (PA, ρ A , cA), combined with Equation (7) derived from the simultaneous solution of Equations (5) and (6), the isentropic exponent can be calculated ( κ A = c A 2 ρ A / P A = 1.3008).
(2) Secondly, based on the interrelationships among various physical properties of natural gas, inputting relevant physical parameters (TA, PA, ρ A , cA, κ A ) into the intelligent compression factor prediction model enables further prediction of the compression factor under operating conditions (ZA = 0.99217).
(3) Thirdly, based on the physical properties of natural gas (TA, PA, ρ A , ZA), its molecular weight can be calculated using Equation (8) ( M A = ( ρ A Z A R u T A ) / P A = 17.16 (g/mol)).
(4) Similarly, input the aforementioned natural gas physical property parameters (TA, PA, cA, ρ A , κ A , MA, ZA) into the intelligent calorific value prediction model to forecast its calorific value (HA = 36.692 (MJ/m3)).
(5) Finally, based on five parameters—natural gas temperature (TA), pressure (PA), the compression factor (ZA), the calorific value (HA), and flow rate (QA)—and using Equation (4), the energy measurement for natural gas at metering station A over one hour was performed, ultimately yielding its total energy as 1,459,918.7 (MJ). ( E A = P A T s T A P s H A Z A t q = 1,459,918.7 (MJ)).
The correlation between the properties of natural gas in this paper refers to directional relationships, which are used to summarize the direction of change between parameters rather than linear correlations at the statistical level. The essence of the correlation presented in this paper is found in examining the trend-based relationship between the measured physical properties of natural gas and the key energy measurement parameters, specifically the compression factor and calorific value.

2.2. Sample Dataset Construction

Intelligent learning algorithms systematically analyze system behavior and evolutionary patterns from a macro perspective [30,31], requiring large datasets for effective model training. As described above, the prediction of compression factor and calorific value relies on datasets constructed from different dimensions:
(1) Compression factor prediction model: A five-dimensional dataset has been utilized. The input features include temperature, pressure, sound velocity, density, and isentropic index of natural gas under operating conditions, with the compression factor as the output label.
(2) Calorific value prediction model: This model is based on the five-dimensional dataset and includes the predicted compression factor and density to determine molecular weight. The resulting seven-dimensional dataset includes temperature, pressure, sound velocity, density, isentropic index, compression factor, and molecular weight as input features, with calorific value as the output label.
Due to the limited availability of natural gas samples with diverse compositions, the component compositions can be manually defined. For each composition, the compression factor and corresponding input-output pairs for calorific value prediction are systematically calculated under various operating conditions using standard methods. This study adheres to the common natural gas component ranges outlined in GB/T 17747.2-2011: Calculation of Natural Gas Compression Factors, Part 2: Calculation Using Molar Composition (Figure 5), generating a dataset covering 200 distinct compositions [14].
To analyze thermodynamic characteristics under diverse operating conditions, 50 operating conditions were systematically selected in this study, covering a temperature range of (253~333) K and a pressure range of (0~10) MPa (detailed in Table 2). The sample dataset combines 200 distinct natural gas compositions with these 50 operating conditions, resulting in a total of 10,000 data points, generated following standard calculation methods.
Based on established research, AGA REPORT NO. 10 [32] provides the standard method for calculating the sound velocity of natural gas, while ISO-6976 [33] is widely used to determine the calorific value. The AGA8-92DC and GERG-2008 state equations are used to calculate the compression factor and density, with GERG-2008 providing superior accuracy [34,35]. Using AGA REPORT NO. 10, ISO-6976, and the GERG-2008 state equations, the input features and output labels of the compression factor and calorific value prediction models were systematically calculated for each natural gas composition under all operating conditions. The dataset construction process is illustrated in Figure 6. For subsequent intelligent learning-based prediction studies, the dataset is split into a training set (80%) and a testing set (20%).
Because input features vary in units and scales, features with larger numerical ranges can dominate during model training, potentially skewing feature importance and reducing model accuracy [36,37]. To address this, the dataset is normalized by linearly transforming each feature to the [0, 1] interval using Equation (9):
x = x x min x max x min ,
where x is the normalized sample data; x is the original sample data before normalization; and x max and x min are the maximum and minimum values of the sample data, respectively.

3. Prediction Model Construction

Figure 7 presents the flowchart for constructing a prediction model for the natural gas compression factor and calorific value. Using the previously constructed natural gas dataset, four models—Support Vector Regression (SVR), Gradient Boosting Regression (GBR), Multi-Layer Perceptron (MLP), and Convolutional Neural Network (CNN)—were trained and tested. Model performance was evaluated using five metrics: Mean Absolute Error (MAE), Root Mean Square Error (RMSE), Mean Absolute Percentage Error (MAPE), Coefficient of Determination (R2) and Single-sample prediction time. By comparing the evaluation metrics across these algorithms for both prediction tasks, the optimal models for compression factor and calorific value were selected, and the best-performing prediction model was determined through optimization.

3.1. Models and Evaluation Indicators

Given the characteristics of compression factor and calorific value prediction tasks, the chosen algorithms must satisfy the following criteria:
(1) Regression problem adaptability: The task is a supervised learning regression problem; the algorithm must effectively predict continuous variables.
(2) Feature-data compatibility: The algorithm should accurately capture the non-linear relationships between physical property data and target parameters to ensure reliable and stable predictions.
(3) Low model complexity: Overly complex models can be difficult to interpret and prone to overfitting. Simpler models are preferred, provided they achieve sufficient accuracy.
To meet these requirements, SVR, GBR, MLP, and CNN were employed to construct prediction models:
-
SVR maps data to a high-dimensional space using a kernel function and identifies the optimal hyperplane [38].
-
GBR iteratively fits weak learners and corrects residuals to approximate the true regression function [39].
-
MLP is flexible regarding input data structure and can process data of arbitrary shape and dimension [40].
-
CNN reduces the dimensionality of input data while extracting spatial features [41].
To quantitatively evaluate model performance, five metrics were used: RMSE, MAE, MAPE, and R2, defined in Equations (10)–(13), single-sample prediction time can serve as a key indicator for evaluating the prediction efficiency of a model.
MAE = 100 % n i = 1 m | y ^ i y i | ,
MAPE = 100 % n i = 1 m | y ^ i y i y i | ,
RMSE = 1 m i = 1 m ( y ^ i y i ) 2 ,
R 2 = 1 i = 1 m ( y ^ i y i ) 2 i = 1 m ( y ¯ i y i ) 2 ,
where m denotes the sample size; y i is the true sample value; y ^ i is the predicted value from the machine learning model; and y ¯ i is the mean of the true sample values.
Among these indicators, smaller MAE, MAPE, and RMSE values indicate more accurate model predictions, shorter single-sample prediction time indicates higher predictive efficiency of the model, while an R2 value closer to 1 signals a better fit of the regression model.

3.2. Model Training

3.2.1. Compression Factor Prediction Model

The previously constructed sample dataset was used for both training and testing the models. To ensure that each model achieved its optimal predictive performance, hyperparameters were tuned using grid search methods [42,43]. Table 3 summarizes the hyperparameter configurations at which each model exhibited its best predictive capability.
In addition, Figure 8 presents a scatter plot comparing predicted compression factor values from each model against the ideal perfect prediction line superimposed as a reference. The dispersion of points around the reference line provides a visual assessment of prediction accuracy: smaller deviations indicate more accurate predictions.
As illustrated in Figure 8, all four models accurately and efficiently predict natural gas compression factors. Performance metrics in Table 4 indicate that the SVR model outperforms the others. Its superior performance can be attributed to the kernel function, which effectively captures non-linear relationships even with limited input features, and its robustness to outliers ensures stable and reliable predictions.

3.2.2. Calorific Value Prediction Model

Four algorithmic models were used to predict the calorific value of natural gas. Table 5 summarizes the hyperparameter configurations for each model when optimal prediction performance was achieved. Figure 9 displays a scatter plot of predicted versus actual calorific values for each model. The dispersion of points around the ideal prediction line provides a visual evaluation of model accuracy.
Performance metrics in Table 6 indicate that SVR and MLP achieved the best results. Specifically, MLP exhibits the lowest MAE and MAPE, indicating minimal relative deviation between predicted and standard values. Additionally, SVR achieves superior RMSE and R2, reflecting stronger capability in capturing data trends and fitting quality. Meanwhile, the MLP model demonstrates the fastest single-sample inference speed; thus, it can be prioritized as the preferred prediction model for large-scale sample forecasting tasks.

3.3. Model Switching Method Based on Feature Range

Overall, outliers frequently occur when intelligent learning algorithms process natural gas sample datasets for training and prediction. To investigate the causes of outliers, a separate set of natural gas samples from a certain region in China (excluded from the training dataset) was analyzed. As shown in Figure 10, the relative error of predicted values increases significantly under medium- to high-pressure conditions; notably, low-temperature environments can further exacerbate this error amplification trend. In these conditions, natural gas approaches a supercritical state, exhibiting properties of both gas and liquid, which leads to prediction failure and elevated errors.
Inspired by the core tenets of adaptive algorithms and the Mixture of Experts (MoE) algorithm [44,45], a model switching method based on feature range is proposed to address this issue. The overall principle of MSM-FR is as follows (Figure 11):
(1) The natural gas sample dataset was randomly split into a training set (80%) and a testing set (20%). Based on this, a multi-model reference prediction framework was developed, which included SVR, GBR, MLP, and CNN. The compression factor and calorific value prediction models were trained with measured physical properties as input. Five metrics were used to evaluate the overall performance of the model: MAE, RMSE, MAPE, R2, and single-sample prediction time.
(2) According to the evaluation results, the SVR model outperformed all four metrics and was chosen as the baseline model for the compression factor prediction task. In the calorific value prediction task, the SVR model demonstrated superior performance in RMSE and R2, while the MLP model showed greater advantages in MAE and MAPE. The choice between the two models should be based on the specific operational requirements.
(3) Under medium- to high-pressure pipeline transmission conditions, natural gas has properties similar to two-phase gas-liquid behavior, reducing the predictive accuracy of a single model. As a result, after completing the reference model evaluation, differentiated feature interval partitioning schemes must be developed for various prediction tasks, and models must be trained separately for each partitioned sub-interval.
The actual workflow is as follows: In the compression factor prediction task, arrange the measured physical property features of the test set in ascending order of pressure. Then, predict and calculate the error for each group sequentially. When the prediction error for five consecutive groups exceeds the training set’s overall RMSE threshold, extract the density and sound velocity values from the first group of five samples. These values serve as the foundation for distinguishing between conventional operating conditions and medium to high-pressure conditions. For the caloric value prediction task, the compression factor, which is already an input feature, is selected directly as the interval partitioning parameter. Additionally, given the SVR model’s superior generalization capability and robustness in the calorific value prediction task, the benchmark model for this prediction task was also selected as SVR prior to implementing feature subinterval partitioning. Table 7 shows the feature range classification and model adaptation table.
The primary reason for selecting these parameters is that natural gas with different compositions exhibits significant property variations under the same temperature and pressure conditions. Density, sound velocity, and compression factor all describe the combined effects of temperature and pressure on natural gas properties. Compared to single-pressure parameter partitioning methods, this approach significantly improves interval segmentation accuracy.
(4) Once the feature subinterval partitioning is complete, independent prediction models must be trained for each interval. To perform compression factor predictions, separate SVR models are constructed for conventional operating conditions and medium- to high-pressure conditions subintervals. The compression factor prediction model trained for the conventional operating condition is denoted as SVR-Z1, whereas the counterpart tailored for the medium- to high-pressure regime is designated as SVR-Z2. Model selection for the calorific value prediction task is differentiated by the following characteristics: The SVR model is well-suited for the medium- to high-pressure operating condition interval, thanks to its advantages in RMSE and R2 metrics, as well as its strong robustness. The calorific value prediction model trained for this scenario is denoted as SVR-H. The MLP model, which outperforms the MAE and MAPE metrics, is better suited to the high-precision prediction requirements of the conventional operating condition interval, and the corresponding prediction model is denoted as MLP-H.
(5) Finally, determine the feature interval to which the test set samples belong, and then apply the optimal model trained for that interval to accurately predict the compression factor and calorific value.
The baseline model was trained on the training set and systematically validated via experiments using the test set. Through this procedure, the demarcation criteria for conventional and medium- to high-pressure operating conditions were established for both the compression factor and calorific value prediction tasks, alongside tailored model switching strategies for each task. Detailed specifications are elaborated below and summarized in Table 7.
For the compression factor prediction task:
(1) When the density feature value of the input sample is less than or equal to 52.26 g/m3 or the sound velocity feature value is greater than or equal to 400.54 m/s, the sample is classified as operating under conventional conditions, with the SVR-Z1 model employed for compression factor prediction.
(2) When the density feature value of the input sample exceeds 52.26 g/m3 and the sound velocity feature value is below 400.54 m/s, the sample is classified as operating under medium- to high-pressure conditions, with the SVR-Z2 model employed for compression factor prediction.
For the calorific value prediction task:
(1) When the compression factor feature value of the input sample is greater than or equal to 0.8542, the sample is classified as operating under conventional conditions, with the MLP-H model employed for calorific value prediction.
(2) When the compression factor feature value of the input sample falls below 0.8542, the sample is classified as operating under medium -to high-pressure conditions, with the SVR-H model employed for calorific value prediction.
The MSM-FR optimization algorithm was applied to train and predict the sample dataset. The evaluation of model performance involved comparing predicted values against standard values, as shown in Figure 12. Additionally, Figure 13 further illustrates the improvement achieved by MSM-FR, comparing predicted values before and after optimization. It is evident that, relative to the optimization models, the MSM-FR-optimized model produces predictions for both compression factor and calorific value that are closer to the standard values.
Table 8 summarizes the performance metrics of the MSM-FR optimization algorithm. The results demonstrate a clear improvement in prediction accuracy for both the com-pression factor and calorific value, and although the proposed MSM-FR optimization algorithm leads to a slight increase in single-sample prediction time compared with the optimal single model, it achieves a favorable trade-off between efficiency and accuracy. In the compression factor prediction model, the MAE, RMSE, and MAPE decreased from 0.00267, 0.0052, and 0.32 to 0.00118, 0.0030, and 0.14, respectively. At the same time, the R2 increased from 0.9963 to 0.9987, indicating an improved goodness-of-fit between the predicted and standard values. For the calorific value prediction model, the MAE, RMSE, and MAPE decreased from 0.2481, 0.415, and 0.69 to 0.1583, 0.331, and 0.44, respectively. On the other hand, R2 increased from 0.9641 to 0.9736, reflecting a significant reduction in prediction errors and improved model reliability. Overall, the MSM-FR optimization algorithm effectively enhances the accuracy and robustness of both compression factor and calorific value predictions.

4. Case Study

4.1. Actual Flow Test

To validate the method under real-flow conditions, a natural gas energy metering test device was established. The structural diagram of the device is shown in Figure 14. The device includes an airflow straightener to enhance the measurement accuracy of the ultrasonic flow meter, in addition to a turbine and natural gas collection/treatment unit to purge and safely collect natural gas from the pipeline.
Four types of natural gas cylinders were used as the gas source, with their component compositions detailed in Table 9. During testing, each cylinder was opened, and the pressure was controlled by adjusting a pressure-reducing valve. Every pressure point was tested three times. Sound velocity and density were recorded and averaged to serve as input features for the intelligent learning algorithm. These inputs were then used to predict the compression factor and calorific value of natural gas under varying temperature and pressure conditions.

4.2. Experimental Results

The MSM-FR optimization algorithm was applied to predict the compression factor and calorific value of four natural gas samples under multiple operating conditions, using physical property parameters collected in real time by the test device. The predicted values were systematically compared with standard values calculated according to industry norms to assess prediction accuracy and model reliability. The results are presented in Figure 15.
Furthermore, Table 10 summarizes the maximum absolute error (AEmax) and maxi-mum relative error (REmax) of the compression factor and calorific value of each gas sample group. The data indicate that, under actual flow conditions, the maximum absolute error of the compression factor predictions across the four gas groups was 0.00061, with a maximum relative error of 0.061%. This demonstrates minimal prediction error and strong model performance. The maximum absolute error for calorific value predictions was 0.478 MJ/m3, with a maximum relative error of 1.19%. The relative errors of total energy for the four gas groups were 1.21%, 1.17%, 0.80%, and 0.95%, respectively. Notably, gas samples 1 and 2 exhibited relatively larger errors, which can be attributed to their higher calorific values and a limited number of concentrated data points, resulting in reduced model generalization capability.

5. Conclusions

This paper proposes a natural gas energy metering method based on the density-sound velocity correlation, enabling accurate metering without the need for a gas chromatograph. The study involved constructing a multidimensional dataset of 10,000 sample sets, integrating multiple intelligent learning algorithms to establish predictive models for compression factor and calorific value, proposing the MSM-FR optimization algorithm to enhance prediction accuracy, and performing real-flow experiments to evaluate practical applicability. The main findings of this study are summarized as follows:
(1) This study proposes measuring key physical parameters, including temperature, pressure, sound velocity, density, isentropic index, and molecular weight, and integrating them with intelligent learning algorithms, thereby enabling accurate real-time energy metering of natural gas with the measurement frequency drastically improved to the second level.
(2) In accordance with natural gas standards, this study constructed a comprehensive sample dataset for the comparative experiments of different intelligent learning algorithms. In predicting the compression factor, the Support Vector Regression (SVR) model demonstrated superior performance, while for predicting calorific value, both the SVR and Multi-layer Perceptron (MLP) models showed distinct advantages.
(3) Based on the results of the model analysis, the MSM-FR optimization algorithm was proposed to further enhance prediction capability. The performance metrics for the compression factor prediction model are as follows: MAE = 0.00118, RMSE = 0.0030, MAPE = 0.14%, and R2 = 0.9987. For the calorific value prediction model, the corresponding metrics are: MAE = 0.1583, RMSE = 0.331, MAPE = 0.44%, and R2 = 0.9736, indicating high predictive accuracy and robustness.
(4) A natural gas energy metering real-flow test rig was constructed, and the predictive models of the compression factor and calorific value were applied to real-flow conditions. Results demonstrated that the proposed method is very effective for natural gas energy metering. In the tests, the maximum prediction errors for the compression factor and calorific value were 0.061% and 1.19%, respectively, with the maximum relative error for total energy at 1.21%, confirming the reliability and accuracy of the method.
(5) The natural gas sample data used in this paper consist of 11 common components, including methane, ethane, nitrogen, carbon dioxide, and others. However, in practical applications, natural gas may contain uncommon components such as hydrogen, hydrogen sulfide, and argon. Due to differences in the physical properties of various gases, it is necessary to further enrich the sample dataset to train the prediction model and evaluate the error generated by this method when dealing with natural gas composed of additional components. In addition, follow-up research can be conducted based on the physical properties selected in this paper, incorporating other natural gas physical properties as feature values to further reduce the error of the physical property correlation method in natural gas energy metering.

Author Contributions

Conceptualization, B.Z.; methodology, B.Z.; software, B.Z.; validation, B.Z.; formal analysis, B.Z.; investigation, Y.Y. and Y.C.; resources, D.X.; data curation B.Z. and J.W.; writing—original, B.Z.; writing—review and editing, J.W. and Z.H.; visualization, B.Z. and Z.H.; supervision, Z.H. and W.W.; project administration W.W.; funding acquisition, Z.H. and W.W. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by Department of Science and Technology of Zhejiang Province, grant number 2022C01244.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The raw data supporting the conclusions of this article will be made available by the authors upon request.

Conflicts of Interest

The authors declare no conflicts of interest.

Abbreviations

ETotal energy of natural gas
t0Initial moment of energy metering
tnFinal moment of energy metering
es(t)Instantaneous energy flow as a function of time
qs(t)Volume flow rate as a function of time
Hs(t)Calorific value as a function of time
qVolume flow rate
fVolume flow correction parameter
PPressure
TThermodynamic temperature
ZCompression factor
H s o Ideal calorific value of natural gas under standard conditions
H s Calorific value of natural gas under standard conditions
H s , i o Ideal calorific value of each component in natural gas under standard conditions
xiMolar fraction of each component
nTotal number of components in natural gas
mSample size
ρ Gas density
MMolecular weight
VmMole volume
RuUniversal gas constant
cSound velocity
κ Isentropic index
xNormalised sample data
xOriginal sample data before normalisation
xmaxMaximum value of the sample data
xminMinimum value of the sample data
yiTrue sample value
y ^ i Predicted value from the machine learning model
y ¯ i Mean of the true sample values
MAEMean absolute error
RMSERoot mean square error
MAPEMean absolute percentage error
R2Coefficient of determination
subscript
sStandard reference conditions
oOperating conditions

References

  1. Wei, Q.; Zhou, P.; Shi, X. Assessing the congestion cost of gas pipeline between China and Russia. Energy Strateg. Rev. 2024, 55, 101493. [Google Scholar] [CrossRef]
  2. Huang, W.; Duan, J.; Chang, H.; Luo, Q.; Zhou, L.; Sun, Q. Construction of natural gas energy-measuring system in China: A discussion. Nat. Gas Ind. B 2022, 9, 33–40. [Google Scholar] [CrossRef]
  3. Zhou, J.; Zhou, P.; Liu, C.; Qin, Y.; Liang, G. Implementation plan and impact of natural gas pipeline network transformation from volume metering to energy metering in China. Int. J. Glob. Energy Issue 2025, 47, 214–242. [Google Scholar] [CrossRef]
  4. Chang, H.; Duan, J. Natural gas measurement technology system and its prospect in China. Nat. Gas Ind. B 2020, 7, 370–379. [Google Scholar] [CrossRef]
  5. Ficco, G.; Dell’Isola, M.; Vigo, P.; Celenza, L. Uncertainty analysis of energy measurements in natural gas transmission networks. Flow Meas. Instrum. 2015, 42, 58–68. [Google Scholar] [CrossRef]
  6. Zhou, J.; Fu, W.; Liang, G.; Zhang, D.; Ma, J. Precision and uncertainty in natural gas calorific value estimation: Advanced combinatorial predictive models for complex pipeline systems. Meas. Sci. Technol. 2024, 36, 015017. [Google Scholar] [CrossRef]
  7. Dörr, H.; Koturbash, T.; Kutcherov, V. Review of impacts of gas qualities with regard to quality determination and energy metering of natural gas. Meas. Sci. Technol. 2019, 30, 022001. [Google Scholar] [CrossRef]
  8. Roy, P.S.; Ryu, C.; Park, C.S. Predicting Wobbe Index and methane number of a renewable natural gas by the measurement of simple physical properties. Fuel 2018, 224, 121–127. [Google Scholar] [CrossRef]
  9. GB/T 17747.3-2011; Natural Gas—Calculation of Compression Factor—Part 3: Calculation Using Physical Properties. Standards Press of China: Beijing, China, 2011.
  10. Morrow, T.B. Development of a Low Cost Inferential Natural Gas Energy Flow Rate Prototype Retrofit Module; Office of Scientific and Technical Information (OSTI), U.S. Department of Energy: Oak Ridge, TN, USA, 2000.
  11. Kojima, K.; Ishiguro, T. Methane Number Calculation Method and Methane Number Measurement Device. U.S. Patent 1,013,274,6B2, 14 December 2022. [Google Scholar]
  12. Kamimoto, T.; Deguchi, Y.; Shisawa, Y.; Kitauchi, Y.; Eto, Y. Development of fuel composition measurement technology using laser diagnostics. Appl. Therm. Eng. 2016, 102, 596–603. [Google Scholar] [CrossRef]
  13. Gao, Y.; Dai, L.-K.; Zhu, H.-D.; Chen, Y.-L.; Zhou, L. Quantitative Analysis of Main Components of Natural Gas Based on Raman Spectroscopy. Chin. J. Anal. Chem. 2019, 47, 67–76. [Google Scholar] [CrossRef]
  14. GB/T 17747.2-2011; Natural Gas—Calculation of Compression Factor—Part 2: Calculation Using Molar—Composition Analysis. Standards Press of China: Beijing, China, 2011.
  15. Baniasadi, M.; Mohebbi, A.; Baniasadi, M. A new correlation based on artificial neural networks for predicting the natural gas compressibility factor. J. Eng. Thermophys. 2012, 21, 248–258. [Google Scholar] [CrossRef]
  16. Wang, J.; Huang, Z.; Xu, Y.; Xie, D. Gas–Liquid Two-Phase Flow Measurement Based on Optical Flow Method with Machine Learning Optimization Model. Appl. Sci. 2024, 14, 3717. [Google Scholar] [CrossRef]
  17. Luo, H.; Zhou, P.; Cui, J.; Wang, Y.; Zheng, H.; Wang, Y. Energy performance prediction of centrifugal pumps based on adaptive support vector regression. Eng. Appl. Artif. Intell. 2025, 145, 110247. [Google Scholar] [CrossRef]
  18. Karpash, O.; Darvay, I.; Karpash, M. New approach to natural gas quality determination. J. Pet. Sci. Eng. 2010, 71, 133–137. [Google Scholar] [CrossRef]
  19. Chamkalani, A.; Zendehboudi, S.; Chamkalani, R.; Lohi, A.; Elkamel, A.; Chatzis, I. Utilization of support vector machine to calculate gas compressibility factor. Fluid Phase Equilib. 2013, 358, 189–202. [Google Scholar] [CrossRef]
  20. Farzaneh-Gord, M.; Rahbari, H.R.; Mohseni-Gharesafa, B.; Toikka, A.; Zvereva, I. Accurate determination of natural gas compressibility factor by measuring temperature, pressure and Joule-Thomson coefficient: Artificial neural network approach. J. Pet. Sci. Eng. 2021, 202, 108427. [Google Scholar] [CrossRef]
  21. Nazari, S.; Bashipour, F. A rigorous model to compute thermodynamic properties of natural gas without applying full component analysis. Flow Meas. Instrum. 2021, 77, 101879. [Google Scholar] [CrossRef]
  22. Farzaneh-Gord, M.; Rahbari, H.R. The precise designation of natural gas volumetric flow by measuring simple thermodynamic properties and using artificial intelligence methods. J. Braz. Soc. Mech. Sci. Eng. 2022, 44, 370. [Google Scholar] [CrossRef]
  23. Hu, J.; Yang, Z.; Su, H. Dynamic Prediction of Natural Gas Calorific Value Based on Deep Learning. Energies 2023, 16, 799. [Google Scholar] [CrossRef]
  24. Dong, J.; Song, B.; He, F.; Xu, Y.; Wang, Q.; Li, W.; Zhang, P. Research on a Hybrid Intelligent Method for Natural Gas Energy Metering. Sensors 2023, 23, 6528. [Google Scholar] [CrossRef]
  25. Zhang, P.; Zhou, L.; Xu, W. Compressibility factor calculation from gross calorific value and relative density for natural gas energy measurement. Int. J. Energy Res. 2022, 46, 9948–9959. [Google Scholar] [CrossRef]
  26. GB/T 11062-2020; Calculation Methods for Natural Gas Calorific Value, Density, Relative Density and Wobbe Index. Standards Press of China: Beijing, China, 2020.
  27. Laznickova, R.; Huemer, H. Investigations on the limits of uncertainty of gas density measurements with vibrating tube densimeters. Meas. Sci. Technol. 1999, 9, 719. [Google Scholar] [CrossRef]
  28. Chen, D.; Cao, H.; Cui, B. Study on flow field and measurement characteristics of a small-bore ultrasonic gas flow meter. Meas. Control 2021, 54, 554–564. [Google Scholar] [CrossRef]
  29. Chen, C.; Sun, W.; Zhou, R.; Lin, C.; Chu, C.; Su, S. Optimization design and research of ultrasonic flowmeter based on time difference method. J. Mech. Sci. Technol. 2024, 38, 245–258. [Google Scholar] [CrossRef]
  30. Ghorbani, B.; Hamedi, M.; Shirmohammadi, R.; Mehrpooya, M.; Hamedi, M.H. A novel multi-hybrid model for estimating optimal viscosity correlations of Iranian crude oil. J. Pet. Sci. Eng. 2016, 142, 68–76. [Google Scholar] [CrossRef]
  31. Liang, F.; Jin, M.; Cui, H.; Zhu, Y.; Chen, J.; Tang, G.; Ding, R. An integrated approach of throttling physical model and machine learning for gas-liquid two-phase flow rates measurement. Flow Meas. Instrum. 2025, 104, 102866. [Google Scholar] [CrossRef]
  32. Smith, J.P.; Clancy, J. Understanding aga reprot no. 10, speed of sound in natural gas and other related hydrocarbons gases. In Proceedings of the 2010 American School of Gas Measurement Technology, Houston, TX, USA, 20–23 September 2010. [Google Scholar]
  33. ISO 6976:2016; Natural gas—Calculation of Calorific Values, Density, Relative Density and Wobbe Indices from Composition. International Organization for Standardization (ISO): Geneva, Switzerland, 2016.
  34. Farzaneh-Gord, M.; Mohseni-Gharyehsafa, B.; Toikka, A.; Zvereva, I. Sensitivity of natural gas flow measurement to AGA8 or GERG2008 equation of state utilization. J. Nat. Gas Sci. Eng. 2018, 57, 305–321. [Google Scholar] [CrossRef]
  35. Farzaneh-Gord, M.; Rahbari, H.R. An intelligent approach for calculating natural gas compressibility factor and its application in ultrasonic flow meters. Flow Meas. Instrum. 2020, 76, 101833. [Google Scholar] [CrossRef]
  36. Rana, P.; St-Onge, B.; Prieur, J.-F.; Cristina Budei, B.; Tolvanen, A.; Tokola, T. Effect of feature standardization on reducing the requirements of field samples for individual tree species classification using ALS data. ISPRS-J. Photogramm. Remote Sens. 2022, 184, 189–202. [Google Scholar] [CrossRef]
  37. Singh, D.; Singh, B. Feature wise normalization: An effective way of normalizing data. Pattern Recognit. 2022, 122, 108307. [Google Scholar] [CrossRef]
  38. Wang, W.; Men, C.; Lu, W. Online prediction model based on support vector machine. Neurocomputing 2008, 71, 550–558. [Google Scholar] [CrossRef]
  39. Park, S.; Jung, S.; Lee, J.; Hur, J. A Short-Term Forecasting of Wind Power Outputs Based on Gradient Boosting Regression Tree Algorithms. Energies 2023, 16, 1132. [Google Scholar] [CrossRef]
  40. Szoplik, J.; Muchel, P. Using an artificial neural network model for natural gas compositions forecasting. Energy 2023, 263, 126001. [Google Scholar] [CrossRef]
  41. Tang, W.; Zhang, Q.; Li, L.; Chen, R.; Li, H.; Wang, H.; Liu, X. Hybrid CNN-MLP architecture data-driven airflow parameters perception in underground metal mine. Expert Syst. Appl. 2025, 279, 127441. [Google Scholar] [CrossRef]
  42. Sun, Y.; Ding, S.; Zhang, Z.; Jia, W. An improved grid search algorithm to optimize SVR for prediction. Soft Comput. 2021, 25, 5633–5644. [Google Scholar] [CrossRef]
  43. Fayed, H.A.; Atiya, A.F. Speed up grid-search for parameter selection of support vector machines. Appl. Soft. Comput. 2019, 80, 202–210. [Google Scholar] [CrossRef]
  44. Yang, S.; Wan, M.P.; Chen, W.; Ng, B.F.; Dubey, S. Model predictive control with adaptive machine-learning-based model for building energy efficiency and comfort optimization. Appl. Energy 2020, 271, 115147. [Google Scholar] [CrossRef]
  45. Nguyen, H.D.; Chamroukhi, F. Practical and theoretical aspects of mixture-of-experts modeling: An overview. WIREs Data Min. Knowl. Discov. 2018, 8, e1246. [Google Scholar] [CrossRef]
Figure 1. Flowchart of the natural gas energy metering method based on the density-sound velocity correlation approach.
Figure 1. Flowchart of the natural gas energy metering method based on the density-sound velocity correlation approach.
Sensors 26 00343 g001
Figure 2. Schematic representation of the isentropic exponents and compression factors for common natural gas components under conditions of 101.325 kPa and 343 K.
Figure 2. Schematic representation of the isentropic exponents and compression factors for common natural gas components under conditions of 101.325 kPa and 343 K.
Sensors 26 00343 g002
Figure 3. Schematic representation of molecular weights and calorific values of common natural gas components under standard conditions.
Figure 3. Schematic representation of molecular weights and calorific values of common natural gas components under standard conditions.
Sensors 26 00343 g003
Figure 4. Flowchart of Hypothetical Example Calculation Process.
Figure 4. Flowchart of Hypothetical Example Calculation Process.
Sensors 26 00343 g004
Figure 5. Schematic of artificially defined ranges for natural gas components (The arrow denotes the lower limit (70%) of the content range).
Figure 5. Schematic of artificially defined ranges for natural gas components (The arrow denotes the lower limit (70%) of the content range).
Sensors 26 00343 g005
Figure 6. Flowchart of sample dataset construction [32,33,34,35].
Figure 6. Flowchart of sample dataset construction [32,33,34,35].
Sensors 26 00343 g006
Figure 7. Flowchart of the construction process for a natural gas compression factor and calorific value prediction models (The arrows denote the direction of process progression.).
Figure 7. Flowchart of the construction process for a natural gas compression factor and calorific value prediction models (The arrows denote the direction of process progression.).
Sensors 26 00343 g007
Figure 8. Comparison of predicted and standard compression factor values for each model. (a) SVR Model; (b) GBR Model; (c) MLP Model; (d) CNN Model.
Figure 8. Comparison of predicted and standard compression factor values for each model. (a) SVR Model; (b) GBR Model; (c) MLP Model; (d) CNN Model.
Sensors 26 00343 g008aSensors 26 00343 g008b
Figure 9. Comparison of predicted and standard calorific values for each model. (a) SVR Model; (b) GBR Model; (c) MLP Model; (d) CNN Model.
Figure 9. Comparison of predicted and standard calorific values for each model. (a) SVR Model; (b) GBR Model; (c) MLP Model; (d) CNN Model.
Sensors 26 00343 g009
Figure 10. Comparison of compression factor and calorific value predictions versus standard values for natural gas under varying operating conditions. (a) Compression Factor Prediction; (b) Calorific Value Prediction ( c-ρ : Predictions Based on Density-Sound Velocity Correlation).
Figure 10. Comparison of compression factor and calorific value predictions versus standard values for natural gas under varying operating conditions. (a) Compression Factor Prediction; (b) Calorific Value Prediction ( c-ρ : Predictions Based on Density-Sound Velocity Correlation).
Sensors 26 00343 g010
Figure 11. Flowchart of the model switching method based on feature range.
Figure 11. Flowchart of the model switching method based on feature range.
Sensors 26 00343 g011
Figure 12. Comparison of MSM-FR model predictions with standard values: (a) Compression Factor Prediction; (b) Calorific Value Prediction.
Figure 12. Comparison of MSM-FR model predictions with standard values: (a) Compression Factor Prediction; (b) Calorific Value Prediction.
Sensors 26 00343 g012
Figure 13. Comparison of model predictions before and after optimization: (a) Compression Factor; (b) Calorific Value.
Figure 13. Comparison of model predictions before and after optimization: (a) Compression Factor; (b) Calorific Value.
Sensors 26 00343 g013
Figure 14. Structural diagram of the natural gas energy metering test bench.
Figure 14. Structural diagram of the natural gas energy metering test bench.
Sensors 26 00343 g014
Figure 15. Relative errors in predicted compression factor and calorific value of natural gas under actual flow conditions. (a) Compression Factor Prediction; (b) Calorific Value Prediction.
Figure 15. Relative errors in predicted compression factor and calorific value of natural gas under actual flow conditions. (a) Compression Factor Prediction; (b) Calorific Value Prediction.
Sensors 26 00343 g015
Table 1. Calorific value-to-molecular weight ratios of common natural gas components under standard conditions.
Table 1. Calorific value-to-molecular weight ratios of common natural gas components under standard conditions.
N2CO2C1C2C3i-C4n-C4neo-C5i-C5n-C5C6
Hs/M002.312.162.092.062.052.042.032.032.02
Table 2. Operating conditions for dataset construction.
Table 2. Operating conditions for dataset construction.
Temperature (K)Pressure (MPa)
2530.10.20.40.81.62.54.06.08.010.0
2730.10.20.40.81.62.54.06.08.010.0
2930.10.20.40.81.62.54.06.08.010.0
3130.10.20.40.81.62.54.06.08.010.0
3330.10.20.40.81.62.54.06.08.010.0
Table 3. Hyperparameter configurations for compression factor prediction models.
Table 3. Hyperparameter configurations for compression factor prediction models.
SVRGBRMLPCNN
Basic Structural ParametersKernel: ‘rbf’
Gamma: ‘auto’
N_estimators: 235;
Max_depth: 5;
Min_samples_split: 12; Max_features: 4;
Hidden layer sizes:
(64, 32, 16);
Batch_size: 64;
Epochs: 50;
Fully connected layer sizes:
(64, 32, 16)
Conv layer: [Kernel size:
(1,3), Padding: (0,1)];
Max pooling layer:
[Kernel size: (1,2), Stride: (1,2)];
Batch_size: 64;
Epochs: 102;
Training-related parametersC = 10
Epsilon: 0.01
Degree: 5
Learning rate: 0.01;
Loss: ‘Least Squares’
Learning rate: 0.025;
Activation: ‘Tansig’;
Optimizer: ‘adam’;
Loss: ‘mseloss’;
Dropout: 0.2;
Learning rate: 0.007;
Activation: ‘Relu’;
Optimizer: ‘adam’;
Loss: ‘mseloss’;
Dropout: 0.2;
Table 4. Performance indicators for compression factor prediction models.
Table 4. Performance indicators for compression factor prediction models.
ModelMAERMSEMAPE (%)R2Single-Sample
Prediction Time (ms)
SVR0.002670.00520.320.99630.2374
GBR0.003270.00610.390.99480.4080
MLP0.004170.00720.500.99290.3552
CNN0.004980.00830.600.99060.7584
Table 5. Hyperparameter configurations for calorific value prediction models.
Table 5. Hyperparameter configurations for calorific value prediction models.
SVRGBRMLPCNN
Basic Structural ParametersKernel: ‘rbf’
Gamma: ‘scale’
N_estimators: 250; Max_depth: 10;
Min_samples_split: 3; Max_features: 4;
Hidden layer sizes:
(256, 128, 64, 16);
Batch_size: 64;
Epochs: 50;
Fully connected layer sizes:
(896, 256, 128, 64, 16)
Conv layer: [Kernel size:
(1,3), Padding: (0,1)];
Batch_size: 64;
Epochs: 550;
Training-related parametersC = 20
Epsilon: 0.06
Degree: 5
Learning rate: 0.04;
Loss: ‘Least Squares’
Learning rate: 0.001;
Activation: ‘Tansig’;
Optimizer: ‘adam’;
Loss: ‘mseloss’;
Dropout: 0.2;
Learning rate: 0.005;
Activation: ‘Relu’;
Optimizer: ‘adam’;
Loss: ‘mseloss’;
Dropout: 0.2;
Table 6. Performance indicators for calorific value prediction models.
Table 6. Performance indicators for calorific value prediction models.
ModelMAERMSEMAPE (%)R2Single-Sample
Prediction Time (ms)
SVR0.27410.3850.760.96410.5257
GBR0.28400.5700.790.92220.4857
MLP0.24810.4150.690.95770.4394
CNN0.29250.4810.810.94480.7580
Table 7. Feature range classification and model adaptation table.
Table 7. Feature range classification and model adaptation table.
Prediction TargetFeature RangeAlgorithm Model
Compression factor ρ 52.26   ( kg / m 3 ) c 400.54   ( m / s ) SVR-Z1
ρ > 52.26   ( kg / m 3 )   &   c < 400.54   ( m / s ) SVR-Z2
Calorific value Z 0.8542 MLP-H
Z < 0.8542 SVR-H
Table 8. Performance metrics of the MSM-FR optimization algorithm.
Table 8. Performance metrics of the MSM-FR optimization algorithm.
Prediction TargetModelMAERMSEMAPE(%)R2Single-Sample
Prediction Time (ms)
Compression factorSVR-10.000540.00100.060.99950.2192
SVR-20.004310.00700.570.99150.2234
SVR0.001180.00300.140.99870.2423
Calorific valueSVR0.48580.7161.320.85240.5274
MLP0.08400.1330.240.99580.4419
MLP + SVR0.15830.3310.440.97360.4653
Table 9. Detailed component composition of natural gas cylinders.
Table 9. Detailed component composition of natural gas cylinders.
x N 2 x C O 2 x C 1 x C 2 x C 3 x n-C 4 x i-C 4 x n-C 5 x i-C 5 x C 6
Gas12.99085.18.922.9900000
Gas22.00090.075.941.9900000
Gas32.022.5294.1350.5210.2010.10.10.150.1520.101
Gas40.9960.09997.08831.010.2010.1010.1010.1530.15070.1
Table 10. Maximum absolute and relative errors of compression factor and calorific value for each natural gas sample group.
Table 10. Maximum absolute and relative errors of compression factor and calorific value for each natural gas sample group.
Compression FactorCalorific Value (MJ/m3)Energy (MJ)
AEmaxREmaxAEmaxREmaxREmax
Gas1 2.1 10 4 0.021%0.4781.19%1.21%
Gas2 4.7 10 4 0.047%0.4471.14%1.17%
Gas3 1.7 10 4 0.017%0.2960.79%0.80%
Gas4 6.1 10 4 0.061%0.3310.88%0.95%
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.

Share and Cite

MDPI and ACS Style

Zhang, B.; Huang, Z.; Wang, W.; Wang, J.; Xie, D.; Cheng, Y.; Yang, Y. A Natural Gas Energy Metering Method Based on Density-Sound Velocity Correlation. Sensors 2026, 26, 343. https://doi.org/10.3390/s26010343

AMA Style

Zhang B, Huang Z, Wang W, Wang J, Xie D, Cheng Y, Yang Y. A Natural Gas Energy Metering Method Based on Density-Sound Velocity Correlation. Sensors. 2026; 26(1):343. https://doi.org/10.3390/s26010343

Chicago/Turabian Style

Zhang, Bin, Zhenwei Huang, Wenlin Wang, Junxian Wang, Dailiang Xie, Ying Cheng, and Yi Yang. 2026. "A Natural Gas Energy Metering Method Based on Density-Sound Velocity Correlation" Sensors 26, no. 1: 343. https://doi.org/10.3390/s26010343

APA Style

Zhang, B., Huang, Z., Wang, W., Wang, J., Xie, D., Cheng, Y., & Yang, Y. (2026). A Natural Gas Energy Metering Method Based on Density-Sound Velocity Correlation. Sensors, 26(1), 343. https://doi.org/10.3390/s26010343

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop