Abstract
In the oil production process, some oil pumps exist in the light load running and empty pumping problems, which result in the waste of electric energy. In order to realize the oil pumping energy saving optimal control by adopting oil pumping start-stop intermittent control scheme, an intelligent energy saving optimal control system based on genetic algorithm and wavelet neural network is proposed in this paper. The Morlet wavelet is adopted as the activation function of neural network and builds the wavelet neural networkandthe structure and parameters of the wavelet neural network which are chromosome encoded, and the genetic algorithm is used to optimize the connection weights and the scale parameters in order to improve the generalization ability and the approximation ability of neural networks. The parameters of effective oil pumping energy saving optimal control are measured using multisensors. The system is used in the oil production plant; the test data show that the oil pumping energy conservation effect is obvious.
1. Introduction
The cost of oil production mainly comes from oil pumping unit energy consumption; so, in the oil production process, the study for oil pumping energy saving is very important and necessary [1, 2].
In the process of oil exploitation, the well liquid level is gradually decreased. Because oil pumping common extraction capacity is greater than the actual load of the oil well, oil pumping can appear as “long light load” and “empty pumping” phenomenon. This not only reduces the motor power factor, increasing oil pumping of invalid stroke, which is a large amount of electric energy waste, but also makes the oil pumping equipment loss and repair costs increase.
In fact, the effective oil pumping energy saving method is to dynamically control the oil pumping stop time which can attain the energy saving. Oil pumping start and stop interval controlling method includes manual control and automatic control. For manual control, the oil pumping stop interval is directly turned on and stopped by the experienced workers or manual timing to start or stop the oil pumping running [3]. The manual control method can achieve energy savings at a certain extent, but there are some existing problems. When the stop interval is longer, it affects the oil production, when the stop interval is shorter, oil pumping liquid filling degree is low and the pump empty pumping phenomenon still exists; thereby, at a certain extent, waste energy is still existent.
Due to the underground oil production being extremely complex, the system of oil production is a nonlinear system with strong load disturbance. It is difficult to establish accurate mathematical mode. It is difficult to meet the control requirements using classical control theory [4].
The wavelet neural network is a neural network combined with wavelet analysis theory and artificial neural network, namely, replacing the sigmoid function with the wavelet function [5]. Wavelet neural network has good time-frequency property, multiscale resolution, stronger approximation capability, and stronger fault-tolerant ability; it can solve the traditional neural network learning convergence speed slowly, which is easy to fall into local minimum and over fitting problems; so it is applied widely [6–10]. However, the wavelet neural network method has the shortcoming that the hidden layer node is not easy to determine; it usually adopts the trial and error method, but the convergence speed is slow and difficult to find optimal solutions. Genetic algorithm is a kind of widely used optimum algorithm which has some advantages such as the parallel and highly efficient search [11]. In order to solve the existing problems of wavelet neural network, the genetic algorithm is introduced to the wavelet neural network, from the genetic wavelet neural network; the genetic wavelet neural network has a fast response speed and high control precision, and it is suitable for solving intelligent control problems. So the genetic wavelet neural network is applicable to oil pumping intelligent energy saving control.
2. Genetic Wavelet Neural Network
2.1. Wavelet Neural Network
The wavelet is a wave whose length is finite; the average is 0, and the wavelet function is obtained by a mother wavelet function through translation and scaling. The wavelet neural network replaces the sigmoid function which, in the traditional neural network with nonlinear wavelet basis function, through the nonlinear wavelet translation and the linear superposition with scaling factor, is to complete signal expression. The output of the network is the linear superposition of the chosen wavelet base; namely, the output of the output layer is a linear neuron output.
To ∀ψ ∈ L2(R), if
here, the ψ(t) is called a basic wavelet or wavelet mother function.
The continuous wavelet generated by the wavelet mother function ψ(t) is as follows:
Here, ψ a,b (t) is continuous wavelet obtained by dilation and translation of the ψ(t), a is the scaling parameter, and b is the translation parameter. For different application fields, one can choose a different a and b value.
Wavelet transform of signal f(t) ∈ L2(R) is defined as follows:
Based on the discrete wavelet transform principle, in the Hilbert space, select a wavelet mother function ψ(xt − 1,xt − 2,…,xt − q) and make it satisfy the admissibility condition
Here,
The wavelet basis function can be obtained by doing the dilation, translation, and rotational transform to the ψ(xt − 1,xt − 2,…xt − q). Consider
Here, a(a≠0, a ∈ R) is the scaling coefficient and
The rotating vector is defined as follows:
When properly selecting the scaling coefficient a, the translation parameter b and rotation parameter θ and the
Here, f ∈ L2, A, and B are known as the frame bounds. When A = B, the frame
The wavelet neural network structure is shown in Figure 1. The activation functions of single hidden layer neuron are the wavelet basis functions
or
Here, w ij ′ is the weight between input layer and the hidden layer nodes, w j is the weight between hidden layer and the output layer nodes, and ψ i (·) is the hidden layer nodes output value.

The wavelet neural network structure.
2.2. Genetic Wavelet Neural Network
2.2.1. Genetic Algorithm
Genetic algorithm (GA) is an adaptive heuristic search algorithm that simulates natural evolution ideas. Randomly generate an initial population, using the fitness function to evaluate the individuals. High fitness individuals execute reproduction-crossover-mutation operation and form a new population which is the optimal selection of the next generation. This process is repeated to obtain the global optimal solution.
In this paper, the genetic algorithm use decimal code instead of binary encoding to direct characterization parameters which can enhance the speed and computational accuracy of the algorithm.
For the crossover operation, execute crossover operation for two stochastic individuals according to the crossover probability P c , and two new individuals are generated by the following formula:
Here, r ∈ (0, 1) is a random number.
For the mutation operation, execute mutation operation for some individual according to the mutation probability P m , and a new individual is generated by the following formula:
Here, u and v are the boundary values of the parameters to be optimized; r ∈ (0, 1) is a random number.
The adaptation function is given as follows:
Here, the Dmax can be the maximum value E of evolutionary process; E is the object function.
2.2.2. Genetic Wavelet Neural Network
The genetic algorithm and wavelet neural network organically, form the genetic wavelet neural network, namely, adopting genetic algorithm to optimize the structure and parameters of wavelet neural network [12, 13].
The GA regards the number of wavelet basic function n, the weights between input layer and the hidden layer node w ij ′, the weights between hidden layer and the output layer node w j , scaling coefficient a j , the translation parameter b j , and the rotation parameter θ j as an individual; individual code consists of 6 parts, as shown in Figure 2.

Individual code.
In the initialization phase, produce a large number of individuals, which are called group colony.
In order to guarantee the stability and the convergence of the algorithm, in the GA selection operation, the best preserved selection mechanism is adopted.
The steps of optimizing the structure and parameters of wavelet neural network can be described as follows.
Step 1. Initialization: set the parameters of the genetic algorithm, such as individual code length, the population size M, the number of iterations T, crossover probability P c , and mutation probability P m .
Step 2. Randomly generate N groups initial network weights and parameters n (the number of the wavelet basis function), w ij ′, w j , a j , b j , and θ j from different real interval, as the initial population. Decode the number of hidden layer nodes n; generate the corresponding neural network structure. Decode the rest of the individual string; generate initial weights of neural network, scaling coefficient, translation parameter, and rotation parameter.
Step 3. Train these N groups initial weights and parameters n, w ij ′, w j , a j , b j , and θ j separately using gradient falling algorithm; if there is at least one group satisfying the accuracy requirement after training, then the algorithm ends or else turn to Step 4.
Step 4. Define the numeric value range, respectively, according to the upper and lower limit of the N groups network weight and parameters n, w ij ′, w j , a j , b j , and θ j which have been preliminary trained; randomly generate r × N groups new network weights and parameters in the numeric value range; these new weights and parameters n, w ij ′, w j , a j , b j , and θ j in conjunction with the N groups trained weights and parameters compose a complete gene group colony; there are (r + 1) × N groups network weight and parameters.
Step 5. According to the formula (12), calculate the fitness value of each individual. According to the fitness value, execute reproduction, crossover, and mutation genetic operation on the (r + 1) × N groups weights and parameters and get the next generation colony.
Step 6. If there is at least one group weight and parameters which can satisfy the accuracy requirement after Step 5, the algorithm ends and gets the optimal wavelet network structure and parameters; else, select N groups better weights and parameters from the (r + 1) × N, and turn to Step 3.
The algorithm flow is showed in Figure 3.

Flow chart of genetic wavelet network.
3. Energy Saving Intelligent Control
3.1. Analysis of Oil Pumping Factor
Oil pumping machine is divided into the ground and underground two parts. The ground device includes the dynamic force and the balance part of oil pumping which is composed of the pumping rod strain, fluid production, oil pumping current, oil pumping voltage, and active power. The underground part includes oil pumping and corresponding penalty door. The depth of underground oil well is about thousands of meters; the small space in the well and oil pumping machine is generally in the work; direct measurement liquid filling degree is very difficult. Oil pumping structure and energy saving control effect factors are shown in Figure 4.

Oil pumping energy saving control effect factors.
The working efficiency is an important performance index which is used to evaluate the efficiency of oil pumping, improve the efficiency of pumping, reduce energy consumption, and make work efficiency maintained at a reasonable level. The factors affecting the work efficiency include geological factors, equipment factors, and work methods [2].
Work efficiency is the ratio of effective power and motor input power [14]. Consider
Here, η is the work efficiency, Q is the oil well production fluid volume, P is the input power of motor, H is the effective lift height, H d is the depth of liquid level, p o and p t are, respectively, the pressure of oil tube and casing, and ρ is the liquid density.
The theoretical formula for calculating pump output is expressed as follows:
Here, A is piston cross-sectional area, S is stroke, and n is the frequency of the stroke.
The energy saving problem of oil pumping is to enhance the work efficiency η up to the hilt. Work efficiency is an important performance index used to evaluate the efficiency of oil pumping system; in order to improve the efficiency of pumping system and reduce the energy consumption, the work efficiency must be maintained at a reasonable level. The work efficiency directly reflects whether the performance of the pump and the pumping parameters is appropriate.
The work efficiency is decided by the working status of the oil pumping. Now, the control of pumping unit stroke S is more difficult; so temporary fixed stroke S and the oil pumping controllable working state include two parts; one is the oil pumping stop time t, and another is the oil pumping work frequency f. Oil pumping stop time and the oil pumping work frequency are affected by the following parameters: oil well output speed V, the oil well liquid level depth H d , and the oil pump fullness D.
The oil pump fullness D can be directly determined by measuring the oil rod tension F t , fluid production Q, oil pumping current I, oil pumping voltage V, and active power P a . On the other hand, the direct measurement of oil production rate is difficult; through field investigation, the following parameters influence the oil production rate; they are reservoir porosity ϕ, permeability γ, the remaining oil Q r , oil reservoir pressure F r , oil viscosity μ, oil tension σ, water flooding pressure F w , and water flooding rate Q w . According to the oil production rate, the oil level and the oil pump fullness degree, the oil pumping working state can be controlled; so the oil pumping work efficiency can be enhanced and the electric energy of pumping will be saved.
3.2. Control System Structure
Oil pumping energy saving control is very complicated nonlinear system in the oil exploitation. So the genetic wavelet neural network internal model control is adopted to solve the oil pumping energy saving problem [15–18]. The internal model control model is shown in Figure 5.

Oil pumping energy saving control model.
Two of the same genetic wavelet neural networks M−1 and M constitute the oil pumping energy saving control systems. The M is the state estimator of the controlled object, which can be used fully to approach the controlled object dynamic model. The M−1 is the controller of the system. The controller M−1 is not directly learning the controlled object's inverse dynamic model, but it is indirectly learning the inverse dynamic characteristics of the controlled object, using state estimator model as the training object. The M and controlled object are arranged in parallel; their difference is delivered to the input end through the feedback effect, through a linear filter processing, into the controller M−1; the output of M−1 is the input of the controlled object. After several trainings, the controller M−1 will indirectly learn inverse dynamic characteristics of the controlled object, and the system error tends to zero.
3.3. Establish State Estimator M
The network structure of state estimator M consists of three layers, including input layer, one hidden layer, and output layer. The input layer of M has 7 neurons that are the oil pumping stop time t, the oil pumping work frequency f, the porosity ϕ, the oil viscosity μ, the water flooding pressure F w , the water flooding rate Q w , and the oil rod tension F t . The output layer of M has 2 neurons that are the fluid production Q and oil pumping current I; the ratio (fluid production/oil pumping current) is the pumping work efficiency η = Q/I.
The state estimator M model is established by using the genetic wavelet neural network.
The output of genetic wavelet neural network is expressed as follows:
Here, w
j
is the weight between the hidden layer nodes and the output layer nodes and
When wavelet neural network structure and parameters are optimized by using the genetic algorithm and the corresponding sample data, the state estimator M model is obtained as follows:
3.4. Establish Controller
The network structure of controller M−1 consists of three layers, including input layer, one hidden layer, and output layer. The input layer of M−1 has 7 input neurons that are the porosity ϕ, oil viscosity μ, water flooding pressure F w , water flooding rate Q w , the oil rod tension F t , the amount of feedback of fluid production dQ which is the error of the system output and the desired output, and the amount of feedback of oil pumping current dI. The controller M−1 has 2 output neurons that are the oil pumping stop time t and the oil pumping work frequency f which are the controlled variables of the controlled object.
The controller M−1 model is also established by using the genetic wavelet neural network. When wavelet neural network structure and parameters are optimized by using the genetic algorithm and the corresponding sample data, the controller M−1 model is obtained as follows:
3.5. Control Process
First, the M model is trained offline using GA and the collected sample data; when the M model is stable, we can obtain the controlled object input-output properties. The network parameters of the trained M can be taken as the initial parameters of the M−1. Then the M−1 is trained using the back-propagation error obtained by the M model. When the controller works, the controller M−1 can be trained and revised online.
The working process of control system, the oil rod tension F t , fluid production Q, viscosity μ, water flooding pressure F w , oil pumping current I, and so forth parameters are correspondingly connected to different sensors. For the controlled variable, the stop time t and the work frequency f are, respectively, connected to 2 controllers. If the oil rod tension F t , fluid production Q, oil pumping current I, and so forth parameters are changing, the corresponding sensors can timely detect the change and input these change to M−1 controller, which can obtain the oil pumping stop time t and the oil pumping work frequency f through the network computing and further obtain the oil pumping work efficiency η through the M model. If the η also cannot meet the expected effect, the M−1 controller can be trained online using the error between the output of M−1 and the expected output until obtaining the expected effect. These show that the oil pumping stop time and the oil pumping work frequency can be real-time controlled through the controller M−1 and several different sensors [19, 20].
4. Application Research
In order to make the control system work efficiently, firstly, we want to collect a lot of training samples and testing samples. For the state estimator M, through a lot of oil field pumping experiments, we can obtain large numbers of relations between the oil pumping stop time t, the oil pumping work frequency f, porosity ϕ, oil viscosity μ, water flooding pressure F w , water flooding rate Q w , the oil rod tension F t , the fluid production Q, and oil pumping current I; then, we can get many group training samples, and every training sample is composed of 7 inputs and 2 outputs.
For the controller M−1, through a lot of oil field pumping experiments, we can obtain large numbers of relations between the porosity ϕ, oil viscosity μ, water flooding pressure F w , water flooding rate Q w , the oil rod tension F t , the amount of feedback of fluid production dQ, the amount of feedback of oil pumping current dI, the oil pumping stop time t, and the oil pumping work frequency f; then, we can get many group training samples, and every training sample is composed of 7 inputs and 2 outputs.
The collected samples are divided into training samples and testing samples, and all samples are normalized. In the VC++ integrated development environment, the corresponding algorithm programs are written in C++. Because Morlet wavelet is an often used wavelet in the analysis of geophysical processes and fluid turbulence, so, in this paper, the Morlet wavelet is used as the activation function of genetic wavelet neural network.
The Morlet wavelet is shown as follows:
The Fourier transform is as follows:
From the formula (19), we can see that when ω = 0, the
The corresponding Fourier transform is as follows:
Collect 200 sample data in oil production plant and choose 120 groups of data from 200 samples as the training set; the remaining 80 groups of data are the test set. The training set and test set data are normalized in [0, 1] range. Based on the actual sample data, using genetic algorithm to optimize the structure of wavelet neural network and the corresponding parameters, determine the number of hidden layer basis function is 5. The genetic wavelet neural network structure is 7–5–2.
In order to show the advantages and feasibility of the genetic wavelet neural network, we use BP network, wavelet neural network, and the genetic wavelet neural network to control the oil pumping stop time t and the oil pumping work frequency η real-time. The structure of BP network, wavelet neural network, and the genetic wavelet neural network is the same. For BP network, the transfer function of the hidden layer and output layer is used as sigmoid function. For wavelet neural network and the genetic wavelet neural network, the hidden layer uses the Morlet wavelet function. At the same time, the evolutionary population size of the genetic wavelet neural network is 60, evolutionary iterations are 200, the crossover probability P c is 0.75, and the mutation probability P m is 0.2. The system error of three kinds of model is 0.001. The iteration times of three kinds of model are 2000. The error curve of three models learning is shown in Figure 6.

BP network, WNN, and GA-WNN are three kinds of model learning curves.
From Figure 6, we can see that after 1400 times of training, the BP network can obtain convergence; the WNN can obtain convergence after 560 times training, and the GA-WNN can obtain convergence after roughly 300 times of training. In the training process, BP network causes oscillatory phenomena, because the BP network has the local minima problem. Meanwhile, the WNN also has smaller oscillation problem. The genetic wavelet neural network has good convergence and no oscillation. Therefore, the convergence rate and the control precision of the genetic wavelet neural network control model are superior to BP and WNN. The genetic wavelet neural network can avoid the local minimum value and find the optimal solution quickly.
In order to further show the advantage of genetic wavelet neural network, the 200 samples data are randomly divided into 4 groups and each group has 50 samples of data. In each group, 30 samples of data are training samples and the remaining 20 samples are testing samples. After the sample data are normalized, the BP network, wavelet neural network, and the genetic wavelet neural network, respectively, use 4 groups of different training samples to train 4 times; then, the corresponding 4 groups testing samples are used for testing. The final training error is the average value of 4 times training error. The final testing error is the average value of 4 times testing error. The results of training and testing by BP network, wavelet neural network, and the genetic wavelet neural network are shown in Table 1.
Contrast of training and test results by BP network and wavelet neural network and genetic wavelet neural network.
From Table 1, for the training sample, the genetic wavelet neural network mean square error is smaller than that of the wavelet neural network and BP network. The BP network mean square error is the largest. For the testing sample, the genetic wavelet neural network mean square error is also smaller than that of the wavelet neural network and BP network, and the BP network mean square error is also the largest. For the average iterations, under the same system error, the genetic wavelet neural network iteration number is the least, the second is the wavelet neural network, and the BP network iteration number is the most. These show that the genetic wavelet neural network is all superior to the wavelet neural network and BP network at the control precision and convergence rate aspects. So the control system based on the genetic wavelet neural network has higher stability and faster real-time control speed.
After the use of energy saving control system, according to oil pumping system efficiency and electricity consumption changes, the energy saving effect of energy saving control system can be a quantitative analysis. The efficiency comparison by before and after use control system is shown in Tables 2 and 3. Measured data are pumping the liquid producing capacity, power consumption, power, and system efficiency.
System efficiency comparison for well W1.
System efficiency comparison for well W2.
From Table 2, we can see that the power consumption is 105.3 KWh. System efficiency is 10.3%, before the use of energy saving control system. After using the energy saving control system, the power consumption is 87.2 KWh. System efficiency increased to 15.2%. Thus, the use of oil pumping control system and power consumption decreased significantly; the efficiency of the system significantly improved. From Table 3, we can see that the liquid producing capacity of well W2 is relatively low which belongs to the low productivity of oil well, but, after using the energy saving control system, the power consumption is to reduce; the efficiency of the system is improved, which shows that this control system has good energy saving effect.
5. Conclusion
In order to solve the problem of energy consumption of oil pumping, adopt the “intermittent start-stop operation” mode for oil pumping, using the genetic wavelet neural network to realize intelligent control. Because the wavelet neural network has good time-frequency property, multiscale resolution, stronger approximation capability, and stronger fault-tolerant ability, the genetic algorithm is a kind of widely used optimum algorithm which has some advantages such as the parallel and highly efficient search. Genetic algorithm and wavelet neural network can organically give full play to their respective advantages, convergence speed, and control precision which is obviously improved. Therefore, the oil pumping energy saving control system based on the genetic wavelet neural network can improve the control accuracy and speed to a large extent. The control system effectively solves the problem of oil pumping relatively light load running. In practical application, the good energy saving effect is achieved.
Conflict of Interests
The authors declare that there is no conflict of interests regarding the publication of this paper.
Footnotes
Acknowledgments
This work is supported in part by the National Natural Science Foundation of China under Grant no. 40674028, the National High Technology Research and Development Program of China (863 Program) under Grant no. 2013AA013202, and the Funding Project for Academic Human Resources Development in Beijing Union University no. 11101501105.
