Diagnostic method for production data abnormity of natural gas recovery well and storage medium
By identifying the working conditions of the gas production well and analyzing the production data using EM algorithms, the problem that the existing technology cannot accurately identify the source of abnormal data is solved, and accurate diagnosis and alarm of abnormal production data of natural gas production wells is achieved.
Patent Information
- Application Number
- CN202311549221.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-20
- Publication Date
- 2025-05-20
AI Technical Summary
The prior art cannot accurately identify whether the abnormal data in the production data of natural gas production wells is caused by real abnormalities or the operating condition switching.
By identifying the working conditions of the gas production well, the mean and variance calculation of the production data is used using EM algorithm, and combined with the index range of historical data, abnormal data is diagnosed and its source is judged.
It realizes accurate diagnosis of abnormal production data of natural gas production wells, improves the accuracy of data analysis, and can issue alarm prompts in a timely manner.
Smart Images

Figure CN120020773A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of big data analysis, and particularly relates to a diagnostic method for abnormal production data of natural gas production wells. Background Art
[0002] Natural gas has an increasingly greater impact on people's daily lives. Basically, urban households use natural gas systems. Therefore, the demand for natural gas has increased, posing higher requirements for natural gas extraction.
[0003] Currently, natural gas is generally extracted by the natural flow method. However, because the pressure of production wells is generally high and natural gas is a flammable and explosive gas, the requirements for the pressure-bearing capacity and sealing performance of production wellhead devices are much higher than those for oil production wellhead devices. Therefore, it is particularly important to monitor and diagnose the production data of production wells.
[0004] The production data of production wells fluctuates within a large range under different working conditions. If only abnormal deviation, variance, and standard deviation are calculated for the data, it is impossible to accurately identify whether it is caused by a real anomaly or a working condition switch. Summary of the Invention
[0005] In view of the technical problem in the prior art that the specific source of abnormal data cannot be identified, the present invention discloses a diagnostic method for abnormal production data of natural gas production wells. First, the working conditions of the production wells are identified, and then the abnormal data is diagnosed to determine the source of the abnormal data.
[0006] To achieve the above object, the present invention provides the following technical solutions:
[0007] A diagnostic method for abnormal production data of natural gas production wells specifically includes the following steps:
[0008] S1: Obtain the historical production data of natural gas production wells under different working conditions from the server, and determine the corresponding first index range and second index range;
[0009] S2: Real-time obtain the production data of natural gas production wells and perform preprocessing;
[0010] S3: Use the EM algorithm to calculate the mean and variance of the preprocessed production data to obtain a calculation result, and then compare the calculation result with the first index range and the second index range respectively to determine the corresponding working condition;
[0011] S4: Calculate the mean absolute error value according to the preprocessed production data and the indexes of the corresponding working condition, and judge the working state.
[0012] Preferably, the S1 includes:
[0013] S1-1: Obtain the historical production data of natural gas production wells under different operating conditions from the server, where the operating conditions include well opening and well closing;
[0014] S1-2: Remove the outliers from the historical production data under different operating conditions respectively to obtain the first historical database and the second historical database, and then determine the corresponding first index range and second index range according to the maximum and minimum values in the first historical database and the second historical database respectively.
[0015] Preferably, in the S1-1, the historical production data includes oil pressure, casing pressure, instantaneous flow rate, and gas transmission pressure.
[0016] Preferably, in the S1-2, the method for removing outliers from the historical production data includes:
[0017] A. Filtering method:
[0018] First, discretize the characteristic data in the historical production data, score each characteristic data according to divergence or correlation, calculate the variance, and remove the characteristic data with a value less than the variance threshold;
[0019] B. Recursive feature elimination method:
[0020] First, set corresponding weights for each characteristic data in the historical production data, then input the data screening model for training, and remove the characteristic data corresponding to the smallest absolute value of the weight until the number of remaining characteristic data reaches the preset number.
[0021] Preferably, in the S2, the sliding average filtering method is used to preprocess the production data.
[0022] Preferably, in the S3, if the calculation result is within the first index range, the collected production data is in the well-opening condition; if the calculation result is within the second index range, the collected production data is in the well-closing condition.
[0023] Preferably, in the S4, the calculation formula for the mean absolute error value is:
[0024]
[0025] In formula (1), MAE represents the mean absolute error value; y i represents the i-th actual value; f i represents the i-th index; m represents the number of indexes.
[0026] Preferably, it further includes S5:
[0027] When the mean absolute error value is greater than the preset threshold, an alarm prompt is issued and the corresponding operator is notified.
[0028] The present invention also provides a storage medium, on which a computer program is stored, and when the computer program is executed, the steps of a diagnosis method for abnormal production data of a natural gas production well are realized.
[0029] In summary, due to the adoption of the above technical solutions, compared with the prior art, the present invention has at least the following beneficial effects:
[0030] The present invention first preliminarily analyzes the collected data to determine the working condition; then judges whether the data is abnormal according to the indexes corresponding to the working condition. If it is abnormal, an alarm prompt is issued, so as to judge from which working condition the abnormal data comes from, which plays a guiding role in the subsequent data analysis and improves the analysis accuracy. Description of the drawings:
[0031] Figure 1 It is a schematic diagram of a diagnosis method for abnormal production data of a natural gas production well according to an exemplary embodiment of the present invention.
[0032] Figure 2 It is a schematic diagram of the oil pressure data collected in real time according to an exemplary embodiment of the present invention.
[0033] Figure 3 It is a schematic diagram of the oil pressure data after preprocessing according to an exemplary embodiment of the present invention. Detailed implementation manners
[0034] The present invention will be further described in detail below in conjunction with the embodiments and specific implementation manners. However, this should not be construed as limiting the scope of the above-mentioned subject matter of the present invention to the following embodiments. All technologies implemented based on the content of the present invention belong to the scope of the present invention.
[0035] In the description of the present invention, it should be understood that the orientation or positional relationship indicated by the terms "longitudinal", "lateral", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc. is based on the orientation or positional relationship shown in the drawings, and is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be construed as limiting the present invention.
[0036] As Figure 1 shown, a diagnosis method for abnormal production data of a natural gas production well according to the present invention specifically includes the following steps:
[0037] S1: Obtain the historical production data of the natural gas production well under different working conditions from the server, and determine the corresponding first index range and second index range.
[0038] S1-1: Obtain the historical production data of the natural gas production well under different working conditions from the server, where the working conditions include well opening and well closing.
[0039] In this embodiment, the historical production data includes characteristic data such as tubing head pressure, casing pressure, instantaneous flow rate, and gas transmission pressure.
[0040] S1-2: Remove the outliers in the historical production data under different working conditions respectively to obtain the first historical database and the second historical database, and then determine the corresponding first index range and second index range according to the maximum and minimum values in the first historical database and the second historical database respectively.
[0041] In this embodiment, the production data during well opening and well closing are quite different, so the corresponding index ranges are also different.
[0042] In this embodiment, the method for removing outliers in the historical production data includes:
[0043] A. Filtering method:
[0044] Since the production data of the gas production well are all continuous time series data, it is necessary to first discretize the characteristic data, score each characteristic data according to divergence or correlation, calculate the variance, and remove the characteristic data with a variance less than the variance threshold.
[0045] B. Recursive feature elimination method:
[0046] First, set corresponding weights for each characteristic data in the historical production data, then input the data screening model for training, and remove the characteristic data corresponding to the smallest absolute value of the weight until the number of remaining characteristic data reaches the preset number.
[0047] In this embodiment, for example, when the well is open, the tubing head pressure data in the first historical database is 7.2 Kpa, 7.5 Kpa, 7.8 Kpa, 6.5 Kpa, 7.9 Kpa, 6.2 Kpa, 6.9 Kpa, then the first specified range corresponding to the tubing head pressure is 6.2 Kpa - 7.9 Kpa; similarly, when the well is closed, the second specified range corresponding to the tubing head pressure is 8.5 Kpa - 9.7 Kpa.
[0048] S2: Obtain the production data of the natural gas production well in real time and perform preprocessing.
[0049] In this embodiment, the number of production data collected for each gas production well is 1000, and the collection frequency is 1 piece / minute.
[0050] In this embodiment, through the sliding average filtering method, the production data (sampling values) of the natural gas production well obtained in real time are preprocessed to ensure the continuity of the data. The specific method is as follows:
[0051] Regard N consecutive sampled values as a queue. Each time a new data is sampled, it is put into the end of the queue, and the original data at the head of the queue is discarded (first-in, first-out principle); perform an average operation on the N data in the queue to obtain a new filtering result. Selection of N value: for flow rate, N = 12; for pressure, N = 4; for temperature, N = 4.
[0052] According to Figure 2 and Figure 3 From the comparison results of the oil pressure data preprocessing, it can be seen that the moving average filtering method has a good inhibitory effect on periodic interference, has a high smoothness, and is suitable for data with high-frequency oscillations.
[0053] S3: Use the EM algorithm to calculate the mean and variance of the preprocessed production data to obtain the calculation results (the calculation of the mean and variance is a prior art), and then compare the calculation results with the first index range and the second index range respectively to determine the corresponding working conditions.
[0054] The full name of the EM algorithm is the Expectation-Maximization algorithm, that is, the maximum expectation algorithm. The core elements of this algorithm are, one is the expectation, and the other is the maximization of the expectation. And these two elements represent the two processes of the EM algorithm. First, the EM algorithm is an iterative algorithm, that is, each iteration can obtain new parameters after learning, and the end flag of the iteration is generally defined artificially by a threshold or the convergence of the parameters. Second, each iteration of the EM algorithm mainly performs two steps:
[0055] 1. Calculate the expectation to obtain an expectation function formula about the parameters.
[0056] 2. Find the parameters that maximize the expectation function formula.
[0057] In this embodiment, if the calculation result is within the first index range, the collected production data is in the open well working condition; if the calculation result is within the second index range, the collected production data is in the closed well working condition.
[0058] S4: Calculate the mean absolute error value according to the preprocessed production data and the indicators of the corresponding working conditions, and judge the working state.
[0059] In this embodiment, when the mean absolute error value is less than or equal to the preset threshold, the working state is normal; when the mean absolute error value is greater than the preset threshold, the working state is abnormal.
[0060] In this embodiment, the mean absolute error (MAE) is used to measure the deviation degree of the data, that is, the mean absolute error value between the actual value and the indicator. The smaller the value, the lower the deviation degree and the more normal the data. The higher the value, the more the data deviates from the normal situation, and the corresponding operator needs to be notified to check.
[0061]
[0062] In formula (1), MAE represents the mean absolute error value; y i represents the i-th actual value; f i represents the i-th index; m represents the number of indices.
[0063] In this embodiment, it further includes S5:
[0064] When the mean absolute error value is greater than the preset threshold, an alarm prompt is issued, and the corresponding operator is notified to check.
[0065] A computer-readable medium can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of a computer-readable storage medium can include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0066] In the present disclosure, a computer-readable storage medium can be any tangible medium that contains or stores a program, and this program can be used by or in combination with an instruction execution system, apparatus, or device. In the present disclosure, a computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, in which the computer-readable program code is carried. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, and this computer-readable medium can send, propagate, or transmit a program for use by or in combination with an instruction execution system, apparatus, or device. The program code contained on a computer-readable medium can be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0067] The computer-readable medium can be included in a diagnostic method for abnormal production data of natural gas production wells as described, or can exist separately without being assembled into the system. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a system, the method described in the embodiment is implemented.
[0068] Those of ordinary skill in the art can understand that the above embodiments are specific examples for implementing the present invention, and in actual applications, various changes can be made to them in form and details without departing from the spirit and scope of the present invention.
Claims
1. A method for diagnosing abnormal production data of natural gas production wells, characterized in that: The specific steps include: S1: Obtain historical production data of natural gas production wells under different working conditions from a server, and determine the corresponding first indicator range and second indicator range; S2: Real-time acquisition of natural gas well production data and pre-processing; S3: using the EM algorithm to calculate the mean and variance of the preprocessed production data to obtain a calculation result, and then comparing the calculation result with the first indicator range and the second indicator range respectively to determine the corresponding working condition; S4: Calculate the mean absolute error value based on the preprocessed production data and the indicators of the corresponding working conditions to determine the working status.
2. A method for diagnosing abnormal production data of a natural gas production well according to claim 1, characterized in that: The S1 includes: S1-1: Obtain historical production data of natural gas wells under different operating conditions from the server, including well opening and well closing; S1-2: Remove abnormal values in historical production data under different working conditions to obtain a first historical database and a second historical database, and then determine corresponding first indicator ranges and second indicator ranges according to the maximum and minimum values in the first historical database and the second historical database, respectively.
3. A method for diagnosing abnormal production data of a natural gas production well according to claim 2, characterized in that: In S1-1, the historical production data includes oil pressure, casing pressure, instantaneous flow rate, and gas transmission pressure.
4. A method for diagnosing abnormal production data of a natural gas production well according to claim 2, characterized in that: In S1-2, the method for removing abnormal values in the historical production data includes: A. Filtration method: First, discretize the feature data in the historical production data, score each feature data according to divergence or correlation, calculate the variance, and remove the feature data with a variance threshold value; B. Recursive feature elimination method: First, a corresponding weight is set for each feature data in the historical production data, and then the data screening model is input for training to remove the feature data corresponding to the minimum absolute value weight until the number of remaining feature data reaches the preset number.
5. A method for diagnosing abnormal production data of a natural gas production well according to claim 1, characterized in that: In S2, the production data is preprocessed using a sliding average filtering method.
6. A method for diagnosing abnormal production data of a natural gas production well according to claim 1, characterized in that: In S3, if the calculation result is within the first index range, the collected production data is in an open-well condition; if the calculation result is within the second index range, the collected production data is in a closed-well condition.
7. A method for diagnosing abnormal production data of a natural gas production well according to claim 1, characterized in that: In S4, the calculation formula of the mean absolute error value is: In formula (1), MAE represents the mean absolute error; y i represents the i-th actual value; f i represents the i-th indicator; m represents the number of indicators.
8. A method for diagnosing abnormal production data of a natural gas production well according to claim 1, characterized in that: Also includes S5: When the mean absolute error value is greater than the preset threshold, an alarm is issued and the corresponding operator is notified.
9. A storage medium, characterized in that: The storage medium stores a computer program, which, when executed, implements the steps of a method for diagnosing abnormal production data of a natural gas production well as described in any one of claims 1-8.