A kind of oil-field oil pumper oil recovery energy-saving and production-increase optimization method based on BP neural network and SPEA2 algorithm
Technical field
The invention belongs to the control technology of oil pumping machine oil pumping process, particularly a kind of oil-field oil pumper oil recovery energy-saving and production-increase optimization method based on BP neural network and SPEA2 algorithm.
Background technology
Pumping production mainly is comprised of motor, ground drive apparatus and down-hole pumping unit three parts as a kind of mechanical oil production model.
The whole process of pumping production is mainly two strokes in up and down: during upstroke, the horse head suspension point need be mentioned sucker rod string and fluid column, does not carry out at oil pumper under the condition of balance, and motor need be paid very large energy, and at this moment motor is in motoring condition; During down stroke, the oil pumper roofbolt turns and pulls motor acting, makes motor be in the running status of generator.The energy loss of oil pumper in the oil recovery process links is very large, and as the situation of motor low load with strong power, this makes oil pumper have that loading rate is low, system effectiveness is low and the shortcoming such as energy consumption is large.
At present, oil pumper is very high in the occupancy volume in China oil field, but system effectiveness is low, and energy consumption is large, and its Increasing Production and Energy Saving is the major issue that current urgent need solves.The technological parameter of pumping production whether be operated in optimal state be realize Increasing Production and Energy Saving one in simple, effective method, and the foundation of oil pumper model is the key of optimizing ideal technology parameter.
The oil pumper course of work is a Complex Nonlinear System, and its input parameter collection comprises: jig frequency; Maximum load; Minimum load; Effective stroke; Calculate pump efficiency; Working fluid level; Motor armature sample rate current value; Motor armature sample rate current integrated value; Stroke; Active power; Power factor (PF); Back pressure; Casing pressure; Oil pressure; Voltage; Electric current; Rotating speed; Frequency; Water percentage; Wellhead temperature etc.And Output rusults is mainly seen two indexs: power consumption and oil offtake.Like this complicated system, be difficult to one accurately mathematical model go to describe it,
Summary of the invention
The present invention explains a kind of based on the oil-field oil pumper oil recovery energy-saving and production-increase optimization method of BP neural network (being called for short BPNN) with SPEA2 algorithm (strength Pareto evolutionary algorithm), can determine the optimal value of technological parameter; Carrying out actual production according to the technological parameter optimal value after optimizing instructs.Its key is to carry out as follows:
Step 1: add up all to power consumption, the influential original variable S of oil offtake, and therefrom determine in the oil-field oil pumper oil recovery process power consumption, very large S1 decision variable X of oil offtake impact;
Step 2: decision variable and corresponding power consumption, the sample of oil offtake Y in acquisition time T obtain a sample matrix;
Step 3: as input, as output, use the BP neural network algorithm with power consumption, oil offtake Y with decision variable X, to the sample training, check, set up the process model of pumping production;
Step 4: take the BPNN model as the basis, with two output valves of BPNN as fitness function F (i) i=1,2, use the SPEA2 multi-objective Evolutionary Algorithm, decision variable in bound scope separately, is optimized;
Step 5: the S1 after optimizing decision variable X optimal value brought the BPNN model into, calculate two output valve power consumption of model, the oil offtake Y of this moment, compare with sample value mean value, if power consumption reduces, output improves, bring the oil field into, actual production is instructed, otherwise, return to step 1, artificially change S1 decision variable X, again screen decision variable X; Step 6: power consumption reduces, output improves if the S1 of all settings decision variable X combination does not all make, S1=S1+1, then return to step 1.
The process model establishment step of described step 3 pumping production is:
The first step: variable and parameter are set:
X
k=[x
k1, x
k2..., x
kM] (k=1,2 ..., N) being input vector, or claiming training sample, N is the training sample number,
Be that g(g generally is set as 500) weighted vector during inferior iteration between input layer and hidden layer I;
W
JPWeighted vector when (g) being the g time iteration between hidden layer J and output layer;
Y
k(g)=[y
k1(g), y
k2(g) ..., y
kP(g)] (k=1,2 ..., the actual output of network when N) being the g time iteration;
d
k=[d
k1, d
k2..., d
kP] (k=1,2 ..., N) be desired output;
Second step: initialization is assigned to W
MI(0), W
JP(0) random value between each 0 to 1;
The 3rd step: input at random sample X
k, g=0;
The 4th step: to input sample X
k, every layer of neuronic input signal of forward calculation BP network and output signal;
The 5th step: by desired output d
kThe actual output Y that tries to achieve with previous step
k(g), error of calculation E (g) judges whether it meets the demands, and goes to for the 8th step if satisfy; If do not satisfy and went to for the 6th step;
The 6th step: whether judge g+1 greater than maximum iteration time, if greater than going to for the 8th step, if be not more than, to input sample X
k, every layer of neuronic partial gradient δ of backwards calculation;
The 7th step: be calculated as follows weights correction amount W, and revise weights; G=g+1 went to for the 4th step; For example,
Wherein η is learning rate, and g is iterations;
The 8th step: judging whether to finish all training samples, is to finish training, completes modeling, otherwise goes to for the 3rd step.
The optimizing process of described step 4 is:
The first step: initialization, establish evolutionary generation t=0, produce at random the initial rules p of colony of decision variable
0The outside colony of a sky of structure
Wherein, | p
0|=D, V
0=Q, establishing T is maximum evolutionary generation;
Second step: fitness assignment, calculate p
tAnd V
tThe fitness F (i) of middle individuality;
The 3rd step: environmental selection, utilize the environmental selection mode that provides to carry out environmental selection;
The 4th step: end condition, if the difference of t<T or maximum adaptation degree value and average fitness value and average fitness value ratio continued for the 5th step less than 5%;
Otherwise, end iteration, V
t+1In non-domination individuality be the Pareto optimal solution set;
The 5th step: mating is selected, and uses scale-of-two competitive bidding match to select V
t+1In individuality enter the mating pond;
The 6th step: genetic manipulation, to individual restructuring and the mutation operation of using in the mating pond, the new individuality of generation enters p
t+1, t=t+1 returns to second step.
The invention has the beneficial effects as follows: the non-linear mapping capability of BP neural network (BP neural network, BPNN) is strong, is applicable to solve the nonlinear system modeling problem.For this reason, employing BPNN determines the mapping relations of technological parameter and Increasing Production and Energy Saving index, sets up the mapping model of pumping production process;
Then use evolution algorithm strength Pareto evolutionary algorithm 2 (the Strength Pareto evolutionary algorithm2 with intelligent characteristic, SPEA2) mapping model is searched for, the best ideal point of search Increasing Production and Energy Saving, the optimal value of definite technological parameter accordingly; Carrying out actual production according to the technological parameter optimal value after optimizing instructs.
Description of drawings:
Fig. 1 is FB(flow block) of the present invention.
Embodiment
A kind of oil-field oil pumper oil recovery energy-saving and production-increase optimization method based on BP neural network and SPEA2 algorithm, carry out as follows:
Step 1: add up all to power consumption, the influential original variable S of oil offtake, and therefrom determine in the oil-field oil pumper oil recovery process power consumption, very large S1 decision variable X of oil offtake impact;
From parameter set: jig frequency; Maximum load; Minimum load; Effective stroke; Calculate pump efficiency; Working fluid level; Motor armature sample rate current value; Motor armature sample rate current integrated value; Stroke; Active power; Power factor (PF); Back pressure; Casing pressure; Oil pressure; Voltage; Electric current; Rotating speed; Frequency; Water percentage; Filter out 5 in wellhead temperature in all parameters power consumption, oil offtake affected very large decision variable:
Preferred 5 decision variable X are: jig frequency, and maximum load, minimum load, effective stroke calculates pump efficiency.
Step 2: decision variable and corresponding power consumption, the sample of oil offtake Y in acquisition time T obtain a sample matrix;
Step 3: as input, as output, use the BP neural network algorithm with power consumption, oil offtake Y with decision variable X, to the sample training, check, set up the process model of pumping production, the process model establishment step is:
The first step: variable and parameter are set:
X
k=[x
k1, x
k2..., x
kM] (k=1,2 ..., N) being input vector, or claiming training sample, N is the training sample number,
Be that g(g generally is set as 500) weighted vector during inferior iteration between input layer and hidden layer I;
W
JPWeighted vector when (g) being the g time iteration between hidden layer J and output layer;
Y
k(g)=[y
k1(g), y
k2(g) ..., y
kP(g)] (k=1,2 ..., the actual output of network when N) being the g time iteration;
d
k=[d
k1, d
k2..., d
kP] (k=1,2 ..., N) be desired output;
Second step: initialization is assigned to W
MI(0), W
JP(0) random value between each 0 to 1;
The 3rd step: input at random sample X
k, g=0;
The 4th step: to input sample X
k, every layer of neuronic input signal of forward calculation BP network and output signal;
The 5th step: by desired output d
kThe actual output Y that tries to achieve with previous step
k(g), error of calculation E (g) judges whether it meets the demands, and goes to for the 8th step if satisfy; Noly just went to for the 6th step.
D namely
kAnd Y
k(g) subtract each other, and judge that its absolute difference whether less than predefined threshold value, satisfies condition less than threshold value;
The 6th step: whether judge g+1 greater than maximum iteration time, if greater than going to for the 8th step, if be not more than, to input sample X
k, every layer of neuronic partial gradient δ of backwards calculation;
The 7th step: be calculated as follows weights correction amount W, and revise weights; G=g+1 went to for the 4th step; For example,
Wherein η is learning rate, and g is iterations;
The 8th step: judging whether to finish all training samples, is to finish training, completes modeling, otherwise goes to for the 3rd step.
Step 4: take the BPNN model as the basis, with two output valves of BPNN as fitness function F (i) i=1,2, use the SPEA2 multi-objective Evolutionary Algorithm, decision variable in bound scope separately, is optimized, optimizing process is:
The first step: initialization, establish evolutionary generation t=0, produce at random the initial rules p of colony of decision variable
0The outside colony of a sky of structure
Wherein, | p
0|=D, V
0=Q, establishing T is maximum evolutionary generation;
Second step: fitness assignment, calculate p
tAnd V
tThe fitness F (i) of middle individuality;
The 3rd step: environmental selection, utilize the environmental selection mode that provides to carry out environmental selection;
The 4th step: end condition, if the difference of t<T or maximum adaptation degree value and average fitness value and average fitness value ratio continued for the 5th step less than 5%; Otherwise, end iteration, V
t+1In non-domination individuality be the Pareto optimal solution set;
The 5th step: mating is selected, and uses scale-of-two competitive bidding match to select V
t+1In individuality enter the mating pond;
The 6th step: genetic manipulation, to individual restructuring and the mutation operation of using in the mating pond, the new individuality of generation enters p
t+1, t=t+1 returns to second step.
Step 5: 5 decision variable X optimal values after optimizing are brought the BPNN model into, calculate two output valve power consumption of model, the oil offtake Y of this moment, compare with sample value mean value, if power consumption reduces, output improves, bring the oil field into, actual production is instructed, otherwise, return to step 1, artificially change 5 decision variable X, again screen decision variable X;
Step 6: power consumption reduces, output improves if all artificial 5 decision variable X combinations setting all do not make, 6 decision variable X combinations setting, then return to step 1, if 6 decision variable X combinations do not improve effect yet, 7 decision variable X combinations, so circulations setting.