# The Health Index Prediction Model and Application of PCP in CBM Wells Based on Deep Learning

Authors: Chaodong Tan; Song Wang; Hanwen Deng; Guoqing Han; Guanghao Du; Wenrong Song; Xiongying Zhang
Journal: Geofluids
 (2021)

---

## Abstract

Aiming at the problems of the current production and operation status of the progressive cavity pump (PCP) in coalbed methane (CBM) wells which cannot be timely monitored, quantitatively evaluated, and accurately predicted, a five-step method for evaluating and predicting the health status of PCP wells is proposed: data preprocessing, principal parameter optimization, health index construction, health degree division, and health index prediction. Therein, a health index (HI) formulation was made based on deep learning, and a statistical method was used to define the health status of PCP wells as being healthy, subhealthy, or faulty. This allowed further research on the HI prediction model of PCP wells based on the long short-term memory (LSTM) network. As demonstrated in the study, they can reflect both the change trend and the contextual relevance of the health status of PCP wells with high accuracy to achieve real-time, quantitative, and accurate assessment and prediction. At the same time, the conclusion gives good guidance on the production performance analysis and failure warning of the PCP wells and suggests a new direction for the health status assessment and warning of other artificial lift equipment.


---

## Body

## 1. Introduction

Coalbed methane is a kind of clean energy; it is drained through depressor desorption; when the reservoir pressure is reduced to the desorption pressure of methane, the methane gas in the pores is desorbed, then diffuses and percolates into the wellbore [1–3]. The progressive cavity pump (PCP) is one of the lifting methods in CBM wells. The operation of PCP in CBM wells often fails, resulting in large production losses and short equipment life. Therefore, the monitoring, diagnosis, and early warning of the operation and health status of the PCP in CBM wells have attracted more and more attention from researchers and field engineers. Experience and statistical methods are not possible to evaluate the health status of the pump in the future and perform predictive maintenance. Some scholars thus have put forward some measures on PCP health management based on machine learning methods. For example, Saghir et al. discussed how to use data collected from a data acquisition system to apply data approximation and unsupervised machine learning methods to time series datasets to help analyze PCP performance and detect abnormal pump behavior [4]. Hoday et al. proposed a method based on abnormal monitoring to characterize PCP failures, maximize the information value of monitoring the operating conditions of each well, and minimize operating costs [5]. Saghir et al. proposed to convert the features extracted from time series data into images, which helps to detect abnormal behavior of PCP autonomously [6]. Prosper and West proposed the use of a machine learning framework that can be used to customize each workover configuration to optimize the service life of PCP while considering the heterogeneity and life of wells [7].Due to the large number of parameters collected for CBM, quantitative evaluation of the health status of the PCP cannot be achieved and the evaluation results are not accurate. Some scholars also use some new technologies to manage the health status of the PCP. For example, a tool called the Pressure Actuated Relief Valve (PAR Valve) is used above the PCP to eliminate solids settling during a shutdown [8]. Caballeroa et al. involved in supplying PCP technologies to the Orinoco Belt and have developed the exclusive and patented HR-PCP (hydraulically regulated PCP) technology in order to extend the run life of the conventional PCPs in these fields where the Mean Time Between Failure (MTBF) has shown a sharp decrease in the last few years [9]. In order to achieve continuous decision-making and control of the parameters of PCP wells, taking the maximum cumulative gas production as the optimization goal, a reinforcement learning model with the self-optimization ability and a model framework of the Q learning, Sarsa, Sarsa (lambda) algorithm were proposed [10]. Based on the above technical methods, although the service life of PCP can be prolonged and the output of CBM wells can be increased, real-time evaluation and prediction of the health status of the lifting equipment PCP cannot be carried out.In fact, health status assessment has also been widely studied and applied in other equipment systems. Most of them use current detection data and historical operating data to evaluate the current health status of equipment systems or subsystems [11]. According to the different strategies of constructing the HI curve, it can be divided into two types: direct HI and indirect HI [12]. The former refers to the direct construction of health values with a certain physical significance based on the original monitoring data, guided by experts or empirical knowledge, through simple statistical analysis or feature extraction. Indirect HI is usually obtained by using machine learning methods to fuse or reduce the time domain features or frequency domain features of the sensor. It has no physical meaning and is often called virtual HI (VHI). Among the construction methods of VHI, the most popular is to use dimensionality reduction technology to construct VHI [13, 14]. Some scholars use the Mahalanobis distance to construct VHI [15–17] and use linear data transformation methods to construct VHI by fusing multiple features [18–20]. In the above method of constructing HI, the VHI constructed by dimensionality reduction calculation can best reflect the data change characteristics of the equipment collected and can better reflect the operating conditions of the equipment in real time. The methods of VHI provide a reference for the construction of the PCP health index.Therefore, in view of the real-time evaluation and prediction of the health status of the PCP wells, this paper proposes a method based on deep learning to construct a health index calculation model and prediction model to reflect the before and after trends of the health status of the PCPs and realize the real-time, quantitative, and accurate evaluation and prediction of the health status of the wells.


## 2. Establishment of the HI Model

The health index calculation model is the basis for the analysis and prediction of the production performance of PCP wells. There are many parameters collected in CBM wells, and parameters that have an important impact on the health of PCP wells need to be selected as the principal parameters to form the input variables of the HI calculation model.


### 2.1. Principal Parameter Analysis

There are many parameters collected in CBM wells. However, some of these parameters have the same change trend, and these parameters show a strong correlation. There are also some parameters that cannot characterize whether the PCP fails or the influence of these parameters is small. Therefore, it is necessary to optimize the principal parameters before predicting the failure of the PCP. In this study, Pearson’s correlation coefficient method was used for correlation analysis, and the principal component analysis method was used for principal parameter selection.


#### 2.1.1. Pearson’s Correlation Coefficient

Pearson’s correlation coefficient is also called Pearson’s product-moment correlation coefficient; it is a linear correlation coefficient, denoted asγ, used to reflect the degree of linear correlation between two variables X and Y. The value of γ is between -1 and 1; the larger the absolute value, the stronger the correlation. The calculation formula of γ is
(1)γ=∑i=1nXi−X¯Y−Y¯∑i=1nXi−X¯2∑i=1nYi−Y¯2,where n is the number of samples. i is the serial number of the sample point.The relationship between Pearson’s correlation coefficient and the degree of correlation is shown in Table1.Table 1
Correlation degree.
Pearson’s correlation coefficientCorrelation0.8–1.0Extremely strongly correlated0.6–0.8Strongly correlated0.4–0.6Moderately correlated0.2–0.4Weakly correlated0.0–0.2Very weakly correlated or not correlatedIn this paper, it is stipulated that the correlation coefficient between the production parameters of PCP wells is extremely strong when the correlation coefficientγ is greater than 0.9.


#### 2.1.2. Principal Component Analysis

The principal component analysis (PCA) is a statistical analysis method that reduces the original multiple variables to a few comprehensive indicators. From a mathematical point of view, this is a dimensionality reduction processing technology. There are many parameters automatically collected in PCP wells. Too many inputs will increase the difficulty and complexity of analyzing this problem. Therefore, this paper made use of the correlation between various factors to replace the original multiple influencing factors with the principal components after dimensionality reduction.The input and output are as follows:Input: n′-dimensional sample set D′=x1,x2,⋯,xn′, to be reduced to n-dimensional (where xi represents each parameter, i=1,2,⋯,n).Output: the sample set D after dimensionality reduction.The process of dimensionality reduction algorithm is as follows:(1)
Centralize all samples:xi=xi−1/n∑j=1nxj(2)
Calculate the covariance matrix of the sampleXXT(3)
Perform eigenvalue decomposition on the covariance matrixXXT, and the eigenvalue result is W=w1,w2,⋯,wn(4)
Calculate the weight of each parameter, and the calculation formula isωi=wi/∑i=1nwi×100%. The weight result is Ω=ω1,ω2,⋯,ωn(5)
Set the threshold of the principal parameter. Add the weights of each parameter from large to small. When the weight sum is greater than 95%, it is considered that these parameters can characterize all the features, and the remaining parameters are removed


### 2.2. Health Index Calculation

The health index is a comprehensive indicator reflecting the health status of the PCP wells. Through data preprocessing and principal parameter optimization of the original data,n parameters are selected as the principal parameters for predicting the health status of the PCP wells. First, the principal parameters of all the failure wells are combined, and the PCA method is used to calculate the covariance matrix A of n principal parameters. Diagonalize the covariance matrix to obtain the eigenvalue of the covariance matrix, which is the weight of each principal parameter. Multiply the weights of the n principal parameters and add them together to obtain a comprehensive index that can reflect the health of the PCP, then normalize it to obtain the health index.Assume that the hypothetical dataset is shown in Table2.Table 2
Hypothetical dataset.
Time (t)Principal parameter 1Principal parameter 2⋯Principal parametern0x10x20⋯xn01x11x21⋯xn1⋮⋮⋮⋮⋮m−1x1,m−1x2,m−1⋯xn,m−1The PCA method uses variance to measure the amount of information, and the sample set isX=X1j,X2j,⋯,XnjT0≤j≤m−1, where n is the number of principal parameters, m is t=m at a certain time, and Xnj=xn1,xn2,⋯,xnj. All samples are constructed into an n×m matrix, which is the covariance matrix. Let the covariance matrix be A; then,
(2)A=1m−1∑j=0m−1x1j−x¯1x1j−x¯1∑j=0m−1x1j−x¯1x2j−x¯2∑j=0m−1x2j−x¯2x1j−x¯1∑j=1mx2j−x¯2x2j−x¯2⋯∑j=0m−1x1j−x¯1xnj−x¯n⋯∑j=0m−1x2j−x¯2xnj−x¯n⋮⋮∑j=0m−1xnj−x¯nx1j−x¯1∑j=0m−1xnj−x¯nx2j−x¯2⋮⋮⋯∑j=0m−1xnj−x¯nxnj−x¯n,where xnj is the sample attribute value corresponding to the nth principal parameter in the dataset at t=j. x¯n is the average value of all attribute values of the principal parameter n, where x¯n=∑j=0m−1xnj/m.Let the set of eigenvectors of matrixA be υ, and the eigenvalue corresponding to υ is λii=1,2,⋯,n, so the relationship between the matrix, eigenvalue, and eigenvector can be obtained as
(3)Aυ=λiυ.Construct the eigenvalue formula for solving the eigenmatrix:(4)λiE−A=0,where E is the identity matrix.The principal parameter value input at a certain timet is Xt=x1t,x2t,⋯,xnt; the calculation formula of the composite index (CIt) is
(5)CIt=λXtT,where λ is the eigenvalue vector composed of eigenvalues of matrix A, where λ=λ1,λ2,⋯,λn.The comprehensive index at each moment in theΔT period is calculated as
(6)CI=CI0,CI1,⋯,CIΔT.Normalize the obtained comprehensive index to obtain the health index (HI). The formula for calculating the health index at timet is
(7)HIt=CIt−CIminCImax−CImin.So the health index at each moment in theΔT period is
(8)HI=HI0,HI1,⋯,HIΔT.


### 2.3. Health Degree Division

The health index will show different trends with the severity of the PCP failure. Before predicting the health status, the health status should be divided into different degrees according to the change trend of the health index, namely, health, subhealth, and fault, as shown in Figure1. According to existing data, the range of the health index of health, subhealth, and failure of all sample wells is calculated. According to the statistics of the HI scope of all sample wells, the threshold of HI is obtained as the basis for the failure alarm.Figure 1
Change curve of the health status.The healthy state is the normal operation state of the pump unit, the HI value is close to 1 with little fluctuation, and the production of the CBM well is stable. The pump is running in a subhealthy state due to gas interference, stator swelling, wear, and leakage; the HI value gradually decreases with time; and the gas production continues to decrease. Owing to the gas locking, shaft broken, and serious leakage of the pump, the pump unit runs under the fault condition, the HI value is close to 0, and almost no gas is produced. When different faults occur, the drop rate of HI is different. For example, when the sucker rod is broken, HI will instantly fall to 0, and when the pump is running dry, HI will slowly decrease.


## 2.1. Principal Parameter Analysis

There are many parameters collected in CBM wells. However, some of these parameters have the same change trend, and these parameters show a strong correlation. There are also some parameters that cannot characterize whether the PCP fails or the influence of these parameters is small. Therefore, it is necessary to optimize the principal parameters before predicting the failure of the PCP. In this study, Pearson’s correlation coefficient method was used for correlation analysis, and the principal component analysis method was used for principal parameter selection.


### 2.1.1. Pearson’s Correlation Coefficient

Pearson’s correlation coefficient is also called Pearson’s product-moment correlation coefficient; it is a linear correlation coefficient, denoted asγ, used to reflect the degree of linear correlation between two variables X and Y. The value of γ is between -1 and 1; the larger the absolute value, the stronger the correlation. The calculation formula of γ is
(1)γ=∑i=1nXi−X¯Y−Y¯∑i=1nXi−X¯2∑i=1nYi−Y¯2,where n is the number of samples. i is the serial number of the sample point.The relationship between Pearson’s correlation coefficient and the degree of correlation is shown in Table1.Table 1
Correlation degree.
Pearson’s correlation coefficientCorrelation0.8–1.0Extremely strongly correlated0.6–0.8Strongly correlated0.4–0.6Moderately correlated0.2–0.4Weakly correlated0.0–0.2Very weakly correlated or not correlatedIn this paper, it is stipulated that the correlation coefficient between the production parameters of PCP wells is extremely strong when the correlation coefficientγ is greater than 0.9.


### 2.1.2. Principal Component Analysis

The principal component analysis (PCA) is a statistical analysis method that reduces the original multiple variables to a few comprehensive indicators. From a mathematical point of view, this is a dimensionality reduction processing technology. There are many parameters automatically collected in PCP wells. Too many inputs will increase the difficulty and complexity of analyzing this problem. Therefore, this paper made use of the correlation between various factors to replace the original multiple influencing factors with the principal components after dimensionality reduction.The input and output are as follows:Input: n′-dimensional sample set D′=x1,x2,⋯,xn′, to be reduced to n-dimensional (where xi represents each parameter, i=1,2,⋯,n).Output: the sample set D after dimensionality reduction.The process of dimensionality reduction algorithm is as follows:(1)
Centralize all samples:xi=xi−1/n∑j=1nxj(2)
Calculate the covariance matrix of the sampleXXT(3)
Perform eigenvalue decomposition on the covariance matrixXXT, and the eigenvalue result is W=w1,w2,⋯,wn(4)
Calculate the weight of each parameter, and the calculation formula isωi=wi/∑i=1nwi×100%. The weight result is Ω=ω1,ω2,⋯,ωn(5)
Set the threshold of the principal parameter. Add the weights of each parameter from large to small. When the weight sum is greater than 95%, it is considered that these parameters can characterize all the features, and the remaining parameters are removed


## 2.1.1. Pearson’s Correlation Coefficient

Pearson’s correlation coefficient is also called Pearson’s product-moment correlation coefficient; it is a linear correlation coefficient, denoted asγ, used to reflect the degree of linear correlation between two variables X and Y. The value of γ is between -1 and 1; the larger the absolute value, the stronger the correlation. The calculation formula of γ is
(1)γ=∑i=1nXi−X¯Y−Y¯∑i=1nXi−X¯2∑i=1nYi−Y¯2,where n is the number of samples. i is the serial number of the sample point.The relationship between Pearson’s correlation coefficient and the degree of correlation is shown in Table1.Table 1
Correlation degree.
Pearson’s correlation coefficientCorrelation0.8–1.0Extremely strongly correlated0.6–0.8Strongly correlated0.4–0.6Moderately correlated0.2–0.4Weakly correlated0.0–0.2Very weakly correlated or not correlatedIn this paper, it is stipulated that the correlation coefficient between the production parameters of PCP wells is extremely strong when the correlation coefficientγ is greater than 0.9.


## 2.1.2. Principal Component Analysis

The principal component analysis (PCA) is a statistical analysis method that reduces the original multiple variables to a few comprehensive indicators. From a mathematical point of view, this is a dimensionality reduction processing technology. There are many parameters automatically collected in PCP wells. Too many inputs will increase the difficulty and complexity of analyzing this problem. Therefore, this paper made use of the correlation between various factors to replace the original multiple influencing factors with the principal components after dimensionality reduction.The input and output are as follows:Input: n′-dimensional sample set D′=x1,x2,⋯,xn′, to be reduced to n-dimensional (where xi represents each parameter, i=1,2,⋯,n).Output: the sample set D after dimensionality reduction.The process of dimensionality reduction algorithm is as follows:(1)
Centralize all samples:xi=xi−1/n∑j=1nxj(2)
Calculate the covariance matrix of the sampleXXT(3)
Perform eigenvalue decomposition on the covariance matrixXXT, and the eigenvalue result is W=w1,w2,⋯,wn(4)
Calculate the weight of each parameter, and the calculation formula isωi=wi/∑i=1nwi×100%. The weight result is Ω=ω1,ω2,⋯,ωn(5)
Set the threshold of the principal parameter. Add the weights of each parameter from large to small. When the weight sum is greater than 95%, it is considered that these parameters can characterize all the features, and the remaining parameters are removed


## 2.2. Health Index Calculation

The health index is a comprehensive indicator reflecting the health status of the PCP wells. Through data preprocessing and principal parameter optimization of the original data,n parameters are selected as the principal parameters for predicting the health status of the PCP wells. First, the principal parameters of all the failure wells are combined, and the PCA method is used to calculate the covariance matrix A of n principal parameters. Diagonalize the covariance matrix to obtain the eigenvalue of the covariance matrix, which is the weight of each principal parameter. Multiply the weights of the n principal parameters and add them together to obtain a comprehensive index that can reflect the health of the PCP, then normalize it to obtain the health index.Assume that the hypothetical dataset is shown in Table2.Table 2
Hypothetical dataset.
Time (t)Principal parameter 1Principal parameter 2⋯Principal parametern0x10x20⋯xn01x11x21⋯xn1⋮⋮⋮⋮⋮m−1x1,m−1x2,m−1⋯xn,m−1The PCA method uses variance to measure the amount of information, and the sample set isX=X1j,X2j,⋯,XnjT0≤j≤m−1, where n is the number of principal parameters, m is t=m at a certain time, and Xnj=xn1,xn2,⋯,xnj. All samples are constructed into an n×m matrix, which is the covariance matrix. Let the covariance matrix be A; then,
(2)A=1m−1∑j=0m−1x1j−x¯1x1j−x¯1∑j=0m−1x1j−x¯1x2j−x¯2∑j=0m−1x2j−x¯2x1j−x¯1∑j=1mx2j−x¯2x2j−x¯2⋯∑j=0m−1x1j−x¯1xnj−x¯n⋯∑j=0m−1x2j−x¯2xnj−x¯n⋮⋮∑j=0m−1xnj−x¯nx1j−x¯1∑j=0m−1xnj−x¯nx2j−x¯2⋮⋮⋯∑j=0m−1xnj−x¯nxnj−x¯n,where xnj is the sample attribute value corresponding to the nth principal parameter in the dataset at t=j. x¯n is the average value of all attribute values of the principal parameter n, where x¯n=∑j=0m−1xnj/m.Let the set of eigenvectors of matrixA be υ, and the eigenvalue corresponding to υ is λii=1,2,⋯,n, so the relationship between the matrix, eigenvalue, and eigenvector can be obtained as
(3)Aυ=λiυ.Construct the eigenvalue formula for solving the eigenmatrix:(4)λiE−A=0,where E is the identity matrix.The principal parameter value input at a certain timet is Xt=x1t,x2t,⋯,xnt; the calculation formula of the composite index (CIt) is
(5)CIt=λXtT,where λ is the eigenvalue vector composed of eigenvalues of matrix A, where λ=λ1,λ2,⋯,λn.The comprehensive index at each moment in theΔT period is calculated as
(6)CI=CI0,CI1,⋯,CIΔT.Normalize the obtained comprehensive index to obtain the health index (HI). The formula for calculating the health index at timet is
(7)HIt=CIt−CIminCImax−CImin.So the health index at each moment in theΔT period is
(8)HI=HI0,HI1,⋯,HIΔT.


## 2.3. Health Degree Division

The health index will show different trends with the severity of the PCP failure. Before predicting the health status, the health status should be divided into different degrees according to the change trend of the health index, namely, health, subhealth, and fault, as shown in Figure1. According to existing data, the range of the health index of health, subhealth, and failure of all sample wells is calculated. According to the statistics of the HI scope of all sample wells, the threshold of HI is obtained as the basis for the failure alarm.Figure 1
Change curve of the health status.The healthy state is the normal operation state of the pump unit, the HI value is close to 1 with little fluctuation, and the production of the CBM well is stable. The pump is running in a subhealthy state due to gas interference, stator swelling, wear, and leakage; the HI value gradually decreases with time; and the gas production continues to decrease. Owing to the gas locking, shaft broken, and serious leakage of the pump, the pump unit runs under the fault condition, the HI value is close to 0, and almost no gas is produced. When different faults occur, the drop rate of HI is different. For example, when the sucker rod is broken, HI will instantly fall to 0, and when the pump is running dry, HI will slowly decrease.


## 3. HI Prediction Model

Aiming at the characteristics of CBM well production data and the degree of PCP changes over time, a long short-term memory (LSTM) neural network is selected to establish a HI deep learning model. LSTM is based on the general recurrent neural network (RNN) [21], adding memory units to the neural units of each hidden layer to achieve controllable memory information in time series. It is suitable for processing and predicting important events with relatively long intervals and delays in time series. LSTM is generally an artificial intelligence prediction algorithm based on deep learning.


### 3.1. Principle of LSTM

In order to solve the problem of vanishing gradient and maintain the long-term memory of the hidden layer, the long short-term memory (LSTM) network is improved on the basis of RNN [22]. LSTM uses three “gating” structures to control the state and output at different moments. The short-term memory and long-term memory are combined through the “gating” structure, which can alleviate the problem of gradient disappearance. The expansion of the LSTM structure is exactly the same as RNN in time; the difference lies in the difference of the cell. The cell calculation node of LSTM contains more structures, including update gates, forget gates, and output gates. As shown in Figure 2, the calculation formulas are as follows:
(9)Γft=σWfat⎯1,Xt+bf,c̃t=tanhWcat⎯1,Xt+bc,Γit=σWiat⎯1,Xt+bi,ct=Γft∗ct−1+Γit∗c~t,Γot=σWoat⎯1,Xt+bo,at=Γot∗tanhct.Figure 2
Cell structure of LSTM.Among them,Γft represents the forget gate. If the value of a cell in the forget gate is close to 0, LSTM will “forget” the storage state in the corresponding cell of the previous cell state. If the value of a cell in the forget gate is close to 1, LSTM will mainly remember the corresponding value in the storage state; c̃t represents a candidate value, which is a tensor containing information that may be stored in the cell state at the current time; Γit represents the update gate, which is used to determine which information of candidate value c̃t is added to ct; ct is the record of the current cell state information, and the information is used for transmission in subsequent time steps; the output gate Γot determines which information is used for the prediction of the current time step; at contains the current hidden node information, which is used to pass to the next time step to calculate the value of each gate and for label prediction calculation.By introducing a gating mechanism into the computing nodes of the hidden layer, LSTM naturally overcomes the problem of gradient disappearance in the structure and has more parameters to control the model. By four times the parameter amount of RNN, time series variables can be predicted more finely. The prediction of the equipment health index is a long-term time series information processing process. Therefore, this paper chooses LSTM as the prediction model of HI.


### 3.2. Steps for HI Prediction

The methods of HI model establishment, training, and verification are as follows:(1)
Call the interface to create the model and set the initial parameters. Call the interface on TensorFlow to create an LSTM model; set the number of neural network layers, time series steps, number of neurons, number of training cycles (epochs), batch size, and other hyperparameters; and set the activation function and optimization function(2)
According to the model structure, establish a training set and a test set. According to the LSTM model structure, extract the PCP health index data, set up the time series, segment the sample data according to the set input time length, and create the HI training set and test set. And 80% of the data of each sample well is used for model training, and 20% of the data is used for model testing(3)
For model tuning, through the grid search method, the optimal hyperparameters, activation function, and optimization function of the model are selected(4)
For model training, use thetanh function as the activation function and the Adam function as the optimization function(5)
To verify the model, when evaluating the effect of the health index prediction model, set the prediction total of the model ton, the prediction value to ypre, and the true value to yt. The regression model evaluation indicators in Table 3 can be used to evaluate the accuracy of the model(6)
For model release, use the test set data to evaluate the prediction accuracy of the HI machine learning model. When the accuracy of the prediction result meets the requirements, the model training is completed and released as a formal prediction modelTable 3
Evaluation index of the regression model.
Evaluation indexCalculation formulaCriteriaMean absolute percentage errorMAPE=∑i=1nyt−ypreyt×100nThe smaller the MAPE, the smaller the errorMean absolute errorMAD=∑i=1nyt−yprenThe smaller the MAD, the smaller the errorRoot mean square errorRMSE=1n∑i=1nyt−ypre2The smaller the RMSE, the smaller the error, and the larger the RMSE, the larger the errorTheil’s inequality coefficientTIC=1/n∑i=1nyt−ypre21/n∑i=1nyt2+1/n∑i=1nypre2The closer the TIC value is to zero, the higher the prediction accuracy will be; when it is equal to zero, it means 100% fittingDecisive factorR2=1−∑i=1nyt−ypre2∑i=1nyt−y¯t2R2 is between 0 and 1; the larger the value, the better the model fitting


## 3.1. Principle of LSTM

In order to solve the problem of vanishing gradient and maintain the long-term memory of the hidden layer, the long short-term memory (LSTM) network is improved on the basis of RNN [22]. LSTM uses three “gating” structures to control the state and output at different moments. The short-term memory and long-term memory are combined through the “gating” structure, which can alleviate the problem of gradient disappearance. The expansion of the LSTM structure is exactly the same as RNN in time; the difference lies in the difference of the cell. The cell calculation node of LSTM contains more structures, including update gates, forget gates, and output gates. As shown in Figure 2, the calculation formulas are as follows:
(9)Γft=σWfat⎯1,Xt+bf,c̃t=tanhWcat⎯1,Xt+bc,Γit=σWiat⎯1,Xt+bi,ct=Γft∗ct−1+Γit∗c~t,Γot=σWoat⎯1,Xt+bo,at=Γot∗tanhct.Figure 2
Cell structure of LSTM.Among them,Γft represents the forget gate. If the value of a cell in the forget gate is close to 0, LSTM will “forget” the storage state in the corresponding cell of the previous cell state. If the value of a cell in the forget gate is close to 1, LSTM will mainly remember the corresponding value in the storage state; c̃t represents a candidate value, which is a tensor containing information that may be stored in the cell state at the current time; Γit represents the update gate, which is used to determine which information of candidate value c̃t is added to ct; ct is the record of the current cell state information, and the information is used for transmission in subsequent time steps; the output gate Γot determines which information is used for the prediction of the current time step; at contains the current hidden node information, which is used to pass to the next time step to calculate the value of each gate and for label prediction calculation.By introducing a gating mechanism into the computing nodes of the hidden layer, LSTM naturally overcomes the problem of gradient disappearance in the structure and has more parameters to control the model. By four times the parameter amount of RNN, time series variables can be predicted more finely. The prediction of the equipment health index is a long-term time series information processing process. Therefore, this paper chooses LSTM as the prediction model of HI.


## 3.2. Steps for HI Prediction

The methods of HI model establishment, training, and verification are as follows:(1)
Call the interface to create the model and set the initial parameters. Call the interface on TensorFlow to create an LSTM model; set the number of neural network layers, time series steps, number of neurons, number of training cycles (epochs), batch size, and other hyperparameters; and set the activation function and optimization function(2)
According to the model structure, establish a training set and a test set. According to the LSTM model structure, extract the PCP health index data, set up the time series, segment the sample data according to the set input time length, and create the HI training set and test set. And 80% of the data of each sample well is used for model training, and 20% of the data is used for model testing(3)
For model tuning, through the grid search method, the optimal hyperparameters, activation function, and optimization function of the model are selected(4)
For model training, use thetanh function as the activation function and the Adam function as the optimization function(5)
To verify the model, when evaluating the effect of the health index prediction model, set the prediction total of the model ton, the prediction value to ypre, and the true value to yt. The regression model evaluation indicators in Table 3 can be used to evaluate the accuracy of the model(6)
For model release, use the test set data to evaluate the prediction accuracy of the HI machine learning model. When the accuracy of the prediction result meets the requirements, the model training is completed and released as a formal prediction modelTable 3
Evaluation index of the regression model.
Evaluation indexCalculation formulaCriteriaMean absolute percentage errorMAPE=∑i=1nyt−ypreyt×100nThe smaller the MAPE, the smaller the errorMean absolute errorMAD=∑i=1nyt−yprenThe smaller the MAD, the smaller the errorRoot mean square errorRMSE=1n∑i=1nyt−ypre2The smaller the RMSE, the smaller the error, and the larger the RMSE, the larger the errorTheil’s inequality coefficientTIC=1/n∑i=1nyt−ypre21/n∑i=1nyt2+1/n∑i=1nypre2The closer the TIC value is to zero, the higher the prediction accuracy will be; when it is equal to zero, it means 100% fittingDecisive factorR2=1−∑i=1nyt−ypre2∑i=1nyt−y¯t2R2 is between 0 and 1; the larger the value, the better the model fitting


## 4. Application Results

The real-time production data of 30 PCP failure wells and 6 wells under normal conditions in a coalbed methane block in Australia’s Surat Basin were collected. These data include downhole pressure, fluid level, gas production, water production, current, voltage, torque, tubing pressure, casing pressure, and pump speed. The data acquisition interval is one minute. The failure types of the collected failure wells include 6 types of failure, such as pump ran dry, tubing plugged, stator plugged, tubing broken, connection broken, and pump lost efficiency. The following mainly takes well E001 as an example to perform production characteristic analysis, health index calculation, early warning of failure.


### 4.1. Production Characteristic Analysis of PCP Wells

In the data preprocessing, the original data was deleted (removed noise points) and replaced (missing value processing), and the 10 parameters collected by the CBM well were processed into 8 items. Pearson’s correlation coefficient analysis of these 8 parameters is shown in Figure3.Figure 3
Parameter correlation distribution graph.The lower triangler in the figure represents the correlation coefficient between the two parameters corresponding to the horizontal and vertical coordinates. A positive number indicates a positive correlation between the parameters, and the larger the positive number, the stronger the positive correlation. A negative number indicates a negative correlation between the parameters, and the smaller the negative number, the stronger the negative correlation. The upper triangle represents the corresponding correlation between the two parameters. The closer the slope of the line is to 1, the stronger the positive correlation between the two parameters; the closer the slope of the line is to -1, the stronger the negative correlation between the two parameters.It is defined that the correlation between the two parameters is greater than 0.9, showing a strong correlation. It can be seen from Figure3 that the correlation coefficient between downhole pressure (dh_press) and fluid level (fluid_level) is 0.99, and the correlation coefficient between current (motor_current) and torque (torque) is 1. Therefore, one of the downhole pressure and fluid level and current and torque can be deleted.The principal component analysis is performed on the parameters screened by Pearson’s correlation coefficient, and the weight analysis chart shown in Figure4 is obtained. Each histogram in the figure represents the weight of each parameter, and the line graph represents the sum of the weight of each parameter. It is defined that when the sum of the weights of the parameters is greater than 95%, the parameters obtained can fully represent the characteristics of all parameters.Figure 4
Parameter weight distribution graph.In this study, it can be seen from Figure4 that when the first four parameters of downhole pressure (dh_press), gas production (gas_flow_rate), casing pressure (gas_press), and current (motor_current) are selected, the cumulative weight is greater than 95%. Therefore, these four parameters are selected as the principal parameters in well E001.In order to make the obtained principal parameters adapt to the entire failure wells, the principal parameters of 30 failure wells are statistically analyzed, as shown in Table4.Table 4
Principal parameters of 30 failure wells.
Well_IDPrincipal parameter 1Principal parameter 2Principal parameter 3Principal parameter 4E001dh_pressgas_flow_rategas_pressmotor_currentE002dh_pressgas_flow_rategas_presstubing_pressE003dh_pressgas_flow_rategas_presstubing_pressE004dh_presstubing_press——E005dh_pressgas_flow_rategas_presstubing_pressE006dh_pressgas_flow_rategas_pressmotor_currentE007gas_flow_ratepump_speedwater_flow_ratetubing_pressE008dh_pressgas_pressmotor_currentpump_speedE009dh_pressgas_flow_rategas_presspump_speedE010dh_pressgas_flow_rategas_press—E011dh_pressgas_flow_rategas_presspump_speedE012dh_pressgas_flow_rategas_pressmotor_currentE013dh_pressgas_presswater_flow_ratetubing_pressE014gas_flow_rategas_presspump_speedtubing_pressE015gas_flow_rategas_prestubing_press—E016gas_flow_rategas_presspump_speedtubing_pressE017gas_flow_rategas_pressmotor_currenttubing_pressE018gas_flow_rategas_pressmotor_currentwater_flow_rateE019dh_pressgas_flow_rategas_pressmotor_currentE020gas_flow_rategas_pressmotor_currentwater_flow_rateE021gas_presstubing_pressdh_pressgas_flow_rateE022dh_pressgas_flow_rategas_presspump_speedE023gas_flow_ratetubing_presspump_speed—E024dh_pressgas_presspump_speedtubing_pressE025gas_flow_ratepump_speedwater_flow_ratetubing_pressE026gas_flow_rategas_pressmotor_currentubing_pressE027pump_speeddh_pressgas_flow_ratemotor_currenE028gas_flow_rategas_presstorquetubing_pressE029dh_pressgas_flow_rategas_pressmotor_currentE030dh_presspump_speedwater_flow_ratetubing_pressFrom the analysis of Table4, downhole pressure (dh_press), gas production (gas_flow_rate), casing pressure (gas_press), and tubing pressure (tubing_press) are ranked in the top four for the most cumulative times in all cases. Therefore, these four parameters are selected as the principal parameters.


### 4.2. HI Analysis Results

Using the collected 4 principal parameters of 30 failure wells, a4×30 sample matrix is established, substituting equation (3), and the covariance matrix A applicable to the entire block is calculated as
(10)A=1.00−0.88−0.83−0.03−0.881.000.760.06−0.830.761.00−0.24−0.030.06−0.241.00.From equations (4) and (6), the eigenvalue vector composed of the eigenvalues of matrix A can be obtained:
(11)λ=2.65,1.06,0.10,0.18.The data of 4000 points before and after the failure of well E001 is selected for health index analysis, and the principal parameters change with time, as shown in Figure5. From formulas (5)~(8), the health index before and after the event of the Event_001 well can be calculated. As shown in Figure 6, the health index fluctuated between 0.7 and 1.0 before the failure, and the health index began to decline when the failure occurred, until the lowest value, fluctuating between 0 and 0.2.Figure 5
Four principal parameters of E001.Figure 6
HI of E001.The health index was calculated for 30 failure wells and 6 normal wells. Figure7 shows the health index of 6 failure wells. It can be concluded that when the PCP is operating normally, the health index is between 0.7 and 1. When a failure occurs, the health index will gradually decrease. Therefore, it can accurately reflect the health status of the PCP operation.Figure 7
HI curves of 6 failure wells.
(a)
E001(b)
E002(c)
E003(d)
E004(e)
E005(f)
E006Table5 shows the range of health index variation of 30 failure wells. It shows that the health index of most wells under normal operating conditions is between 0.7 and 1, and the health index under failure conditions is between 0 and 0.4. When the health index is 0.7-1, the PCP is healthy; when the health index is 0.4-0.7, the PCP is subhealthy; when the health index is 0-0.4, the PCP is faulty. Therefore, when the health index is lower than 0.7, a failure warning will be sent and when it is lower than 0.4, a severe warning will be sent.Table 5
HI range of 30 failure wells.
Well_IDHI range in normal conditionHI range in failure conditionWell_IDHI range in normal conditionHI range in failure conditionE0010.8-1.00-0.2E0160.8-1.00-0.4E0020.7-1.00-0.3E0170.8-10-0.1E0030.8-0.10-0.2E0180.8-10-0.2E0040.8-1.00-0.2E0190.6-1.00-0.3E0050.7-1.00-0.3E0200.9-1.00.7-0.8E0060.7-10-0.2E0210.7-10-0.4E0070.8-1.00-0.2E0220.7-10-0.2E0080.7-1.00-0.3E0230.6-1.00-0.3E0090.7-1.00-0.3E0240.7-1.00-0.3E0100.8-10.5-0.7E0250.8-0.10-0.4E0110.8-1.00-0.2E0260.8-10-0.2E0120.8-1.00-0.2E0270.7-0.80.6-0.7E0130.7-10.4-0.6E0280.7-10-0.5E0140.8-10.1-0.3E0290.8-1.00-0.2E0150.7-10-0.2E0300.7-10.5-0.7


### 4.3. HI Analysis of Failure Types

The change trend of the health index curve under different types of working conditions is different. The following three working conditions of normal, tubing broken, and pump ran dry are taken as examples for analysis. The health index is shown in Figures8–10.Figure 8
HI curve of the normal well.Figure 9
HI curve of tubing broken.Figure 10
HI curve of pump ran dry.It can be seen from Figure8 that when the well is operating normally, the health index fluctuates between 0.8 and 1.0, which meets the scope of health index classification; Figures 9 and 10 show the HI curves of two different failures at the same time period.Both mechanism analysis and data analysis have confirmed that tubing broken occurs in an instant, the process is fast, and the change in the health index appears to be a sudden drop; pump ran dry is a slow occurrence, the process is relatively longer, and the change in the health index appears to be a slow decline. This study counts the approximate time required for all wells from the beginning of the failure to the end of the failure according to different types of failures, as shown in Table6.Table 6
Statistics of the failure time range of different failure types.
Failure typeWell_IDFailure time range (minutes)Well_IDFailure time range (minutes)Well_IDFailure time range (minutes)Tubing brokenE0031500E0051000E0061000E0091000E0111200E012100E0131200E0161200E0231400E0241200E0251400——Tubing pluggedE0012200E0101300E0272200Stator pluggedE0023000E0152000E0181000E0191200E0203000E0221200E0261200E0283200E0292500E0301400————Pump ran dryE0073200E0214000E0266000Pump lost efficiencyE0081700E0145000E0142200Table6 demonstrates that the health index not only can accurately represent the real-time health status of the PCP wells but also can be used for fault diagnosis.When the pump is running dry, the time period from the beginning to the complete failure is greater than 3000 minutes, and the time period from the beginning to the complete failure of other failures is less than 3000 minutes. Therefore, the severity of the fault can be judged by analyzing the slowness of the change of the health index curve. If the health index drops suddenly, it can be concluded that this type of fault is a serious fault; if the health index drops slowly, it is a slight failure.


### 4.4. Early Warning of Failure

First, initialize the LSTM neural network parameters randomly and set the number of neural network layers to 2, the time step to 200 minutes, the number of neurons to 8, the number of training cycles (epochs) to 8, and the batch size to 8.Then, use the training data for model training. After the model training is completed, the grid search and the learning curve are drawn on the validation set to obtain the optimal network structure parameters of the LSTM model:epochs=10, batch_size=256, and time_step=200.The number of neurons in the first layer is 64; the number of neurons in the second layer is 16. The change process of the loss function with the training times during the training process is shown in Figure11.Figure 11
Change curve of training set loss with training times.It can be seen from Figure11 that the loss function of the model gradually decreases and tends to zero as the number of training increases. It shows that the LSTM prediction model has no overfitting or underfitting, and the model has good generalization ability and can be used for pumping well power prediction.Figure12 shows the training and prediction effects of the LSTM model.Figure 12
Curve of predicted data versus real data.Table7 shows the LSTM model evaluation results based on the model evaluation method.Table 7
Evaluation result of the LSTM model.
MAPEMADRMSETICR2Training set0.60.0050.0130.0070.98Testing set32.80.0090.0120.0240.98It can be seen that the average percentage errorMAPE of the model on the training set and test set is 0.6 and 32.8, respectively; the average absolute error MAD, root mean square error RMSE, and Theil’s inequality coefficient TIC are all close to 0; and the evaluation coefficient R2 is 0.98 on both the test set and the training set, which is close to 1.Therefore, the LSTM prediction model accurately grasps the trend of the health index change and the correlation before and after and can accurately predict the health status of the PCP wells in real time.


## 4.1. Production Characteristic Analysis of PCP Wells

In the data preprocessing, the original data was deleted (removed noise points) and replaced (missing value processing), and the 10 parameters collected by the CBM well were processed into 8 items. Pearson’s correlation coefficient analysis of these 8 parameters is shown in Figure3.Figure 3
Parameter correlation distribution graph.The lower triangler in the figure represents the correlation coefficient between the two parameters corresponding to the horizontal and vertical coordinates. A positive number indicates a positive correlation between the parameters, and the larger the positive number, the stronger the positive correlation. A negative number indicates a negative correlation between the parameters, and the smaller the negative number, the stronger the negative correlation. The upper triangle represents the corresponding correlation between the two parameters. The closer the slope of the line is to 1, the stronger the positive correlation between the two parameters; the closer the slope of the line is to -1, the stronger the negative correlation between the two parameters.It is defined that the correlation between the two parameters is greater than 0.9, showing a strong correlation. It can be seen from Figure3 that the correlation coefficient between downhole pressure (dh_press) and fluid level (fluid_level) is 0.99, and the correlation coefficient between current (motor_current) and torque (torque) is 1. Therefore, one of the downhole pressure and fluid level and current and torque can be deleted.The principal component analysis is performed on the parameters screened by Pearson’s correlation coefficient, and the weight analysis chart shown in Figure4 is obtained. Each histogram in the figure represents the weight of each parameter, and the line graph represents the sum of the weight of each parameter. It is defined that when the sum of the weights of the parameters is greater than 95%, the parameters obtained can fully represent the characteristics of all parameters.Figure 4
Parameter weight distribution graph.In this study, it can be seen from Figure4 that when the first four parameters of downhole pressure (dh_press), gas production (gas_flow_rate), casing pressure (gas_press), and current (motor_current) are selected, the cumulative weight is greater than 95%. Therefore, these four parameters are selected as the principal parameters in well E001.In order to make the obtained principal parameters adapt to the entire failure wells, the principal parameters of 30 failure wells are statistically analyzed, as shown in Table4.Table 4
Principal parameters of 30 failure wells.
Well_IDPrincipal parameter 1Principal parameter 2Principal parameter 3Principal parameter 4E001dh_pressgas_flow_rategas_pressmotor_currentE002dh_pressgas_flow_rategas_presstubing_pressE003dh_pressgas_flow_rategas_presstubing_pressE004dh_presstubing_press——E005dh_pressgas_flow_rategas_presstubing_pressE006dh_pressgas_flow_rategas_pressmotor_currentE007gas_flow_ratepump_speedwater_flow_ratetubing_pressE008dh_pressgas_pressmotor_currentpump_speedE009dh_pressgas_flow_rategas_presspump_speedE010dh_pressgas_flow_rategas_press—E011dh_pressgas_flow_rategas_presspump_speedE012dh_pressgas_flow_rategas_pressmotor_currentE013dh_pressgas_presswater_flow_ratetubing_pressE014gas_flow_rategas_presspump_speedtubing_pressE015gas_flow_rategas_prestubing_press—E016gas_flow_rategas_presspump_speedtubing_pressE017gas_flow_rategas_pressmotor_currenttubing_pressE018gas_flow_rategas_pressmotor_currentwater_flow_rateE019dh_pressgas_flow_rategas_pressmotor_currentE020gas_flow_rategas_pressmotor_currentwater_flow_rateE021gas_presstubing_pressdh_pressgas_flow_rateE022dh_pressgas_flow_rategas_presspump_speedE023gas_flow_ratetubing_presspump_speed—E024dh_pressgas_presspump_speedtubing_pressE025gas_flow_ratepump_speedwater_flow_ratetubing_pressE026gas_flow_rategas_pressmotor_currentubing_pressE027pump_speeddh_pressgas_flow_ratemotor_currenE028gas_flow_rategas_presstorquetubing_pressE029dh_pressgas_flow_rategas_pressmotor_currentE030dh_presspump_speedwater_flow_ratetubing_pressFrom the analysis of Table4, downhole pressure (dh_press), gas production (gas_flow_rate), casing pressure (gas_press), and tubing pressure (tubing_press) are ranked in the top four for the most cumulative times in all cases. Therefore, these four parameters are selected as the principal parameters.


## 4.2. HI Analysis Results

Using the collected 4 principal parameters of 30 failure wells, a4×30 sample matrix is established, substituting equation (3), and the covariance matrix A applicable to the entire block is calculated as
(10)A=1.00−0.88−0.83−0.03−0.881.000.760.06−0.830.761.00−0.24−0.030.06−0.241.00.From equations (4) and (6), the eigenvalue vector composed of the eigenvalues of matrix A can be obtained:
(11)λ=2.65,1.06,0.10,0.18.The data of 4000 points before and after the failure of well E001 is selected for health index analysis, and the principal parameters change with time, as shown in Figure5. From formulas (5)~(8), the health index before and after the event of the Event_001 well can be calculated. As shown in Figure 6, the health index fluctuated between 0.7 and 1.0 before the failure, and the health index began to decline when the failure occurred, until the lowest value, fluctuating between 0 and 0.2.Figure 5
Four principal parameters of E001.Figure 6
HI of E001.The health index was calculated for 30 failure wells and 6 normal wells. Figure7 shows the health index of 6 failure wells. It can be concluded that when the PCP is operating normally, the health index is between 0.7 and 1. When a failure occurs, the health index will gradually decrease. Therefore, it can accurately reflect the health status of the PCP operation.Figure 7
HI curves of 6 failure wells.
(a)
E001(b)
E002(c)
E003(d)
E004(e)
E005(f)
E006Table5 shows the range of health index variation of 30 failure wells. It shows that the health index of most wells under normal operating conditions is between 0.7 and 1, and the health index under failure conditions is between 0 and 0.4. When the health index is 0.7-1, the PCP is healthy; when the health index is 0.4-0.7, the PCP is subhealthy; when the health index is 0-0.4, the PCP is faulty. Therefore, when the health index is lower than 0.7, a failure warning will be sent and when it is lower than 0.4, a severe warning will be sent.Table 5
HI range of 30 failure wells.
Well_IDHI range in normal conditionHI range in failure conditionWell_IDHI range in normal conditionHI range in failure conditionE0010.8-1.00-0.2E0160.8-1.00-0.4E0020.7-1.00-0.3E0170.8-10-0.1E0030.8-0.10-0.2E0180.8-10-0.2E0040.8-1.00-0.2E0190.6-1.00-0.3E0050.7-1.00-0.3E0200.9-1.00.7-0.8E0060.7-10-0.2E0210.7-10-0.4E0070.8-1.00-0.2E0220.7-10-0.2E0080.7-1.00-0.3E0230.6-1.00-0.3E0090.7-1.00-0.3E0240.7-1.00-0.3E0100.8-10.5-0.7E0250.8-0.10-0.4E0110.8-1.00-0.2E0260.8-10-0.2E0120.8-1.00-0.2E0270.7-0.80.6-0.7E0130.7-10.4-0.6E0280.7-10-0.5E0140.8-10.1-0.3E0290.8-1.00-0.2E0150.7-10-0.2E0300.7-10.5-0.7


## 4.3. HI Analysis of Failure Types

The change trend of the health index curve under different types of working conditions is different. The following three working conditions of normal, tubing broken, and pump ran dry are taken as examples for analysis. The health index is shown in Figures8–10.Figure 8
HI curve of the normal well.Figure 9
HI curve of tubing broken.Figure 10
HI curve of pump ran dry.It can be seen from Figure8 that when the well is operating normally, the health index fluctuates between 0.8 and 1.0, which meets the scope of health index classification; Figures 9 and 10 show the HI curves of two different failures at the same time period.Both mechanism analysis and data analysis have confirmed that tubing broken occurs in an instant, the process is fast, and the change in the health index appears to be a sudden drop; pump ran dry is a slow occurrence, the process is relatively longer, and the change in the health index appears to be a slow decline. This study counts the approximate time required for all wells from the beginning of the failure to the end of the failure according to different types of failures, as shown in Table6.Table 6
Statistics of the failure time range of different failure types.
Failure typeWell_IDFailure time range (minutes)Well_IDFailure time range (minutes)Well_IDFailure time range (minutes)Tubing brokenE0031500E0051000E0061000E0091000E0111200E012100E0131200E0161200E0231400E0241200E0251400——Tubing pluggedE0012200E0101300E0272200Stator pluggedE0023000E0152000E0181000E0191200E0203000E0221200E0261200E0283200E0292500E0301400————Pump ran dryE0073200E0214000E0266000Pump lost efficiencyE0081700E0145000E0142200Table6 demonstrates that the health index not only can accurately represent the real-time health status of the PCP wells but also can be used for fault diagnosis.When the pump is running dry, the time period from the beginning to the complete failure is greater than 3000 minutes, and the time period from the beginning to the complete failure of other failures is less than 3000 minutes. Therefore, the severity of the fault can be judged by analyzing the slowness of the change of the health index curve. If the health index drops suddenly, it can be concluded that this type of fault is a serious fault; if the health index drops slowly, it is a slight failure.


## 4.4. Early Warning of Failure

First, initialize the LSTM neural network parameters randomly and set the number of neural network layers to 2, the time step to 200 minutes, the number of neurons to 8, the number of training cycles (epochs) to 8, and the batch size to 8.Then, use the training data for model training. After the model training is completed, the grid search and the learning curve are drawn on the validation set to obtain the optimal network structure parameters of the LSTM model:epochs=10, batch_size=256, and time_step=200.The number of neurons in the first layer is 64; the number of neurons in the second layer is 16. The change process of the loss function with the training times during the training process is shown in Figure11.Figure 11
Change curve of training set loss with training times.It can be seen from Figure11 that the loss function of the model gradually decreases and tends to zero as the number of training increases. It shows that the LSTM prediction model has no overfitting or underfitting, and the model has good generalization ability and can be used for pumping well power prediction.Figure12 shows the training and prediction effects of the LSTM model.Figure 12
Curve of predicted data versus real data.Table7 shows the LSTM model evaluation results based on the model evaluation method.Table 7
Evaluation result of the LSTM model.
MAPEMADRMSETICR2Training set0.60.0050.0130.0070.98Testing set32.80.0090.0120.0240.98It can be seen that the average percentage errorMAPE of the model on the training set and test set is 0.6 and 32.8, respectively; the average absolute error MAD, root mean square error RMSE, and Theil’s inequality coefficient TIC are all close to 0; and the evaluation coefficient R2 is 0.98 on both the test set and the training set, which is close to 1.Therefore, the LSTM prediction model accurately grasps the trend of the health index change and the correlation before and after and can accurately predict the health status of the PCP wells in real time.


## 5. Conclusions

This study proposed an artificial intelligence-based method for evaluating and predicting the health status of PCP in CBM wells and established a five-step method for failure prediction: data preprocessing, optimization of principal parameters, health index construction, health degree division, and health index prediction.(1)
Through data preprocessing and optimization of principal parameters for 10 production parameters of PCP wells, four principal parameters that are strongly related to the health status of the wells are determined, and a comprehensive index (health index) is constructed. According to the statistics of the HI scope of all sample wells, the health status of PCP wells is characterized by degrees: health (0.7-1.0), subhealth (0.4-0.7), and failure (0-0.4).(2)
Use the long short-term memory (LSTM) neural network to train the sample set to obtain the machine learning model of the health index. This model can accurately predict the health status of PCP wells in real time and can realize early warning of well failures(3)
The health index model and LSTM prediction model in this study can reflect the health status of PCP wells timely and can realize early warning of failure, quantitative evaluation, and accurate prediction of the health status of the PCP in CBM wells



---

*Source: 6641395-2021-04-26.xml*