Method and apparatus for detecting downhole overflow

By integrating ultrasonic signals from the wellbore and the wellbore medium, as well as time-series data on resistivity of the drill pipe's inner and outer walls, and utilizing Rocket and ResNet models to construct a overflow detection model, the complexity and low accuracy of downhole overflow detection are solved. This enables efficient and accurate downhole overflow identification, ensuring drilling safety.

CN122432890APending Publication Date: 2026-07-21CHINA NAT PETROLEUM CORP +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHINA NAT PETROLEUM CORP
Filing Date
2025-01-20
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Existing technologies for downhole overflow detection are cumbersome and complex to operate, time-consuming, and have low accuracy, making them prone to errors and affecting drilling safety.

Method used

By acquiring time-series ultrasonic signal data of the wellbore and the wellbore medium, as well as time-series resistivity data of the inner and outer walls of the drill pipe, and after preprocessing using preset processing rules, these data are fused together. Combined with feature extraction and processing sub-models based on Rocket and ResNet models, a overflow detection model is constructed to achieve efficient and accurate downhole overflow detection.

Benefits of technology

It achieves efficient and accurate downhole overflow detection, enabling timely identification of gas and liquid intrusion levels and ensuring drilling safety.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122432890A_ABST
    Figure CN122432890A_ABST
Patent Text Reader

Abstract

The present specification provides a method and device for detecting downhole overflow. Based on the method, before implementation, a preset overflow detection model including at least a feature extraction sub-model based on a Rocket model and a feature processing sub-model based on a ResNet model can be constructed and trained. During implementation, the ultrasonic signal time series data of the target well about the well wall and the medium in the well, and the resistivity time series data of the target well about the inner and outer walls of the drill pipe can be obtained and preprocessed; then the preprocessed ultrasonic signal time series data and the preprocessed resistivity time series data are fused to obtain target fusion data about the target well; and the preset overflow detection model is used to process the target fusion data to determine whether the target well has downhole overflow. Thus, the downhole overflow of the target well can be efficiently and accurately detected and determined, and the safety of the drilling operation of the target well can be better ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This manual pertains to the field of oil and gas well drilling technology, and particularly relates to methods and devices for detecting downhole overflows. Background Technology

[0002] During oil and gas well drilling, downhole overflows often occur. If they are not detected and dealt with in time, they may lead to safety accidents such as blowouts and well leakage, affecting the safety of drilling operations.

[0003] Existing methods for detecting and identifying downhole overflows often suffer from problems such as cumbersome and complex operation processes, long detection times, low detection accuracy, and susceptibility to detection errors.

[0004] There is currently no effective solution to the above problems. Summary of the Invention

[0005] This manual provides a method and apparatus for detecting downhole overflows, which can efficiently and accurately detect and determine whether a downhole overflow exists in a target well, thus better ensuring the safety of drilling operations in the target well.

[0006] This manual provides a method for detecting downhole overflows, including:

[0007] Acquire time-series data of ultrasonic signals of the target well with respect to the wellbore and the wellbore medium, as well as time-series data of resistivity of the target well with respect to the inner and outer walls of the drill pipe;

[0008] According to the preset processing rules, the ultrasonic signal time series data and resistivity time series data are preprocessed respectively to obtain the preprocessed ultrasonic signal time series data and the preprocessed resistivity time series data.

[0009] By fusing the preprocessed ultrasonic signal time series data and the preprocessed resistivity time series data, target fused data about the target well is obtained;

[0010] The target fusion data is processed using a pre-defined overflow detection model to obtain the corresponding target detection results; wherein the pre-defined overflow detection model includes at least a feature extraction sub-model based on the Rocket model and a feature processing sub-model based on the ResNet model.

[0011] Based on the target detection results, determine whether there is a downhole overflow in the target well.

[0012] In one embodiment, the target detection results include at least: gas intrusion level detection results and liquid intrusion level detection results;

[0013] Accordingly, after determining whether a downhole overflow exists in the target well based on the target detection results, the method further includes:

[0014] If, based on the target detection results, it is determined that there is a downhole overflow in the target well, the overflow type of the target well is determined based on the gas intrusion level detection results and the liquid intrusion level detection results.

[0015] Based on the overflow type of the target well, query the preset downhole treatment strategy set and determine the matching target downhole treatment strategy;

[0016] Based on the target well treatment strategy, the target well is subjected to corresponding downhole overflow elimination treatment.

[0017] In one embodiment, acquiring time-series data of ultrasonic signals from the target well regarding the wellbore and the wellbore medium, as well as time-series data of resistivity from the inner and outer walls of the drill pipe, includes:

[0018] Ultrasonic sensors installed on the drill pipe of the target well emit ultrasonic signals within a specified time period and collect echo signals reflected from the well wall and the medium inside the well. At the same time, resistivity sensors installed on the inner and outer walls of the drill pipe collect resistivity signals at a specified time and calculate the difference between the resistivity signals of the inner and outer walls at the same location on the drill pipe to obtain the corresponding resistivity difference value.

[0019] Based on the time information, the echo signals and resistivity difference values ​​within a specified time period are arranged in sequence to obtain the corresponding ultrasonic signal time series data and resistivity time series data.

[0020] In one embodiment, the ultrasonic signal time-series data is preprocessed according to preset processing rules, including:

[0021] Obtain the operating frequency of the ultrasonic sensor;

[0022] Based on the operating frequency of the ultrasonic sensor, determine the bandpass filter whose bandpass range matches that of the ultrasonic sensor;

[0023] The ultrasonic signal timing data is subjected to bandpass filtering to obtain preprocessed ultrasonic signal timing data that meets the requirements.

[0024] In one embodiment, the resistivity time-series data is preprocessed according to preset processing rules, including:

[0025] Detect outliers in resistivity time-series data;

[0026] Based on the outlier detection results, the outliers in the resistivity time series data are adjusted to obtain the adjusted resistivity time series data.

[0027] According to the preset windowing rules, the adjusted resistivity time series data is divided into multiple windows in chronological order.

[0028] Based on the resistivity time series data in each window, the difference between the maximum and minimum amplitude values ​​in each window is calculated to determine the amplitude difference value of each window, so as to obtain the preprocessed resistivity time series data that meets the requirements.

[0029] In one embodiment, preprocessed ultrasonic signal time-series data and preprocessed resistivity time-series data are fused to obtain target fused data about the target well, including:

[0030] Linear interpolation is performed on the preprocessed resistivity time series data to obtain the expanded resistivity time series data; wherein the number of point data included in the expanded resistivity time series data is the same as that in the preprocessed ultrasonic signal time series data.

[0031] The extended resistivity time series data and the preprocessed ultrasonic signal time series data are time-aligned to obtain aligned resistivity time series data and ultrasonic signal time series data.

[0032] Based on the aligned resistivity time-series data and ultrasonic signal time-series data, a corresponding fusion matrix is ​​constructed as the target fusion data; wherein, the first row of the fusion matrix corresponds to the ultrasonic signal time-series data, the second row corresponds to the resistivity time-series data, and the data in the same column of the first row and the second row correspond to the same time point.

[0033] In one embodiment, the preset overflow detection model further includes a multi-class sub-model;

[0034] Accordingly, the target fusion data is processed using a pre-defined overflow detection model to obtain the corresponding target detection results, including:

[0035] The target fusion data is processed using a feature extraction sub-model to obtain and output the corresponding primary feature matrix;

[0036] The initial feature matrix is ​​processed using a feature processing sub-model to obtain and output the corresponding deep feature matrix;

[0037] The deep feature matrix is ​​processed using a multi-class sub-model to obtain and output a first result vector related to air intrusion level detection and a second result vector related to liquid intrusion level detection, which serve as the target detection results.

[0038] In one embodiment, the method further includes:

[0039] Construct a simulated wellbore; and install corresponding ultrasonic sensors and resistivity sensors on the simulated drill pipe in the simulated wellbore.

[0040] According to the preset first simulation rule, the corresponding air is injected into the simulated well; and by using ultrasonic sensors and resistivity sensors, the first type of sample data is obtained by collecting the corresponding ultrasonic signal time series data and resistivity time series data.

[0041] According to the preset second simulation rule, the corresponding sodium chloride solution is injected into the simulated wellbore; and by using ultrasonic sensors and resistivity sensors, the corresponding ultrasonic signal time series data and resistivity time series data are collected to obtain the second type of sample data.

[0042] By combining the first type of sample data and the second type of sample data, the corresponding joint sample data is constructed.

[0043] Construct an initial overflow detection model; wherein the initial overflow detection model includes at least an initial feature extraction sub-model based on the Rocket model and an initial feature processing sub-model based on the ResNet model;

[0044] By using joint sample data, a pre-defined overflow detection model that meets the requirements is obtained through deep learning on the initial overflow detection model.

[0045] This specification also provides a downhole overflow detection device, including:

[0046] The acquisition module is used to acquire the ultrasonic signal time series data of the target well with respect to the well wall and the well medium, as well as the resistivity time series data of the target well with respect to the inner and outer walls of the drill pipe;

[0047] The preprocessing module is used to perform corresponding preprocessing on ultrasonic signal time series data and resistivity time series data according to preset processing rules, so as to obtain preprocessed ultrasonic signal time series data and preprocessed resistivity time series data.

[0048] The fusion module is used to fuse preprocessed ultrasonic signal time series data and preprocessed resistivity time series data to obtain target fused data about the target well.

[0049] The detection module is used to process target fusion data using a preset overflow detection model to obtain the corresponding target detection results; wherein, the preset overflow detection model includes at least a feature extraction sub-model based on the Rocket model and a feature processing sub-model based on the ResNet model.

[0050] The determination module is used to determine whether there is a downhole overflow in the target well based on the target detection results.

[0051] This specification also provides a computer-readable storage medium storing computer instructions that, when executed by a processor, implement the relevant steps of the downhole overflow detection method.

[0052] Based on the downhole overflow detection method and apparatus provided in this specification, before implementation, a simulated wellbore can be used to construct and train a pre-defined overflow detection model, including at least a feature extraction sub-model based on the Rocket model and a feature processing sub-model based on the ResNet model. In implementation, ultrasonic signal time-series data of the target well regarding the wellbore and the wellbore medium, as well as resistivity time-series data of the target well regarding the inner and outer walls of the drill pipe, can be acquired first. Then, according to pre-defined processing rules, the ultrasonic signal time-series data and resistivity time-series data are pre-processed to obtain pre-processed ultrasonic signal time-series data and pre-processed resistivity time-series data. These are then fused to obtain target fused data for the target well. Finally, the pre-defined overflow detection model is used to process the target fused data to determine whether a downhole overflow exists in the target well. By integrating data from different dimensions, such as ultrasonic signal time-series data and resistivity time-series data about the target well, and by processing the above-mentioned target fused data using a pre-set overflow detection model based on an improved structure, it is possible to efficiently and accurately detect and determine whether there is a downhole overflow in the target well, thus better ensuring the drilling safety of the target well. Attached Figure Description

[0053] To more clearly illustrate the embodiments of this specification, the accompanying drawings used in the embodiments will be briefly introduced below. The drawings described below are only some embodiments recorded in this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0054] Figure 1 This is a schematic flowchart of a downhole overflow detection method provided in one embodiment of this specification;

[0055] Figure 2 This is a schematic diagram illustrating one embodiment of the downhole overflow detection method provided in this specification, applied in a scenario example.

[0056] Figure 3 This is a schematic diagram illustrating one embodiment of the downhole overflow detection method provided in this specification, applied in a scenario example.

[0057] Figure 4 This is a schematic diagram illustrating one embodiment of the downhole overflow detection method provided in this specification, applied in a scenario example.

[0058] Figure 5 This is a schematic diagram illustrating one embodiment of the downhole overflow detection method provided in this specification, applied in a scenario example.

[0059] Figure 6 This is a schematic diagram illustrating one embodiment of the downhole overflow detection method provided in this specification, applied in a scenario example.

[0060] Figure 7 This is a schematic diagram of the structural composition of a computer device provided in one embodiment of this specification;

[0061] Figure 8 This is a schematic diagram of the structural composition of a downhole overflow detection device provided in one embodiment of this specification;

[0062] Figure 9 This is a schematic diagram illustrating one embodiment of the downhole overflow detection method provided in this specification, applied in a scenario example. Detailed Implementation

[0063] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this specification, and not all embodiments. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this specification.

[0064] It should be noted that the information and data related to users involved in the embodiments of this specification are all information and data authorized by the user or fully authorized by the relevant parties. Furthermore, the collection, storage, use, processing, transmission, provision, disclosure, and application of the relevant data all comply with relevant laws, regulations, and standards, and necessary confidentiality measures have been taken. They do not violate public order and good morals, and corresponding operation entry points are provided for users or relevant parties to choose to authorize or refuse.

[0065] It should also be noted that in the embodiments of this specification, certain software, components, models and other existing solutions in the industry may be mentioned. These should be regarded as exemplary and are only intended to illustrate the feasibility of implementing the technical solution of this application. However, they do not mean that the applicant has used or necessarily used the solution.

[0066] See Figure 1 As shown in the embodiments of this specification, a method for detecting downhole overflow is provided. In specific implementation, this method may include the following:

[0067] S101: Acquire the ultrasonic signal time series data of the target well with respect to the wellbore and the well medium, as well as the resistivity time series data of the target well with respect to the inner and outer walls of the drill pipe;

[0068] S102: According to the preset processing rules, the ultrasonic signal time series data and resistivity time series data are preprocessed respectively to obtain the preprocessed ultrasonic signal time series data and the preprocessed resistivity time series data.

[0069] S103: Fuse the preprocessed ultrasonic signal time series data and the preprocessed resistivity time series data to obtain target fused data about the target well;

[0070] S104: Process the target fusion data using a pre-defined overflow detection model to obtain the corresponding target detection results; wherein, the pre-defined overflow detection model includes at least a feature extraction sub-model based on the Rocket model and a feature processing sub-model based on the ResNet model.

[0071] S105: Based on the target detection results, determine whether there is a downhole overflow in the target well.

[0072] Specifically, the aforementioned target wells can be understood as oil and gas wells currently undergoing drilling operations.

[0073] In practice, ultrasonic sensors and resistivity sensors can be installed on the drill pipe of the target well according to the preset layout rules.

[0074] For details, please refer to Figure 9 As shown, two resistivity sensors can be installed on the outer wall of the upper half of the drill pipe at the same horizontal plane, and two resistivity sensors can be installed on the inner wall. The two resistivity sensors installed on the inner wall are symmetrical with respect to the center point of the drill pipe; the lines connecting the two resistivity sensors on the outer wall and the two resistivity sensors on the inner wall are symmetrical with respect to each other. Multiple resistivity sensors installed according to the above layout rules can achieve good coverage and acquisition effect, thus enabling the acquisition of more comprehensive and valuable resistivity time-series data.

[0075] For details, please refer to Figure 9 As shown, a receiving ultrasonic sensor and an transmitting ultrasonic sensor (collectively referred to as ultrasonic sensors) can be installed at different positions on the outer wall of the lower half of the drill rod along the vertical direction; wherein, the two ultrasonic sensors are symmetrical about the center point of the drill rod in the horizontal plane. By deploying multiple ultrasonic sensors according to the above layout rules, good coverage and acquisition effect can be achieved, thereby acquiring more comprehensive and valuable ultrasonic signal time-series data.

[0076] In practice, multiple ultrasonic sensors can be installed at the drill pipe of the target well. Correspondingly, ultrasonic sensors can be used to emit ultrasonic signals; and by collecting the echo signals reflected from the wellbore and the internal medium of the target well, the ultrasonic signal time-series data of the target well regarding the wellbore and the internal medium can be obtained.

[0077] In practice, echo signals reflected from the wellbore and the medium inside the well at multiple different sampling points can be collected and calculated simultaneously to obtain the time-series data of the ultrasonic signals of the target well with respect to the wellbore and the medium inside the well.

[0078] Specifically, based on the aforementioned echo signals, especially the scattered echoes of solid particles in the well medium, the scattered echoes of invading gas, and the reflected echoes from the well wall, various characteristic information that is more relevant to gas intrusion can be analyzed and extracted, such as echo amplitude, echo phase, echo spectral characteristics, and echo arrival time.

[0079] Simultaneously, resistivity sensors can be installed on the inner and outer walls of the drill pipe at multiple locations within the target well. Correspondingly, by collecting and calculating the difference in resistivity signals between the inner and outer walls of the drill pipe using these resistivity sensors, time-series resistivity data of the target well regarding the inner and outer walls of the drill pipe can be obtained.

[0080] In practice, the resistivity signals of the inner and outer walls of the drill pipe at multiple different sampling points can be collected and calculated simultaneously to obtain the time-series resistivity data of the target well with respect to the inner and outer walls of the drill pipe.

[0081] Specifically, based on the difference in resistivity signals between the inner and outer walls of the drill pipe (which can be simply referred to as resistivity difference), it can reflect the difference in resistivity between the inner and outer walls of the drill pipe caused by the change in conductivity of the contact medium on the well wall due to liquid intrusion. In this way, more relevant characteristic information about liquid intrusion can be analyzed and extracted, such as the mean, variance, and rate of change of the resistivity difference.

[0082] The acquired ultrasonic signal time series data and resistivity time series data can be data from different dimensions corresponding to the same time period.

[0083] Specifically, the aforementioned ultrasonic signal timing data may include multiple first-type point data; the aforementioned resistivity timing data may include multiple second-type point data. Each first-type and second-type point data may carry a corresponding timestamp. The timestamps are generated based on the acquisition time of the electrical data.

[0084] Furthermore, the number of the first type of data points can be greater than the number of the second type of data points. Also, among the multiple first type of data points, there can be second type of data points collected at the same time as each of the first type of data points.

[0085] It should be noted that the aforementioned point data (first type of point data, second type of point data) may specifically include point data based on the time dimension, corresponding to different time points; or point data based on the spatial dimension, corresponding to different sampling points.

[0086] The aforementioned pre-set overflow detection model can be understood as a neural network model obtained by pre-testing a simulated well shaft and combining it with deep learning training.

[0087] Based on the aforementioned pre-set overflow detection model, it can comprehensively and meticulously analyze the characteristic changes in the well by using two different dimensions of data: ultrasonic signal time series data and resistivity time series data from the input model. At the same time, it can jointly predict different types of overflows such as gas intrusion and liquid intrusion in the well, and then determine and output the detection results of the downhole overflow.

[0088] For details, please refer to Figure 2 As shown, the aforementioned preset overflow detection model includes at least: a feature extraction sub-model and a feature processing sub-model.

[0089] Specifically, the aforementioned feature extraction sub-model can be constructed based on the Rocket model. This sub-model can be used to extract features from the input fused data to obtain primary features suitable for air intrusion detection and liquid intrusion detection, which are then combined to output the corresponding primary feature matrix.

[0090] The aforementioned feature processing sub-model can be specifically constructed based on the ResNet model. Specifically, this sub-model can be used to perform in-depth joint feature processing on the input primary feature matrix to uncover hidden relationships between different features of the same dimension and between different features of different dimensions. Based on the data patterns trained by deep learning, it integrates and utilizes these relationships to output a corresponding deep feature matrix with better predictive performance.

[0091] The Rocket (RandOm Convolutional KErnel Transform) model described above can be understood as a feature extraction structure based on time series analysis. Based on this structure, time series data are transformed using random convolutional kernels, and the transformed features are used to train a linear classifier. It exhibits good classification accuracy when processing time-series data.

[0092] The ResNet (Residual Network) model described above introduces "residual learning" and adds shortcut connections, or "skip connections," allowing the network to train deeper architectures. Based on this structure, it can learn and utilize the residuals between inputs and outputs to achieve optimizations in deep networks and improve the overall efficiency of the model.

[0093] Furthermore, the aforementioned preset overflow detection model also includes a multi-classification model. This multi-classification model is used to perform overflow detection based on types such as gas intrusion and liquid intrusion, according to the input depth feature matrix, and then outputs a relatively comprehensive and detailed target detection result that includes at least gas intrusion level detection results and liquid intrusion level detection results.

[0094] In practice, the preprocessed ultrasonic signal time-series data and the preprocessed resistivity time-series data can be fused first to obtain more comprehensive and rich target fusion data that integrates feature information from different dimensions. Then, a preset overflow detection model is used to process this target fusion data, jointly utilizing feature information from different dimensions, and simultaneously detecting different types of overflows such as gas intrusion and liquid intrusion, to obtain a target detection result with high accuracy and small error. Based on this target detection result, the presence of downhole overflow in the target well can be detected and determined relatively accurately.

[0095] In practice, if a downhole overflow is confirmed in the target well, a risk warning message about the downhole overflow can be generated. This risk warning message will then be sent to the drilling personnel at the target well so that appropriate measures can be taken in a timely manner to eliminate the downhole overflow and ensure drilling safety.

[0096] Conversely, if it is determined that there is no downhole overflow in the target well, the above process can be repeated to conduct the next round of downhole overflow detection for the target well.

[0097] Based on the above embodiments, ultrasonic signal time-series data of the target well regarding the wellbore and the internal medium, as well as resistivity time-series data of the target well regarding the inner and outer walls of the drill pipe, can be acquired first. Then, according to preset processing rules, the ultrasonic signal time-series data and resistivity time-series data are preprocessed respectively to obtain preprocessed ultrasonic signal time-series data and preprocessed resistivity time-series data. These two data are then fused to obtain target fused data for the target well. Finally, a preset overflow detection model is used to process the target fused data to determine whether downhole overflow exists in the target well. Thus, by fusing feature data from different dimensions, such as ultrasonic signal time-series data and resistivity time-series data of the target well, and processing the target fused data using a preset overflow detection model, the presence of downhole overflow in the target well can be detected and determined efficiently and accurately, effectively ensuring the drilling safety of the target well.

[0098] In one embodiment, the target detection results may include at least: air intrusion level detection results and liquid intrusion level detection results.

[0099] Specifically, the aforementioned air intrusion levels can include six different levels: Level 1, Level 2, Level 3, Level 4, Level 5, and Level 6. The higher the level, the more severe the air intrusion. Level 1 represents the mildest air intrusion, indicating no risk of overflow, at least based solely on the air intrusion aspect. Conversely, Level 6 represents the most severe air intrusion.

[0100] The aforementioned liquid intrusion levels can specifically include four different levels: Level 1, Level 2, Level 3, and Level 4. Similarly, the higher the level, the more severe the liquid intrusion. Level 1 represents the mildest liquid intrusion, at least based solely on the liquid intrusion dimension, there is no risk of overflow. Conversely, Level 4 represents the most severe liquid intrusion.

[0101] It should be noted that the above-mentioned rules for classifying gas intrusion levels and liquid intrusion levels can be determined in advance by clustering a large number of historical overflow records and combining them with expert experience.

[0102] In practice, the above target detection results may include at least a first result vector and a second result vector.

[0103] The first result vector is used to characterize the air intrusion level detection result. It may contain 6 elements corresponding to the 6 air intrusion levels, and the value of each element represents the probability value of the corresponding air intrusion level.

[0104] The second result vector mentioned above is used to characterize the liquid intrusion level detection result. It can contain four elements corresponding to the four liquid intrusion levels, and the value of each element represents the probability value of the corresponding liquid intrusion level.

[0105] Accordingly, the above-mentioned determination of whether there is a downhole overflow in the target well based on the target detection results may include the following in specific implementation:

[0106] S1: Determine the gas invasion level corresponding to the element with the largest value in the first result vector, and use it as the target gas invasion level of the target well; determine the liquid invasion level corresponding to the element with the largest value in the second result vector, and use it as the target liquid invasion level of the target well.

[0107] S2: Determine whether there is downhole overflow in the target well based on the target gas invasion level and the target liquid invasion level.

[0108] In practice, determining whether a downhole overflow exists in a target well based on the target gas invasion level and the target liquid invasion level may include the following:

[0109] S1: Detect whether the target gas intrusion level and target liquid intrusion level are at the first level;

[0110] S2: If the target gas invasion level is determined to be Level 1 and the target liquid invasion level is determined to be Level 1, then the target well is determined to have no downhole overflow.

[0111] In practice, if the target gas invasion level is not the first level and the target liquid invasion level is not the first level, it is determined that there is a downhole overflow in the target well.

[0112] In specific implementation, if one of the target gas intrusion level and the target liquid intrusion level is not at the first level, while the other is at the first level, the method may further include the following:

[0113] S1: Obtain the data value of the element corresponding to the target gas intrusion level as the first data value, and obtain the data value of the element corresponding to the target liquid intrusion level as the second data value;

[0114] S2: Determine the weight coefficients of the target gas intrusion level and the target liquid intrusion level according to the preset weight coefficient mapping rules; wherein, the preset weight coefficient mapping rules are determined in advance based on historical overflow processing records through clustering and machine learning, combined with expert experience, and the preset weight coefficient mapping rules include the weight coefficients of the gas intrusion level and the weight coefficients of the liquid intrusion level under different combinations of gas intrusion level and liquid intrusion level.

[0115] S3: Based on the weighting coefficients of the target gas invasion level, the target liquid invasion level, the first data value, and the second data value, the overflow risk parameters of the target well are obtained through weighted calculation.

[0116] S4: Determine whether there is a downhole overflow in the target well by detecting whether the overflow risk parameter of the target well is greater than the preset risk threshold.

[0117] Specifically, the weighting coefficients (e.g., w1) for the target gas intrusion level and the weighting coefficients (w2) for the target liquid intrusion level can be determined based on the relative reliability between the ultrasonic sensor and the resistivity sensor used, and / or the relative impact of gas intrusion and liquid intrusion on the overflow.

[0118] In practice, the performance parameters of the ultrasonic sensor and the resistivity sensor, as well as the calibration test results for the ultrasonic sensor and the resistivity sensor respectively, can be obtained separately. Based on the above performance parameters and calibration test results, the measurement sensitivity of the ultrasonic sensor and the measurement sensitivity of the resistivity sensor can be determined. Based on the measurement sensitivity of the ultrasonic sensor and the measurement sensitivity of the resistivity sensor, the relative reliability between the ultrasonic sensor and the resistivity sensor can be determined.

[0119] In practice, field test data can be collected from the target well. Based on the field test data and expert experience, the impact of gas intrusion on the overflow of the target well and the impact of liquid intrusion on the overflow of the target well can be assessed respectively. Then, by combining the impact of gas intrusion on the overflow of the target well and the impact of liquid intrusion on the overflow of the target well, the relative impact of gas intrusion and liquid intrusion on the overflow can be determined.

[0120] Based on the above embodiments, various complex overflow situations can be analyzed in detail according to the gas intrusion level detection results and liquid intrusion level detection results in the target detection results, and the existence of downhole overflow in the target well can be accurately detected and judged.

[0121] In some embodiments, the target detection results include at least: gas intrusion level detection results and liquid intrusion level detection results;

[0122] Accordingly, see Figure 3 As shown, after determining whether there is a downhole overflow in the target well based on the target detection results, the method may further include the following in its specific implementation:

[0123] S1: If the target well is found to have downhole overflow based on the target detection results, the overflow type of the target well is determined based on the gas invasion level detection results and the liquid invasion level detection results;

[0124] S2: Based on the overflow type of the target well, query the preset downhole treatment strategy set and determine the matching target downhole treatment strategy;

[0125] S3: Based on the target well treatment strategy, perform corresponding downhole overflow elimination treatment on the target well.

[0126] Among them, each overflow type corresponds to at least one combination of gas intrusion level and liquid intrusion level.

[0127] In practice, the combination of target gas invasion level and target liquid invasion level can be determined based on the gas invasion level detection results and liquid invasion level detection results. Then, by querying the preset overflow type correspondence table, the overflow type corresponding to the combination of target gas invasion level and target liquid invasion level can be found as the overflow type of the target well.

[0128] Before implementation, a large number of historical overflow handling records can be obtained. Based on a preset overflow type correspondence table, different combinations of gas intrusion and liquid intrusion levels are distinguished, and the historical overflow handling records are clustered to obtain multiple processing data groups. Each processing data group corresponds to at least one overflow type and includes common operations for overflow elimination processing for the corresponding overflow type. Based on the multiple processing data groups, multiple preset downhole handling strategies corresponding to multiple overflow types are constructed. The multiple preset downhole handling strategies are combined, and the correspondence between the preset downhole handling strategies and overflow types is established to obtain a preset downhole handling strategy set.

[0129] Based on the above embodiments, when it is determined that there is a downhole overflow in the target well, a matching target downhole treatment strategy can be determined according to a preset set of downhole treatment strategies. Then, the target well can be repaired and adjusted in a targeted manner according to the target downhole treatment strategy to eliminate the downhole overflow in the target well in a timely manner and ensure the safety of subsequent drilling operations in the target well.

[0130] In some embodiments, the acquisition of ultrasonic signal time-series data of the target well with respect to the wellbore and the wellbore medium, as well as resistivity time-series data of the target well with respect to the inner and outer walls of the drill pipe, may specifically include the following:

[0131] S1: Ultrasonic sensors installed on the drill pipe of the target well emit ultrasonic signals within a specified time period and collect echo signals reflected from the well wall and the medium inside the well; at the same time, resistivity sensors installed on the inner and outer walls of the drill pipe collect resistivity signals at a specified time and calculate the difference between the resistivity signal of the inner wall and the resistivity signal of the outer wall at the same location on the drill pipe to obtain the corresponding resistivity difference value.

[0132] S2: Based on the time information, arrange the echo signals and resistivity difference values ​​within the specified time period in sequence to obtain the corresponding ultrasonic signal time series data and resistivity time series data.

[0133] Based on the above embodiments, by combining ultrasonic sensors and resistivity sensors deployed at corresponding positions on the drill pipe, ultrasonic signal time-series data and resistivity time-series data that are interrelated and have good synchronization with the target well can be efficiently acquired.

[0134] In some embodiments, the ultrasonic signal time-series data is preprocessed according to preset processing rules, including:

[0135] S1: Obtain the operating frequency of the ultrasonic sensor;

[0136] S2: Determine a bandpass filter whose bandpass range matches the ultrasonic sensor based on the operating frequency of the ultrasonic sensor;

[0137] S3: Perform corresponding bandpass filtering on the ultrasonic signal timing data using a bandpass filter to obtain preprocessed ultrasonic signal timing data that meets the requirements.

[0138] The operating frequency (or center frequency) of the ultrasonic sensor can be 200kHz.

[0139] Accordingly, a bandpass filter with a bandpass range of 200kHz to 600kHz can be selected as the matching bandpass filter.

[0140] In practice, by using the aforementioned bandpass filter to perform bandpass filtering on the ultrasonic signal time series data, low-frequency and high-frequency interference can be effectively filtered out, while retaining the main echo signal. This reduces the impact of environmental noise and improves the signal-to-noise ratio (SNR) of the data, so that a clearer waveform can be obtained based on the aforementioned ultrasonic signal time series data analysis.

[0141] In some embodiments, see Figure 4 As shown, the resistivity time series data is preprocessed according to preset processing rules. In specific implementation, this may include the following:

[0142] S1: Perform outlier detection on resistivity time series data;

[0143] S2: Based on the outlier detection results, adjust the outliers in the resistivity time series data to obtain the adjusted resistivity time series data;

[0144] S3: According to the preset windowing rules, the adjusted resistivity time series data is divided into multiple windows in chronological order;

[0145] S4: Based on the resistivity time series data in each window, calculate the difference between the maximum and minimum amplitude values ​​in each window, determine the amplitude difference value of each window, and obtain the preprocessed resistivity time series data that meets the requirements.

[0146] In practice, the above-mentioned outlier detection of resistivity time-series data may include the following:

[0147] S1: Calculate the mean and standard deviation of the resistivity time series data based on the resistivity time series data;

[0148] S2: Check whether the absolute value of the difference between each data point in the resistivity time series data and the average value is greater than a specified multiple of the standard deviation;

[0149] S3: When an absolute value of the difference between a data point and the average value in resistivity time-series data is detected to be greater than a specified multiple of the standard deviation, the data point is marked as an outlier, and the corresponding outlier detection result is obtained.

[0150] The specified multiple can be 3 times.

[0151] In practice, the abnormal values ​​in the aforementioned resistivity adjustment timing data may include the following:

[0152] S1: Identify the normal values ​​in the resistivity time series data that are adjacent to the outliers;

[0153] S2: Based on the normal value, determine the adjustment value corresponding to the abnormal value through interpolation;

[0154] S3: Replace outliers in the resistivity time series data with corresponding adjustment values.

[0155] Specifically, in resistivity time-series data, normal values ​​located at the five positions preceding and / or following the outlier can be selected as normal values ​​adjacent to the outlier. When an outlier exists at either the five positions preceding or following the outlier, that outlier can be removed.

[0156] This allows for the timely elimination of outliers in resistivity time-series data, preventing errors caused by outliers from being carried over into subsequent data processing and ensuring overall data processing accuracy.

[0157] In practice, based on preset windowing rules and the amount of resistivity time-series data, the multiple Type II data points (e.g., 160 Type II data points) arranged chronologically within the resistivity time-series data can be divided into 5 time windows, each containing 32 Type II data points. Then, each time window is slid across 16 points to obtain 10 windows. For each window, the difference between the maximum and minimum amplitude values ​​of the Type II data points within that window is calculated, yielding the amplitude difference value for that window. This amplitude difference value characterizes the sinusoidal wave characteristics formed by the multiple Type II data points within that window. Finally, the amplitude difference values ​​of the multiple windows are arranged according to their chronological order to obtain the preprocessed resistivity time-series data.

[0158] In this way, the original 160 Class II point data points, which were relatively numerous and had relatively poor characterization effects, can be simplified into amplitude difference values ​​of 10 corresponding windows, which can be used as preprocessed resistivity time series data. This allows for more efficient and accurate mining and use of relevant feature information based on the preprocessed resistivity time series data.

[0159] In some embodiments, see Figure 5 As shown, the above-mentioned fusion of preprocessed ultrasonic signal time series data and preprocessed resistivity time series data yields target fusion data for the target well. In specific implementations, this may include the following:

[0160] S1: Perform linear interpolation to extend the preprocessed resistivity time series data to obtain extended resistivity time series data; wherein, the number of point data contained in the extended resistivity time series data is the same as that in the preprocessed ultrasonic signal time series data.

[0161] S2: Time-align the extended resistivity time-series data and the preprocessed ultrasonic signal time-series data to obtain aligned resistivity time-series data and ultrasonic signal time-series data.

[0162] S3: Based on the aligned resistivity time-series data and ultrasonic signal time-series data, construct a corresponding fusion matrix as the target fusion data; wherein, the first row of the fusion matrix corresponds to the ultrasonic signal time-series data, the second row corresponds to the resistivity time-series data, and the data in the same column of the first row and the second row correspond to the same time point.

[0163] In practice, since the number of point data contained in the preprocessed resistivity data is smaller than that in the preprocessed ultrasonic signal time series data, in order to better integrate these two different dimensions of data, the preprocessed resistivity data can be linearly interpolated and extended so that the number of point data contained in the extended resistivity time series data is the same as that in the preprocessed ultrasonic signal time series data.

[0164] In practice, linear interpolation can be performed on two adjacent data points in the preprocessed ultrasonic signal time series data to obtain multiple new data points; then, the new data points and the original data points in the preprocessed ultrasonic signal time series data are combined in sequence to obtain the extended resistivity time series data.

[0165] The aforementioned linear interpolation extension may include linear interpolation extension based on point data from two adjacent sampling points, and / or linear interpolation extension based on point data from two adjacent time points.

[0166] Specifically, the preprocessed resistivity time series data can be linearly interpolated and expanded according to the following formula:

[0167]

[0168] Where i = 1, 2, 3, ..., 30, y1 and y2 are two adjacent data points in the preprocessed resistivity time series data, y1 is the data point ranked earlier in the two data points, and y2 is the data point ranked later in the two data points. new (i) represents the newly added point data obtained by linear interpolation between two point data, where i is the data number of the newly added point data.

[0169] Specifically, while generating the corresponding new point data through linear interpolation, a timestamp for the new point data can also be generated based on the timestamps of the two adjacent point data corresponding to the new point data and the data number when the new point data is arranged between the two adjacent point data; and the corresponding timestamp is added to the new point data.

[0170] In practice, the second type of point data and the first type of point data corresponding to the same time point can be determined based on the timestamp of the second type of point data in the extended resistivity time series data and the timestamp of the first type of point data in the preprocessed ultrasonic signal time series data, so as to achieve time alignment.

[0171] In practice, the time-series data of resistivity and ultrasonic signals after alignment can be standardized. Then, a corresponding fusion matrix can be constructed based on the standardized time-series data of resistivity and ultrasonic signals. The first row of data in the fusion matrix corresponds to the time-series data of ultrasonic signals, the second row corresponds to the time-series data of resistivity, and the first and second point data corresponding to the same time point are located in the same column.

[0172] Based on the above embodiments, timestamps can be used to align resistivity time-series data and ultrasonic signal time-series data based on different dimensions. Then, using the aligned resistivity time-series data and ultrasonic signal time-series data, target fusion data can be constructed that can simultaneously carry two different dimensions of data and reflect the correlation of different dimensions of data at the same point in time. This allows for accurate and comprehensive analysis and judgment of whether downhole overflow exists based on the target fusion data.

[0173] In some embodiments, the preset overflow detection model may further include a multi-class sub-model;

[0174] Accordingly, the above-mentioned processing of target fusion data using a preset overflow detection model to obtain the corresponding target detection results may include, in specific implementation:

[0175] S1: Process the target fusion data using the feature extraction sub-model to obtain and output the corresponding primary feature matrix;

[0176] S2: Process the primary feature matrix using the feature processing sub-model to obtain and output the corresponding deep feature matrix;

[0177] S3: Use a multi-class sub-model to process the deep feature matrix, obtain and output the first result vector related to air intrusion level detection and the second result vector related to liquid intrusion level detection, as the target detection result.

[0178] Based on the above embodiments, the preset overflow detection model can be used to effectively and fully process the target fusion data in order to obtain target detection results with high accuracy and good effect.

[0179] In practice, the aforementioned feature extraction sub-model may include at least multiple convolutional kernels, a global max pooling layer and a global min pooling layer connected in sequence with the convolutional kernels, and a feature matrix merging unit.

[0180] Accordingly, the above-mentioned use of the feature extraction sub-model to process the target fusion data, obtain and output the corresponding primary feature matrix, may include the following in specific implementations:

[0181] S1: Using multiple convolution kernels, perform convolution operations on the target fusion data to obtain multiple convolution results;

[0182] S2: Use global max pooling layer and global min pooling layer to perform corresponding pooling operations on multiple convolution results to obtain the first intermediate feature vector of ultrasonic signal time series data and the second intermediate feature vector of resistivity time series data.

[0183] S3: Using the feature matrix merging unit, merge the first intermediate feature vector and the second intermediate feature vector to obtain the corresponding primary feature matrix.

[0184] In specific implementation, the aforementioned feature processing sub-model may include at least: a matrix transformation unit and multiple ResNet network layers; wherein, each ResNet network layer includes multiple residual blocks, comprising 3 convolutional layers, 3 batch normalization layers, and 3 ReLU activation functions, connected by skip connections. These skip connections are used to preserve original information and prevent gradient vanishing.

[0185] Accordingly, the above-mentioned use of the feature processing sub-model to process the primary feature matrix and obtain and output the corresponding deep feature matrix may include the following in specific implementations:

[0186] S1: The matrix transformation unit is used to perform a format transformation operation on the primary feature matrix to obtain the reshaped feature matrix with a 3D shape that matches the ResNet network layer.

[0187] S2: The reshaped feature matrix is ​​processed using multiple ResNet network layers. Based on its deep learning capabilities, deep feature extraction and integration are performed to obtain and output the corresponding deep feature matrix.

[0188] In specific implementation, the above multi-class sub-model may include at least: a global average pooling layer, and a first fully connected layer and a second fully connected layer connected in parallel; wherein, the first fully connected layer includes at least 6 neuron structures, the second fully connected layer includes at least 4 neuron structures, and the first fully connected layer and the second fully connected layer are respectively connected to a softmax activation function.

[0189] Accordingly, the above-mentioned processing of deep feature matrices using a multi-class sub-model can, in practice, include the following:

[0190] S1: Use a global average pooling layer to reduce the dimensionality of the depth feature matrix to obtain the corresponding depth feature vector;

[0191] S2: The first fully connected layer is used to process the depth feature vector, determine and output the corresponding first result vector; at the same time, the second fully connected layer is used to process the depth feature vector, determine and output the corresponding second result vector.

[0192] In some embodiments, the method is specifically implemented as described in the following references. Figure 6 As shown, it may also include the following:

[0193] S1: Construct a simulated wellbore; and install corresponding ultrasonic sensors and resistivity sensors on the simulated drill pipe in the simulated wellbore.

[0194] S2: According to the preset first simulation rule, inject the corresponding air into the simulated well; and use ultrasonic sensors and resistivity sensors to collect the corresponding ultrasonic signal time series data and resistivity time series data to obtain the first type of sample data.

[0195] S3: According to the preset second simulation rule, inject the corresponding sodium chloride solution into the simulated wellbore; and use ultrasonic sensors and resistivity sensors to collect the corresponding ultrasonic signal time series data and resistivity time series data to obtain the second type of sample data.

[0196] S4: Combine the first type of sample data and the second type of sample data to construct the corresponding joint sample data;

[0197] S5: Construct the initial overflow detection model; wherein the initial overflow detection model includes at least an initial feature extraction sub-model based on the Rocket model and an initial feature processing sub-model based on the ResNet model.

[0198] S6: Using joint sample data, a pre-defined overflow detection model that meets the requirements is obtained by performing deep learning on the initial overflow detection model.

[0199] In practice, according to a preset first simulation rule, air at different flow rates (e.g., 0.2 L / min, 0.3 L / min, 0.4 L / min, 0.5 L / min, and 0.6 L / min) can be injected sequentially as simulated gas to perform multiple gas intrusion simulations. Simultaneously, multiple sets of ultrasonic signal time-series data and resistivity time-series data are collected; each set of data corresponds to a flow rate. After collecting the ultrasonic signal time-series data and resistivity time-series data, the gas intrusion level and liquid intrusion level at each time point can be determined according to the corresponding rating rules. Corresponding gas intrusion level labels and liquid intrusion level labels are then set for each data point included in the ultrasonic signal time-series data and resistivity time-series data to obtain the first type of sample data.

[0200] In practice, according to the preset second simulation rules, a 5% sodium chloride solution can be used as the simulation liquid, injected stably into the simulated wellbore at a specified rate (e.g., 1 g / s), and maintained for multiple different injection durations (e.g., 60 seconds, 120 seconds, and 180 seconds) to perform multiple liquid intrusion simulations. Simultaneously, multiple sets of ultrasonic signal time-series data and resistivity time-series data are collected; each set of data corresponds to a specific injection duration. After collecting the ultrasonic signal time-series data and resistivity time-series data, the gas intrusion level and liquid intrusion level at each time point can be determined according to the corresponding rating rules. Corresponding gas intrusion level labels and liquid intrusion level labels are then set for each data point included in the ultrasonic signal time-series data and resistivity time-series data to obtain the second type of sample data.

[0201] In practice, the first type of sample data and the second type of sample data can be randomly mixed to obtain the corresponding joint sample data.

[0202] In practical implementation, when constructing the initial feature extraction sub-model in the initial overflow detection model, multiple (e.g., 1000) random convolutional kernels can be generated using a random number generator based on the Rocket model's structure; and the convolutional kernel parameters for each kernel can be randomly determined. These parameters include: kernel length, stride, dilation rate, and bias. Specifically, the kernel length can be randomly generated between 50 and 625 sampling points; the stride can be randomly generated between 1 and 3 integer values; the dilation rate can be randomly generated between 1 and 4 integer values; and the bias can be randomly generated between -1 and 1 floating-point values. These convolutional kernels are then connected to the initial global max-pooling layer, the initial global min-pooling layer, and the feature matrix merging unit to obtain the initial feature extraction sub-model.

[0203] In practice, when constructing the initial feature processing sub-model in the initial overflow detection model, multiple initial residual blocks can be constructed based on the ResNet model structure, using 3 convolutional layers, 3 batch normalization layers, 3 ReLU activation functions, and skip connections. These multiple initial residual blocks are then combined to construct a multi-layer ResNet network, which is then connected to a matrix transformation unit to obtain the initial feature processing sub-model.

[0204] In practical implementation, the initial overflow detection model mentioned above also includes an initial multi-class sub-model. When constructing the initial multi-class sub-model, an initial first fully connected layer containing 6 neurons (each used to predict the probability values ​​of 6 air intrusion levels) and an initial second fully connected layer containing 4 neurons (each used to predict the probability values ​​of 4 liquid intrusion levels) can be constructed first. The initial first and second fully connected layers are then connected in parallel to obtain a parallel network layer. A corresponding global average pooling layer is connected to the input of the parallel network layer, and a softmax activation function is connected to the output to obtain the initial multi-class sub-model.

[0205] In practice, cross-entropy loss can be used as the initial loss function. Based on this initial loss function, a first weighted loss term for the gas intrusion level detection result and a second weighted loss term for the liquid intrusion level detection result are introduced to obtain the improved target loss function.

[0206] Meanwhile, the Adam optimizer was selected as the optimizer for model training, and the initial learning rate, learning rate change rules, and weight update step size were set in combination with the amount of joint sample data.

[0207] When using joint sample data to perform deep learning on the initial overflow detection model, the Adam optimizer is used for gradient descent and multiple rounds of iterative training are conducted.

[0208] In each iteration of training, the loss value for the current round is calculated based on the target loss function; and the model parameters are updated based on the current loss value and the current learning rate to complete the current round of training. After completing the current round of training, the weights are updated according to the learning rate change rules, the target loss function for the current round is updated, and the learning rate for the current round is also updated to proceed to the next round of training. Training stops when the training termination condition is met, and the final model is identified as the preset overflow detection model that meets the requirements.

[0209] Based on the above embodiments, by constructing and utilizing a simulated wellbore and conducting simulation tests in various downhole scenarios, relatively rich joint sample data can be obtained. Then, by using the joint sample data, deep learning can be performed on the initial overflow detection model built based on a specific structure. This can fully leverage the model structure advantages of the Rocket model and the ResNet model, and efficiently train a preset overflow detection model with good performance at a relatively low cost.

[0210] In some embodiments, the method may further include: simultaneously injecting corresponding air and sodium chloride solution into a simulated wellbore according to a preset third simulation rule; and using an ultrasonic sensor and a resistivity sensor to collect corresponding ultrasonic signal time series data and resistivity time series data to obtain third type of sample data; and using the first type of sample data, the second type of sample data, and the third type of sample data in combination to construct corresponding joint sample data.

[0211] In this way, a third type of sample data can be simulated and collected in a relatively complex downhole scenario where gas intrusion and liquid intrusion coexist. By integrating the first, second, and third types of sample data, a richer and more comprehensive joint sample data can be obtained, which can cover more complex downhole scenarios. Subsequently, the above joint sample data can be used to train a preset overflow detection model with relatively better performance.

[0212] As can be seen from the above, based on the downhole overflow detection method provided in the embodiments of this specification, before specific implementation, a simulated wellbore can be used to construct and train a preset overflow detection model that includes at least a feature extraction sub-model based on the Rocket model and a feature processing sub-model based on the ResNet model. In specific implementation, ultrasonic signal time-series data of the target well regarding the wellbore and the wellbore medium, as well as resistivity time-series data of the target well regarding the inner and outer walls of the drill pipe, can be acquired first. Then, according to preset processing rules, the ultrasonic signal time-series data and resistivity time-series data are preprocessed respectively to obtain preprocessed ultrasonic signal time-series data and preprocessed resistivity time-series data. The preprocessed ultrasonic signal time-series data and preprocessed resistivity time-series data are then fused to obtain target fused data for the target well. Finally, the preset overflow detection model is used to process the target fused data to determine whether downhole overflow exists in the target well. By integrating and using characteristic data from different dimensions, such as ultrasonic signal time-series data and resistivity time-series data of the target well, and processing the above-mentioned target fused data using a preset overflow detection model, it is possible to efficiently and accurately detect and determine whether there is a downhole overflow in the target well, thus better ensuring the drilling safety of the target well.

[0213] This specification provides an embodiment of a computer device, see below. Figure 7 As shown. The computer device includes a network communication port 701, a processor 702, and a memory 703. These structures are connected by internal cables so that they can perform specific data interaction.

[0214] Specifically, the network communication port 701 can be used to acquire ultrasonic signal time-series data of the target well with respect to the wellbore and the well medium, as well as resistivity time-series data of the target well with respect to the inner and outer walls of the drill pipe.

[0215] The processor 702 can be specifically used to preprocess ultrasonic signal time-series data and resistivity time-series data according to preset processing rules to obtain preprocessed ultrasonic signal time-series data and preprocessed resistivity time-series data; fuse the preprocessed ultrasonic signal time-series data and preprocessed resistivity time-series data to obtain target fusion data about the target well; process the target fusion data using a preset overflow detection model to obtain the corresponding target detection result; wherein the preset overflow detection model includes at least a feature extraction sub-model based on the Rocket model and a feature processing sub-model based on the ResNet model; and determine whether there is a downhole overflow in the target well based on the target detection result.

[0216] The memory 703 can be used to store corresponding instruction programs, as well as related data such as ultrasonic signal timing data, resistivity timing data, and target fusion data.

[0217] Based on the above method, the relevant structural performance of computer equipment can be effectively utilized to improve the data processing speed of electronic equipment and efficiently realize the data processing for downhole overflow detection.

[0218] In this embodiment, the network communication port 701 can be a virtual port bound to different communication protocols, thereby enabling the sending or receiving of different data. For example, the network communication port can be a port responsible for web data communication, a port responsible for FTP data communication, or a port responsible for email data communication. Furthermore, the network communication port can also be a physical communication interface or communication chip. For example, it can be a wireless mobile network communication chip, such as GSM or CDMA; it can also be a Wi-Fi chip; or it can be a Bluetooth chip.

[0219] In this embodiment, the processor 702 can be implemented in any suitable manner. For example, the processor can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers, etc. This specification is not limiting.

[0220] In this embodiment, the memory 703 may include multiple layers. In a digital system, anything that can store binary data can be a memory. In an integrated circuit, a circuit with storage function but no physical form is also called a memory, such as RAM, FIFO, etc. In a system, a storage device with a physical form is also called a memory, such as a memory stick, TF card, etc.

[0221] This specification also provides a computer-readable storage medium based on the above-described downhole overflow detection method. The computer-readable storage medium stores computer program instructions that, when executed, perform the following: acquire ultrasonic signal time-series data of the target well regarding the wellbore and the wellbore medium, and resistivity time-series data of the target well regarding the inner and outer walls of the drill pipe; preprocess the ultrasonic signal time-series data and resistivity time-series data according to preset processing rules to obtain preprocessed ultrasonic signal time-series data and preprocessed resistivity time-series data; fuse the preprocessed ultrasonic signal time-series data and preprocessed resistivity time-series data to obtain target fused data for the target well; process the target fused data using a preset overflow detection model to obtain corresponding target detection results; wherein the preset overflow detection model includes at least a feature extraction sub-model based on the Rocket model and a feature processing sub-model based on the ResNet model; and determine whether downhole overflow exists in the target well based on the target detection results.

[0222] In this embodiment, the storage medium includes, but is not limited to, Random Access Memory (RAM), Read-Only Memory (ROM), cache, hard disk drive (HDD), or memory card. The memory can be used to store computer program instructions. The network communication unit can be an interface configured according to standards specified in the communication protocol for network connection communication.

[0223] In this embodiment, the specific functions and effects implemented by the program instructions stored in the computer-readable storage medium can be explained in comparison with other embodiments, and will not be repeated here.

[0224] This specification also provides a computer program product, comprising at least a computer program, which, when executed by a processor, implements the following method steps: acquiring ultrasonic signal time-series data of the target well regarding the wellbore and the wellbore medium, and resistivity time-series data of the target well regarding the inner and outer walls of the drill pipe; performing corresponding preprocessing on the ultrasonic signal time-series data and resistivity time-series data according to preset processing rules, to obtain preprocessed ultrasonic signal time-series data and preprocessed resistivity time-series data; fusing the preprocessed ultrasonic signal time-series data and preprocessed resistivity time-series data to obtain target fused data of the target well; processing the target fused data using a preset overflow detection model to obtain corresponding target detection results; wherein, the preset overflow detection model includes at least a feature extraction sub-model based on the Rocket model and a feature processing sub-model based on the ResNet model; and determining whether there is a downhole overflow in the target well based on the target detection results.

[0225] See Figure 8 As shown in the embodiments of this specification, a downhole overflow detection device is also provided, which may specifically include the following structural modules:

[0226] The acquisition module 801 can be used to acquire the ultrasonic signal time series data of the target well with respect to the well wall and the medium inside the well, as well as the resistivity time series data of the target well with respect to the inner and outer walls of the drill pipe.

[0227] The preprocessing module 802 can be used to perform corresponding preprocessing on ultrasonic signal time series data and resistivity time series data according to preset processing rules, so as to obtain preprocessed ultrasonic signal time series data and preprocessed resistivity time series data.

[0228] The fusion module 803 can be used to fuse preprocessed ultrasonic signal time series data and preprocessed resistivity time series data to obtain target fusion data about the target well.

[0229] The detection module 804 can be used to process target fusion data using a preset overflow detection model to obtain the corresponding target detection results; wherein, the preset overflow detection model includes at least a feature extraction sub-model based on the Rocket model and a feature processing sub-model based on the ResNet model.

[0230] The determination module 805 can be used to determine whether there is a downhole overflow in the target well based on the target detection results.

[0231] In some embodiments, the target detection results may include at least: gas intrusion level detection results and liquid intrusion level detection results;

[0232] Accordingly, after determining whether a downhole overflow exists in the target well based on the target detection results, the device can also be used in specific implementations to: determine the overflow type of the target well based on the gas intrusion level detection results and the liquid intrusion level detection results when it is determined that a downhole overflow exists in the target well based on the target detection results; query a preset downhole treatment strategy set based on the overflow type of the target well to determine a matching target downhole treatment strategy; and perform corresponding downhole overflow elimination treatment on the target well based on the target downhole treatment strategy.

[0233] In some embodiments, when the acquisition module 801 is specifically implemented, it can acquire the ultrasonic signal time series data of the target well regarding the well wall and the well medium, as well as the resistivity time series data of the target well regarding the inner and outer walls of the drill pipe, in the following manner: Ultrasonic sensors deployed on the drill pipe of the target well emit ultrasonic signals within a specified time period and collect the echo signals reflected by the well wall and the well medium; simultaneously, resistivity sensors deployed on the inner and outer walls of the drill pipe collect resistivity signals at a specified time and calculate the difference between the resistivity signal of the inner wall and the resistivity signal of the outer wall at the same location on the drill pipe to obtain the corresponding resistivity difference value; based on the time information, the echo signals and resistivity difference values ​​within the specified time period are arranged sequentially to obtain the corresponding ultrasonic signal time series data and resistivity time series data.

[0234] In some embodiments, when the preprocessing module 802 is specifically implemented, it can perform corresponding preprocessing on the ultrasonic signal timing data according to the preset processing rules in the following manner: obtaining the operating frequency of the ultrasonic sensor; determining a bandpass filter whose bandpass range matches the ultrasonic sensor based on the operating frequency of the ultrasonic sensor; and performing corresponding bandpass filtering processing on the ultrasonic signal timing data using the bandpass filter to obtain preprocessed ultrasonic signal timing data that meets the requirements.

[0235] In some embodiments, when the preprocessing module 802 is specifically implemented, it can perform corresponding preprocessing on resistivity time series data according to preset processing rules in the following manner: detect outliers in the resistivity time series data; adjust the outliers in the resistivity time series data according to the outlier detection results to obtain adjusted resistivity time series data; divide the adjusted resistivity time series data into multiple windows in chronological order according to preset windowing rules; calculate the difference between the maximum amplitude and the minimum amplitude in each window based on the resistivity time series data in each window, determine the amplitude difference value of each window, so as to obtain the preprocessed resistivity time series data that meets the requirements.

[0236] In some embodiments, when the fusion module 803 is specifically implemented, the preprocessed ultrasonic signal time series data and the preprocessed resistivity time series data can be fused in the following manner to obtain target fused data about the target well: The preprocessed resistivity time series data is linearly interpolated and extended to obtain extended resistivity time series data; wherein the number of point data included in the extended resistivity time series data is the same as that in the preprocessed ultrasonic signal time series data; the extended resistivity time series data and the preprocessed ultrasonic signal time series data are time-aligned to obtain aligned resistivity time series data and ultrasonic signal time series data; based on the aligned resistivity time series data and ultrasonic signal time series data, a corresponding fusion matrix is ​​constructed as the target fused data; wherein the first row of the fusion matrix corresponds to the ultrasonic signal time series data, the second row corresponds to the resistivity time series data, and the data in the same column of the first row and the second row correspond to the same time point.

[0237] In some embodiments, the preset overflow detection model may further include a multi-class sub-model;

[0238] Accordingly, in some embodiments, when the detection module 804 is specifically implemented, it can process the target fusion data using a preset overflow detection model in the following manner to obtain the corresponding target detection results: process the target fusion data using a feature extraction sub-model to obtain and output the corresponding primary feature matrix; process the primary feature matrix using a feature processing sub-model to obtain and output the corresponding deep feature matrix; process the deep feature matrix using a multi-classification sub-model to obtain and output the first result vector related to the gas intrusion level detection and the second result vector related to the liquid intrusion level detection, as the target detection results.

[0239] In some embodiments, the device can also be used to: construct a simulated wellbore; and deploy corresponding ultrasonic sensors and resistivity sensors on the simulated drill pipe in the simulated wellbore; inject corresponding air into the simulated wellbore according to a preset first simulation rule; and obtain first-type sample data by collecting corresponding ultrasonic signal time-series data and resistivity time-series data using the ultrasonic sensors and resistivity sensors; inject corresponding sodium chloride solution into the simulated wellbore according to a preset second simulation rule; and obtain second-type sample data by collecting corresponding ultrasonic signal time-series data and resistivity time-series data using the ultrasonic sensors and resistivity sensors; construct corresponding joint sample data by combining the first-type sample data and the second-type sample data; construct an initial overflow detection model; wherein the initial overflow detection model includes at least an initial feature extraction sub-model based on the Rocket model and an initial feature processing sub-model based on the ResNet model; and obtain a preset overflow detection model that meets the requirements by performing deep learning on the initial overflow detection model using the joint sample data.

[0240] It should be noted that the units, devices, or modules described in the above embodiments can be implemented by computer chips or physical entities, or by products with certain functions. For ease of description, the above devices are described by dividing them into various modules according to their functions. Of course, in implementing this specification, the functions of each module can be implemented in one or more software and / or hardware, or the module that implements the same function can be implemented by a combination of multiple sub-modules or sub-units, etc. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection between the devices or units shown or discussed can be through some interfaces, and the indirect coupling or communication connection between devices or units can be electrical, mechanical, or other forms.

[0241] As can be seen from the above, the downhole overflow detection device provided in the embodiments of this specification can efficiently and accurately detect and determine whether there is downhole overflow in the target well by integrating and using feature data of different dimensions such as ultrasonic signal time series data and resistivity time series data about the target well; and by using a preset overflow detection model to process the above-mentioned target fused data, thus better ensuring the drilling safety of the target well.

[0242] In a specific scenario example, the downhole overflow detection method provided in this manual can be applied to achieve downhole overflow detection based on a combined ultrasonic and resistivity measurement technique. The specific implementation process can be found below.

[0243] In this scenario example, we can consider integrating the advantages of two physical measurement technologies—ultrasonic sensors and resistivity sensors—and combining data fusion processing with neural network models to achieve accurate monitoring and quantitative analysis of downhole gas and liquid intrusion. This is particularly suitable for real-time monitoring during oil and gas well drilling, helping to promptly detect and prevent overflow accidents, thereby improving the safety and efficiency of downhole operations. Specific implementation may include the following steps.

[0244] S1: Sensor placement and signal acquisition.

[0245] (1) Install ultrasonic sensors and resistivity sensors on the drill pipe. The ultrasonic sensors are responsible for transmitting ultrasonic signals to the wellbore and receiving the reflected echo signals. By analyzing these echo signals, especially the echoes scattered by solid particles in the medium, the echoes scattered by invading gas, and the echoes reflected from the wellbore, multiple characteristic values ​​related to gas intrusion (such as echo amplitude, phase, spectral characteristics, and arrival time) can be extracted (for example, to obtain the time series data of ultrasonic signals of the target well relative to the wellbore and the wellbore medium).

[0246] (2) The resistivity sensor detects liquid intrusion by measuring the resistivity of the inner and outer walls of the drill pipe. Since liquid intrusion changes the conductivity of the medium in contact with the well wall, resulting in a difference in resistivity between the inner and outer walls, this invention identifies liquid intrusion by measuring the temporal variation of this difference and extracting feature values ​​(such as the mean, variance, and rate of change of the resistivity difference) (for example, obtaining temporal data of resistivity of the inner and outer walls of the drill pipe for the target well).

[0247] S2: Data fusion processing.

[0248] (1) Through multi-step data fusion processing, the feature values ​​of ultrasonic signals and resistivity signals are combined to generate a unified comprehensive feature vector. First, the data from different sensors are time-aligned to ensure that the feature values ​​are consistent at the same point in time. Then, the aligned feature values ​​are standardized to unify the dimensions and numerical ranges of different physical quantities, ensuring that the data are comparable during the fusion process.

[0249] (2) Subsequently, the standardized feature values ​​can be weighted based on experimental data or field experience to generate a representative comprehensive feature vector (e.g., target fusion data). This comprehensive feature vector not only retains the advantages of each individual measurement technology, but also improves the overall perception of downhole overflows through data fusion.

[0250] S3: Intelligent Analysis and Prediction.

[0251] (1) The comprehensive feature vector is input into a trained deep learning model combining the Rocket model and the ResNet model (e.g., a pre-defined overflow detection model) for regression analysis. This neural network model comprises two parts: 1) a Rocket model (e.g., a feature extraction sub-model): used to extract features from the input ultrasonic and resistivity signals, generating a high-dimensional feature vector. 2) a ResNet model (e.g., a feature processing sub-model): used to perform deep convolution and residual learning on the high-dimensional feature vector generated by the Rocket model, and to generate two dimensionless values ​​at the output layer, representing the degree of gas intrusion and the degree of liquid intrusion (e.g., gas intrusion level, liquid intrusion level).

[0252] (2) Output layer (e.g., multi-class sub-model): The final output consists of two dimensionless values, representing the degree of air invasion and the degree of liquid invasion, respectively.

[0253] (3) Optimization and training: Optimization is carried out using a large training dataset, with cross-entropy loss as the loss function, and prediction accuracy is improved by backpropagation algorithm and gradient descent optimization (such as Adam optimizer).

[0254] S4: Quantification and judgment of overflow situation.

[0255] By analyzing two dimensionless values ​​(e.g., target detection results) of gas intrusion and liquid intrusion, the downhole overflow situation can be accurately quantified, and the overflow risk can be assessed in real time. This detection method based on composite measurement and intelligent analysis can effectively reduce the risk of missed detection and improve the accuracy and reliability of downhole overflow detection.

[0256] Before implementation, the above deep learning model can be trained by following these steps:

[0257] S1: Arrangement of ultrasonic and resistivity sensors and acquisition of sample signals.

[0258] In this scenario example, a wellbore environment can be simulated under laboratory conditions (e.g., constructing a simulated wellbore), using a round rod (as a simulated drill pipe) with an array of ultrasonic and resistivity sensors arranged on its surface to collect sample data under different media conditions.

[0259] 1. Ultrasonic sensor:

[0260] An ultrasonic sensor with a center frequency of 200 kHz was used. The sensor detects changes in the medium by emitting ultrasonic pulses towards the simulated well wall and receiving the echo signals reflected back from the well wall and the medium inside the well by another transducer. The sensor emits ultrasonic signals at 0.1-second intervals via a controller and collects 30,000 data points at a sampling rate of 125 MHz, recording 240 microseconds of echo signal data. Each acquisition process lasts 10 seconds, resulting in 100 sets of data.

[0261] 2. Resistivity sensor:

[0262] Resistivity sensors are installed on the inner and outer walls of the drill rod to measure the resistivity difference between a certain range of media on the inner wall and a certain range of media on the outer wall. The sensor is excited by a 100Hz sine wave signal and collects the difference in resistivity between the inner and outer walls at a sampling rate of 1600Hz. Data is collected continuously for 10 seconds at a time, totaling 16,000 points, consistent with the single-collection time of an ultrasonic sensor.

[0263] 3. Simulated gas intrusion into sample signal acquisition:

[0264] (1) To simulate the situation of gas intrusion, different flow rates of air were injected sequentially during the experiment, with injection rates of 0.2L / min, 0.3L / min, 0.4L / min, 0.5L / min and 0.6L / min respectively.

[0265] (2) Each time air is injected at different flow rates, the ultrasonic sensor collects the changes in the reflected signal in real time to analyze the impact of gas intrusion on the medium inside the well. Each gas injection volume is collected 10 times, and 100 sets of data are collected at 0.1-second intervals each time, for a total of 1000 sets of tag data. Each set of tag data consists of 30,000 points (multiple first-class point data).

[0266] (3) Each time air of different flow rate is injected, the resistivity sensor group of inner and outer walls collects the resistivity difference between the inner and outer walls in real time to analyze the impact of gas intrusion on the medium inside the well. Each gas injection volume is collected 10 times, and 100 sets of data are collected at an interval of 0.1 seconds each time, for a total of 1000 sets of tag data. Each set of tag data consists of 160 points (multiple second-type point data).

[0267] 4. Simulated liquid intrusion into sample signal acquisition:

[0268] (1) To simulate liquid intrusion, a 5% sodium chloride solution was used as the intrusion liquid. The sodium chloride solution was injected steadily at a rate of 1 g / s for three phases: 60 seconds, 120 seconds, and 180 seconds.

[0269] (2) Sodium chloride solution was injected at different time points each time, and the ultrasonic sensor collected the changes in the reflected signal in real time to analyze the impact of liquid intrusion on the well medium. Each liquid injection stage was repeated 10 times, and 100 sets of data were collected at 0.1-second intervals each time, for a total of 1,000 sets of tag data. Each set of tag data consisted of 30,000 points.

[0270] (3) Sodium chloride solution was injected at different time points each time, and the resistivity sensor group of the inner and outer walls collected the resistivity difference between the inner and outer walls in real time to analyze the impact of liquid intrusion on the well medium. Each liquid injection stage was repeated 10 times, and 100 sets of data were collected at 0.1-second intervals each time, for a total of 1000 sets of tag data. Each set of tag data consisted of 160 points.

[0271] S2: Data preprocessing.

[0272] After collecting the sample data, preprocessing is required to ensure the accuracy and validity of the data for both the ultrasonic signal and the resistivity difference signal. The preprocessing mainly includes bandpass filtering of the ultrasonic signal and outlier handling of the resistivity difference signal. The specific steps are as follows:

[0273] S2-1: Bandpass filtering of ultrasonic signals:

[0274] (1) The acquired ultrasonic signals contain noise and interference in different frequency bands. In order to extract effective echo signals, the original signals need to be bandpass filtered. The design of the bandpass filter is based on the operating frequency of the ultrasonic sensor, that is, a signal with a center frequency of 200kHz.

[0275] (2) The passband range of the bandpass filter is set to 200kHz to 600kHz to effectively filter out low-frequency and high-frequency interference and retain the main echo signal. The filtered signal can significantly reduce the influence of environmental noise, thereby improving the signal-to-noise ratio (SNR) of the data and providing a clearer waveform for subsequent signal analysis.

[0276] S2-2: Windowing of resistivity difference signals:

[0277] (1) The resistivity sensor collects a signal every 0.1 seconds, which contains 160 points (point data corresponding to 160 different sampling points at the same time point). These points represent sinusoidal signals. The larger the resistivity difference, the larger the difference between the peaks and troughs of the sine wave. In order to effectively extract the characteristics of these differences, the signal needs to be segmented.

[0278] (2) Divide the 160 data points into windows, each containing 32 points. Slide 16 points at a time, for a total of 10 windows. Within each window, calculate the difference between the maximum and minimum values. This difference represents the amplitude change of the sine wave within that window. In this way, the 160 data points are simplified to 10 points, each representing the amplitude difference of a window.

[0279] S2-3: Outlier processing algorithm for resistivity difference signals:

[0280] (1) The data collected by the resistivity sensor may contain outliers, which may be caused by environmental interference or other external factors. In order to ensure the reliability of the data, outlier detection and processing must be performed on the resistivity difference signal.

[0281] (2) Outlier detection adopts a statistical analysis-based method. First, the mean and standard deviation of each data set are calculated. Then, the three-standard-deviation rule is used, that is, any signal point that exceeds or falls below three standard deviations of the mean is judged as an outlier.

[0282] (3) When processing the detected outliers, choose to replace them with the interpolation results of the nearest normal values.

[0283] S3: Data fusion processing.

[0284] (1) The difference data collected by the resistivity sensor group over 10 seconds, after data preprocessing, is in the format of 1000x1. It needs to be expanded to 30000x1 using linear interpolation. The values ​​of these new data points are calculated according to the following formula:

[0285]

[0286] Where i = 1, 2, 3, ..., 30.

[0287] (2) The transposed resistivity sensor data and the ultrasonic sensor data are merged in the column dimension to form a 2x30000 matrix.

[0288] S4: Design and application of neural network models.

[0289] In this scenario example, a deep learning-based multi-task classification model was designed and trained. Specifically, it combines the feature extraction capabilities of the Rocket model with the deep learning capabilities of the classic 101-layer ResNet to achieve dual classification outputs on the input time-series data, namely, predictions of air intrusion level (6 categories) and liquid intrusion level (4 categories). The input data consists of time-series signals from ultrasonic and resistivity sensors.

[0290] S4-1: Input Data Preparation

[0291] (1) The input data is a two-dimensional time series matrix with a shape of 2x30000, where the first row represents the time series data received by the ultrasonic sensor and the second row represents the time series data received by the resistivity sensor.

[0292] (2) The classification labels are designed as a two-dimensional label matrix with a shape of 1x2. The first column represents the air intrusion level, with a value range of {0,1,2,3,4,5}, corresponding to the six categories of air intrusion level. The second column represents the liquid intrusion level, with a value range of {0,1,2,3}, corresponding to the four categories of liquid intrusion level.

[0293] S4-2: Feature extraction of the Rocket model:

[0294] (1) Use a random number generator to generate 10,000 random convolution kernels. The parameters of each convolution kernel are randomly generated. The specific parameters are: convolution kernel length: randomly generated between 50 and 625 sampling points; stride: randomly generated between 1 and 3 integer values; dilation rate: randomly generated between 1 and 4 integer values; bias: randomly generated between -1 and 1 floating-point values.

[0295] (2) Apply the generated random convolution kernel to each input sequence (data from ultrasonic and resistivity sensors) for convolution operation. Result data format: The convolution result output by each sequence is a two-dimensional matrix with a shape of 10000xn, where n is calculated based on the convolution kernel parameters (such as dilation rate, stride, etc., which affect the length of the result).

[0296] (3) Apply global max pooling and global min pooling to each convolution output to generate a feature vector. In this way, the data from each sensor will generate a feature matrix with a shape of 10000x2.

[0297] (4) The feature matrices from the data from the two sensors are merged, and the final feature matrix has a shape of 20000x2.

[0298] S4-3: Feature input to ResNet model:

[0299] (1) Adjust the feature vectors extracted by the Rocket model to a shape suitable for the input layer of ResNet. That is, convert the feature matrix from a shape of 20000x2 to a three-dimensional shape of 2x200x100. The reshaped matrix will be used as the input shape of ResNet101 (conforming to the standard form of channels x height x width).

[0300] (2) The reshaped feature matrix is ​​input into the classic 101-layer ResNet network to perform deep feature extraction using its deep learning capabilities. The 101-layer ResNet contains multiple residual blocks, each containing 3 convolutional layers, 3 batch normalization layers and 3 ReLU activation functions, and retains the original information through skip connections to prevent gradient vanishing.

[0301] (3) Result data format: The feature matrix after ResNet101 processing has a shape of 2048x1x1 (because the final feature dimension of ResNet101 is 2048).

[0302] S4-4: Multi-task classification output:

[0303] (1) At the end of ResNet101, the deep features are further reduced in dimensionality by a global average pooling layer to generate a feature vector with a shape of 2048x1.

[0304] (2) The 2048-dimensional feature vector is input into two independent fully connected layers to handle the classification tasks of air intrusion level and liquid intrusion level, respectively. The fully connected layer for air intrusion level contains 6 neurons (corresponding to 6 categories) and outputs a probability distribution vector of shape 1x6; the fully connected layer for liquid intrusion level contains 4 neurons (corresponding to 4 categories) and outputs a probability distribution vector of shape 1x4. The output of each fully connected layer is activated by a softmax function to obtain the probability distribution for the corresponding level.

[0305] (3) The classification results are output as two vectors: Air intrusion level prediction result: a 1x6 vector, for example [0.1,0.2,0.1,0.1,0.4,0.1], predicting the level as the category with the highest probability, i.e., 4. Liquid intrusion level prediction result: a 1x4 vector, for example [0.3,0.5,0.15,0.05], predicting the level as the category with the highest probability, i.e., 1. Final classification output: [[4,1]], indicating that the air intrusion level is 4 and the liquid intrusion level is 1 (e.g., level 1).

[0306] S4-5: Training and Optimization

[0307] (1) Cross-entropy loss is used as the loss function to calculate the loss of the two tasks of gas intrusion and liquid intrusion respectively, and the weighted sum is calculated. The loss value is controlled between 0 and 1.

[0308] (2) The Adam optimizer was selected as the optimizer for model training. The initial learning rate was set to 0.001, β1 = 0.9, and β2 = 0.999. The parameters were optimized.

[0309] (3) The model was trained on the training set using the Adam optimizer for gradient descent. The step size for weight updates was fixed at 0.001 after each iteration, and the total number of training iterations was 1000. After each training iteration, the validation loss was calculated using the validation set, and the learning rate and other hyperparameters were adjusted.

[0310] The above scenario examples validate the downhole overflow detection method provided in this manual. By organically combining ultrasonic and resistivity technologies, it overcomes the limitations of existing single measurement techniques, providing a more accurate, intelligent, and comprehensive solution for downhole overflow detection. It is not only suitable for conventional gas and liquid overflow detection but also plays a stable role in complex downhole environments, demonstrating significant application value and promotion potential. In addition to collecting various types of data, it integrates different data types into a comprehensive feature vector through multi-step data fusion methods such as time alignment, standardization, and weighted processing, effectively improving data utilization and overflow detection accuracy. Deep learning networks, including the Rocket and ResNet models, are used for data analysis. The Rocket model is responsible for efficient feature extraction, while the ResNet model, through its deep convolution and residual learning mechanisms, further improves the detection accuracy and reliability.

[0311] While this specification provides the steps of operation for the methods described in the embodiments or flowcharts, more or fewer steps may be included based on conventional or non-inventive means. The order of steps listed in the embodiments is merely one possible order of execution among many steps and does not represent the only possible order. In actual device or client product execution, the methods shown in the embodiments or drawings may be executed sequentially or in parallel (e.g., in a parallel processor or multi-threaded processing environment, or even a distributed data processing environment). The terms "comprising," "including," or any other variations thereof are intended to cover a non-exclusive inclusion, such that a process, method, product, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, product, or apparatus. Without further limitations, the presence of other identical or equivalent elements in a process, method, product, or apparatus that includes said elements is not excluded. The terms "first," "second," etc., are used to denote names and do not indicate any particular order.

[0312] Those skilled in the art will also know that, besides implementing the controller using purely computer-readable program code, the same functions can be achieved by logically programming the method steps, making the controller function as logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers (PLCs), and embedded microcontrollers. Therefore, such a controller can be considered a hardware component, and the devices within it used to implement various functions can also be considered structures within that hardware component. Alternatively, the devices used to implement various functions can be considered as both software modules implementing the method and structures within a hardware component.

[0313] This specification can be described in the general context of computer-executable instructions that are executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, classes, etc., that perform a specific task or implement a specific abstract data type. This specification can also be practiced in distributed computing environments, where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer-readable storage media, including storage devices.

[0314] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that this specification can be implemented by means of software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solutions of this specification can essentially be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, mobile terminal, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments of this specification.

[0315] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on its differences from other embodiments. This specification can be used in numerous general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable electronic devices, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices, etc.

[0316] Although this specification has been described by way of examples, those skilled in the art will recognize that many variations and modifications are possible without departing from the spirit of this specification, and it is intended that the appended claims cover such variations and modifications without departing from the spirit of this specification.

Claims

1. A method for detecting downhole overflow, characterized in that, include: Acquire time-series data of ultrasonic signals of the target well with respect to the wellbore and the wellbore medium, as well as time-series data of resistivity of the target well with respect to the inner and outer walls of the drill pipe; According to the preset processing rules, the ultrasonic signal time series data and resistivity time series data are preprocessed respectively to obtain the preprocessed ultrasonic signal time series data and the preprocessed resistivity time series data. By fusing the preprocessed ultrasonic signal time series data and the preprocessed resistivity time series data, target fused data about the target well is obtained; The target fusion data is processed using a pre-defined overflow detection model to obtain the corresponding target detection results; wherein the pre-defined overflow detection model includes at least a feature extraction sub-model based on the Rocket model and a feature processing sub-model based on the ResNet model. Based on the target detection results, determine whether there is a downhole overflow in the target well.

2. The method according to claim 1, characterized in that, The target detection results include at least: gas intrusion level detection results and liquid intrusion level detection results; Accordingly, after determining whether a downhole overflow exists in the target well based on the target detection results, the method further includes: If, based on the target detection results, it is determined that there is a downhole overflow in the target well, the overflow type of the target well is determined based on the gas intrusion level detection results and the liquid intrusion level detection results. Based on the overflow type of the target well, query the preset downhole treatment strategy set and determine the matching target downhole treatment strategy; Based on the target well treatment strategy, the target well is subjected to corresponding downhole overflow elimination treatment.

3. The method according to claim 1, characterized in that, Acquire time-series ultrasonic signal data of the target well regarding the wellbore and the wellbore medium, as well as time-series resistivity data of the target well regarding the inner and outer walls of the drill pipe, including: Ultrasonic sensors installed on the drill pipe of the target well emit ultrasonic signals within a specified time period and collect echo signals reflected from the well wall and the medium inside the well. At the same time, resistivity sensors installed on the inner and outer walls of the drill pipe collect resistivity signals at a specified time and calculate the difference between the resistivity signals of the inner and outer walls at the same location on the drill pipe to obtain the corresponding resistivity difference value. Based on the time information, the echo signals and resistivity difference values ​​within a specified time period are arranged in sequence to obtain the corresponding ultrasonic signal time series data and resistivity time series data.

4. The method according to claim 3, characterized in that, According to preset processing rules, the ultrasonic signal time series data undergoes corresponding preprocessing, including: Obtain the operating frequency of the ultrasonic sensor; Based on the operating frequency of the ultrasonic sensor, determine the bandpass filter whose bandpass range matches that of the ultrasonic sensor; The ultrasonic signal timing data is subjected to bandpass filtering to obtain preprocessed ultrasonic signal timing data that meets the requirements.

5. The method according to claim 3, characterized in that, According to the preset processing rules, the resistivity time series data is preprocessed accordingly, including: Detect outliers in resistivity time-series data; Based on the outlier detection results, the outliers in the resistivity time series data are adjusted to obtain the adjusted resistivity time series data. According to the preset windowing rules, the adjusted resistivity time series data is divided into multiple windows in chronological order. Based on the resistivity time series data in each window, the difference between the maximum and minimum amplitude values ​​in each window is calculated to determine the amplitude difference value of each window, so as to obtain the preprocessed resistivity time series data that meets the requirements.

6. The method according to claim 1, characterized in that, By fusing the preprocessed ultrasonic signal time series data and the preprocessed resistivity time series data, target fused data about the target well is obtained, including: Linear interpolation is performed on the preprocessed resistivity time series data to obtain the expanded resistivity time series data; wherein the number of point data included in the expanded resistivity time series data is the same as that in the preprocessed ultrasonic signal time series data. The extended resistivity time series data and the preprocessed ultrasonic signal time series data are time-aligned to obtain aligned resistivity time series data and ultrasonic signal time series data. Based on the aligned resistivity time-series data and ultrasonic signal time-series data, a corresponding fusion matrix is ​​constructed as the target fusion data; wherein, the first row of the fusion matrix corresponds to the ultrasonic signal time-series data, the second row corresponds to the resistivity time-series data, and the data in the same column of the first row and the second row correspond to the same time point.

7. The method according to claim 1, characterized in that, The preset overflow detection model also includes a multi-class sub-model; Accordingly, the target fusion data is processed using a pre-defined overflow detection model to obtain the corresponding target detection results, including: The target fusion data is processed using a feature extraction sub-model to obtain and output the corresponding primary feature matrix; The initial feature matrix is ​​processed using a feature processing sub-model to obtain and output the corresponding deep feature matrix; The deep feature matrix is ​​processed using a multi-class sub-model to obtain and output a first result vector related to air intrusion level detection and a second result vector related to liquid intrusion level detection, which serve as the target detection results.

8. The method according to claim 1, characterized in that, The method further includes: Construct a simulated wellbore; and install corresponding ultrasonic sensors and resistivity sensors on the simulated drill pipe in the simulated wellbore. According to the preset first simulation rule, the corresponding air is injected into the simulated well; and by using ultrasonic sensors and resistivity sensors, the first type of sample data is obtained by collecting the corresponding ultrasonic signal time series data and resistivity time series data. According to the preset second simulation rule, the corresponding sodium chloride solution is injected into the simulated wellbore; and by using ultrasonic sensors and resistivity sensors, the corresponding ultrasonic signal time series data and resistivity time series data are collected to obtain the second type of sample data. By combining the first type of sample data and the second type of sample data, the corresponding joint sample data is constructed. Construct an initial overflow detection model; wherein the initial overflow detection model includes at least an initial feature extraction sub-model based on the Rocket model and an initial feature processing sub-model based on the ResNet model; By using joint sample data, a pre-defined overflow detection model that meets the requirements is obtained through deep learning on the initial overflow detection model.

9. A downhole overflow detection device, characterized in that, include: The acquisition module is used to acquire the ultrasonic signal time series data of the target well with respect to the well wall and the well medium, as well as the resistivity time series data of the target well with respect to the inner and outer walls of the drill pipe; The preprocessing module is used to perform corresponding preprocessing on ultrasonic signal time series data and resistivity time series data according to preset processing rules, so as to obtain preprocessed ultrasonic signal time series data and preprocessed resistivity time series data. The fusion module is used to fuse preprocessed ultrasonic signal time series data and preprocessed resistivity time series data to obtain target fused data about the target well. The detection module is used to process target fusion data using a preset overflow detection model to obtain the corresponding target detection results; wherein, the preset overflow detection model includes at least a feature extraction sub-model based on the Rocket model and a feature processing sub-model based on the ResNet model. The determination module is used to determine whether there is a downhole overflow in the target well based on the target detection results.

10. A computer-readable storage medium, characterized in that, It stores computer instructions that, when executed by a processor, implement the steps of the method according to any one of claims 1 to 8.