Beam-pumping unit stroke estimation method based on generative adversarial model denoising
Through the generation of adversarial model denoising technology, the problem of noise and missing of oil pump data is solved, the accuracy and adaptability of stroke calculation is improved, and the error problem of oil pump working condition detection in oil fields is solved.
Patent Information
- Application Number
- CN202310725016.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-19
- Publication Date
- 2024-12-20
AI Technical Summary
The working condition detection of oil pumps in the oil field is difficult to accurately carry out, mainly because the data collected by the acceleration sensor contains noise and missing, resulting in large errors in stroke calculation, which affects oil field output and equipment wear.
Using a denoising method based on the generation of adversarial models, data is collected through the acceleration sensor, a generative adversarial model is established, and the acceleration signal is denoised by the generator and discriminator, and noise-free data is generated by combining the physical model. The generator is trained to improve denoising. ability to reduce noise error.
It significantly improves the accuracy of stroke data, reduces calculation errors, provides more reliable data support, and enhances adaptability to multiple working conditions.
Smart Images

Figure CN119166985A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of signal processing, and in particular to a method for estimating the stroke of a beam pumping unit based on generating adversarial model denoising. Background Art
[0002] During the oilfield production process, due to the dynamic changes of underground reservoirs and the influence of sand, wax, gas and other factors in various oil layers on the working conditions of the downhole pipes, rods and pumps of the pumping units, it is difficult to accurately detect and manage the working conditions of the pumping units. However, the management work such as whether the pumping units can operate stably and timely monitoring and troubleshooting of faults seriously affects the output of the oilfield on the one hand, and is also related to the wear of the equipment and the consumption of electricity on the other hand.
[0003] One of the main means of monitoring the pumping unit is to analyze and interpret the indicator diagram. The indicator diagram is a closed curve, with the horizontal axis being the donkey head stroke and the vertical axis being the load. The curve of the indicator diagram represents the relationship between the donkey head stroke of the pumping unit and the load on the donkey head. Because the donkey head reciprocates up and down, the curve of the indicator diagram is a closed shape. The lower left corner of the closed curve is the bottom dead center position. The rod is pulled upward for an upward stroke, and then the stroke and load increase at the same time. It runs counterclockwise along the indicator diagram to the upper right corner, reaches the top dead center, and then starts to perform a downward stroke until the bottom dead center, thus constituting a reciprocating motion of the donkey head. Because the closed curve on the indicator diagram represents the movement position of the donkey head and the load force, the area enclosed by the closed curve represents the work done by the donkey head in a reciprocating motion. According to the work done by the donkey head in the reciprocating motion, the working state of the deep well pump can be reflected. Therefore, it is very important to accurately measure the stroke position of the donkey head for the analysis of the working condition of the pumping unit.
[0004] At present, there are three ways to measure the donkey head stroke in oil fields: angular displacement, dead point switch and acceleration sensor measurement. Among them, the measurement of angular displacement uses an angular displacement sensor installed on the walking beam of the oil pump. The angle change measured by the angular displacement sensor is used as the angle, and the distance from the center axis of the oil pump to the sucker rod is used as the radius. The arc length obtained by the product of the angle and the radius is the displacement of the light rod, which is the donkey head stroke. The dead point switch uses a Hall non-contact proximity switch (probe) and is triggered by a magnetic field. It is a position signal transmitter. The dead point switch is installed at the lower dead point position of the oil pump's light rod. The light rod displacement is indirectly measured based on the data measured in one stroke cycle of the light rod, which is the donkey head stroke. The acceleration sensor measurement method collects the acceleration at the suspension point by mounting an acceleration sensor at the suspension point of the walking beam oil pump, and then integrates the acceleration data twice over time to obtain the suspension point displacement, which is then mapped to the donkey head stroke. In the above schemes, the data collected by the sensor mostly contains noise, and there will be data missing during the collection process. After filtering the collected data, filtering errors will be introduced, and the error of the result calculated by the algorithm will also be large. In view of the noise influence of the collected signal, the present invention adopts the acceleration sensor measurement method for the stroke monitoring task of the walking beam pumping unit, and denoises the collected acceleration signal data based on the generative adversarial model, thereby greatly improving the accuracy of the stroke data calculated by the algorithm. Summary of the invention
[0005] In view of the above problems, the purpose of the present invention is to provide a method for estimating the stroke of a beam pumping unit based on generative adversarial model denoising. The method proposes to collect acceleration sensor data at the suspension point of the beam pumping unit, establish a generative adversarial model to realize denoising of the original noisy data, and thus calculate the stroke of the beam pumping unit, thereby reducing the stroke calculation error caused by data acquisition loss and noise error.
[0006] The technical solution adopted by the present invention to achieve the above-mentioned purpose is:
[0007] A method for estimating the stroke of a beam pumping unit based on generative adversarial model denoising comprises the following steps:
[0008] 1) The acceleration data at the suspension point of the beam pumping unit is collected through the acceleration sensor, and the acceleration data is processed through the WIA-PA chip;
[0009] 2) Preprocess the acceleration data to obtain single-cycle acceleration data;
[0010] 3) Building a generative adversarial model;
[0011] 4) The generator in the generative adversarial model is used to convert the single-cycle data into denoised data, and the single-cycle data before denoising is used as noisy data and marked as a false sample;
[0012] 5) Model the acceleration physical model of the beam pumping unit, and calculate the noise-free data using the physical model and mark it as a true sample;
[0013] 6) Combine the noisy data and its corresponding labeled false samples with the noise-free data and its corresponding labeled true samples to create a dataset, and use the dataset to train a generative adversarial model;
[0014] 7) Use the generator in the trained generative adversarial model to denoise the single-cycle data, and calculate the denoised data to obtain the stroke.
[0015] The step 2) comprises the following steps:
[0016] 2.1) Convert the acceleration signal data into real acceleration data, i.e. acceleration x with actual physical meaning;
[0017]
[0018] Where x is the true acceleration, is the collected and processed acceleration signal, g is the gravity acceleration, m and h are the attribute values of the device itself;
[0019] 2.2) Smoothing out the abnormal data in the real acceleration data x:
[0020] From the time t in the data, if the data of n consecutive time points is greater than the maximum set threshold, then the n consecutive data are abnormal data, and the n data are modified into new n interpolated data, and the interpolated data are:
[0021]
[0022] Among them, x t is the acceleration data value at time t, i is the i-th time point among n consecutive time points, i is less than or equal to n;
[0023] 2.3) Find the maximum point in the smoothed data and divide the data into single-cycle acceleration data according to the maximum point.
[0024] The step 2.3) comprises the following steps:
[0025] 2.3.1) Calculate the average value of the real acceleration data x as the minimum threshold for maximum value selection;
[0026] 2.3.2) Perform discrete Fourier transform on the real acceleration data x to obtain the frequency spectrum of the data, and take the inverse of the frequency value corresponding to the maximum energy in the frequency spectrum as the estimated period;
[0027] 2.3.3) Select the maximum point in the real acceleration data x, that is, the points before and after this point are both smaller than this point, as the candidate maximum point, and remove the candidate points smaller than the minimum threshold;
[0028] 2.3.4) Sort the maximum candidate points in chronological order, and calculate the time interval between two adjacent points in sequence. If the time interval is less than half of the estimation period, the latter point is considered to be an erroneous candidate point caused by noise or signal fluctuation, and the point is removed from the candidate points;
[0029] 2.3.5) After each candidate point is removed, step 2.3.4) is repeated until all the maximum candidate points have been screened, thereby obtaining all the maximum points in the real acceleration data x;
[0030] 2.3.6) Use the maximum point as the dividing point to divide the real acceleration data x, thereby obtaining multiple single-cycle acceleration data a.
[0031] The generative adversarial model consists of a generator G and a discriminator D, where:
[0032] The generator G includes an encoder and a decoder, wherein the encoder includes three convolution layers with convolution kernels of 7×1, 5×1, and 3×1 connected in sequence and two parallel fully connected layers connected after the convolution layer with a convolution kernel of 3×1; the decoder includes three deconvolution layers with convolution kernels of 3×1, 5×1, and 7×1 connected in sequence;
[0033] The discriminator D includes three convolutional layers with convolution kernels of 7×1, 5×1, and 3×1 connected in sequence, and two fully connected layers connected in sequence after the convolutional layer with a convolution kernel of 3×1.
[0034] The generative adversarial model performs the following steps:
[0035] The encoder passes the noisy data through three layers of convolution operations with convolution kernels of 7×1, 5×1, and 3×1, and then passes them through two parallel fully connected layers to obtain the expectation and variance respectively, and then multiplies the variance by a Gaussian distribution random value with a (0, 1) distribution. Finally, the expectation and variance are added to obtain the sampled feature data, and the encoder completes the encoding;
[0036] The decoder passes the sampled feature data through three layers of deconvolution operations with convolution kernels of 3×1, 5×1, and 7×1. Each layer of deconvolution has the corresponding convolution layer output features in the encoder to supplement the deconvolution operation output features. The decoder completes decoding and outputs denoised data.
[0037] The discriminator passes the denoised data through three layers of convolution and then connects two layers of fully connected layers. The output of the first fully connected layer is 256 dimensions, and the output of the second fully connected layer is 2 dimensions. The corresponding inference results are 0 or 1, that is, the input signal of the inference discriminator is false or true.
[0038] The step 5) comprises the following steps:
[0039] 5.1) Within the parameter setting range of the acceleration physical model of the beam pumping unit, multiple sets of parameters are uniformly and randomly selected, and multiple sets of noise-free data are generated through the acceleration physical model of the beam pumping unit;
[0040] 5.2) Set the labels of the generated multiple sets of noise-free data to true.
[0041] The step 6) comprises the following steps:
[0042] 6.1) Combine the noisy data and the noise-free data to create a data set, where the label of the noisy data in the data set is false, represented by 0; the label of the noise-free data in the data set is true, represented by 1;
[0043] 6.2) Divide the data set into training set, verification set and test set;
[0044] 6.3) Use the training set to train the discriminator k times, and use the validation set to test the prediction effect of the discriminator D;
[0045] 6.4) After k discriminator trainings, fix the discriminator D parameter θ d ;
[0046] 6.5) Use single-cycle noisy data to train the generator G;
[0047] 6.6) Repeat steps 6.3) to 6.5) until the cost functions of the discriminator and the generator are both less than the set small threshold, and the probability that the data generated by the generator G is judged as true by the discriminator D is greater than the large threshold.
[0048] The step 6.3) comprises the following steps:
[0049] 6.3.1) The value function v of training the discriminator D d :
[0050] v d =E z,a (logD(z)+log(1-D(G(a)))
[0051] Where E represents the expected value, z represents the noise-free data, a represents the obtained single-cycle noisy data, D(·) represents the value predicted by the discriminator D, and G(·) represents the data generated by the generator G;
[0052] 6.3.2) The parameter update gradient of the discriminator D during training is Discriminator parameters θ d Add to the original parameters where γ d is the learning rate of the discriminator.
[0053] The step 6.5) comprises the following steps:
[0054] 6.5.1) The value function v of training generator G g :
[0055] v g =E a (log(1-D(G(a)))
[0056] 6.5.2) Generator G parameters θ g Update the gradient to Generator parameter θ g Subtract the original parameter where γ g is the learning rate of the generator.
[0057] The step 7) comprises the following steps:
[0058] 7.1) Continuously collect the acceleration signal data on site and pre-process it to obtain single-cycle acceleration data;
[0059] 7.2) Pass the single-cycle acceleration data through the generator G to obtain denoised data;
[0060] 7.3) Perform a time integration on the denoised data to obtain the velocity v:
[0061]
[0062] Among them, x t Represents the acceleration value at time t in the theoretical single-cycle acceleration data, i=1~T, T is the number of all data in one cycle, Δt is the time interval between adjacent data points of the acceleration data, that is, the time interval for the device to sample the signal;
[0063] 7.4) Calculate the stroke corresponding to the first half of a cycle, and the ideal speed v i Perform another time integration, with the integration range being the first half of the cycle, that is,
[0064]
[0065] Among them, T 1 / 2 is the dividing point between the first half of a cycle and the second half of a cycle, s 1 is the stroke corresponding to the first half cycle;
[0066] 7.5) Calculate the stroke corresponding to the second half of a cycle, and the ideal speed Perform another time integration, with the integration range being the second half of the cycle, that is,
[0067]
[0068] Among them, s 2 is the stroke corresponding to the second half cycle;
[0069] 7.6) The final stroke value s of the beam pump is the average of the two half-cycle strokes:
[0070]
[0071] The present invention has the following beneficial effects and advantages:
[0072] 1. The acceleration sensor of the present invention collects the preprocessing process of the acceleration signal of the walking beam pumping unit. The algorithm is simple and only uses first-order linear smoothing and discrete Fourier transform to complete the extraction and preprocessing of single-cycle raw acceleration signal data at a very low computing power cost.
[0073] 2. The method for removing acceleration signal noise based on the generative adversarial model of the present invention uses the noise-free data generated by the walking beam pumping unit acceleration physical model as the object for the generator to learn and fit when training the generator's denoising ability, which greatly improves the generator's denoising ability and makes the characteristic distribution of the denoised data as consistent as possible with the characteristic distribution of the noise-free data, thereby improving the quality of the denoised data and providing reliable data for accurate stroke calculation.
[0074] 3. The acceleration noise-free data in this aspect is generated by the physical model of the walking beam pump acceleration. The model parameters are selected within a reasonable range, thereby generating different noise-free data. However, these noise-free data are all reasonable, but they correspond to different working conditions of the walking beam pump. The generator that generates adversarial training with the noise-free data under these different parameter working conditions as the target can have better generalization for various working conditions. BRIEF DESCRIPTION OF THE DRAWINGS
[0075] Figure 1 is a flow chart of the method of the present invention;
[0076] Figure 2 A structural diagram of a generator for generating a confrontation model of the present invention;
[0077] Figure 3 This is a diagram of the discriminator structure of the generative adversarial model of the present invention;
[0078] Figure 4A comparison diagram of an original single-cycle data signal of the present invention and a denoised signal obtained by passing the data signal through a generator;
[0079] Figure 5 This is a comparison chart of the stroke measured in the field, the stroke calculated by the original signal, and the stroke calculated by this patent. DETAILED DESCRIPTION
[0080] The present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. According to the following description, the advantages and features of the present invention will be clearer. It should be noted that the drawings are in a very simplified form and use non-precise proportions, which are only used to conveniently and clearly assist in explaining the purpose of the embodiments of the present invention. In order to make the purposes, features and advantages of the present invention more obvious and easy to understand, please refer to the accompanying drawings. It should be noted that the structures, proportions, sizes, etc. illustrated in the drawings of this specification are only used to match the contents disclosed in the specification for people familiar with this technology to understand and read, and are not used to limit the limiting conditions for the implementation of the present invention, so they have no technical substantive significance. Any structural modification, change in proportional relationship or adjustment of size, without affecting the effects that the present invention can produce and the purposes that can be achieved, should still fall within the scope of the technical content disclosed by the present invention.
[0081] like Figure 1 The flowchart of the method of the present invention is as follows. The present invention provides a method for estimating the stroke of a beam pumping unit based on generative adversarial model denoising, which specifically includes the following steps:
[0082] Step 1: The acceleration sensor collects acceleration signal data of the suspension point of the beam pumping unit;
[0083] Step 1.1 Install the acceleration sensor at the suspension point of the beam pumping unit;
[0084] Step 1.2: collecting acceleration signals at the suspension point of the beam pumping unit through an acceleration sensor;
[0085] Step 1.3 Process the acceleration signal through the WIA-PA chip to obtain the processed acceleration signal data
[0086] Step 2 performs data preprocessing on the processed acceleration data to obtain single-cycle acceleration data; specifically:
[0087] Step 2.1: convert the acceleration signal data into real acceleration data, i.e. acceleration x with actual physical meaning, through a conversion formula;
[0088]
[0089] Where x is the true acceleration, This is the acceleration signal collected and processed in step 1. g is the acceleration due to gravity, which is 9.8 N / m. 2 , m and h are attribute values of the device itself. Specifically, in this embodiment, the values are: m=0.000217653301838, h=1.42668178026.
[0090] Step 2.2 performs smoothing on the abnormal data in the real acceleration data x. Starting from time t in the data, if the data of n consecutive time points is greater than the maximum set threshold, then the n consecutive data are abnormal data, and the n data are modified into new n interpolated data, and the interpolated data are:
[0091]
[0092] Wherein, i is less than or equal to n, and the interpolation method is first-order linear interpolation;
[0093] Step 2.3: Find the maximum point in the smoothed data, and divide the data into single-cycle acceleration data according to the maximum point. The specific method is:
[0094] Step 2.3.1 First calculate the average value of data x as the minimum threshold for maximum value selection;
[0095] Step 2.3.2: Perform discrete Fourier transform on the data x to obtain the frequency spectrum of the data, and take the inverse of the frequency value corresponding to the maximum energy in the frequency spectrum as the estimated period;
[0096] The discrete Fourier transform is:
[0097]
[0098] Where X(ω) is the signal strength amplitude corresponding to the frequency ω, x(t) is the discrete signal data, where t = 0, 1, 2, ... T-1, T is the sampling number corresponding to the signal data, and e is a complex function, that is, e -jx = cos(x) + j sin(x);
[0099] The frequency ω corresponding to the maximum signal strength amplitude in the obtained frequency spectrum X(ω) is selected as the estimated frequency of the acceleration signal data x, and then the inverse of the estimated frequency is taken to obtain the estimated period;
[0100] Step 2.3.3: Select the maximum point in the data x, that is, the points before and after this point are both smaller than this point, as the candidate maximum point, and then remove the candidate points smaller than the minimum threshold in step 2.3.1, and keep the points larger than the minimum threshold;
[0101] Step 2.3.4 sorts the maximum candidate points in chronological order, and calculates the time interval between two adjacent points from the front to the back. If it is less than half of the estimated period obtained in step 2.3.2, the latter point is considered to be an erroneous candidate point caused by noise or signal fluctuation, and the point is removed from the candidate points. When removing candidate points based on half of the estimated period, each time a candidate point is removed, the time interval between two adjacent points in the candidate points must be recalculated from the front to the back until all the maximum candidate points have been screened, thereby obtaining the maximum point in the data x.
[0102] Step 2.3.5: using the extreme value point obtained in step 2.3.4 as a dividing point, dividing the acceleration data x, thereby obtaining a plurality of single-cycle acceleration data a;
[0103] Step 3: Establish a generative adversarial model. The model consists of two parts: a generator and a discriminator. Figure 1 As shown in , the generator is represented by G and the discriminator is represented by D, specifically:
[0104] Step 3.1 First create the generator G, such as Figure 2 As shown, the generator consists of two parts: encoder and decoder;
[0105] Step 3.1.1 The noisy data is successively passed through three layers of convolution operations with convolution kernels of 7×1, 5×1, and 3×1, and then passed through two parallel fully connected layers to obtain the expectation and variance respectively, and then the variance is multiplied by a Gaussian distribution random value with a (0, 1) distribution, and finally the expectation and variance are added to obtain the sampled feature data, and the encoder completes the encoding;
[0106] Step 3.1.2 The decoder decodes the encoded sampled feature data, and the sampled feature data undergoes a three-layer deconvolution operation with convolution kernels of 3×1, 5×1, and 7×1, such as Figure 3 As shown in the figure, each deconvolution layer has the corresponding convolution layer output features in the encoder to supplement the deconvolution operation output features to prevent the loss of original signal feature details, and the final output is denoised data;
[0107] Step 3.2 builds the discriminator D, such as Figure 3 The discriminator structure diagram shown in the figure is basically the same as the encoder in the generator. The difference is that after three layers of convolution, two layers of fully connected layers are connected. The output of the first fully connected layer is 256 dimensions, and the output of the last fully connected layer is 2 dimensions. The corresponding inference result is 0 or 1, that is, the input signal of the inference discriminator is false or true;
[0108] Step 4: The single-cycle data a obtained by processing in step 2.3.5 is converted into denoised data through the generator G as described in step 3.1, and the corresponding noisy data is marked as a false sample {a; label: 0}, that is, the label is false;
[0109] Step 5 uses the existing beam pumping unit to build an acceleration physical model, and calculates noise-free data from the physical model and marks it as a true sample, that is, the label is true; specifically:
[0110] Step 5.1 The specific physical model of the existing beam pumping unit for acceleration is:
[0111] The theoretical acceleration expression z is as follows:
[0112]
[0113] in:
[0114]
[0115]
[0116]
[0117] A 1 =2RP sinθ-2PK cosθ 4
[0118] A 2 =2CK cosθ 4 -2RC sinθ
[0119] B 1 =2RP cosθ-2PK sinθ 4
[0120] B 2 =2CK sinθ 4 -2RC cosθ
[0121] C 1 =R 2 +P 2 +K 2 -C 2 -2RK sin(θ+θ 4 )
[0122] C 2 =R 2 -P 2 +K 2 +C 2 -2RK sin(θ+θ 4 )
[0123] ω BD =-ωR cos(θ+θ 3 ) / P / sin(θ 2 -θ 3 )
[0124]
[0125] Among them, A is the length of the front arm of the walking beam, C is the length of the rear arm of the walking beam, BD is the connecting rod of the walking beam pumping unit, P is the length of the connecting rod, R is the length of the crank, K is the pole pitch, H is the distance between the center of the walking beam support and the ground, I is the horizontal distance from the center of the motor shaft to the center of the walking beam support, J is the distance from the center of the crank pin bearing to the center of the walking beam support, G is the height from the center of the motor shaft to the bottom of the base, θ is the crank angle, ω is the crank angular velocity, ω BD is the angular velocity of connecting rod BD around B, The connecting rod AB is around O 1 The angular velocity of rotation, θ 1 is the angle between the crank and the horizontal direction, θ 2 is the angle between the connecting rod BD and the horizontal direction rotating counterclockwise around D, θ 3 For rod O 1 B and horizontal direction counterclockwise around O 1 Angle of rotation, θ 4 O 1 The angle between the line connecting A and O and the horizontal direction.
[0126] Step 5.2: Select the length A of the front arm of the rocker beam, the length C of the rear arm of the rocker beam, the length P of the connecting rod, the length R of the crank, the distance H between the center of the rocker beam support and the ground, the distance I from the center of the motor shaft to the center of the rocker beam support in the horizontal direction, the height G from the center of the motor shaft to the bottom of the base, and the angular velocity w of the crank as variable parameters;
[0127] Step 5.3: According to the operating conditions of the beam pumping unit, the ranges of the eight parameters in step 5.2 are set as follows: A: 2.2-4.5, C: 3.3-4.5, P: 3.6-5.5, R: 0.7-1.2, H: 7.1-8.2, I: 0.7-2.3, G: 2.3-3.1, ω=π / 7-π / 2;
[0128] Step 5.4: uniformly and randomly select multiple sets of parameters within the 8 parameter setting ranges described in step 5.3, and then generate multiple sets of noise-free data z by using the acceleration physical model of the beam pumping unit described in step 5.1;
[0129] Step 5.5 marks the noise-free data z as a true sample, that is, the label of the noise-free data is true {z; label: 1};
[0130] Step 6: Combine the noisy data and its corresponding labeled false samples {a; label: 0}, and the noise-free data and its corresponding labeled true samples {z; label: 1} to create a data set, and use the data set to train the discriminator and generator of the generative adversarial model so that the discriminator can distinguish true and false samples as much as possible, and the denoised data obtained by the generator can deceive the discriminator as much as possible; specifically:
[0131] Step 6.1: Combine the noisy data and the noise-free data to create a data set. The label of the noisy data in the data set is false, represented by 0; the label of the noise-free data in the data set is true, represented by 1.
[0132] Step 6.2: Divide the dataset into training set, validation set, and test set in a ratio of 8:1:1.
[0133] Step 6.3: Use the training set to train the discriminator k times, and use the verification set to test the prediction effect of the discriminator D;
[0134] Step 6.3.1 Train the value function v of the discriminator D d for:
[0135] v d =E z,a (logD(z)+log(1-D(G(a)))
[0136] Where E represents the expected value, z represents the noise-free data, a represents the single-cycle noisy data obtained in step 2.3.5, D(·) represents the value predicted by the discriminator D, and G(·) represents the data generated by the generator G;
[0137] Step 6.3.2 The parameter update gradient of the discriminator D in training is Discriminator parameters θ d Add to the original parameters where γ d is the learning rate of the discriminator to enhance the recognition ability of the discriminator;
[0138] Step 6.4 After k discriminator trainings, fix the discriminator D parameter θ d ;
[0139] Step 6.5 uses the single-cycle noisy data obtained in step 2 to train the generator G;
[0140] Step 6.5.1 Train the value function v of the generator G g for
[0141] v g =E a (log(1-D(G(a)))
[0142] Step 6.5.2 Generator G parameters θ g Update the gradient to Generator parameter θ g Subtract the original parameter where γ g is the learning rate of the generator to enhance the ability of the data generated by the generator G not to be judged as false by the discriminator;
[0143] Step 6.6: Repeat steps 6.3, 6.4, and 6.5 to train the discriminator D and the generator G until the cost functions of the discriminator and the generator are both less than the set small threshold, and the probability that the data generated by the generator G is judged as true by the discriminator D is large enough;
[0144] Step 7 deploys the trained generator G, as Figure 1 As shown in the deployment part, the acquired single-cycle noisy data is passed through the deployed generator G to obtain the denoised data, and the denoised data is time-integrated twice to obtain the stroke, which is specifically:
[0145] Step 7.1 deploys the producer G model trained in step 6 on site;
[0146] Step 7.2: Continue to use steps 1 and 2 to collect and preprocess the acceleration signal data on site to obtain single-cycle acceleration data;
[0147] Step 7.3 passes the single-cycle acceleration data through the deployed producer G to obtain the denoised data. The original collected single-cycle data and the denoised data are as follows: Figure 4 As shown;
[0148] Step 7.4: Perform a time integration on the denoised data to obtain the velocity v:
[0149]
[0150] where x t Represents the acceleration value at time t in the theoretical single-cycle acceleration data, i=1~T, T is the number of all data in one cycle, Δt is the time interval between adjacent data points of the acceleration data, that is, the time interval for the device to perform signal sampling, and in the present invention, Δt=100ms;
[0151] Step 7.5 Calculate the stroke corresponding to the first half of a cycle for the ideal speed v i Perform another time integration, with the integration range being the first half of the cycle, that is,
[0152]
[0153] Where T 1 / 2is the dividing point between the first half of a cycle and the second half of a cycle, s 1 is the stroke corresponding to the first half cycle;
[0154] Step 7.7 Calculate the stroke corresponding to the second half of a cycle, and the ideal speed Perform another time integration, with the integration range being the second half of the cycle, that is,
[0155]
[0156] where s 2 is the stroke corresponding to the second half cycle;
[0157] Step 7.8 The final stroke value of the beam pump is the average of the two half-cycle strokes:
[0158]
[0159] The method of estimating the stroke of a beam pumping unit based on generative adversarial model denoising of the present invention trains a generator by using a generative adversarial method, and uses the generator to denoise acceleration signal data, so that the characteristic distribution of denoised data approaches the characteristic distribution of theoretical noise-free data, thereby effectively removing noise and retaining accurate signal data that conforms to the theory as much as possible, greatly improving the accuracy of acceleration data, and making the stroke data obtained by integrating acceleration twice over time more accurate. Field measurements are conducted on some oil wells, and the stroke is calculated using the original collected signal, respectively, and compared with the stroke calculation results of the present invention. Figure 5 As shown, the results show that the denoised signal obtained by the invention through the generation adversarial method is more accurate than the original acquired signal, so the stroke data obtained by two integrations is closer to the true value.
[0160] The acceleration sensor of the present invention collects the preprocessing process of the walking beam pumping unit acceleration signal. The algorithm is simple and only through first-order linear smoothing and discrete Fourier transform, the extraction and preprocessing of single-cycle original acceleration signal data can be completed at a very low computing power cost.
[0161] The method for estimating the stroke of a walking beam pump based on generative adversarial model denoising of the present invention, the true samples in the generative adversarial model training are noise-free data generated by the physical model of the acceleration of the walking beam pump, and the noise-free data are obtained by selecting the physical model within a reasonable range under different model parameter conditions. The generator that performs generative adversarial training with the noise-free data under these different parameter conditions as the target can have better generalization for various working conditions.
[0162] The above description is only an embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, expansion, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims
1. A method for estimating the stroke of a beam pumping unit based on generative adversarial model denoising, characterized in that: The following steps are involved: 1) The acceleration data at the suspension point of the beam pumping unit is collected through the acceleration sensor, and the acceleration data is processed through the WIA-PA chip; 2) Preprocess the acceleration data to obtain single-cycle acceleration data; 3) Building a generative adversarial model; 4) The generator in the generative adversarial model is used to convert the single-cycle data into denoised data, and the single-cycle data before denoising is used as noisy data and marked as a false sample; 5) Model the acceleration physical model of the beam pumping unit, and calculate the noise-free data using the physical model and mark it as a true sample; 6) Combine the noisy data and its corresponding labeled false samples with the noise-free data and its corresponding labeled true samples to create a dataset, and use the dataset to train a generative adversarial model; 7) Use the generator in the trained generative adversarial model to denoise the single-cycle data, and calculate the denoised data to obtain the stroke.
2. The method for estimating the stroke of a beam pumping unit based on generative adversarial model denoising according to claim 1 is characterized in that: The step 2) comprises the following steps: 2.1) Convert the acceleration signal data into real acceleration data, i.e. acceleration x with actual physical meaning; Where x is the true acceleration, is the collected and processed acceleration signal, g is the gravity acceleration, m and h are the attribute values of the device itself; 2.2) Smoothing out the abnormal data in the real acceleration data x: From the time t in the data, if the data of n consecutive time points is greater than the maximum set threshold, then the n consecutive data are abnormal data, and the n data are modified into new n interpolated data, and the interpolated data are: Among them, x t is the acceleration data value at time t, i is the i-th time point among n consecutive time points, i is less than or equal to n; 2.3) Find the maximum point in the smoothed data and divide the data into single-cycle acceleration data according to the maximum point.
3. The method for estimating the stroke of a beam pumping unit based on generative adversarial model denoising according to claim 2 is characterized in that: The step 2.3) comprises the following steps: 2.3.1) Calculate the average value of the real acceleration data x as the minimum threshold for maximum value selection; 2.3.2) Perform discrete Fourier transform on the real acceleration data x to obtain the frequency spectrum of the data, and take the inverse of the frequency value corresponding to the maximum energy in the frequency spectrum as the estimated period; 2.3.3) Select the maximum point in the real acceleration data x, that is, the points before and after this point are both smaller than this point, as the candidate maximum point, and remove the candidate points smaller than the minimum threshold; 2.3.4) Sort the maximum candidate points in chronological order, and calculate the time interval between two adjacent points in sequence. If the time interval is less than half of the estimation period, the latter point is considered to be an erroneous candidate point caused by noise or signal fluctuation, and the point is removed from the candidate points; 2.3.5) After each candidate point is removed, step 2.3.4) is repeated until all the maximum candidate points have been screened, thereby obtaining all the maximum points in the real acceleration data x; 2.3.6) Use the maximum point as the dividing point to divide the real acceleration data x, thereby obtaining multiple single-cycle acceleration data a.
4. The method for estimating the stroke of a beam pumping unit based on generative adversarial model denoising according to claim 1, characterized in that: The generative adversarial model consists of a generator G and a discriminator D, where: The generator G includes an encoder and a decoder, wherein the encoder includes three convolution layers with convolution kernels of 7×1, 5×1, and 3×1 connected in sequence and two parallel fully connected layers connected after the convolution layer with a convolution kernel of 3×1; the decoder includes three deconvolution layers with convolution kernels of 3×1, 5×1, and 7×1 connected in sequence; The discriminator D includes three convolutional layers with convolution kernels of 7×1, 5×1, and 3×1 connected in sequence, and two fully connected layers connected in sequence after the convolutional layer with a convolution kernel of 3×1.
5. The method for estimating the stroke of a beam pumping unit based on generative adversarial model denoising according to claim 4 is characterized in that: The generative adversarial model performs the following steps: The encoder passes the noisy data through three layers of convolution operations with convolution kernels of 7×1, 5×1, and 3×1, and then passes them through two parallel fully connected layers to obtain the expectation and variance respectively, and then multiplies the variance by a Gaussian distribution random value with a (0, 1) distribution. Finally, the expectation and variance are added to obtain the sampled feature data, and the encoder completes the encoding; The decoder passes the sampled feature data through three layers of deconvolution operations with convolution kernels of 3×1, 5×1, and 7×1. Each layer of deconvolution has the corresponding convolution layer output features in the encoder to supplement the deconvolution operation output features. The decoder completes decoding and outputs denoised data. The discriminator passes the denoised data through three layers of convolution and then connects two layers of fully connected layers. The output of the first fully connected layer is 256 dimensions, and the output of the second fully connected layer is 2 dimensions. The corresponding inference results are 0 or 1, that is, the input signal of the inference discriminator is false or true.
6. The method for estimating the stroke of a beam pumping unit based on generative adversarial model denoising according to claim 1, characterized in that: The step 5) comprises the following steps: 5.1) Within the parameter setting range of the acceleration physical model of the beam pumping unit, multiple sets of parameters are uniformly and randomly selected, and multiple sets of noise-free data are generated through the acceleration physical model of the beam pumping unit; 5.2) Set the labels of the generated multiple sets of noise-free data to true.
7. The method for estimating the stroke of a beam pumping unit based on generative adversarial model denoising according to claim 1, characterized in that: The step 6) comprises the following steps: 6.1) Combine the noisy data and the noise-free data to create a data set, where the label of the noisy data in the data set is false, represented by 0; the label of the noise-free data in the data set is true, represented by 1; 6.2) Divide the data set into training set, verification set and test set; 6.3) Use the training set to train the discriminator k times, and use the validation set to test the prediction effect of the discriminator D; 6.4) After k discriminator trainings, fix the discriminator D parameter θ d ; 6.5) Use single-cycle noisy data to train the generator G; 6.6) Repeat steps 6.3) to 6.5) until the cost functions of the discriminator and the generator are both less than the set small threshold, and the probability that the data generated by the generator G is judged as true by the discriminator D is greater than the large threshold.
8. The method for estimating the stroke of a beam pumping unit based on generative adversarial model denoising according to claim 7, characterized in that: Step 6.3) The following steps are involved: 6.3.1) The value function v of training the discriminator D d : v d =E z,a (logD(z)+log(1-D(G(a))) Where E represents the expected value, z represents the noise-free data, a represents the obtained single-cycle noisy data, D(·) represents the value predicted by the discriminator D, and G(·) represents the data generated by the generator G; 6.3.2) The parameter update gradient of the discriminator D during training is Discriminator parameters θ d Add to the original parameters where γ d is the learning rate of the discriminator.
9. The method for estimating the stroke of a beam pumping unit based on generative adversarial model denoising according to claim 7, characterized in that: Step 6.5) The following steps are involved: 6.5.1) The value function v of training generator G g : v g JE a (log(1-D(G(a))) 6.5.2) Generator G parameters θ g Update the gradient to Generator parameter θ g Subtract the original parameter where γ g is the learning rate of the generator.
10. The method for estimating the stroke of a beam pumping unit based on generative adversarial model denoising according to claim 1, characterized in that: The step 7) comprises the following steps: 7.1) Continuously collect the acceleration signal data on site and pre-process it to obtain single-cycle acceleration data; 7.2) Pass the single-cycle acceleration data through the generator G to obtain denoised data; 7.3) Perform a time integration on the denoised data to obtain the velocity v: Among them, x t Represents the acceleration value at time t in the theoretical single-cycle acceleration data, i=1~T, T is the number of all data in one cycle, Δt is the time interval between adjacent data points of the acceleration data, that is, the time interval for the device to sample the signal; 7.4) Calculate the stroke corresponding to the first half of a cycle, and the ideal speed v i Perform another time integration, with the integration range being the first half of the cycle, that is, Among them, T 1 / 2 It is the dividing point between the first half cycle and the second half cycle in a cycle, and s1 is the stroke corresponding to the first half cycle; 7.5) Calculate the stroke corresponding to the second half of a cycle, and the ideal speed Perform another time integration, with the integration range being the second half of the cycle, that is, Among them, s2 is the stroke corresponding to the second half cycle; 7.6) The final stroke value s of the beam pump is the average of the two half-cycle strokes:
Citation Information
Patent Citations
Curved cylinder rotary internal combustion engine without crankshaft
CN101033711A
Sparse constraint generative adversarial network implementation method for rotary machine vibration signal
CN112257694A
Method for obtaining stroke and stroke frequency of beam-pumping unit based on physical model denoising
CN112836613A
Method for tracing complex and missing textures in crack propagation process based on deep learning
CN114049343A
