Abstract

Acceleration-based displacement measurement approach is often used to measure the polish rod displacement in the oilfield pumping well. Random noises and trend terms of the accelerometer signals are the main factors that affect the measuring accuracy. In this paper, an efficient online learning algorithm is proposed to improve the measurement precision of polish rod displacement in the oilfield pumping well. To remove the random noises and eliminate the trend term of accelerometer signals, the ARIMA model and its parameters are firstly derived by using the obtained data of time series of acceleration sensor signals. Secondly, the period of the accelerometer signals is estimated through the Rife-Jane frequency estimation approach based on Fast Fourier Transform. With the obtained model and parameters, the random noises are removed by employing the Kalman filtering algorithm. The quadratic integration of the period is calculated to obtain the polish rod displacement. Moreover, the windowed recursive least squares algorithm is implemented to eliminate the trend terms. The simulation results demonstrate that the proposed online learning algorithm is able to remove the random noises and trend terms effectively and greatly improves the measurement accuracy of the displacement.

1. Introduction

Indicator diagram is an important method to analyze the operating state of the oilfield pumping unit and sucker rod [1, 2]. The vertical motion displacement of polish rod in oil well is an essential part of the indicator diagram. However, the acceleration sensor signals are always mixed with various noises which are mostly composed of random noises and trend terms [24]. The random noises and trend terms errors induce huge integral signal waveform distortion which will greatly reduce the measurement accuracy of the indicator diagram displacement [3, 5]. Improving the measurement accuracy of the indicator diagram displacement is a key problem to be solved.

To solve the problem mentioned above, the morphological filtering algorithm was proposed by Li et al. [6] while a moving average filter algorithm was used by Guo et al. [7, 8] to remove the noises of the acceleration sensor signals. Unfortunately, the performance of the morphological filtering algorithm is closely related to its structural elements and the algorithm is complex which impedes its practical engineering application. Although the moving average filter algorithm is simple and easy to use, the result of noise reduction is poor and the measurement accuracy of displacement measurement are unsatisfactory. In order to eliminate the trend term of the acceleration sensor signal, the commonly used method is firstly using least squares algorithm to fit the trend term dynamically and then using some techniques to remove it [59]. In general, these techniques are batch process methods which are not suitable for real-time application.

Therefore, a real-time online learning-based noise deduction and trend term rejection method is proposed in this work. Firstly, the actual online measurement acceleration sensor signal is analyzed based on online learning method to obtain the autoregressive moving average model (ARMA) and its parameters [8, 10]. Then, the accelerometer signal cycle can be obtained by using the Fast Fourier Transform Rife-Jane frequency estimation method. Secondly, the Kalman filtering techniques are used to eliminate the online measured acceleration signal random noise based on the state-space model parameters from the online learning method result. And then the polish rod displacement can be obtained through quadratic integration. The trend items can be online eliminated in real-time by use of the windowed recursive least squares method.

The structure of this paper is organized as follows. Section 2 introduces the acquisition method of the test signal model based on online learning. In Section 3, the real-time theoretical approaches of removing noise and trend terms of the acceleration sensor signals are presented. Section 4 presents the simulation and experimental results of the measured acceleration signal to validate the effectiveness of the algorithm. Section 5 draws the conclusions.

2. The Test Signal Model Based on Learning Method

In this section, the time series modeling methods of the test signal as well as the Rife-Jane frequency estimation method of the time series model are presented. The frequency estimation method is based on the Fast Fourier Transform. The test signal model and its parameters can be obtained with the help of the two methods.

2.1. Time Series Modeling of the Test Signal

Time series analysis method [1113] is a kind of modern statistical analysis method. The analysis method uses the parametric models to analyze and deal with the observed sequential random signal series. The contents of the time series model include acquisition, statistical analysis (stationary test and correlation analysis), the parametric pretreatment, model selection, model order determination, model coefficients estimation, and the feasibility validation of the model. Among the above contents, the determination of the model order, the estimation of the model coefficients, and the feasibility validation of the model are critical to the time series model.

ARMA can be expressed as follows:where ; . is a random signal time series. is a white noise sequence, and is the model order of autoregressive (AR) model. is the model order of moving average (MA) model. stands for the aggression coefficient of the AR model. is the moving average coefficient.   is the delay operator.

When , the ARMA model (formula (1)) degenerates into the AR model. And the AR model can be expressed as

When , ARMA model (formula (1)) degenerates into the MA model. And the AR model can be expressed as

Obviously, the AR model and MA model can be seen as a special case of the ARMA model. The differences among the three models are the respective characteristics of the model autocorrelation and partial autocorrelation function. AR model has a tailing autocorrelation function and a truncated partial autocorrelation function. MR model has a truncated autocorrelation function and a tailing partial autocorrelation function. The autocorrelation function and the partial autocorrelation function of AMMR model are both tailing. Suppose a stationary time series is drawn; the model type can be determined by the tailing and truncated features of the autocorrelation and partial autocorrelation function. And the model order can be determined based on the AIC criteria.

AIC criteria consider both the interaction between the order and the residual of the model and the effect of the test data series length in the model which provides high accuracy for the estimation. AIC criteria are defined as follows:where is the variance of the fitting residual error. and denote, respectively, the orders of the autoregressive model and the moving average model. is the sample size. According to the value of , , the AIC value was calculated and the , which lead to the minimum AIC value are selected as the order of the model. Once the model order is determined, the model coefficients can be estimated by using the least squares method [8, 10, 14].

The signal time series model according to given time series can be established by using the modeling method. The model can objectively describe the system characteristics. And the model parameter can also be determined.

2.2. Rife-Jane Frequency Estimation Method

The signal frequency can be obtained by use of Fast Fourier Transform (FFT). And the frequency accuracy is affected by the frequency resolution of FFT. If the signal frequency is not the integral multiple of the FFT frequency resolution, the barrier effects of the FFT will cause the spectral leakage, which will decrease the accuracy of the frequency estimation. Rife-Jane frequency estimation method can make up this defect [1517]. The Rife-Jane frequency calculation procedure is as follows.

Let be the -point FFT of the series . In view of the symmetry of the real FFT sequences, only points of the discrete spectrum should be considered. Then, (5) can be obtained:The index values of the discrete frequencies at the maximum amplitude of series can be denoted as . The signal frequency can be estimated with , . And is the FFT frequency resolution, that is, the interval between adjacent spectral lines. When the signal frequency is not exactly an integer multiple of , the actual frequency lies in the FFT main lobe lines between two maximum spectral lines. The maximum spectral line amplitude can be denoted as , and the second largest can be denoted as , . According to , the relative error of the actual frequency and coarse frequency can be obtained:The symbol of formula (6) is based on the left side or right side of the second largest spectral amplitude compared to maximum spectral amplitude. The signal actual frequency can be estimated with this method.

3. Real-Time Elimination Method of the Noise and Trend Terms

In this section, the basic principles of Kalman filtering are described. The method of transforming from ARMA model to the state-space model is proposed. Moreover, the recursive least squares trend terms removal method is discussed.

3.1. Basic Principles of Kalman Filtering

Kalman filtering principle uses the state-space model consisting of the state and observation equations to describe and study the system [1820]. And the principle uses the recursive characteristics of the system state equations to make the best estimate of the system state by use of the recursive algorithm according to the linear unbiased minimum mean square error estimation criteria. It is suitable for online real-time estimation and analysis of the system state for a small amount of computation and storage requirement. However, Kalman filter must be used based on the reasonable state-space model of the studied system to make the best result. So the state-space model must be built strictly based on the specific research system and the specific research aim (such as time variant characteristics or time invariant characteristics). According to the specific state-space model, three recursive filter formulas can be selected. The recursive filter formulas are Kalman filter, Kalman predictor, and Kalman smoother. In this paper, the Kalman filter is selected as the estimation model of the system state.

Let the system state at time be driven by the system noise sequence, . And the driving mechanism can be described as the state equationAnd the measurement of has linear characteristics. The measurement equation of is where is the transition matrix from time to time . is the system noise driven matrix. is the measurement matrix. is the system measurement noise sequence. is the system noise incentives sequences. At the same time, and should meet the following constraints:where is the variance matrix of system noise series, which is a nonnegative matrix. is the variance matrix of the system measurement noise series, which is a negative matrix. By theorem [9], it is assumed that the estimation of the system state satisfies (7). is the measuring amount of which satisfies (8). The system noises matrix and system measurement noises matrix satisfy (9). The system noise variance matrix is a nonnegative matrix. The system measurement noise variance matrix is a negative matrix. And the measuring amount at time is . The estimation of is . can be estimated according to the following recursive procedure:

Equations (7), (8), (9), and (10) are the basic discrete Kalman filter equations. As long as the initial values and are obtained, the state estimate at time () can be recursively obtained based on the measurement at time point . Generally, the initial value can be obtained from the equation , . The numerical values of and are taken based on the engineering experience in the practical engineering applications. Therefore, if the state-space model and associated initial value is known, the Kalman filter recursive formula can be used for the real-time filtering.

3.2. Transform Method from ARMA Model to System State-Space Model

If the test data time series have been obtained, the time series ARMA model can be formed based on the time series modeling. The ARMA model should be transferred to the system state-space model. And then the Kalman filtering state and measurement equations [18, 20] can be established.

The model can be expressed aswhere is the white noise about time, . If , then . If , then . (Note: is a time series that have a zero mean.) Then the above model can be converted into a state-space model:whereThat is, the system state equation is The measurement equation isBased on the above conversion, model can be converted to the corresponding system state-space model. And the Kalman filter recursive formula can be used to filter time series in real time.

3.3. The Recursive Least Squares Method Principle for the Elimination of Trend Term

Linear least squares method [2123] is commonly used in eliminating the line state baseline shift and the trend term of high order polynomial in engineering application. The steps of eliminating the trend term are as follows. First, suppose that the trend term polynomials are established, and the polynomials can be solved with equations listed in the least squares principle. Second, the trend term coefficient matrix and fitting curve can be calculated based on matrix method. Finally, subtracting the trend term fitting curve from the original signal curve can eliminate the trend term error.

Recursive least squares method originates from the least squares method. In this paper, the recursive least squares algorithm is applied to eliminate the trend term. The recursive algorithms are derived as follows.

Suppose is the time series with the sampling interval of ; the -order polynomial, , is used to fit the trend item. Assumewhere is the size of the selected initial test data series. And is the highest order of the fitting polynomial. Equation (16) can be expressed in the form of matrix as where The equation above can be obtained according to the least squares estimation principle:LetThe recursive least squares equation based on the least squares estimation is derived as follows.

Firstly assume new test data is measured, , and it will build a new data series, . So the model parameters should be estimated again. According to the above matrix arrangement form, the least squares estimation equation relative to data can be represented aswhereUsing the subblock matrix multiplication and matrix theory inverse formula can derive the recurrence equation (23) of the recursive least squares method as follows. And the detailed derivation method can be seen in [8]:From (23), it can be seen that , the new estimation of the model parameters, is the correction of the primary estimation, . And the correction term () of the model parameters is the weighted processing of the difference of the new signal () and its estimation. The weighted coefficient is . The current estimation of the new signal data can be expressed asSuppose the first observation data of the test series are known; and can be calculated by using the recursive operation equation (23). , , ,and can be obtained in the same way. Each step estimation result () of the recursive calculation processing is the trend term of the new signal data, , where . The trend term can be eliminated by subtracting the estimation result () from the new signal data ().

4. Simulation and Verification

A semiphysical simulation platform of pumping is built to simulate the working state of the field pumping unit. The online real-time recursive least squares algorithm to eliminate the noise and trend term of the acceleration signal is used to deal with the random noise and trend term. And the polish rod displacement of the semiphysical simulation platform of pumping can be calculated. Data processing can be divided into two phases: online real-time learning phase and eliminating phase of the noise and trend term.

4.1. Online Real-Time Learning Phase

Firstly, an acceleration signals series shall be measured from the semiphysical simulation platform in the online real-time learning phase. Then the time series model and parameters can be obtained by using the time series analysis techniques. Finally, the period of the acceleration signal is obtained by using the FFT transform. The Kalman model parameters, initial value, and signal period are all obtained to eliminate the noise and trend term of the acceleration signal.

A series of acceleration signals are collected from the semiphysical simulation platform. The series are shown in Figure 1 (the zero mean has not been processed). The sampling interval is 50 ms.

The acceleration data in Figure 1 should be stationary pretreated for stationed uncertainty of the signal. The stationary test methods include Data Figure test, autocorrelation test, characteristic root tests, and some other test methods. In this paper, the best test guidelines [24, 25] and nonparametric tests [26] stationary test methods are selected to test the stationarity of the acceleration sensor signal data.

Upon stationary test, it can be found that the acceleration sensor signal in Figure 1 is nonstationary. After a differential operation of the signal, the sequence stationary becomes acceptable. And the acceptable differentiated sequence is shown in Figure 2.

Based on the tailing or truncated characteristics of the autocorrelation function and partial autocorrelation function, the acceleration signal data in Figure 2 can be treated and modeled with the time series model method. And the time series model of differenced acceleration signal data is . The AIC value is −3.7351. The time series model of the initial acceleration signal data is . Let ; the model can be expressed as By substitution of into formula (25), can be expressed as

Using (26) to fit the learning data, the result can be seen in Figure 3.

It can be seen from Figure 3 that the fitting data from the ARIMA model can well fit the original data, which verifies the correctness of the ARIMA model.

Then the built ARIMA model is transformed into the state-space model of Kalman filter. Referring to (14), (15), (16), and (17), it is clear that value is 13. Substituting formula (26) into (12) and (14) obtains the state and measurement equations of Kalman filter. In this paper, and are selected. And the original value is selected as , . By simulation, and are selected in the end.

The denoised signal is zero mean processed. The spectrogram can be obtained by using FFT algorithm. Let the sampling frequency of the signal series be 20 Hz. The subscript and amplitude of the maximum and second maximum amplitude signal point in the spectrogram can be obtained. Then the acceleration signals frequency can also be calculated, 0.2469, by using the frequency estimation method in Section 2.1. So one complete period have 81 points. And the integration and eliminating the trend terms of the acceleration signal are done by adding windows of 81 points in the subsequent signal processing.

4.2. Real-Time Elimination of the Random Noise and Trend Term

The measured acceleration signal is treated with the Kalman filter to eliminate the random noises. And the denoised acceleration signal plot can be seen in Figure 4.

It can be seen from Figure 4 that the glitch of the original data charts disappeared. And the denoises signal chart is smooth. So the majority of the random noise is filtered out.

The displacement is obtained by integrating the acceleration signal with adding windows of 81 points in one complete period. The trend terms of velocity and acceleration signals are eliminated by using the recursive least squares method. Firstly, the integrated acceleration signal can be calculated and the trend terms of acceleration signals are online eliminated in real-time by using the recursive least squares method. The displacement is calculated and the trend terms of velocity signals are online eliminated in real-time in the same way. The acceleration signals are processed one period after another. So the trend terms are eliminated by adding windows of 81 points. In this paper, six-period acceleration signals have been filtered to eliminate the trend terms. The simulation results are shown in Figure 5.

It can be seen that the displacement plot has no trend terms fluctuations among signal periods. The trend terms of velocity and acceleration signals have been eliminated effectively by adding windows of 81 points.

However, the same acceleration signals are also filtered by using the recursive least squares method without adding windows and the simulation results are shown in Figure 6.

It can be seen that the trend terms of velocity are eliminated and the trend terms of displacement are eliminated from the global aspect as well. But the plots of velocity and displacement have obvious fluctuation tendency among adjacent local periods of the curves. The reason is that though the whole signal data of acceleration and velocity have been zero mean treated, the signal data of acceleration and velocity of each period have not been zero mean treated. So there will be some local trend terms of the displacement and velocity among adjacent local periods of the curves. And the displacement measurement error is relatively large.

Comparing the results of the two methods, we can see that the windowed method is more effective in eliminating trend items.

The maximum displacement of pumping rod movement is less than 1.60 m in the semiphysical simulation platform. Using the method studied in this paper combined with period windowing method, selecting the data of six consecutive periods, using Kalman filtering, taking integral operation, and eliminating trend term can obtain the displacement values of each period. And the displacements of each period are shown in Table 1.

Table 1 shows the displacements of each period, that is, the relative displacements between the highest and lowest points. And the relative displacements are very close to the actual values. The relative measurement error is less than 3%. The limit of the indicator diagram displacement error in the actual project is less than 5%. So this result can meet the requirements of the actual project. It also further validates the effectiveness of the real-time method to eliminate the noise and trend term of the acceleration signal.

5. Conclusions

This paper presents a real-time method to remove noises and eliminate trend terms based on online learning method and the platform pumping semiphysical simulation system verifies the feasibility and practicality of the proposed method. The new online real-time method can be summarized as follows. Firstly, the ARIMA model of the acceleration signal is constructed based on the time series analysis method. Secondly, the period of the acceleration signal is calculated by using the Rife-Jane frequency estimation method and the effect on the estimation precision of the acceleration signal period caused by the barrier effect is inhibited. Thirdly, the random noises of the acceleration signal are eliminated by using the Kalman filter algorithm and the recursive least squares method is used to online eliminate in real-time the trend term of the acceleration signal. The experimental results show that this method can effectively remove the noise of the acceleration signal and the trend terms of the displacement. It can control the displacement error within 3% which is 2% less than the actual displacement engineering requirements error (5%). In summary, the new method can greatly improve the measurement accuracy of the dynamometer displacement.

Competing Interests

The authors declare that they have no competing interests.

Acknowledgments

The project was supported by the Department of Education Fund Project of Henan Province, China (Project nos. 12B510037 and 13B510296), by the Department of Science & Technology Fund Project of Henan Province, China (Project nos. 162102210092 and 142102210579), and by the Zhengzhou Administration of Science & Technology Fund Project of Henan Province, China (Project no. 141PPTGG363).