Automatic production calculation method and device for rod-pumped well based on XGBoost algorithm
Through the machine learning method based on the XGBoost algorithm, a model for liquid production determination of oil pump wells was established, which solved the problems of inaccurate production and poor real-time performance in the traditional production measurement method, and achieved more efficient and accurate liquid production measurement.
Patent Information
- Application Number
- CN202311620026.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-29
- Publication Date
- 2025-05-30
AI Technical Summary
The existing oil pump well output measurement methods have problems such as heavy workload, difficult real-time production measurement and inaccurate production calculations. Especially the method of using work drawings to calculate production is obtained due to empirical formulas, which may not be consistent with the actual dynamic changes, resulting in low accuracy of production calculations.
Using machine learning method based on XGBoost algorithm, we use the historical production operation data of the pumping well, determine the data categories with high correlation, establish a liquid production determination model, and realize real-time automatic production measurement of the well.
It improves the speed and accuracy of liquid production calculation, reduces artificial influence, is highly applicable, can more accurately reflect the dynamic changes of the pumping machine well, and meets the requirements of on-site measurement accuracy.
Smart Images

Figure CN120068566A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of automatic production metering for pumping wells, and particularly to an automatic production metering method and device for pumping wells based on the XGBoost algorithm. Background Art
[0002] Oil well production metering is one of the important tasks in oilfield production management. The accuracy and timeliness of production metering are important influencing factors for mastering the production dynamics of the oilfield, evaluating the development potential of oil reservoirs, and reasonably formulating oilfield production plans. Traditional liquid production metering methods include glass tube production metering, tanker production metering, weighing production metering, etc. Traditional metering methods have strong on-site applicability, but the on-site liquid metering cycle is long, and it is difficult to perform real-time production metering, which limits the timeliness of oilfield production dynamic analysis. With the development of the oilfield Internet of Things and digital construction, software production metering methods have emerged, which can achieve real-time continuous production metering, are convenient for operation and management, and can cancel manual testing on the premise of ensuring metering accuracy. The common method for software production metering of pumping wells is stroke method metering based on the dynamometer card, but some of the parameters used in this metering method are obtained from empirical formulas, which may differ from the actual dynamic change law of the pumping unit. The considered parameters are relatively fixed, and the production metering accuracy is easily affected by factors such as actual complex well conditions, and it cannot meet the on-site metering requirements in terms of metering accuracy and reliability. Summary of the Invention
[0003] The present invention proposes an automatic production metering method and device for pumping wells based on the XGBoost algorithm to solve the problems of heavy workload, difficult real-time production metering, and inaccurate production metering due to empirical formulas or complex well conditions in the existing method of using traditional manual metering of pumping unit production.
[0004] According to one aspect of the present invention, there is provided an automatic production metering method for pumping wells based on the XGBoost algorithm, including:
[0005] Obtaining historical production operation data of pumping wells in the work area;
[0006] Determining the correlation between each data category in the historical production operation data and the liquid production volume, selecting the data corresponding to the data category whose correlation meets the predetermined requirements as sample data, and dividing the sample data into a training set and a test set;
[0007] Establishing a machine learning model based on the XGBoost algorithm, inputting the data of the training set and the test set into the model for training and testing, and obtaining a determined model of the liquid production volume of pumping wells based on the XGBoost algorithm after training and testing;
[0008] Input the data corresponding to the data category of the target well that meets the predetermined requirements into the oil production volume determination model of the pumping unit well based on the XGBoost algorithm, and run to obtain the corresponding oil production volume measurement result.
[0009] Preferably, the historical production operation data at least includes: operation parameter data, production data, and characteristic data extracted according to the operation parameter data and the production data;
[0010] Among them, the operation parameter data at least includes: measured surface dynamometer card, stroke, stroke frequency, current, pump depth of the sucker rod pump, pump diameter of the sucker rod pump, diameter of the sucker rod, and length of the sucker rod;
[0011] Among them, the production data at least includes: oil pressure, casing pressure, water cut, and daily oil production volume.
[0012] Preferably, the characteristic data at least includes:
[0013] Slope of the up and down strokes of the pumping unit, maximum load, minimum load, effective stroke, filling degree, weight of the sucker rod string of the pumping unit, weight of the liquid column, and theoretical displacement.
[0014] Preferably, the method for determining the correlation between each data category in the historical production operation data and the oil production volume includes:
[0015] Use the Pearson correlation coefficient calculation formula to determine the correlation between each data category in the historical production operation data and the oil production volume;
[0016] Among them, the Pearson correlation coefficient calculation formula is:
[0017]
[0018] In the formula, n is the dimension of the vector, and x and y are two random variables respectively.
[0019] Preferably, it further includes:
[0020] Determine the error between the oil production volume measurement result obtained by running the oil production volume determination model of the pumping unit well based on the XGBoost algorithm and the actual measurement result;
[0021] Judge whether the error is greater than the first predetermined value. If so, determine the correction coefficient according to the error;
[0022] Use the correction coefficient to correct the oil production volume measurement result obtained by running the oil production volume determination model of the pumping unit well based on the XGBoost algorithm to obtain the corrected oil production volume measurement result.
[0023] Preferably, the method for determining the error between the liquid production measurement result obtained by running the liquid production determination model of the pumping unit well based on the XGBoost algorithm and the actual measurement result includes:
[0024] Adopt the glass tube oil measurement or weighing oil measurement method to actually measure the liquid production of the target well a predetermined number of times;
[0025] Determine the average value of the liquid production measured actually for the predetermined number of times;
[0026] Determine the error between the liquid production measurement result obtained by running the liquid production determination model of the pumping unit well based on the XGBoost algorithm and the average value of the liquid production.
[0027] Preferably, the method for determining the correction coefficient according to the error includes:
[0028] Correction coefficient = average value of the liquid production measured actually for the predetermined number of times / liquid production measurement result obtained by model operation.
[0029] Preferably, the method for correcting the liquid production measurement result obtained by running the liquid production determination model of the pumping unit well based on the XGBoost algorithm by using the correction coefficient to obtain the corrected liquid production measurement result includes:
[0030] Corrected liquid production measurement result = liquid production measurement result obtained by model operation * correction coefficient.
[0031] According to one aspect of the present invention, there is provided an automatic liquid production measurement device for pumping unit wells based on the XGBoost algorithm, including:
[0032] A data acquisition unit for acquiring historical production operation data of pumping unit wells in the work area;
[0033] A sample data screening unit for determining the correlation between each data category in the historical production operation data and the liquid production, selecting the data corresponding to the data category whose correlation meets the predetermined requirements as sample data, and dividing the sample data into a training set and a test set;
[0034] A model training unit for establishing a machine learning model based on the XGBoost algorithm, inputting the data of the training set and the test set into the model for training and testing, and obtaining a liquid production determination model of the pumping unit well based on the XGBoost algorithm after training and testing;
[0035] A liquid production measurement result output unit for inputting the data corresponding to the data category whose correlation meets the predetermined requirements of the target well into the liquid production determination model of the pumping unit well based on the XGBoost algorithm, and running to obtain the corresponding liquid production measurement result.
[0036] The present invention has at least the following beneficial effects:
[0037] The present invention proposes an automatic liquid production calculation method and device for pumping wells based on the XGBoost algorithm. Based on a large amount of historical production operation data of oil wells, the XGBoost algorithm in the field of machine learning is preferably used to establish a liquid production determination model, realizing real-time automatic liquid production calculation for pumping wells. Compared with the traditional empirical formula liquid production calculation method, it can greatly improve the speed and accuracy of liquid production calculation, and has the characteristics of high efficiency, convenience, and strong applicability. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The drawings herein are incorporated into the specification and constitute a part of this specification. These drawings show embodiments in accordance with the present invention and, together with the specification, are used to explain the technical solutions of the present invention.
[0039] Figure 1 A flowchart showing an automatic liquid production calculation method for pumping wells based on the XGBoost algorithm according to an embodiment of the present invention.
[0040] Figure 2 A comparison diagram showing the liquid production determined by the model and the actual liquid production according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0041] Various exemplary embodiments, features, and aspects of the present invention will be described in detail below with reference to the drawings. The same reference numerals in the drawings denote elements having the same or similar functions. Although various aspects of the embodiments are shown in the drawings, the drawings do not have to be drawn to scale unless otherwise specified.
[0042] The special term "exemplary" herein means "serving as an example, embodiment, or illustrative". Any embodiment described as "exemplary" here does not have to be construed as superior to or better than other embodiments.
[0043] The term "and / or" herein merely describes the association relationship of associated objects and indicates that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the term "at least one" herein means any one of a plurality or any combination of at least two of a plurality. For example, including at least one of A, B, and C may represent including any one or more elements selected from the set composed of A, B, and C.
[0044] In addition, to better illustrate the present invention, numerous specific details are given in the following detailed implementation manners. Those skilled in the art should understand that the present invention can also be implemented without certain specific details. In some instances, methods, means, elements, and circuits well-known to those skilled in the art are not described in detail in order to highlight the gist of the present invention.
[0045] Figure 1 The flowchart shows an automatic production measurement method for pumping wells based on the XGBoost algorithm according to an embodiment of the present invention. Figure 2 The figure shows a comparison chart of the determined liquid production volume and the actual liquid production volume according to an embodiment of the present invention. As Figure 1-2 shown, an automatic production measurement method for pumping wells based on the XGBoost algorithm includes: Step S01: Obtain the historical production operation data of the pumping wells in the work area; Step S02: Determine the correlation between each data category in the historical production operation data and the liquid production volume, select the data corresponding to the data categories that meet the predetermined requirements as sample data, and divide the sample data into a training set and a test set; Step S03: Establish a machine learning model based on the XGBoost algorithm, input the data of the training set and the test set into the model for training and testing, and obtain a determined model for the liquid production volume of the pumping wells based on the XGBoost algorithm after training and testing; Step S04: Input the data corresponding to the data categories that meet the predetermined requirements of the target well into the determined model for the liquid production volume of the pumping wells based on the XGBoost algorithm, and run to obtain the corresponding liquid production measurement result.
[0046] The automatic production measurement method for pumping wells based on the XGBoost algorithm provided by the embodiment of the present invention specifically includes the following steps:
[0047] Step S01: Obtain the historical production operation data of the pumping wells in the work area.
[0048] In the present invention, the historical production operation data at least includes: operation parameter data, production data, and feature data extracted according to the operation parameter data and the production data; wherein, the operation parameter data at least includes: measured ground dynamometer card, stroke, pumping frequency, current, depth of the sucker rod pump, diameter of the sucker rod pump, diameter of the sucker rod, and length of the sucker rod; wherein, the production data at least includes: tubing head pressure, casing pressure, water cut, and daily liquid production volume.
[0049] In the present invention, the feature data at least includes: up and down stroke slopes of the pumping unit, maximum load, minimum load, effective stroke, filling degree, weight of the sucker rod string of the pumping unit, weight of the liquid column, and theoretical displacement.
[0050] In the embodiments of the present invention, historical production operation data of a pumping unit well is obtained, and data feature extraction of the pumping unit well is carried out. Among them, the above-mentioned operation parameter data and production data should be corresponding in time.
[0051] Feature extraction is carried out on the dynamometer card data of the pumping unit well, including extracting characteristic values such as the upper and lower stroke slopes, maximum load and minimum load, effective stroke, and filling degree from the measured ground dynamometer card in the operation parameter data, as well as characteristic values such as the weight of the rod string, the weight of the liquid column, theoretical displacement, and other basic data calculated using relevant parameters of the pumping unit. Specific extraction is carried out according to needs. The more reasonable the extraction of characteristic values, the better the mapping relationship between the liquid production and parameters can be established during subsequent model training, making the output result of the model more accurate.
[0052] Step S02: Determine the correlation between each data category in the historical production operation data and the liquid production, select the data corresponding to the data category whose correlation meets the predetermined requirements as sample data, and divide the sample data into a training set and a test set.
[0053] In the present invention, the method for determining the correlation between each data category in the historical production operation data and the liquid production includes: using the Pearson correlation coefficient calculation formula to determine the correlation between each data category in the historical production operation data and the liquid production; where the Pearson correlation coefficient calculation formula is:
[0054]
[0055] In the formula, n is the dimension of the vector, and x and y are two random variables respectively.
[0056] In the embodiments of the present invention, correlation analysis is measured by calculating the magnitude of the Pearson correlation coefficient between two variables, that is, two n-dimensional vectors x and y; the two random variables respectively correspond to the liquid production and the upper and lower stroke slopes, maximum load, minimum load, effective stroke, filling degree of the pumping unit extracted from the measured ground dynamometer card in the operation parameter data, as well as data categories such as oil pressure, casing pressure, water cut, daily liquid production in the production data, and the weight of the rod string, the weight of the liquid column, theoretical displacement, stroke, pumping frequency, current, depth of the sucker rod pump, diameter of the sucker rod pump, diameter of the sucker rod, and length of the sucker rod calculated using relevant parameters of the pumping unit.
[0057] Correlation coefficient r xy The calculation result is a real number in [-1, 1]. When r xy takes the value of 1, it indicates a completely positive correlation between the two random variables; when it takes the value of -1, it indicates a completely negative correlation between the two random variables; when it takes the value of 0, it indicates that the two random variables are linearly independent.
[0058] Among them, the satisfaction of the correlation with the predetermined requirement is: judging the correlation coefficient r between a certain data category and the liquid production volume xy Whether the absolute value is greater than the second predetermined value. If so, the correlation between the data category and the liquid production volume meets the predetermined requirement. Among them, the second predetermined value is: 0.3.
[0059] By calculating the correlation to screen the data categories, the number of input parameters during model training and calculation can be reduced, the workload of pre-data processing can be reduced, the influence of non-correlated parameters on the model can be reduced, and the model accuracy can be improved.
[0060] All the data corresponding to the data categories whose finally determined correlation meets the predetermined requirement and the daily liquid production volume data are used as sample data, and they are divided into a training set and a test set.
[0061] Step S03: Establish a machine learning model based on the XGBoost algorithm, input the data of the training set and the test set into the model for training and testing, and obtain a determined model of the liquid production volume of the pumping unit well based on the XGBoost algorithm after training and testing.
[0062] In the embodiment of the present invention, a calculation model of the daily liquid production volume of the pumping unit well based on the XGBoost algorithm is established. The XGBoost model program is written in the python language, and the internal parameters of the model are set, mainly including parameters such as the learning rate, the maximum depth of the tree, the number of training times, the sample weight, and the feature sampling ratio. The XGBoost (Extreme Gradient Boosting) extreme gradient boosting algorithm is an efficient gradient boosting decision tree algorithm. It is improved on the basis of the original GBDT, making the model effect greatly improved. As a forward additive model, its core is to adopt the integration idea - the Boosting idea, integrating multiple weak learners into a strong learner through a certain method. That is, multiple trees are used to make joint decisions, and the result of each tree is the difference between the target value and the prediction results of all previous trees, and all the results are accumulated to obtain the final result, so as to achieve the improvement of the overall model effect.
[0063] By inputting the training set data of the samples into the model, carrying out learning and training of the machine learning model based on the XGBoost algorithm, then carrying out the calculation of the liquid production volume by inputting the test set data, comparing with the actual liquid production volume, testing the model, and finally obtaining a determined model of the liquid production volume of the pumping unit well based on the XGBoost algorithm whose training and testing results meet the requirements.
[0064] Step S04: Input the data corresponding to the data category of the target well that meets the predetermined requirements into the model for determining the liquid production volume of the pumping unit well based on the XGBoost algorithm, and run to obtain the corresponding liquid production volume measurement result.
[0065] In an embodiment of the present invention, data that meets the correlation requirements of the oil well with the liquid production volume to be measured is obtained, and the data that meets the correlation requirements is input into the model for determining the liquid production volume of the pumping unit well based on the XGBoost algorithm after training and testing, and run to obtain the corresponding liquid production volume measurement result.
[0066] In the present invention, it further includes: determining the error between the liquid production volume measurement result obtained by running the model for determining the liquid production volume of the pumping unit well based on the XGBoost algorithm and the actual measurement result; judging whether the error is greater than a first predetermined value, if so, determining a correction coefficient according to the error; using the correction coefficient to correct the liquid production volume measurement result obtained by running the model for determining the liquid production volume of the pumping unit well based on the XGBoost algorithm to obtain a corrected liquid production volume measurement result.
[0067] In an embodiment of the present invention, when the model is used for a period of time in the initial stage, the accuracy of measuring the liquid production volume is relatively high because the historical data used in its training includes recent data. However, as the pumping unit well operates continuously for a long time, various operating parameters, formation parameters, etc. will change, and the model still operates based on the historical data used in training, which may lead to a deviation between the measurement result and the actual measured liquid production volume as the model is used for a longer time. Therefore, at regular intervals, it is necessary to check and adjust the operation result of the model to ensure the accuracy of the measurement result output by the model.
[0068] In the present invention, the method for determining the error between the liquid production volume measurement result obtained by running the model for determining the liquid production volume of the pumping unit well based on the XGBoost algorithm and the actual measurement result includes: actually measuring the liquid production volume of the target well a predetermined number of times by using a glass tube oil measurement or a weighing oil measurement method; determining the average value of the liquid production volume of the predetermined number of actual measurements; determining the error between the liquid production volume measurement result obtained by running the model for determining the liquid production volume of the pumping unit well based on the XGBoost algorithm and the average value of the liquid production volume.
[0069] In an embodiment of the present invention, the value of the predetermined number of times is greater than or equal to 3. According to the actual production needs on site, the result of the automatic production measurement of the model is checked at regular intervals. A glass tube oil measurement or a weighing oil measurement method can be used, and the actual measurement liquid production volume value used for calculating the error during each check should be the average value of no less than 3 actual measurement results, so as to prevent large deviations in manual measurement and ensure the accuracy of the actual measurement result.
[0070] wherein, the error = |the average value of the liquid production measured actually for a predetermined number of times - the liquid production measurement result obtained from the model operation| / the average value of the liquid production measured actually for a predetermined number of times * 100%.
[0071] When the error of the automatic liquid production measurement for a single well, that is, the absolute value of the error between the measurement result obtained from the model operation and the corresponding actually measured result, is greater than the first predetermined value, it is necessary to correct the liquid production measurement result obtained from the model operation. Wherein, the first predetermined value is 20%.
[0072] In the present invention, the method for determining the correction coefficient according to the error includes: the correction coefficient = the average value of the liquid production measured actually for a predetermined number of times / the liquid production measurement result obtained from the model operation.
[0073] In the present invention, the method for correcting the liquid production measurement result obtained from the model operation of the liquid production determination model for pumping wells based on the XGBoost algorithm by using the correction coefficient to obtain the corrected liquid production measurement result includes: the corrected liquid production measurement result = the liquid production measurement result obtained from the model operation * the correction coefficient.
[0074] In an embodiment of the present invention, the calibration coefficient is calculated, that is, the ratio of the actually measured liquid production to the liquid production output by the model, and the liquid production measurement result obtained from the model operation is multiplied by this correction coefficient to finally obtain the accurate corrected liquid production.
[0075] By determining the error between the model operation measurement result and the actual measurement result through actual measurement at every predetermined time interval, the model can be adjusted in a timely manner to ensure the accuracy of the model.
[0076] It can be understood that the above-mentioned various method embodiments mentioned in the present invention can be combined with each other to form a combined embodiment without violating the principle logic. Due to space limitations, the present invention will not elaborate further.
[0077] The execution subject of the automatic liquid production measurement method for pumping wells based on the XGBoost algorithm can be an automatic liquid production measurement device for pumping wells based on the XGBoost algorithm. For example, the automatic liquid production measurement method for pumping wells based on the XGBoost algorithm can be executed by a terminal device or a server or other processing devices. Among them, the terminal device can be a user equipment (UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. In some possible implementation manners, the automatic liquid production measurement method for pumping wells based on the XGBoost algorithm can be implemented by a processor calling computer-readable instructions stored in a memory.
[0078] Those skilled in the art can understand that in the above method of the specific implementation manner, the writing order of each step does not mean a strict execution order and does not impose any limitation on the implementation process. The specific execution order of each step should be determined according to its function and possible internal logic.
[0079] The present invention also provides an automatic oil production metering device for pumping wells based on the XGBoost algorithm, including: a data acquisition unit for acquiring historical production operation data of pumping wells in the work area; a sample data screening unit for determining the correlation between each data category in the historical production operation data and the liquid production volume, selecting the data corresponding to the data category with the correlation meeting the predetermined requirements as sample data, and dividing the sample data into a training set and a test set; a model training unit for establishing a machine learning model based on the XGBoost algorithm, inputting the data of the training set and the test set into the model for training and testing, and obtaining a determined model of the liquid production volume of the pumping well based on the XGBoost algorithm after training and testing; and a production metering result output unit for inputting the data corresponding to the data category with the correlation meeting the predetermined requirements of the target well into the determined model of the liquid production volume of the pumping well based on the XGBoost algorithm, and running to obtain the corresponding liquid production volume metering result.
[0080] In the embodiment of the present invention, the data acquisition unit further includes: a data storage module for storing historical production operation data of pumping wells, including surface dynamometer cards, current, stroke, pumping frequency, oil pressure, casing pressure, pump depth of the sucker rod pump, pump diameter, sucker rod diameter and length, etc.
[0081] The sample data screening unit further includes: a data preprocessing module for cleaning the acquired historical production operation data. Data cleaning is to screen and filter the abnormal data with missing values, errors or significantly deviating from the expected values in the acquired data. After feature value selection and correlation analysis on the cleaned data, a model sample data set is formed and divided into a training set and a test set.
[0082] The model training unit and the production metering result output unit utilize the historical production operation data of the oil well to construct a production metering model based on XGBoost, and realize the automatic production metering of the pumping well through the learning and training of the model and the prediction of the liquid production volume.
[0083] The automatic liquid production measurement device for pumping wells based on the XGBoost algorithm further includes: a liquid production correction module, which is used to determine the error between the liquid production measurement result obtained by running the liquid production determination model of the pumping well based on the XGBoost algorithm and the actual measurement result; determine whether the error is greater than a first predetermined value, if so, determine a correction coefficient according to the error; use the correction coefficient to correct the liquid production measurement result obtained by running the liquid production determination model of the pumping well based on the XGBoost algorithm to obtain a corrected liquid production measurement result.
[0084] In some embodiments, the functions, modules, or units included in the device provided by the embodiments of the present invention can be used to execute the methods described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments. For the sake of brevity, it will not be repeated here.
[0085] In the embodiments of the present invention, taking 7,228 pumping wells in a certain oilfield block as an example, historical production operation data is randomly sampled, including data such as surface dynamometer cards, stroke, pumping frequency, current, depth of the sucker rod pump, pump diameter, sucker rod diameter, sucker rod length, oil pressure, casing pressure, water cut, and daily liquid production of the pumping wells.
[0086] The data preprocessing module performs data cleaning on the historical production operation data of the pumping wells, and filters and cleans missing values, error values, and abnormal values in the historical production operation data.
[0087] Feature value selection is performed on the cleaned data. Feature value selection includes extracting feature values such as the maximum load, minimum load, effective stroke, slopes of the upstroke and downstroke of the dynamometer card, and feature values such as the weight of the rod string, weight of the liquid column, theoretical displacement, and other basic data calculated using parameters such as sucker rod pump parameters, stroke, and pumping frequency.
[0088] Correlation analysis is performed on the feature values and the liquid production, and data with an absolute value of the liquid production correlation coefficient greater than 0.3 is selected as the oil well feature sample set (sample data); the data categories that meet the requirements include the slope of the upstroke, slope of the downstroke, effective stroke, degree of filling, pump depth, water cut, stroke, pumping frequency, oil pressure, casing pressure, current, weight of the rod string, weight of the liquid column, and theoretical displacement, etc. It is divided into a training set and a test set.
[0089] An XGBoost liquid production measurement model is established, with the feature set being the above-mentioned oil well feature sample set and the target set being the daily liquid production. A program is written in the Python language to set the internal parameters of the model. Among them, the learning rate in the model parameters is 0.03, the maximum depth of the tree is 6, the number of training times is 1000, the sample weight is 1, the feature sampling ratio is 1, and other parameters are set to default values.
[0090] Select 75% of the sample data as the training set to carry out the learning and training of the XGBoost production calculation model; the remaining 25% of the sample data is used as the test set for model testing to further examine the generalization ability of the model. The final test results are as follows Figure 2 shown, from Figure 2 it can be seen that the fitting degree between the value of the daily liquid production of oil wells in the test set output by the model operation and the true daily liquid production value in the test set is relatively high, indicating that the model for determining the daily liquid production of oil wells established based on XGBoost has high accuracy. The average absolute error of the daily liquid production obtained by the model is 5.1 / day, and the average relative error of the daily liquid production is 6.74%. The prediction error results of the daily liquid production of some single wells are shown in Table 1
[0091] Table 1: Prediction error results of the daily liquid production of some single wells
[0092] Hash sign <![CDATA[Liquid production rate (m 3 / day)]]> <![CDATA[Predicted liquid volume (m 3 / day)]]> Absolute error (%) Relative error (%) 15329 78.96 80.17 1.21 1.53 27128 47.9 48.28 0.38 0.8 15912 124.22 123.08 -1.14 -0.92 9172 66 66.16 0.16 0.24 2472 30.5 30.73 0.23 0.74 16381 37.15 36.39 -0.76 -2.04 24041 54.33 54.44 0.11 0.21 12692 126.3 131.17 4.87 3.86 6544 29.15 28.93 -0.22 -0.75 19137 72.64 71.6 -1.04 -1.43 11340 79.54 80.1 0.56 0.71 23278 58.4 58.79 0.39 0.66 3458 261.63 236 -25.63 -9.8 19049 53.09 55.82 2.73 5.13 15628 94 94.04 0.04 0.04 11592 66 60.09 -5.91 -8.95 8634 61.83 62.24 0.41 0.66 20991 63.7 65.09 1.39 2.18 17317 43.43 40.91 -2.52 -5.81 3385 53.7 53.06 -0.64 -1.19 16751 98.62 102.15 3.53 3.58 24152 72.63 72.16 -0.47 -0.65 25842 23.89 24.26 0.37 1.54 2794 17.34 16.2 -1.14 -6.59 7153 23.17 23.14 -0.03 -0.14 16006 46.2 46.4 0.2 0.44 21087 61.1 61.08 -0.02 -0.04 4691 34.8 34.73 -0.07 -0.21
[0093] As can be seen from Table 1, the overall accuracy of the liquid production measurement results of the target oil wells by the present invention is relatively good. In practical applications, the results of the model's automatic production calculation can be verified by the liquid production correction module at regular intervals. On-site, the glass tube oil measurement or weighing oil measurement method can be adopted, and the single verification should be compared with the average liquid production of no less than three actual tests. For example, if the first predetermined value is set to 20%, when the production calculation accuracy of a single well continuously drops below 80%, calculate the ratio of the actual average liquid production to the liquid production calculated by the model to obtain the calibration coefficient, input the calibration coefficient into the liquid production correction module, and the correction module automatically optimizes the production calculation model to further improve the production calculation accuracy
[0094] Based on a large amount of historical production operation data of oil wells and combined with the change law of on-site liquid production influencing factors, the present invention optimizes the XGBoost algorithm in the field of machine learning to establish a liquid production determination model, realizing the real-time automatic production calculation of pumping units. Compared with the traditional manual measurement and empirical formula production calculation methods, the present invention has more advantages in terms of calculation speed and accuracy, has the characteristics of high efficiency, convenience, and strong applicability, reduces the deviation of measurement results caused by human influence, eliminates the need for manual repeated on-site detection and calculation, and reduces the labor intensity; it does not need to rely on fixed empirical formulas, accurately establishes a mapping relationship for different situations in each work area through the model, conforms to the actual dynamic change law of pumping units, and the accuracy of production calculation results is not easily affected by complex working conditions, fully meeting the on-site measurement accuracy requirements
[0095] The embodiments of the present invention have been described above. The above description is exemplary and not exhaustive, and is also not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The choice of terms used herein is intended to best explain the principles of the embodiments, the practical application, or the improvement of technologies in the market, or to enable other ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. An automatic production measurement method for pumping wells based on the XGBoost algorithm, characterized in that, it includes: Obtain the historical production operation data of the pumping wells in the work area; Determine the correlation between each data category in the historical production operation data and the liquid production volume, select the data corresponding to the data categories whose correlation meets the predetermined requirements as sample data, and divide the sample data into a training set and a test set; Establish a machine learning model based on the XGBoost algorithm, input the data of the training set and the test set into the model for training and testing, and obtain a determined model of the liquid production volume of the pumping well based on the XGBoost algorithm after training and testing; Input the data corresponding to the data categories whose correlation meets the predetermined requirements of the target well into the determined model of the liquid production volume of the pumping well based on the XGBoost algorithm, and run to obtain the corresponding liquid production measurement result.
2. The automatic production measurement method for pumping wells based on the XGBoost algorithm according to claim 1, characterized in that, the historical production operation data at least includes: operation parameter data, production data, and feature data extracted from the operation parameter data and the production data; wherein, the operation parameter data at least includes: measured ground dynamometer card, stroke, pumping speed, current, depth of the sucker rod pump, diameter of the sucker rod pump, diameter of the sucker rod, and length of the sucker rod; wherein, the production data at least includes: oil pressure, casing pressure, water cut, and daily liquid production volume.
3. The automatic production measurement method for pumping wells based on the XGBoost algorithm according to claim 2, characterized in that, the feature data at least includes: the slope of the up and down strokes of the pumping unit, maximum load, minimum load, effective stroke, filling degree, weight of the sucker rod string, weight of the liquid column, and theoretical displacement of the pumping unit.
4. The automatic production measurement method for pumping wells based on the XGBoost algorithm according to claim 1, characterized in that, the method for determining the correlation between each data category in the historical production operation data and the liquid production volume includes: Use the Pearson correlation coefficient calculation formula to determine the correlation between each data category in the historical production operation data and the liquid production volume; wherein, the Pearson correlation coefficient calculation formula is: In the formula, n is the dimension of the vector, and x and y are two random variables respectively.
5. The automatic production measurement method for pumping wells based on the XGBoost algorithm according to any one of claims 1-4, characterized in that, it further includes: Determine the error between the liquid production measurement result obtained by running the determined model of the liquid production volume of the pumping well based on the XGBoost algorithm and the actual measurement result; Judge whether the error is greater than the first predetermined value. If so, determine the correction coefficient according to the error; Use the correction coefficient to correct the liquid production measurement result obtained by running the determined model of the liquid production volume of the pumping well based on the XGBoost algorithm to obtain the corrected liquid production measurement result.
6. The automatic production measurement method for pumping wells based on the XGBoost algorithm according to claim 5, characterized in that, The method for determining the error between the liquid production measurement result obtained by running the liquid production determination model of the pumping unit well based on the XGBoost algorithm and the actual measurement result includes: Adopt the glass tube oil measurement or weighing oil measurement method to actually measure the liquid production of the target well for a predetermined number of times; Determine the average value of the liquid production measured actually for the predetermined number of times; Determine the error between the liquid production measurement result obtained by running the liquid production determination model of the pumping unit well based on the XGBoost algorithm and the average value of the liquid production.
7. The automatic liquid production measurement method for the pumping unit well based on the XGBoost algorithm according to claim 6, characterized in that, the method for determining the correction coefficient according to the error includes: Correction coefficient = average value of the liquid production measured actually for the predetermined number of times / liquid production measurement result obtained by running the model.
8. The automatic liquid production measurement method for the pumping unit well based on the XGBoost algorithm according to claim 6 or 7, characterized in that, the method for correcting the liquid production measurement result obtained by running the liquid production determination model of the pumping unit well based on the XGBoost algorithm by using the correction coefficient to obtain the corrected liquid production measurement result includes: Corrected liquid production measurement result = liquid production measurement result obtained by running the model * correction coefficient.
9. An automatic liquid production measurement device for the pumping unit well based on the XGBoost algorithm, characterized in that, it includes: A data acquisition unit for acquiring the historical production operation data of the pumping unit wells in the work area; A sample data screening unit for determining the correlation between each data category in the historical production operation data and the liquid production, selecting the data corresponding to the data categories whose correlation meets the predetermined requirements as sample data, and dividing the sample data into a training set and a test set; A model training unit for establishing a machine learning model based on the XGBoost algorithm, inputting the data of the training set and the test set into the model for training and testing, and obtaining the liquid production determination model of the pumping unit well based on the XGBoost algorithm after training and testing; A liquid production measurement result output unit for inputting the data corresponding to the data categories whose correlation meets the predetermined requirements of the target well into the liquid production determination model of the pumping unit well based on the XGBoost algorithm, and running to obtain the corresponding liquid production measurement result.