Mathematical Problems in Engineering

Volume 2016, Article ID 2759092, 9 pages

http://dx.doi.org/10.1155/2016/2759092

## Denoising and Trend Terms Elimination Algorithm of Accelerometer Signals

School of Electric and Information Engineer, Zhongyuan University of Technology, Zhengzhou 450007, China

Received 22 December 2015; Accepted 30 March 2016

Academic Editor: Mingcong Deng

Copyright © 2016 Peng Zhang et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

#### 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 [2–4]. 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 [5–9]. 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 [11–13] 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 [15–17]. 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 [18–20]. 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 [21–23] 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.