Next Article in Journal
Flexible Pressure Sensors for Integration into Karate Body Protector
Previous Article in Journal
TED-Face: Texture-Enhanced Deep Face Reconstruction in the Wild
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Research on a Hybrid Intelligent Method for Natural Gas Energy Metering

1
Natural Gas Research Institute, PetroChina & Southwest Oil and Gas Field Company, Chengdu 610213, China
2
School of Mechatronic Engineering, Southwest Petroleum University, Chengdu 610500, China
3
Key Laboratory of Natural Gas Quality Control & Energy Metering Measurement for State Market Regulation, Chengdu 610095, China
*
Author to whom correspondence should be addressed.
Sensors 2023, 23(14), 6528; https://doi.org/10.3390/s23146528
Submission received: 23 May 2023 / Revised: 26 June 2023 / Accepted: 7 July 2023 / Published: 19 July 2023
(This article belongs to the Section Chemical Sensors)

Abstract

:
In this paper, a Comprehensive Diagram Method (CDM) for a Multi-Layer Perceptron Neuron Network (MLPNN) is proposed to realize natural gas energy metering using temperature, pressure, and the speed of sound from an ultrasonic flowmeter. Training and testing of the MLPNN model were performed on the basis of 1003 real data points describing the compression factors (Z-factors) and calorific values of the three main components of natural gas in Sichuan province, China. Moreover, 20 days of real tests were conducted to verify the measurements’ accuracy and the adaptability of the new intelligent method. Based on the values of the Mean Relative Errors and the Root Mean Square errors for the learning and test errors calculated on the basis of the actual data, the best-quality MLP 3-5-1 network for the metering of Z-factors and the new CDM methods for the metering of calorific values were experimentally selected. The Bayesian regularized MLPNN (BR-MLPNN) 3-5-1 network showed that the Z-factors of natural gas have a maximum relative error of −0.44%, and the new CDM method revealed calorific values with a maximum relative error of 1.90%. In addition, three local tests revealed that the maximum relative error of the daily cumulative amount of natural gas energy was 2.39%.

1. Introduction

Accuracy of measurement is essential to maintain natural gas trade fairness and to maintain pipeline network safety management, as well as correct billing for consumption [1]. In modern transmission networks, natural gases from different origins are transported and distributed, leading to diverse calorific values and physical property parameters among natural gases. In addition, in order to support the development of renewable energy sources, the Chinese government strongly promotes the efficient use of hydrogen resources [2,3]. It is expected that hydrogen mixing will further aggravate calorific value differences between natural gases. Consequently, the billing method of natural gas will need to be based on gas energy instead of volumetric measurement results, due to the wide variety of chemical characteristics in the networks.
Direct energy metering devices for natural gas are still not available on the market. The process for measuring natural gas energy requires both volume flow measurement using flowmeters, such as the orifice flowmeter, Venturi flowmeter, ultrasonic flowmeter, etc., and determination of the calorific value, which is calculated using the mole fractions of different components detected using a gas chromatograph. Therefore, the accuracy of the energy measurement of natural gas is a function not only of the volumetric measurement device used, but also of gas chromatography and of the measurement process. However, an online gas chromatograph is expensive, both in cost and in maintenance, to equip to every metering station [4,5].
The traditional calculation methods for the physical properties of natural gas, such as calorific value, compression factors (known as Z-factors), and energy measurement, are inseparable from the detection of natural gas components, with the exception of gas chromatography; another approach to determine the characteristics of gas components is the use of Raman spectroscopy. This can be used to assess natural gas thermodynamic parameters under different laboratorial environments [6,7,8,9]. Raman spectroscopy techniques have been validated for use in natural gas reservoirs for in situ composition tests for shale collection and for the detection of traces of water at sufficient levels in gas pipelines, as well as the detection of several contaminants [10,11]. However, as the main weaknesses of long fiber optic applications in Raman spectrometry techniques are high noise and strong signal attenuation, the applicability of Raman spectrometry in the field is limited.
The choice of an appropriate method depends on the purpose and the complexity of the analyzed problem. In recent years, overcoming the aforementioned challenges of conventional techniques has motivated many scholars to utilize data-driven techniques, such as artificial intelligence (AI)-based methods, for process control, process optimization, and prediction. Some of these intelligent methods, so-called “black box” models, are data-driven methods which use sets of input and output data obtained from past data, data obtained during the measurement process, or data based on observed feature values (in regression, classification, and time series analysis). A typical AI-based technique is represented by artificial neural networks (ANNs). The prerequisites for using neural networks are sufficient historical data describing the problem and the existence of a true relationship or set of relationships between variables. Based on these historical data and mechanical relationships, the machine (computer) uses an algorithm combined with statistical examination techniques to build a model that can predict the output values without knowledge of all of the data, or with only a proportion of the related data.
ANNs have been used to support parameter prediction, e.g., natural gas load prediction [12], solar radiation potential [13], or thermal loads in regional energy systems [14,15]; process optimization, e.g., the parameter optimization of industrial gas turbines [16] or biodiesel-based engine performance [17]; and process control, e.g., fault detection [18] or steam turbine heating [19]. ANN models and their improved forms have gradually become more widely used in flowmeter verification, calibration, and measurement accuracy improvement. For example, B. Yazdanshenasshad and M.S. Safizadeh [20] built an ANN model to improve ultrasonic flowmeter calibration accuracy at two points. Xiong Yin et al. [21] built a hybrid AI model, which included a classic proportional integral differential (PID) controller and a genetic algorithm (GA) model, to optimize the verification process of a flowmeter; a radial-based artificial neural network was established [22] to improve the measurement accuracy of ultrasonic flowmeters and reduce the influence of flow field disturbances on measurement accuracy.
ANNs can also be used in the calculation of the thermodynamic state of fluids. Unlike the traditional natural gas thermodynamic parameter determination method, which requires knowing the components of the natural gas, an ANN-based approach can predict and measure natural gas components using some known thermodynamic parameters [23,24], based on data that were previously thought to be weakly correlated [25,26], or using incomplete data sets [27,28,29].
Recent studies have already proven that intelligent models have strong robustness and generalization. On the premise of knowing some components of natural gas or some other parameters (possibly from other sensors), an intelligent model can be used to solve for the desired natural gas energy metering parameters (such as the compression factor and calorific value of the tested natural gas) [30]. However, the measurement of natural gas energy has some limitations.
(1) In the literature, most of the research is focused on the calculation of natural gas physical parameters (compressibility, density, the Joule–Thomson coefficient, etc.), mainly based on some temperature and pressure data. Few papers report on the enhancement of flowmeters for natural gas energy metering.
(2) Most of the intelligent methods used in the existing literature are insufficiently advanced because they ignore the possible disadvantages of overly disaggregating data. Few published works have considered the influence of network structure on accuracy, and most of the improvements made are in the combining of intelligent models. By optimizing the structure of the model and combining it with an optimization algorithm, a much simpler and more efficient model can be established.
(3) In previous research papers, the calculation of actual accumulated natural gas energy at the site is not reported.
To solve these problems, we carried out the following:
(1) We established a natural gas energy measurement database based on the actual production data of the Southwest Oil & Gas Field Company, through which a novel natural gas energy metering model could be proposed.
(2) We used local pressure transmitter data, temperature transmitter data, and speed of sound data to establish and improve the intelligent model. We adjusted the optimal structure to avoid overfitting.
(3) To verify the adaptability of the developed model of the ultrasonic flowmeter, the natural gas energy transient and accumulation in 20 days were calculated, and the results were compared with field measurements.

2. Materials and Methods

2.1. Energy Measurement Principle

Traditional natural gas online energy metering includes volume measurement, determined using a volumetric flowmeter, and calorific value assignment achieved using a chromatograph. The natural gas energy can be determined by multiplying the volume flow and the calorific value using the following equation:
E b = Q b × H b
where
Q b = K 1 u A
H b = K 1 i = 1 n x i H i
Eb, Qb, and Hb are the energy flow, volume flow, and calorific value at the base condition, which is a STANDARD CONDITION for the natural gas trade. u is the average flow velocity measured using the ultrasonic flowmeter; A is the pipeline cross-sectional area; xi is the gas mole fraction; Hi is the calorific value of i components; and K1 is a convert coefficient, determined using the following equation:
K 1 = T b T f p f p b 1 Z f
where T is temperature, p is pressure, and Z is the compression factor. Subscript b represents the base condition; hence, Tb = 20 °C, pb = 101,325 Pa. Subscript f represents the WORKING CONDITION, which varies between different flow fields. Zf is compressibility under working conditions, which is a parameter determined by ISO20765 and GB 17747, and relies on natural gas component analysis.
From Equations (1)–(4), it can be seen that the energy measurement of natural gas is inseparable from the traditional ultrasonic flowmeter and gas composition analysis instruments. However, the purpose of this paper was to add an algorithm on the basis of the original ultrasonic flowmeter, so that the ultrasonic flowmeter can complete the calorific value calculation without relying on chromatographic analysis.

2.2. ANN Approach

The application of an ANN model is a popular tool for the recognition, classification, or forecasting of selected process parameters. The advantage of neural networks over a mechanistic process model is that no prior knowledge about functional relationships between the driving input variables and the target variable is needed. As a result, neural networks were particularly suitable for our study, as we wanted to build a model to measure the natural gas energy without knowing the natural gas components. There are many types of ANN model, differing in structure and operating principles. In this study, a feedforward ANN multilayer perceptron (MLP) was used.
The main purpose of this study was to achieve natural gas energy measurement using an ultrasonic flowmeter only; the proposed idea for achieving this is shown in Figure 1.
Subplot (a) of Figure 1 shows a typical natural gas ultrasonic flow metering process. According to the measurement principle, the gas ultrasonic flowmeter is used to measure the gas flow velocity by measuring the time difference of multi-channel ultrasonic signal propagation. Therefore, the speed of sound (SOS) of an ultrasonic flowmeter is an inevitable parameter to be measured when using a gas ultrasonic flowmeter to measure gas volumetric flow. Although no use is currently defined for sound speed, an ultrasonic flowmeter measures sound speed as well as flow speed in the current measurement system. Both values are recorded as references for volumetric flow measurement accounting. In one recent study, Farzaneh-Gord et al. [26] developed an ANN method to calculate the natural gas compressibility factor and speed of sound. The results of their work showed that more than 95% of the data had good consistency. Therefore, it can be determined from the propagation law of SOS that ultrasonic sound velocity is different for different components, and can be used for characterizing gas composition.
Natural gas calorific value at base condition was determined using the proposed MLPNN model in this study, shown in subplot (b) of Figure 1. The number of neurons in the input layer was three, which was equal to the number of independent variables: temperature (T), pressure (p), and speed of sound (SOS); meanwhile, the number of neurons in the output layer was equal to the number of dependent variables.
Training of the MLP model was conducted on a set of 1003 cases, which were randomly separated into two categories for developing the models:
(a) Training set: 80% of the data were selected for model preparation, optimum discovery, and model prediction.
(b) Test set: this subgroup contained 20% of the cases of the whole dataset, utilized to assess the estimation ability of the model.
The training set was used to modify the neuron weights, while the test set was used for ongoing monitoring of the learning process. In the preliminary study, the different activation functions (logical function, linear function, exponential function, and hyperbolic tangent function) of neurons in the hidden layer and output layer were tested. The whole process of model calculation is shown in Figure 2.
As can be seen from Figure 2, the data were first randomly divided into a training set and a test set. ANN models were established and trained with the data of the training set until the training results met the stop requirements, and then, the test set was used for overfitting analysis to finally output the optimal model. Among these optimal models, a CDM model was established in this paper to combine the advantages of different ANN models to improve the accuracy of calculation. Details of the parameters of the above neural network are shown in Table 1.
As shown in Table 1, the obtained values in the hidden and output neurons were transmitted through an activation function. The activation functions are represented in Equations (5) and (6):
Tansig:
f y = exp y + exp y exp y + exp y
Purelin:
f y = y
where y represents the independent variables in the activation functions. Therefore, it can be seen that the model structures established in this paper were of the 3-yj-1 type. Input variables included temperature, pressure, and sound velocity; the hidden layer number was yj; and the output layer number was 1.

2.3. Working Steps

For the purpose of energy metering natural gas using an ultrasonic flowmeter, a novel accurate method is proposed to calculate the natural gas Z-factor and the calorific value with the knowledge of temperature, pressure, and ultrasonic wave velocity. The procedure of natural gas energy metering proposed in this study is shown in Figure 3.
As Figure 3 shows, the working steps were as follows:
Step 1: The first stage’s primary purpose was to establish a database, including working temperature (Tf), working pressure (pf), mole fraction of composition (xi), volumetric flow (Qb), energy flow (Eb), speed of sound (SOS), and other parameters calculated from the data collected by the local sensors, such as the compression factor (Z-factor), calorific value, etc.
Step 2: The main purpose of this step was to establish a new intelligent model to obtain the calorific value of the natural gas determination without a gas chromatograph. ANN models were built to calculate Z-factors and calorific values of natural gas with input data temperature (Tf), pressure (pf), and speed of sound (SOS). Consequently, the artificial neural network (ANN) and its sub-methods (multilayer perceptron (MLP)) were trained and structured to calculate the natural gas energy.
Step 3: This step involved the evaluation of the forecast results. The overall instantaneous and accumulated energy were analyzed, considering the model’s measurement accuracy and pattern adaptability.

3. Validation of the New Model

3.1. Data Collection

The essential elements used in metering natural gas energy can be divided into climate variables, network working variables, and flowmeter working variables. The original dataset used in this paper was collected from the PetroChina Southwest Oil & Gas Field Company, who implement gas field development, gas marketing, pipeline real-time remote monitoring operations, and the allocation of gas field gathering and transportation networks in the Sichuan–Chongqing region.
In this study, a database of working pressure, temperature, and speed of sound for various natural gas compositions was created. The original dataset, used to establish and verify the model, included (i) shale gas from southern Sichuan; (ii) tight gas from the Jurassic Shaximiao Formation; and (iii) conventional natural gas from the Dengying Formation of the Sinian series gas field in central Sichuan. All data were repeatedly verified during the production run. The working conditions during the experiments are listed in Table 2, and the gas components are given in Table 3.
In this study, a total of 1003 samples were collected. The main research hypothesis considered that the external environmental conditions (i.e., humidity, atmospheric pressure, atmospheric temperature) of the measuring points were the average conditions of the study period. Hence, the calorific value of natural gas at a given measurement point could be predicted using the new neural network model in fixed external environmental conditions.

3.2. Validation of Z-Factor Results

According to Equations (2)–(4), Z-factors were required as key parameters for converting the natural gas energy in working conditions to the base condition. Usually, a large-scale measurement station equips an online chromatograph to achieve sampling, testing, and gas composition analysis. After this, equations of state, e.g., AGA8-92DC [31] recommended by ISO 20765-1, GERG-2008 [32] recommended by ISO 20765-2, or thermodynamic equations under some special conditions, are applied to determine the natural gas Z-factors in a central flow computer.
In this section, we employed four improved MLPNNs, including the Gradient Descent (GD) algorithm [33], Conjugate Gradient Descent (CGD) algorithm [34], Levenberg–Marquardt (LM) algorithm [34,35], and Bayesian Regularization (BR) algorithm [36,37], to calculate the Z-factors, with the input data including only the temperature, pressure, and speed of sound collected from the ultrasonic flowmeter. Figure 4 reveals the influence of the number of hidden neurons (Mean Relative Errors (MRE%s) and Root Mean Square Errors (RMSEs) for the training set and test set) used to predict natural gas compressibility.
Mean   Relative   Error   ( MRE )     MRE % = 100 N i = 1 n X MLP , i X real , i X real , i
Root   Mean   Squared   Error   ( RMSE )      RMSE = 1 N i = 1 n X MLP , i X real , i 2
Here, Xreal,i is the real value of the natural gas, XMLP,i is the estimated value, n is the number of testing times, and N is the total number of cases. In Figure 4, X represents the Z-factor. MRE% reflects the mean value of the errors between the estimated value and the real value in finite calculations. The smaller the value, the higher the accuracy of the calculation. Moreover, the RMSE reflects the degree of discretization between the calculated value and the true value. The smaller the value, the smaller the degree of discretization.
Subplot (a) of Figure 4 shows that the MRE and RMSE decreased with the number of neurons in a hidden layer. The smaller the MRE and RMSE, the smaller the error and dispersion of the calculated value, and the better the model calculation result. As a result, the order of the learning results was as follows:
BR algorithm ≈ LM algorithm > CGD algorithm > GD algorithm.
Subplot (b) of Figure 4 shows that the RMSEs of the GD algorithm, CGD algorithm, and BR algorithm were largely independent of the number of hidden layers, while the LM algorithm showed overfitting when the number of neurons in the hidden layers exceeded five. The order of the testing results was as follows:
BR algorithm ≈ CGD algorithm ≈ LM algorithm > GD algorithm (if number of neurons in the hidden layer ≤ 5).
BR algorithm ≈ CGD algorithm > GD algorithm > LM algorithm (if number of neurons in the hidden layer > 5).
Considering the lowest MSE%, the lowest RMSE, the minimum time required (the learning and testing time increased with the number of hidden layer neurons), and the most economical computing memory requirement (the learning and testing memory bank increased with the number of hidden layer neurons), the MLP 3-5-1 network model was chosen for further analysis. In the 3-5-1 MLP structure proposed in this paper, 3 represents the number of input parameters, 5 is the number of hidden layers, and 1 is the output parameter, which represents the Z-factor in this case.
A comparison of the estimated Z-factors and actual Z-factors using the MLP 3-5-1 model for 80% datasets in the network learning process, and for 20% datasets in the network learning process, is shown in Figure 5, using the four different algorithms: GD (a), CGD (b), LM (c), and BR (d). An error distribution plot is a method for demonstrating the distribution of errors around the zero-error line, in addition to showing whether models demonstrate error trends.
In order to analyze the accuracy of all the models more comprehensively, the performance of the developed models in terms of correlation coefficient R, degree of fitting R2, maximum/minimum relative error %, and maximum/minimum |ZMLPZreal| are listed in Table 4.
Relative   Error   ( RE )      RE % = X MLP , i X r e a l , i X r e a l , i × 100
Correlation coefficient for each piece of input data (R):
R = N i = 1 N X r e a l , i X MLP , i i = 1 N X r e a l , i i = 1 N X MLP , i N i = 1 N X MLP , i 2 i = 1 n X MLP , i 2 N i = 1 n X r e a l , i 2 i = 1 n X r e a l , i 2
Degree   of   fitting   ( R 2 )   R 2 = 1 i = 1 N X r e a l , i X MLP , i 2 i = 1 N X MLP , i X ¯ 2
where Xreal,I is the real value of the natural gas, XMLP,I is the estimated value, n is the number of testing times, and N is the total number of cases.
Table 4 shows that the Bayesian Regularization optimization algorithm was the best method, with the highest training/testing/total accuracy. In this study, it successfully predicted almost all the measurements with the training and testing sets, because it regarded weights as Gaussian distributions, eliminating the fixed weight value in a reverse correction. The R and R2 of the total set reached 0.9901 and 0.9801, respectively, and the maximum relative error of the total set was −0.44%.

3.3. Optimization of Calorific Value Calculation

The calorific value of natural gas is one of the most important parameters of energy measurement. Based on Equations (2)–(4), the calorific value under reference conditions should be measured based on accurate determination of the compression factor and calorific value of natural gas under working conditions. Similar to the determination of Z-factors, Figure 6 reveals the influence of numbers of hidden neurons (Mean Relative Errors (MRE%s) and Root Mean Square Errors (RMSEs) for the training set and test set) that were used to predict the natural gas calorific value. It is worth noting that when the MLPNN model was established, the output neuron was the calorific value of the working state of natural gas, and the measurement needed to use Z-factors to convert the working state to the base condition. Therefore, the MLP model should first be used to fit the compression factor under the working state, and then, the heat under the base state.
Subplot (a) of Figure 6 shows that the MRE and RMSE decreased with the number of neurons in the hidden layer, and the order of the learning results was as follows: BR algorithm ≈ LM algorithm > CGD algorithm > GD algorithm.
Subplot (b) of Figure 6 shows that the RMSEs of the GD algorithm, CGD algorithm, and BR algorithm were largely independent of the number of hidden layers, while the LM algorithm also showed overfitting when the number of neurons in the hidden layers exceeded eight. The order of the testing results was as follows:
LM algorithm ≈ BR algorithm ≈ CGD algorithm > GD algorithm (if number of neurons in the hidden layer ≤ 8).
BR algorithm ≈ CGD algorithm > GD algorithm > LM algorithm (if number of neurons in the hidden layer > 8).
In conclusion, we selected for further analysis the MLP 3-8-1 network model. In the 3-8-1 MLP structure proposed in this paper, 3 represents numbers of the input parameters, 8 is the number of hidden layers, and 1 is the output parameter, which was the calorific value in this case. The error distribution plot is shown in Figure 7.
Figure 7 shows that the distribution of other divisions demonstrated that the GD algorithm was not an appropriate model compared to the other models. When looking for an appropriate step size to update the parameters, the gradient direction of the current point was directly selected each time. Therefore, the minimum point obtained this time may not be the minimum value in the direction searched before, which led to slow or even non-convergence.
The Bayesian regularization optimization algorithm performed best in fitting on the whole. In contrast, the normalized test set values showed a relatively low fit of between 0.3 and 0.6 compared with the CGD algorithm, and the normalized test set values showed lower fitness of between 0.6 and 0.8 compared with the LM algorithm. The scattering of the data for the CGD algorithm was near the Y = X line for medium calorific values, and the LM algorithm and BR algorithm had less error scatter for the low and high values.
In order to combine the adaptability of these three algorithms, a diagram of the CDM (Comprehensive Diagram Method) is displayed in Figure 8. Multiple linear regression was established and utilized to determine the optimal coefficients for the CDM model. Therefore, to estimate the calorific value of natural gas, the CDM model was proposed as follows:
CDM = a 1 D C G D + a 2 D L M + a 3 D B R
where a1a3 are the constants of the CDM model, and D is the result of the ANN model. Table 5 presents their values.
In Figure 9, good agreement between the points and the distribution of the prediction errors is shown around the zero-error line in the training and test sets. A good concentration of data at low, medium, and high data for both the training and test data is obvious. The plot shows the excellent performance of the model and its ability to assess the system’s calorific value. Moreover, the performance of the developed models, in terms of correlation coefficient (R), degree of fitting (R2), maximum/minimum relative errors, and maximum/minimum |HMLPHreal|, is given in Table 6.
Comparing the values in the table, BR-MLPNN, as well as the proposed new CDM method, performed better than the other models. The proposed CDM method had the best performance among the intelligent models, with a maximum |HMLPHreal| of less than 0.71 MJ/m3, and BR-MLPNN had sub-excellent performance, with a maximum |HMLPHreal| of less than 0.91 MJ/m3. The R and R2 of the new CDM method indicated that the prediction set reached 0.9710 and 0.9898, and the maximum RE% was 1.9%.

4. Field Application

4.1. Case Description

The new method described in this paper was tested under real working conditions for 20 days. We recorded natural gas component data, instantaneous energy measurement data, and accumulated energy data for 20 days. Volume flow measurement data were recorded every minute, and component data were updated every 6–7 min.
Our main pipe network had a diameter of 813 mm. In order to ensure accuracy, it was divided into three parallel pathways in the metering station, each with DN300. Three ultrasonic flowmeters were equipped and shared with one chromatographic data source. The experiments lasted for 20 days, from 21 September 2022 to 10 October 2022. The average ambient temperature was 288.1 K and the ambient pressure was 95 kPa. The pipe diameter was DN300. The measuring station mainly received gases from the Dengying Formation of the Sinian series gas field located in central Sichuan. Natural gas components were collected from local chromatographic devices, as shown in Table 7. The estimated accuracies of the Z-factor, calorific value, and metering bias of natural gas instantaneous and cumulative energy were taken into consideration.
Figure 10 shows the experimental group and control group. Concise explanations of these techniques are given below:
(1) In the control group, a chromatographic instrument was used to record the natural gas mole fraction to calculate the natural gas calorific value and other thermodynamic properties. Ultrasonic flowmeters, temperature transducers, and pressure transducers were used to record the natural gas volumetric flow under working conditions. The natural gas volumetric flow and energy flow were determined by multiplying the volumetric flow by the calorific value, in the traditional way.
(2) In the experimental group, the metering system contained no chromatographic instruments. Unlike the control group, ultrasonics were used not only to measure natural gas volumetric flow, but also to record sound velocity. The local speed of sound, temperature, and pressure were then introduced into the proposed CDM model to calculate the natural gas calorific value. Consequently, the natural gas energy was estimated using the new method.

4.2. Test Results

The natural gas Z-factors were estimated using the 3-5-1 structure BR-MLPNN method, and the calorific values were estimated using the new proposed CDM method. The results calculated using the NN algorithm are shown in Figure 11.
It can be seen from Figure 11 that the proposed intelligent method was able to effectively estimate the natural gas compressibility and calorific value, with a measurement R2 of over 0.98. The cumulative amount of natural gas energy calculated was compared with the cumulative amount of natural gas energy during the 20 days, as shown in Figure 12.
Compared with the traditional method, the errors of the new intelligent method of each ultrasonic flowmeter were limited; the maximum relative errors were 2.39%, 2.16%, and −2.27%, respectively.
However, as the amount of data in intelligent models is important, more data covering wider ranges can result in a more efficient model and better predictions. For trade purposes, it is necessary to establish a complete traceability system to ensure the fairness of the exchange of goods. Consequently, it is recommended to experimentally measure more data points at a wider range of pressure, temperature, and gas composition values, and to use them for modeling.

5. Conclusions

In this research, 1003 data points were utilized to model the Z-factors and calorific values for the metering of natural gas energy using only an ultrasonic flowmeter. An extensive databank, which included the pressure, temperature, ultrasonic sound velocity, and mole fraction of natural gas, was gathered from different available sources for the Southwest Oil and Gas Field Company. Different intelligent approaches were employed in this study, namely the Gradient Descent algorithm, Conjugate Gradient Descent algorithm, Levenberg–Marquardt algorithm, and Bayesian Regularization algorithm. Then, a Comprehensive Diagram Method (CDM) was developed based on the three best intelligent models to calculate the natural gas calorific value. Theoretical analysis and field tests were carried out, and the outcomes of the study can be summarized as follows:
(1) In the process of predicting Z-factors, the BR-MLPNN 3-5-1 network showed a natural gas Z-factor maximum relative error of −0.44%.
(2) In the process of predicting the calorific values of natural gas, the new proposed CDM method achieved the best fitting effect, with an R of 0.9710. This method had a maximum error of less than 0.7 MJ/m3, and relative error of less than 1.9%.
(3) Field tests showed that the new intelligent model could perfectly predict the accumulation of natural gas energy. The results revealed that the maximum relative error of the daily cumulative amount of natural gas energy was 2.39%. A larger sample for data analysis to continuously improve the NN and a better traceability system will make this new concept applicable to the gas trade.

Author Contributions

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

Funding

This research was funded by the Postdoctoral Research Project of PetroChina Southwest Oil & Gas Field Company, grant number 20220308-08.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The data that were used in this study are confidential.

Acknowledgments

The calculations presented in this paper were made on the basis of real data provided by the PetroChina Southwest Oil & Gas Field Company.

Conflicts of Interest

There are no conflict of interest in the submission of this manuscript, and the manuscript was approved by all authors for publication. I would like to declare on behalf of my co-authors that the work described is original research that has not been published previously, and is not under consideration for publication elsewhere, in whole or in part. All the authors listed have approved the manuscript.

Nomenclature

AbbreviationsDefinitionsUnits
EEnergy flowMJ/h
QVolume flow m3/h
HSuperior calorific value MJ/m3
uAverage flow velocitym/s
APipe cross-sectional aream2
TTemperatureK
pPressurePa
xiNatural gas mole fraction%
ZCompressibility factor (Z-factor)-
tTime travelling for sound wavess
α Installation angle of ultrasonic transducerrad
LDistance between two ultrasonic transducersm
SOSSpeed of soundm/s
Subscript
bBase condition
fWorking condition

References

  1. 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]
  2. Xi, J. Bolstering Confidence and Jointly Overcoming Difficulties to Build a Better World at the general debate of the 76th Session of the United Nations General Assembly. In The Belt and Road Reports; Ministry of Foreign Affairs, The People’s Republic of China: Beijing, China, 2021; pp. 19–21. [Google Scholar]
  3. Xie, M.; Yi, X.; Liu, K.; Sun, C.; Kong, Q. How much natural gas does China need: An empirical study from the perspective of energy transition. Energy 2023, 266, 126357. [Google Scholar] [CrossRef]
  4. International Organization of Legal Metrology. Measuring Systems for Gaseous Fuel; OIML R 140; International Organization of Legal Metrology: Paris, France, 2007. [Google Scholar]
  5. GB/T 18603-2014; Technical Requirements of Measuring Systems for Natural Gas. Standards Press of China: Beijing, China, 2014.
  6. Muhtar, I.; Mengyue, G.; Fang, P.; Aiguo, S.; Jiming, H. Discrimination of natural gas-related bacteria by means of micro-Raman spectroscopy. Vib. Spectrosc. 2016, 82, 44–49. [Google Scholar] [CrossRef]
  7. 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]
  8. Nna-Mvondo, D.; Tobie, G.; Le Menn, E.; Grasset, O. Quantitative study of methane-nitrogen mixed clathrates using gas chromatography and Raman spectroscopy for their detection in icy surfaces of the outer solar system. Icarus 2021, 358, 114182. [Google Scholar] [CrossRef]
  9. Giovannetti, R.; Gambelli, A.M.; Rossi, A.; Castellani, B.; Minicucci, M.; Zannotti, M.; Nicolini, A.; Rossi, F. Thermodynamic assessment and microscale Raman spectroscopy of binary CO2/CH4 hydrates produced during replacement applications in natural reservoirs. J. Mol. Liq. 2022, 368, 120739. [Google Scholar] [CrossRef]
  10. Dąbrowski, K.; Kuczyński, S.; Barbacki, J.; Włodek, T.; Smulski, R.; Nagy, S. Downhole measurements and determination of natural gas composition using Raman spectroscopy. J. Nat. Gas Sci. Eng. 2019, 65, 25–31. [Google Scholar] [CrossRef]
  11. Chibirev, I.; Mazzoleni, C.; van der Voort, D.D.; Borysow, J.; Fink, M. Raman spectrometer for field determination of H2O in natural gas pipelines. J. Nat. Gas Sci. Eng. 2018, 55, 426–430. [Google Scholar] [CrossRef]
  12. Ma, D.; Wu, R.; Li, Z.; Cen, K.; Gao, J.; Zhang, Z. A new method to forecast multi-time scale load of natural gas based on augmentation data-machine learning model. Chin. J. Chem. Eng. Engl. Ed. 2022, 48, 166–175. [Google Scholar] [CrossRef]
  13. Sözen, A.; Arcaklioğlu, E.; Özalp, M. Estimation of solar potential in Turkey by artificial neural networks using meteorological and geographical data. Energy Convers. Manag. 2004, 45, 3033–3052. [Google Scholar] [CrossRef]
  14. Lu, Y.; Tian, Z.; Zhou, R.; Liu, W. Multi-step-ahead prediction of thermal load in regional energy system using deep learning method. Energy Build. 2021, 233, 110658. [Google Scholar] [CrossRef]
  15. Wang, C.; Yuan, J.; Huang, K.; Zhang, J.; Zheng, L.; Zhou, Z.; Zhang, Y. Research on thermal load prediction of district heating station based on transfer learning. Energy 2022, 239, 122309. [Google Scholar] [CrossRef]
  16. Gul, M.; Kalam, M.; Mujtaba, M.; Alam, S.; Bashir, M.N.; Javed, I.; Aziz, U.; Farid, M.R.; Hassan, M.T.; Iqbal, S. Multi-objective-optimization of process parameters of industrial-gas-turbine fueled with natural gas by using Grey-Taguchi and ANN methods for better performance. Energy Rep. 2020, 6, 2394–2402. [Google Scholar] [CrossRef]
  17. Chaki, S.; Biswas, T.K. An ANN-entropy-FA model for prediction and optimization of biodiesel-based engine performance. Appl. Soft Comput. 2023, 133, 109929. [Google Scholar] [CrossRef]
  18. Mahmoud, M.M.; Qurbanov, Z. Review of Fuzzy and ANN Fault Location Methods for Distribution Power System in Oil and Gas Sectors. IFAC-Pap. 2018, 51, 263–267. [Google Scholar] [CrossRef]
  19. Nowak, G.; Rusin, A. Using the artificial neural network to control the steam turbine heating process. Appl. Therm. Eng. 2016, 108, 204–210. [Google Scholar] [CrossRef]
  20. Yazdanshenasshad, B.; Safizadeh, M. Neural-network-based error reduction in calibrating utility ultrasonic flow meters. Flow Meas. Instrum. 2018, 64, 54–63. [Google Scholar] [CrossRef]
  21. Yin, X.; Wen, K.; Wu, Y.; Han, X.; Mukhtar, Y.; Gong, J. A machine learning-based surrogate model for the rapid control of piping flow: Application to a natural gas flowmeter calibration system. J. Nat. Gas Sci. Eng. 2022, 98, 104384. [Google Scholar] [CrossRef]
  22. Qin, L.; Hu, L.; Mao, K.; Chen, W.; Fu, X. Application of extreme learning machine to gas flow measurement with multipath acoustic transducers. Flow Meas. Instrum. 2016, 49, 31–39. [Google Scholar] [CrossRef]
  23. 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]
  24. Shateri, M.; Ghorbani, S.; Hemmati-Sarapardeh, A.; Mohammadi, A.H. Application of Wilcoxon generalized radial basis function network for prediction of natural gas compressibility factor. J. Taiwan Inst. Chem. Eng. 2015, 50, 131–141. [Google Scholar] [CrossRef]
  25. Szoplik, J.; Muchel, P. Using an artificial neural network model for natural gas compositions forecasting. Energy 2023, 263, 126001. [Google Scholar] [CrossRef]
  26. Farzaneh-Gord, M.; Mohseni-Gharyehsafa, B.; Ebrahimi-Moghadam, A.; Jabari-Moghadam, A.; Toikka, A.; Zvereva, I. Precise calculation of natural gas sound speed using neural networks: An application in flow meter calibration. Flow Meas. Instrum. 2018, 64, 90–103. [Google Scholar] [CrossRef]
  27. Azizi, N.; Rezakazemi, M.; Zarei, M.M. An intelligent approach to predict gas compressibility factor using neural network model. Neural Comput. Appl. 2017, 31, 55–64. [Google Scholar] [CrossRef]
  28. Esmaeili, M.; Moradi, M.R.; Afshoun, H.R. A new empirical model and neural network-based approach for evaluation of isobaric heat capacity of natural gas. J. Nat. Gas Sci. Eng. 2022, 102, 104575. [Google Scholar] [CrossRef]
  29. Riazi, M.; Mehrjoo, H.; Amar, M.N.; Riazi, M.; Hemmati-Sarapardeh, A. Modeling the density of acid gases at extensive ranges of pressure and temperature conditions. J. Pet. Sci. Eng. 2021, 207, 109063. [Google Scholar] [CrossRef]
  30. 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]
  31. American Gas Association. AGA8, Compressibility and Super Compressibility Gas and Other Hydrocarbon Gases. In Transmission Measurement Committee Report No. 8, AGA Catalogue No. XQ 1285.; American Gas Association: Arlington, VA, USA, 1992. [Google Scholar]
  32. Kunz, O.; Wagner, W. The GERG-2008 wide-range equation of state for natural gases and other mixtures: An expansion of GERG-2004. J. Chem. Eng. Data 2012, 2012, 3032–3091. [Google Scholar] [CrossRef]
  33. Luo, Y.; Shi, Y.; Cai, N. Chapter 9—Application and Potential of the Artificial Intelligence Technology. In Hybrid Systems and Multi-Energy Networks for the Future Energy Internet; Academic Press: Cambridge, MA, USA, 2019; pp. 217–234. [Google Scholar]
  34. Fan, J.; Zeng, J. A Levenberg–Marquardt algorithm with correction for singular system of nonlinear equations. Appl. Math. Comput. 2013, 219, 9438–9446. [Google Scholar] [CrossRef]
  35. Gonçalves, D.S.; Gonçalves, M.L.N.; Oliveira, F.R. An inexact projected LM type algorithm for solving convex constrained nonlinear equations. J. Comput. Appl. Math. 2021, 391, 113421. [Google Scholar] [CrossRef]
  36. Foresee, F.D.; Hagan, M.T. Gauss-Newton Approximation to Bayesian Learning. In Proceedings of the International Conference on Neural Networks (ICNN’97), Houston, TX, USA, 9–12 June 1997. [Google Scholar]
  37. Byrd, M.; Nghiem, L.H.; Mcgee, M. Bayesian regularization of Gaussian graphical models with measurement error. Comput. Stat. Data. An. 2021, 156, 107085. [Google Scholar] [CrossRef]
Figure 1. Design of the proposed new natural gas energy measurement method: (a) volume flow measurement principle of ultrasonic flowmeter; (b) artificial neural network method for calculating calorific value of natural gas.
Figure 1. Design of the proposed new natural gas energy measurement method: (a) volume flow measurement principle of ultrasonic flowmeter; (b) artificial neural network method for calculating calorific value of natural gas.
Sensors 23 06528 g001
Figure 2. The whole process of model calculation.
Figure 2. The whole process of model calculation.
Sensors 23 06528 g002
Figure 3. Procedure of natural gas energy metering proposed in this study.
Figure 3. Procedure of natural gas energy metering proposed in this study.
Sensors 23 06528 g003
Figure 4. Summary of MRE and RMSE of Z-factors for different structures and for different algorithms of MLP network models for: (a) the training set; (b) the test set.
Figure 4. Summary of MRE and RMSE of Z-factors for different structures and for different algorithms of MLP network models for: (a) the training set; (b) the test set.
Sensors 23 06528 g004
Figure 5. Comparison of the compressibility factor target data against MLPNN outputs for: (a,c,e,g) red dots—training set; (b,d,f,h) blue stars—test set.
Figure 5. Comparison of the compressibility factor target data against MLPNN outputs for: (a,c,e,g) red dots—training set; (b,d,f,h) blue stars—test set.
Sensors 23 06528 g005aSensors 23 06528 g005b
Figure 6. Summary of MRE and RMSE of calorific value for different structures and for different algorithms of MLP network models for: (a) the training set; (b) the test set.
Figure 6. Summary of MRE and RMSE of calorific value for different structures and for different algorithms of MLP network models for: (a) the training set; (b) the test set.
Sensors 23 06528 g006
Figure 7. Comparison of the calorific value target data against the MLPNN outputs for: (a,c,e,g) red dots—training set; (b,d,f,h) blue stars—test set.
Figure 7. Comparison of the calorific value target data against the MLPNN outputs for: (a,c,e,g) red dots—training set; (b,d,f,h) blue stars—test set.
Sensors 23 06528 g007aSensors 23 06528 g007b
Figure 8. The CDM model proposed in this study.
Figure 8. The CDM model proposed in this study.
Sensors 23 06528 g008
Figure 9. Comparison of the calorific value target data against the proposed CDM outputs for: (a) red dots—training data; (b) blue stars—test data.
Figure 9. Comparison of the calorific value target data against the proposed CDM outputs for: (a) red dots—training data; (b) blue stars—test data.
Sensors 23 06528 g009
Figure 10. Schematic diagram of the test group and control group in the field trial: (a) the control group; (b) the test group.
Figure 10. Schematic diagram of the test group and control group in the field trial: (a) the control group; (b) the test group.
Sensors 23 06528 g010
Figure 11. Comparison of normalized error: (a) Z-factors; (b) calorific values.
Figure 11. Comparison of normalized error: (a) Z-factors; (b) calorific values.
Sensors 23 06528 g011
Figure 12. Comparison of results of natural gas energy accumulation of three ultrasonic flowmeters during the test time.
Figure 12. Comparison of results of natural gas energy accumulation of three ultrasonic flowmeters during the test time.
Sensors 23 06528 g012aSensors 23 06528 g012b
Table 1. A detailed report of the proposed MLPNN models.
Table 1. A detailed report of the proposed MLPNN models.
ParameterCompressibilityCalorific Value
Number of input layer neurons33
Number of hidden layers1~91~12
Number of output layers11
Activation function of hidden layersTansigTansig
Activation function of output layersPurelinPurelin
Training data percent80%80%
Test data percent20%20%
Epoch20002000
Table 2. Ultrasonic flowmeter working conditions.
Table 2. Ultrasonic flowmeter working conditions.
Ultrasonic Working Conditions
Atmospheric pressure, kPa94.3~95.0 (average: 94.8)
Ambient Temperature, K281.25~289.33 (average: 284.3)
Ambient Humidity, %RH64.5
Diameter, mmDN 300
Working gauge pressure, kPa2762.2~5583.4
Working temperature, K291.25~309.15
Speed of Sound, m/s402.59~428.75
Table 3. Natural gas components.
Table 3. Natural gas components.
ComponentsMax, %Min, %Average, %SD
CH4, %97.6692.4495.052.66
C2H6, %1.280.050.6651.31
C3H8, %1.290.0020.6461.62
iC4H10, %0.6300.3150.52
nC4H10, %0.6900.3450.22
iC5H12, %0.00200.0010.1
nC5H12, %0.00300.00150.1
nC6H14, %0.3200.160.22
N2, %1.220.670.9451.33
CO2, %2.511.081.7951.76
Calorific value, MJ/m337.6535.7936.243.43
Table 4. Comparison of error analysis of models in calculating Z-factors.
Table 4. Comparison of error analysis of models in calculating Z-factors.
Algorithms RR2Maximum RE%Minimum RE%Maximum |ZMLP − Zreal| Minimum |ZMLP − Zreal|
GDTraining set0.96960.92471.27%0.0026%0.0124 0.0000
Test set0.95620.7856−1.93%0.011%0.0189 0.0001
Total0.96290.8407−1.93%0.011%0.0189 0.0001
CGDTraining set0.98500.9697−0.80%00.0078 0.0000
Test set0.97310.96701.18%0.007%0.0116 0.0001
Total0.97910.96811.18%00.0116 0.0000
LMTraining set0.99180.97630.73%00.0072 0.0000
Test set0.97340.96810.98%0.002%0.0096 0.0000
Total0.98260.97230.73%00.0072 0.0000
BRTraining set0.99190.98710.33%00.0032 0.0000
Test set0.98820.9774−0.44%0.004%0.0043 0.0000
Total0.99010.9801−0.44%00.0043 0.0000
Table 5. The values of constants of CDM.
Table 5. The values of constants of CDM.
Range of Normalized ValuesConstantValue
0–0.3/0.6–1.0a10.0029356
a20.2127399
a30.7843245
0.3–0.6a10.7684462
a20.0192079
a30.2123459
Table 6. Comparison of error analysis of models in calculating the calorific value.
Table 6. Comparison of error analysis of models in calculating the calorific value.
Algorithms RR2Maximum RE%Minimum RE%Maximum |HMLPHreal|, MJ/m3Minimum |HMLPHreal|, MJ/m3
GDTraining set0.84930.7798−4.75%−0.08%1.77 0.03
Test set0.88310.72133.07%−0.06%1.14 0.02
Total0.86620.7441−4.75%−0.08%1.77 0.03
CGDTraining set0.94400.95042.82%01.05 0.00
Test set0.88040.88503.26%01.21 0.00
Total0.91220.92213.26%01.21 0.00
LMTraining set0.93730.89471.78%00.66 0.00
Test set0.80160.84333.22%0.03%1.20 0.01
Total0.89950.87654.22%0.03%1.57 0.01
BRTraining set0.96760.97321.48%00.55 0.00
Test set0.92550.9811−2.44%0.02%0.91 0.01
Total0.96880.9862−2.44%0.02%0.91 0.01
CDM methodTraining set0.98430.99021.02%00.38 0.00
Test set0.93450.98301.90%00.71 0.00
Total0.97100.98981.90%00.71 0.00
Table 7. Natural gas composition, calorific value, relative density, and other parameters.
Table 7. Natural gas composition, calorific value, relative density, and other parameters.
NameMaxMinAverageSD
CH4, %97.841397.834497.83750.89
C2H6, %0.11500.11200.11310.02
C3H8, %0.00240.00230.00230.001
N2, %0.70050.67480.69840.57
CO2, %1.78281.48521.55320.82
Relative density0.68850.68820.68840.06
Superior calorific value MJ/m336.3336.2436.290.19
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

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. https://doi.org/10.3390/s23146528

AMA Style

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(14):6528. https://doi.org/10.3390/s23146528

Chicago/Turabian Style

Dong, Jingya, Bin Song, Fei He, Yingying Xu, Qiang Wang, Wanjun Li, and Peng Zhang. 2023. "Research on a Hybrid Intelligent Method for Natural Gas Energy Metering" Sensors 23, no. 14: 6528. https://doi.org/10.3390/s23146528

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