Question and answer mode flowing well abnormity diagnosis method and system based on AI intelligent agent

By employing an AI-based question-and-answer diagnostic method that utilizes multi-source heterogeneous data and intent recognition technology, the shortcomings of single-data monitoring in the diagnosis of anomalies in flowing wells are addressed. This enables intelligent and interactive diagnosis of flowing wells, improving the accuracy and efficiency of the diagnosis.

CN121807606APending Publication Date: 2026-04-07BEIJING DIHANG TIMES TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-30
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

Existing technologies rely on single data monitoring for the diagnosis of anomalies in flowing wells, which cannot accurately reflect the changing trends of complex faults and cannot support interactive question-and-answer displays.

Method used

An AI-based question-and-answer diagnostic approach is adopted, which constructs a distributed well history knowledge base by acquiring multi-source heterogeneous data, and combines an intent recognition module and a multimodal processing model to achieve interactive anomaly diagnosis.

Benefits of technology

It enables intelligent, multi-level diagnosis of anomalies in flowing wells, providing in-depth trend analysis and interactive Q&A, thereby improving the accuracy and efficiency of diagnosis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121807606A_ABST
    Figure CN121807606A_ABST
Patent Text Reader

Abstract

The invention provides a question and answer mode flowing well anomaly diagnosis method and system based on an AI agent, and relates to the technical field of oil exploitation. In the method, multi-source heterogeneous data of a target flowing well is obtained; constructing a distributed well history knowledge base according to the daily production data and the well history document data; the method comprises the following steps: acquiring session information inquired by a user, performing intention recognition on the session information by utilizing an intention recognition module of an AI agent to obtain intention information, matching the intention information with preset cue word data, and forming multi-modal input data according to a read real-time database and a distributed well history knowledge base under the condition that abnormal diagnosis is indicated; and analyzing the multi-modal input data by using a multi-modal processing model in the AI agent to obtain an anomaly diagnosis analysis result, displaying the anomaly diagnosis analysis result to the user as an answer of user inquiry, and prompting the user to inquire again to realize automatic and interactive accurate diagnosis of flowing well anomaly.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of oil extraction technology, specifically to a question-and-answer method and system for diagnosing anomalies in flowing wells based on AI agents. Background Technology

[0002] In oil extraction, flowing wells are a crucial production method that relies on formation energy to lift crude oil to the surface. Due to the variable downhole environment, production often faces abnormal conditions such as tubing wax buildup, bottom hole fluid accumulation, nozzle blockage, or formation energy depletion. Current technologies typically collect structured time-series data such as oil pressure, casing pressure, back pressure, and production volume, and use machine learning models to analyze their numerical trends for anomaly diagnosis. However, machine learning models cannot accurately extract numerical fluctuations from single data points, nor can they support interactive question-and-answer displays. Summary of the Invention

[0003] To address the aforementioned issues, this application provides a question-and-answer method and system for diagnosing anomalies in flowing wells based on AI agents, which can achieve automated, interactive, and accurate diagnosis of anomalies in flowing wells.

[0004] The technical solution of this application embodiment is as follows: In a first aspect, embodiments of this application provide a question-and-answer-based anomaly diagnosis method for flowing wells based on AI agents, the method comprising: Acquire multi-source heterogeneous data of the target flowing well, including daily production data indexed by time series, IoT-collected data, and well history document data associated with well number; Based on the daily production data and the well history document data, a distributed well history knowledge base is constructed. The distributed well history knowledge base includes multiple well history documents, and the query fields are composed of well number and time. The query fields correspond one-to-one with the well history documents. The system obtains the user's inquiry session information, uses the AI ​​agent's intent recognition module to perform intent recognition on the session information to obtain intent information, and matches the intent information with preset prompt word data to obtain matching results. If the matching result indicates an abnormal diagnosis, read the real-time database composed of IoT-collected data and the distributed well history knowledge base, and form multimodal input data based on the read real-time database and the distributed well history knowledge base; The multimodal processing model in the AI ​​agent is used to analyze the multimodal input data to obtain anomaly diagnosis analysis results. These results are then displayed to the user as answers to their questions, prompting the user to ask again.

[0005] In the above technical solution, firstly, multi-source heterogeneous data of the target flowing well is acquired. This multi-source heterogeneous data includes daily production data indexed by time series, IoT-collected data, and well history document data associated with well numbers. By acquiring data from multiple sources, the inability of a single data source to accurately reflect the changing trend is avoided, facilitating accurate data analysis later. Based on the daily production data and well history document data, a distributed well history knowledge base is constructed. This distributed well history knowledge base includes multiple well history documents, with query fields constructed using well numbers and times. Each query field corresponds one-to-one with a well history document. By constructing a distributed well history knowledge base, structured and unstructured data can be integrated and easily read, achieving multimodal data fusion. Finally, user query session information is acquired, and the intent recognition module of the AI ​​agent is used to identify the intent in the session information to obtain intent information. The system uses intent recognition to identify the constructed question-and-answer pattern, providing a foundation for subsequent interactive question-and-answer sessions for anomaly diagnosis. It matches the intent information with preset prompt words to obtain matching results. If the matching result indicates an anomaly diagnosis, it reads a real-time database composed of IoT-collected data and a distributed well history knowledge base. Based on these data, it generates multimodal input data to trigger anomaly diagnosis. The multimodal processing model in the AI ​​agent analyzes the multimodal input data to obtain anomaly diagnosis analysis results. These results are then displayed to the user as answers to their questions, prompting them to ask again. This combination of anomaly diagnosis and interactive question-and-answer not only achieves intelligent analysis but also provides users with multi-level question-and-answer sessions to understand the changing trends of flowing wells.

[0006] In some embodiments of this application, the step of forming multimodal input data based on the read real-time database and the distributed well history knowledge base includes: The real-time database is read using a pre-defined structured language, and the distributed well history knowledge base is read using the query fields to obtain IoT data, wellhead oil pressure, casing pressure, daily liquid production, daily crude oil production, and daily natural gas production. The oil-gas ratio parameter is obtained by calculating the ratio of the daily crude oil production to the daily natural gas production according to the time series. The IoT data, wellhead oil pressure, casing pressure, daily liquid production, daily crude oil production, daily natural gas production, and oil-gas ratio parameters are used to form multimodal input data. The wellhead oil pressure, casing pressure, daily liquid production, daily crude oil production, daily natural gas production, and oil-gas ratio parameters are all sequential data arranged in time.

[0007] In some embodiments of this application, the step of forming multimodal input data from the IoT data, the wellhead oil pressure, the casing pressure, the daily liquid production, the daily crude oil production, the daily natural gas production, and the oil-gas ratio parameter includes: The wellhead oil pressure, the casing pressure, the daily fluid production, and the oil-gas ratio parameters are visualized to generate a visualization image; The visualization image is cleaned of network noise, and different high-contrast colors are assigned to the wellhead oil pressure, casing pressure, daily fluid production and oil-gas ratio parameters according to a preset color mapping table. Calculate the first derivative of the curve in the visualization image, identify the abrupt change in slope, and overlay standardized visual markers at the corresponding coordinate positions in the visualization image to form a visually enhanced trend map; The trend graph is compressed to form image modal data; The IoT data, the daily crude oil production, and the daily natural gas production are standardized, and the standardized data and the image modal data are used to form the multimodal input data.

[0008] In some embodiments of this application, the step of analyzing the multimodal input data using the multimodal processing model in the AI ​​agent to obtain anomaly diagnosis analysis results includes: Query the historical data corresponding to the query field in the distributed well history knowledge base, including anomaly handling record data; The multimodal processing model is used to analyze the multimodal input data to obtain the probability of anomaly types; If the exception handling record data exists, query the last processing time in the exception handling record data, subtract the processing time from the current time to obtain the time difference, and calculate the correction coefficient corresponding to the probability of the exception type based on the time difference. The correction coefficient is multiplied by the probability of the anomaly type to obtain the confidence level, and the anomaly type corresponding to the confidence level is taken as the anomaly diagnosis analysis result.

[0009] In some embodiments of this application, the prompt word data includes a unique identifier of the intent, a detailed functional description of the intent, a list of input parameters required by the intent, and usage examples; The step of matching the intent information with preset prompt word data to obtain a matching result includes: The similarity between the intent information and the unique identifier of the intent is calculated to obtain a similarity value; If the similarity value is greater than a preset similarity threshold, the detailed functional description of the intent, the list of input parameters required by the intent, and the usage example are read according to the unique identifier of the intent. If the intent information indicates an anomaly diagnosis category, an anomaly diagnosis process is triggered, the anomaly diagnosis process is used as the matching result, and a detailed functional description of the intent, a list of input parameters required by the intent, and a usage example are recorded.

[0010] In some embodiments of this application, after acquiring the multi-source heterogeneous data of the target flowing well, the method further includes: The daily production data is calculated using the moving average and standard deviation methods to obtain the first outlier-removed data; The moving average and standard deviation methods are used to calculate the second outlier-removed data from the IoT-collected data. Interpolation processing is performed on the first outlier-removed data and the second outlier-removed data respectively to obtain preprocessed data; The distributed well history knowledge base is constructed using the preprocessed daily production data and the well history document data.

[0011] In some embodiments of this application, the step of calculating the first outlier-removed data by performing a moving average and standard deviation method on the daily production data includes: The daily production data is processed using a sliding window according to a preset time window to obtain the average value within each sliding window. The outliers are obtained by applying standard deviation to each of the aforementioned average values. The daily production data is processed to remove outliers, resulting in the first outlier-removed data.

[0012] Secondly, embodiments of this application provide a question-and-answer-based anomaly diagnosis system for flowing wells based on AI agents, the system comprising: The data acquisition module is used to acquire multi-source heterogeneous data of the target flowing well. The multi-source heterogeneous data includes daily production data indexed by time series, IoT-collected data, and well history document data based on well number association. The data construction module is used to construct a distributed well history knowledge base based on the daily production data and the well history document data. The distributed well history knowledge base includes multiple well history documents, and the query fields are composed of well number and time. The query fields correspond one-to-one with the well history documents. The conversation acquisition and processing module is used to acquire conversation information queried by the user, use the intent recognition module of the AI ​​agent to perform intent recognition on the conversation information to obtain intent information, and match the intent information with preset prompt word data to obtain matching results; An anomaly triggering module is used to read the real-time database composed of IoT-collected data and the distributed well history knowledge base when the matching result indicates an anomaly diagnosis, and to form multimodal input data based on the read real-time database and the distributed well history knowledge base; The anomaly diagnosis module is used to analyze the multimodal input data using the multimodal processing model in the AI ​​agent, obtain anomaly diagnosis analysis results, display the anomaly diagnosis analysis results to the user as an answer to the user's question, and prompt the user to ask again.

[0013] Thirdly, embodiments of this application provide an electronic device including a processor, a memory, a user interface, a communication bus, and a network interface. The processor, the memory, the user interface, and the network interface are respectively connected to the communication bus. The memory is used to store instructions. The user interface and the network interface are used to communicate with other devices. The processor is used to execute the instructions stored in the memory to cause the electronic device to perform the method described in any one of the first aspects.

[0014] Fourthly, embodiments of this application provide a computer-readable storage medium storing instructions that, when executed, perform the method described in any one of the methods provided in the first aspect above.

[0015] In summary, one or more technical solutions provided in the embodiments of this application have at least the following technical effects or advantages: 1. By employing daily production data indexed by time series, IoT-collected data, and well history document data associated with well numbers, this approach provides multi-faceted data support, avoiding the inability of single data sources to reflect changing trends. Furthermore, a distributed well history knowledge base is constructed based on multi-source heterogeneous data, achieving the fusion of structured and unstructured data for easy retrieval. An intent recognition module is provided to support the recognition of user questions, triggering anomaly diagnosis based on intent and displaying the diagnostic results to the user. This enables continuous inquiry into flowing wells, combining anomaly diagnosis with interactive question-and-answer sessions. This not only achieves intelligent analysis but also provides users with multi-level question-and-answer support to understand the changing trends of flowing wells. Therefore, it effectively solves the problems of related technologies that cannot accurately extract numerical fluctuations from single data sources and cannot support interactive question-and-answer display.

[0016] 2. By establishing a connection between prompt words and intent recognition, anomaly diagnosis is triggered, enabling collaborative processing between interactive question answering and anomaly diagnosis, thus achieving interactive anomaly diagnosis.

[0017] 3. By identifying and removing outliers from the data, and then using linear interpolation to fill in missing values, the quality of the data can be improved and the accuracy of anomaly diagnosis can be increased. Attached Figure Description

[0018] Figure 1 This is a flowchart illustrating a question-and-answer-based anomaly diagnosis method for flowing wells based on an AI agent, provided in one embodiment of this application. Figure 2 This is a schematic diagram of the intent recognition module of a question-and-answer-based anomaly diagnosis method for flowing wells based on AI agents provided in one embodiment of this application; Figure 3 This is a flowchart illustrating another embodiment of the question-and-answer method for diagnosing anomalies in flowing wells based on AI agents provided in this application; Figure 4 This is a schematic diagram of the structure of a question-and-answer type self-flowing well anomaly diagnosis system based on an AI agent provided in one embodiment of this application; Figure 5 This is a schematic diagram of the structure of an electronic device provided in one embodiment of this application. Detailed Implementation

[0019] 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 application, and not all embodiments.

[0020] In the description of the embodiments of this application, the words "for example" or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design that is described as "for example" or "for instance" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design options. Rather, the use of the words "for example" or "for instance" is intended to present the relevant concepts in a specific manner.

[0021] In the description of the embodiments of this application, the term "multiple" means two or more. For example, multiple systems means two or more systems, and multiple screen terminals means two or more screen terminals. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the indicated technical features. Thus, a feature defined with "first" or "second" may explicitly or implicitly include one or more of that feature. The terms "comprising," "including," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.

[0022] In related technologies, oil, as a vital global energy resource, plays an indispensable role in industrial production, transportation, and other fields. Flowing well oil extraction, as an important method of crude oil production, is characterized by low cost and high efficiency, occupying a key position in the petroleum industry. Flowing wells rely on the formation's own energy to lift crude oil to the surface, and their production process involves multiple complex physical stages, including formation seepage, multiphase flow in the wellbore, and surface flow.

[0023] Abnormal situations frequently occur during the production process of flowing wells. For example, wax buildup in the tubing can reduce the tubing diameter, increasing resistance to crude oil flow and thus reducing production; nozzle blockage can cause abnormally high wellhead pressure, affecting production stability; and a decrease in formation energy can prevent crude oil from flowing smoothly to the surface, resulting in a significant drop in production. These abnormal situations not only reduce crude oil production and increase production costs, but may also trigger safety accidents, posing serious threats to personnel and the environment.

[0024] Traditional diagnostic methods for anomalies in flowing wells rely on single-parameter monitoring, typically focusing on only a few key parameters (such as a drop in oil pressure or an increase in casing pressure) while neglecting the dynamic information of coordinated changes in multiple parameters. This results in a weak comprehensive diagnostic capability for complex faults (such as simultaneous occurrence of tubing wax deposition and insufficient formation fluid supply). Reliance on manual diagnosis may lead to missed diagnoses and false positives, and it cannot achieve deeper predictive observations.

[0025] Based on this, embodiments of this application provide a question-and-answer method, system, electronic device, and readable storage medium for diagnosing anomalies in flowing wells based on AI agents. This AI agent-based question-and-answer method first acquires multi-source heterogeneous data from the target flowing well. This multi-source heterogeneous data includes daily production data indexed by time series, IoT-collected data, and well history document data associated with well numbers. By acquiring multiple data sources, it avoids the inability of single data to accurately reflect changing trends, thus facilitating accurate data analysis later. Based on the daily production data and well history document data, a distributed well history knowledge base is constructed. This distributed well history knowledge base includes multiple well history documents, with query fields constructed using well numbers and times. Each query field corresponds one-to-one with a well history document. By constructing a distributed well history knowledge base, structured and unstructured data can be integrated and easily read, achieving multi-modal data fusion. Finally, it acquires the user's query session information. The AI ​​agent's intent recognition module identifies the intent in the conversation information, obtaining intent information. Through intent recognition, the constructed question-and-answer pattern is further analyzed, providing a foundation for subsequent anomaly diagnosis interactive question-and-answer. The intent information is then matched with preset prompt words to obtain matching results. If the matching result indicates an anomaly diagnosis, a real-time database composed of IoT-collected data and a distributed well history knowledge base are read. Based on these data, multimodal input data is generated, triggering anomaly diagnosis. The multimodal processing model within the AI ​​agent analyzes the multimodal input data to obtain anomaly diagnosis analysis results. These results are then displayed to the user as answers to their questions, prompting them to ask again. This combination of anomaly diagnosis and interactive question-and-answer not only achieves intelligent analysis but also provides users with multi-level question-and-answer support to understand the changing trends of flowing wells.

[0026] It should be noted that this AI-based question-and-answer method for diagnosing anomalies in flowing wells is used for anomaly monitoring in oil extraction. It can provide early warnings and, through interactive question-and-answer, allows for a deeper understanding of the anomaly diagnosis process.

[0027] The technical solutions provided in the embodiments of this application will be further described below with reference to the accompanying drawings.

[0028] Reference Figure 1 , Figure 1This is a flowchart illustrating the AI ​​agent-based question-and-answer method for diagnosing anomalies in flowing wells provided in this application embodiment. The AI ​​agent-based question-and-answer method for diagnosing anomalies in flowing wells is applied to an AI agent-based question-and-answer system for diagnosing anomalies in flowing wells. The method is executed by a processor in an electronic device or a readable storage medium. The AI ​​agent-based question-and-answer method for diagnosing anomalies in flowing wells includes steps S100, S200, S300, S400, and S500.

[0029] Step S100: Obtain multi-source heterogeneous data of the target flowing well. The multi-source heterogeneous data includes daily production data indexed by time series, IoT-collected data, and well history document data associated with well number.

[0030] In one embodiment, the daily production dynamic data is a daily report of oil well production, summarized on a daily basis. It records in detail the daily fluid production, daily oil production, water cut, and key operating parameters such as casing pressure, oil pressure, back pressure, and wellhead temperature for each well. This is unstructured data; the table uses the well number and production date as a combined unique query field to ensure data uniqueness, serving as a fundamental basis for assessing oil well production and health. The IoT-acquired data is collected by pressure sensors installed in the flowing well equipment. It collects rich oil well operating parameters on a daily basis, such as stroke, stroke frequency, maximum / minimum load, and dynamic fluid level. This is structured data and can be stored in commonly used databases, such as SQL databases, providing crucial information for equipment performance analysis and fault early warning. Both the daily production dynamic data and the IoT-acquired data are indexed using time series, with the well number and time as unique parameters to ensure the uniqueness of the stored data.

[0031] The well history data of flowing wells is a standardized dataset formed by professional data entry personnel manually extracting key information from multiple sources such as PDF well history documents, Word well repair reports, and Excel production reports, and then structuring it according to the oilfield data governance specifications. It includes (1) Basic information of oil wells: recording fixed attributes such as well number, well name, well type, completion date, drilling depth, and casing specifications. (2) Coordinate information of oil wells: storing the coordinates (X, Y) and elevation (Z) of each well, which is the basis for geographic information analysis and well network deployment. (3) Reservoir geological data: derived from well logging interpretation, describing the physical characteristics of the formations encountered by the oil wells. It includes information such as layer position, sand thickness, permeability, porosity, actual perforation interval, and perforation date, which is crucial for understanding reservoir characteristics. (4) Crude oil analysis data: recording the physicochemical properties of crude oil samples, such as density, viscosity, pour point, sulfur / wax / colloid / asphaltite content, and distillation range. (5) Operation History: Records the purpose, start and end dates, and main measures of each well workover and overhaul operation. Presented in unstructured text format, it records historical operation events. The above-mentioned daily production data indexed by time series, IoT-collected data, and well history document data associated with well numbers constitute multi-source heterogeneous data. By acquiring multi-source heterogeneous data, it provides multi-faceted data support, avoiding the inability of single data to reflect changing trends, and providing data support for subsequent anomaly diagnosis.

[0032] In one embodiment, after acquiring multi-source heterogeneous data of the target flowing well, the question-and-answer method for diagnosing anomalies in flowing wells based on AI agents further includes, but is not limited to, the following steps: Step S610: Calculate the daily production data using the moving average and standard deviation method to obtain the first outlier removal data.

[0033] Specifically, the daily production data is calculated using moving average and standard deviation methods to obtain the first outlier removal data, including but not limited to the following steps: Step S611: Perform sliding window processing on the daily production data according to the preset time window to obtain the average value within each sliding window.

[0034] In some possible embodiments of this application, the moving average is used to filter out high-frequency noise; the standard deviation is used to measure the range of fluctuation; the preset time window can be 2 hours, 3 hours, etc., and the sliding step is 1 hour. For the data sequence of daily production data, the average value within each sliding window is calculated starting from the start time of the day to eliminate high-frequency noise.

[0035] Step S612: Perform standard deviation processing on each mean value to obtain outliers.

[0036] In some possible embodiments of this application, based on the average values ​​obtained in step S611, standard deviation processing is performed on each average value to calculate the standard deviation between the data at a certain moment and the average value. If the standard deviation is greater than a preset standard value, the data at that moment is an outlier, and the data points that deviate are identified. The standard value can be 3 times the standard deviation or 2 times the standard deviation; the larger the value, the greater the range of data fluctuation. Only data points that deviate significantly can be considered outliers.

[0037] Step S613: Perform outlier removal processing on the daily production data to obtain the first outlier removal data.

[0038] In some possible embodiments of this application, based on the outliers detected in step S612 above, the outliers are deleted. Data at that time point is missing, or NaN is used to represent it as empty, resulting in the first outlier-removed data. This first outlier-removed data removes inaccurate collected data while retaining accurate data, providing accurate data support for subsequent calculations.

[0039] Step S620: Calculate the moving average and standard deviation of the IoT-collected data to obtain the second outlier-removed data.

[0040] In one embodiment, the process of calculating the second outlier-removed data by performing moving average and standard deviation on the IoT-collected data is similar to steps S611 to S613, and will not be described in detail here. The second outlier-removed data removes inaccurate collected data and retains accurate data, providing accurate data support for subsequent calculations.

[0041] Step S630: Interpolate the first outlier-removed data and the second outlier-removed data respectively to obtain preprocessed data.

[0042] In one embodiment, linear interpolation is performed on the first outlier-removed data to determine the time point corresponding to NaN. Linear interpolation calculation is then performed using data from the previous and next time points, or a mean calculation is performed, to obtain the processed interpolated data. The second outlier-removed data is interpolated following the same process, thereby obtaining all preprocessed data. This provides an accurate data foundation for subsequent calculations and improves the accuracy of model calculations.

[0043] Step S640: Using the preprocessed daily production data and well history document data, a distributed well history knowledge base is constructed.

[0044] In one embodiment, a folder is constructed for the preprocessed daily production data and well history document data corresponding to each well number. A flattened management model is adopted, and the folder is named using the standard well number format to build a distributed well history knowledge base. The standard well number format strictly follows the specification of "full well name" (e.g., "P5-1-X10"), and the character set of the name must be completely consistent with the well name code in the oilfield production management system. It is also case-sensitive to ensure the standardization of data management and the convenience of cross-module query, so as to enable quick retrieval and direct access through the unique corresponding classifier ID.

[0045] Step S200: Based on daily production data and well history document data, construct a distributed well history knowledge base. The distributed well history knowledge base includes multiple well history documents, and query fields are constructed using well number and time. Each query field corresponds one-to-one with a well history document.

[0046] In one embodiment, daily production data and well history document data corresponding to each well number are stored using ElasticSearch for easy indexing and querying. Alternatively, a folder can be created for each well number, employing a flattened management model to build a distributed well history knowledge base. This distributed well history knowledge base uses folders named according to the standard well number format and includes multiple well history files (i.e., well history folders). The query field is composed of the well number and time; this query field is a unique association field, corresponding one-to-one with the well history file, enabling fast querying and direct access, and facilitating subsequent data retrieval.

[0047] It should be noted that, for pre-processed IoT data, since it is structured data, it is stored in a commonly used database. The data can be queried and accessed using the corresponding query statements in this database. IoT data that has not undergone pre-processing is also stored in a database. When storing data in the database, each wellhead corresponds to a table, and each data table uses the wellhead and time as a unique query key for easy searching.

[0048] Step S300: Obtain the conversation information queried by the user, use the intent recognition module of the AI ​​agent to perform intent recognition on the conversation information to obtain intent information, and match the intent information with preset prompt word data to obtain matching results.

[0049] In one embodiment, the AI-based question-and-answer method for diagnosing anomalies in flowing wells includes a user-interactive page and a corresponding data acquisition API interface. The user inputs relevant voice or text information about the anomaly on the page, and the API interface retrieves the user's conversational information to prepare for subsequent extraction of user intent. Figure 2As shown, the AI ​​agent's intent recognition module includes a preset text recognition algorithm and a preset intent recognition model. The specific process of using the AI ​​agent's intent recognition module to recognize the intent of conversation information is as follows: First, text recognition is performed on the conversation information, which can be either text input or voice data. The preset text recognition algorithm includes a text processing model and a speech recognition model, and the corresponding algorithm is used for recognition based on different input types.

[0050] For example, when the input is text, a text processing model is used to segment the input text into sentences, forming word vectors for subsequent intent recognition. The text processing model can be a bag-of-words model. When the input is speech data, a speech recognition model is used to convert the input speech data into text, forming word vectors for subsequent intent recognition. The speech recognition model can be a transformer-based speech recognition algorithm or the open-source speech recognition algorithm from Tongyi Qianwen. These are existing models and will not be elaborated upon here.

[0051] For the word vectors processed above, an intent recognition model is used to identify the user's intent. The intent recognition model can be a BERT-based classifier used to analyze the word vectors and identify the user's intent. When using a BERT-based classifier for processing, the user's intent category is pre-set. For example, the category can include query category, anomaly diagnosis category, etc., so that the identified intent can be used to trigger anomaly diagnosis later.

[0052] For example, the user's session information is obtained, and the input text is "The pressure at well P5-1 has dropped sharply recently. Let's see what's going on." A text recognition model is used for word segmentation, extracting phrases like "well P5-1," "pressure dropped sharply," and "what's going on," and converting them into word vectors. An intent recognition model is then used to analyze the word vectors, outputting intent information. This intent information is for anomaly diagnosis, not for production querying. This intent recognition provides a foundation for interaction patterns and facilitates subsequent anomaly diagnosis.

[0053] In one embodiment, the prompt word data includes a unique identifier of the intent, a detailed functional description of the intent, a list of input parameters required by the intent, and a usage example. This prompt word data is stored as a JSON object, providing a prompt word library built for professionals. Each prompt word is uniquely identified and associated with a wellhead. Each wellhead data corresponds to a detailed functional description of the intent, a list of input parameters required by the intent, and a usage example. This allows the prompt words to be combined with the intent information when anomaly diagnosis is triggered, thereby enabling the corresponding query processing.

[0054] Specifically, the intent information is matched with preset prompt word data to obtain the matching result, including but not limited to the following steps: Step S310: Calculate the similarity between the intent information and the unique identifier of the intent to obtain a similarity value.

[0055] In one embodiment, a preset similarity algorithm is used to calculate the similarity between the well number in the intent information and the unique identifier of the intent, thereby obtaining a similarity value. The preset similarity algorithm can be either a text similarity algorithm or a cosine similarity algorithm. The well number uniquely identifies an oil well, and the unique identifier of the intent, composed of the well number and time, can also uniquely identify an oil well. By matching the similarity scores, it can be determined which oil well to process.

[0056] Step S320: If the similarity value is greater than the preset similarity threshold, read the detailed functional description of the intent, the list of input parameters required by the intent, and the usage example based on the unique identifier of the intent.

[0057] In one embodiment, the preset similarity threshold can be 0.95. If the similarity is greater than the preset similarity threshold, it indicates that the wellhead has been matched. Based on the unique identifier of the intent corresponding to the wellhead as the query field, the detailed functional description of the intent, the list of input parameters required by the intent, and usage examples in the JSON file are read in order to trigger the anomaly diagnosis process.

[0058] Step S330: If the intent information indicates an anomaly diagnosis category, trigger the anomaly diagnosis process, use the anomaly diagnosis process as the matching result, and record the detailed functional description of the intent, the list of input parameters required by the intent, and usage examples.

[0059] In one embodiment, based on the matched hash symbol, if the intent information falls under the intent diagnosis category, an anomaly diagnosis process is triggered. This anomaly diagnosis process is used as the matching result, allowing for subsequent data retrieval and processing based on the matching result. A detailed functional description of the intent, a list of required input parameters, and usage examples are recorded. This allows for subsequent data retrieval based on the corresponding content in the prompts, enabling processing of the user's intent and returning an answer appropriate to the user's query, thus achieving intelligent interaction.

[0060] It should be noted that intent information can also be query-type intents. When the intent information indicates a query type, the query processing flow is triggered, which will not be elaborated here.

[0061] In step S400, if the matching result indicates an abnormal diagnosis, read the real-time database composed of IoT-collected data and the distributed well history knowledge base, and form multimodal input data based on the read real-time database and distributed well history knowledge base.

[0062] In one embodiment, when the matching result indicates an anomaly diagnosis, an anomaly diagnosis process is performed. Based on the detailed functional description of the intent, the list of input parameters required by the intent, and usage examples, a real-time database composed of IoT-collected data and a distributed well history knowledge base are read to obtain data corresponding to the list of input parameters required by the intent, so as to obtain the input data for anomaly diagnosis and realize an accurate diagnosis process.

[0063] In one embodiment, multimodal input data is generated based on the read real-time database and distributed well history knowledge base, including but not limited to the following steps: Step S410: Use a preset structured language to read data from the real-time database and use query fields to read data from the distributed well history knowledge base to obtain IoT data, wellhead oil pressure, casing pressure, daily liquid production, daily crude oil production and daily natural gas production.

[0064] In some possible embodiments of this application, a structured language is used to read data from a real-time database. This structured language is the language corresponding to the storage database, such as SQL statements. For example, `SELECT * FROM RealTimeDB WHERETIME>T-7d` reads well operating parameter data, realizing the use of IoT-collected data stored in the real-time database to provide data reference for subsequent anomaly diagnosis. A unique query field consisting of well number and time is used to read data from a distributed well history knowledge base. According to the list of input parameters required by the intent, the wellhead oil pressure, casing pressure, daily fluid production, daily crude oil production, and daily natural gas production under that well number are read, providing data support for subsequent anomaly diagnosis.

[0065] Step S420: Calculate the ratio of daily crude oil production to daily natural gas production according to the time series to obtain the oil-gas ratio parameter.

[0066] In some possible embodiments of this application, for each time point in the time series, the daily crude oil production and daily natural gas production are divided by the daily crude oil production and daily natural gas production to obtain the oil-gas ratio parameter. The oil-gas ratio parameter is a key indicator for judging complex operating conditions such as degassing and gas channeling. Since the oil-gas ratio parameter is a ratio at each time point, it is also time series data.

[0067] Step S430: The IoT data, wellhead oil pressure, casing pressure, daily liquid production, daily crude oil production, daily natural gas production, and oil-gas ratio parameters are converted into multimodal input data.

[0068] Among them, the wellhead oil pressure, casing pressure, daily liquid production, daily crude oil production, daily natural gas production, and oil-gas ratio parameters are all time-series data.

[0069] Specifically, IoT data, wellhead oil pressure, casing pressure, daily liquid production, daily crude oil production, daily natural gas production, and oil-gas ratio parameters are converted into multimodal input data, including but not limited to the following steps: Step S431: Visualize the wellhead oil pressure, casing pressure, daily fluid production and oil-gas ratio parameters to generate a visualization image.

[0070] In some possible embodiments of this application, the parameters obtained in steps S410 and S420 are first visualized as wellhead oil pressure, casing pressure, daily fluid production, and oil-gas ratio. A plotting library can be used to draw curves for each time point and the corresponding parameters, forming a time-series graph. All parameters can be plotted on a single time-series graph to generate a visualization image. The matplotlib library can be used as the plotting library. Generating a visualization image not only facilitates differentiation but also allows the image to be output for engineers to view.

[0071] Step S432: Remove network noise from the visualized image and assign different high-contrast colors to the wellhead oil pressure, casing pressure, casing pressure and oil-gas ratio parameters according to the preset color mapping table.

[0072] In some possible embodiments of this application, to ensure that the visualized image meets the requirements of model processing and achieves intelligent processing, network noise is first removed from the visualized image. The background is then set to white using a tool from the drawing library, and grid lines are disabled to prevent the AI ​​from misinterpreting them as data curves. The tool in the drawing library is `plt.grid(False)`. Next, a color mapping table is constructed to assign high-contrast colors. This color mapping table can be represented as follows: wellhead oil pressure -> pure red (RGB:255,0,0); casing pressure -> pure blue (RGB:0,0,255); oil-gas ratio parameter -> pure black (RGB:0,0,0); casing pressure -> pure green (RGB:0,128,0). Based on the color mapping table, different high-contrast colors are drawn corresponding to wellhead oil pressure, casing pressure, casing pressure, and oil-gas ratio parameter. This not only facilitates differentiation but also ensures that these pure colors have the most prominent features in visual encoding.

[0073] Step S433: Calculate the first derivative of the curve in the visualization image, identify the abrupt change points of the slope, and overlay standardized visual markers at the corresponding coordinate positions in the visualization image to form a visually enhanced trend map.

[0074] In some possible embodiments of this application, the slope of the curve represents the rate of change. The first derivative of the curve in the visualization image is calculated. Taking wellhead oil pressure as an example, the first derivative dP / dt of the wellhead oil pressure curve is calculated. A threshold K is set, which is determined empirically and reflects sudden anomalies. In wellhead oil pressure judgment, anomalies include large nozzle spikes or other abnormalities. When the first derivative is greater than the threshold, it is determined to be a slope abrupt change point. At the coordinates corresponding to the abrupt change point, standardized visual markers are drawn using drawing tools. These visual markers can be solid circles or vertical lines corresponding to time points, forming a visually enhanced trend map. By labeling, attention markers can be provided during data processing, increasing the accuracy of identification. The curves in the visualization image are all labeled in the above manner, which will not be elaborated here.

[0075] Step S434: Compress the trend graph to form image modal data.

[0076] In some possible embodiments of this application, the trend graph is compressed into a JPEG image and converted into a Base64 string, or the image is vectorized to form image modal data for subsequent use as input data.

[0077] Step S435: Standardize the IoT data, daily crude oil production, and daily natural gas production, and combine the standardized data with the image modal data to form multimodal input data.

[0078] In some possible embodiments of this application, IoT data, daily crude oil production, and daily natural gas production are standardized. For each time point in the time series, the maximum and minimum values ​​are found, and normalization is performed using the maximum and minimum values ​​at each time point to obtain standardized data. The standardized data and image modal data are then concatenated to form multimodal input data, providing data support for subsequent anomaly diagnosis and identification.

[0079] Step S500: Analyze the multimodal input data using the multimodal processing model in the AI ​​agent to obtain anomaly diagnosis analysis results, and display the anomaly diagnosis analysis results to the user as an answer to the user's question, prompting the user to ask again.

[0080] like Figure 3 As shown, the multimodal processing model in the AI ​​agent is used to analyze the multimodal input data to obtain anomaly diagnosis analysis results, including but not limited to the following steps: Step S510: Query the historical data corresponding to the query field in the distributed well history knowledge base. The historical data includes anomaly handling record data.

[0081] In one embodiment, based on the query field consisting of the well number and time mentioned in the intent information, the corresponding well history document data associated with the well number in the distributed well history knowledge base is queried as historical data. The historical data includes anomaly handling record data. The anomaly handling record data can be fault records from the past three years, along with the handling methods. For example, there are three records of severe wax buildup, which involved wax cleaning and tubing replacement. By querying historical data, confidence levels for anomalies can be calculated, improving the accuracy of anomaly identification.

[0082] Step S520: Analyze the multimodal input data using a multimodal processing model to obtain the probability of anomaly types.

[0083] In one embodiment, the multimodal processing model is a pre-trained model, including an image processing layer and a temporal data processing layer. The image processing layer adopts a ResNet-50 structure, removing the original fully connected layers, and processes the image modality data in the multimodal input data to obtain image feature vectors. The temporal data processing layer adopts a recurrent neural network model or its variant model, processes the standardized data in the multimodal input data to obtain temporal feature vectors, and performs vector concatenation and fusion processing on the image feature vectors and temporal feature vectors, and outputs the anomaly type probability through a feature concatenation mapping layer. The feature concatenation mapping layer can be a fully connected layer or a single-layer convolutional layer, used to extract high-dimensional features from the feature vectors and output the probabilities of different categories.

[0084] It should be noted that the training process of the trained multimodal processing model involves historical data, including historical trend data. This historical trend data comprises data on wellhead oil pressure, casing pressure, daily fluid production, daily crude oil production, daily natural gas production, and oil-gas ratio parameters, reflecting trend changes. This historical trend data is added to the dataset. Alternatively, web crawling algorithms can be used to crawl flowing well data from the internet, which is then cleaned and added to the dataset. Data processing is performed on this dataset to obtain the training multimodal input data. This processing method is similar to the process of obtaining the multimodal input data and will not be elaborated here. The training multimodal input data is divided into training and test sets (both sets include anomalous data types as negative samples). Forward training of the multimodal processing model is performed to obtain the predicted types. The predicted types are then compared with the labeled data to calculate the loss function value. This loss function value is used for backward training to adjust the parameters in the multimodal processing model. After multiple iterations of training, a trained multimodal processing model is obtained, which is used to analyze the multimodal input data and output the probability of anomalous types.

[0085] Since the number of normal positive samples is greater than the number of negative samples, a ternary composite loss function is used, which includes a class balance loss function, a contrastive loss function, and a regularization constraint loss function. The class balance loss function is expressed as L1=-a(1-pt). b log(pt), where a is a balancing factor that increases the weight of outlier negative samples, and pt is the predicted probability (1-pt). b To identify difficult-to-classify samples, this term is increased for ambiguous samples that are hard to classify, forcing the model to focus on learning these difficult examples. The contrastive loss function can use Euclidean distance, ensuring that the "trend graph features" and "time series numerical features" at the same time point are as close as possible in terms of Euclidean distance. The regularization constraint function uses an L2 regularization term to prevent overfitting.

[0086] Step S530: If there is exception handling record data, query the last processing time in the exception handling record data, subtract the processing time from the current time to obtain the time difference, and calculate the correction coefficient corresponding to the probability of exception type based on the time difference.

[0087] In one embodiment, the existence of anomaly handling records indicates that the flowing well previously experienced an anomaly and underwent corresponding treatment, such as abnormal wax buildup followed by wax removal. The last handling time in the anomaly handling records is queried to determine the reliability of subsequent anomalies. For example, if the nozzle was replaced 3 days ago, the reliability of diagnosing an nozzle anomaly would be low. The handling time is subtracted from the current time to obtain the time difference. If the time difference is less than the safety window period, it is considered strong suppression, and the correction parameter is set to 0. If the time difference is greater than or equal to the safety window period, it is considered contact suppression, and the correction parameter is set to 1. The safety window period can be 30 days. As time increases, the probability of anomalies gradually increases with the time difference, constructing a growth index. The growth index increases from 1 to k over time, where k can be 1.5, etc., indicating that the likelihood of anomalies gradually increases. The correction parameter is multiplied by the growth index to obtain the correction coefficient. This correction factor indicates that within the safety window, it suppresses the credibility of abnormal diagnostic results, while outside the safety window, it increases the credibility of abnormal diagnostic results over time.

[0088] It should be noted that if there is no record of anomaly handling data, that is, if the last processing time is 0, the anomaly type corresponding to the anomaly type probability will be used as the anomaly diagnosis and analysis result.

[0089] Step S540: Multiply the correction coefficient by the probability of the anomaly type to obtain the confidence level, and use the anomaly type corresponding to the confidence level as the anomaly diagnosis analysis result.

[0090] In one embodiment, the correction coefficient is multiplied by the probability of the anomaly type to obtain the confidence level. If the confidence level is high, it indicates that the anomaly is not within the safety window, and the anomaly type corresponding to the confidence level is used as the anomaly diagnosis and analysis result. If the confidence level is low, it indicates that the anomaly is within the safety window, triggering a prompt mechanism, and the prompt content is used as the anomaly diagnosis and analysis result. By adjusting the correction coefficient as described above, anomalies can be accurately identified.

[0091] In another embodiment, the abnormality diagnosis analysis results are displayed to the user as answers to user inquiries, prompting the user to ask again. Alternatively, the user can proactively ask again based on the given abnormality diagnosis results. For example, regarding an abnormality of decreased oil pressure, the user can ask again what caused the abnormality. Steps S300 to S500 are executed cyclically to achieve automated interactive question and answering.

[0092] In one embodiment, after the Q&A interaction ends, a report generation process is triggered. The process integrates data summaries, trend analysis, anomaly diagnosis, and model suggestions according to a preset template, generates a standardized Word format analysis report, and sends it to the user via email.

[0093] For example, after the report is generated, the AI ​​agent pushes a notification pop-up to the user through the front-end interface, clearly indicating that the report is ready and providing two operation options: "Send Email" and "No Email Needed." After the user confirms sending, they can further specify the recipient's email address and call the backend email service interface to complete the report delivery. The specific display method is as follows: Based on JavaMail's Session connection pool (with pre-initialized SMTP configuration, including server address, port, and authentication information), a MIME type email object is created (supporting multiple content parts, adapting to mixed "text + attachment" scenarios). The Word format analysis report is set as the core content of the email object, and then the JavaMail Transport utility class is called to perform the sending operation. By reusing the pre-created Session connection pool, the need to re-establish an SMTP connection for each send is avoided, reducing resource consumption and connection timeout risks; the configured SSL / TLS encryption strategy is used throughout the sending process to ensure that the email content (especially the report attachments) is not leaked during transmission.

[0094] like Figure 4As shown, this application provides an AI-based question-and-answer anomaly diagnosis system 100 for flowing wells. This system 100 acquires multi-source heterogeneous data of the target flowing well through a data acquisition module 110. This data includes daily production data indexed by time series, IoT-collected data, and well history document data associated with well numbers. A data construction module 120 constructs a distributed well history knowledge base based on the daily production data and well history document data. This distributed knowledge base includes multiple well history documents, with query fields constructed using well numbers and times, and each query field corresponding to a specific well history document. A session acquisition and processing module 130 acquires user queries. The AI ​​agent's intent recognition module identifies the intent in the conversation information, obtains intent information, and matches the intent information with preset prompt words to obtain matching results. When the matching result indicates an anomaly diagnosis, the anomaly triggering module 140 reads the real-time database composed of IoT-collected data and the distributed well history knowledge base. Based on the read real-time database and distributed well history knowledge base, multimodal input data is formed. The anomaly diagnosis module 150 analyzes the multimodal input data using the multimodal processing model in the AI ​​agent to obtain anomaly diagnosis analysis results. These results are then displayed to the user as answers to their questions, prompting the user to ask again.

[0095] It should be noted that the data acquisition module 110 is connected to the data construction module 120, the data construction module 120 is connected to the session acquisition and processing module 130, the session acquisition and processing module 130 is connected to the anomaly triggering module 140, and the anomaly triggering module 140 is connected to the anomaly diagnosis module 150. The above-mentioned AI agent-based question-and-answer anomaly diagnosis method for flowing wells is applied to the AI ​​agent-based question-and-answer anomaly diagnosis system 100. The AI ​​agent-based question-and-answer anomaly diagnosis system 100 provides multi-faceted data support by acquiring daily production data indexed by time series, IoT-collected data, and well history document data associated with well numbers. This avoids the inability of single data to reflect changing trends. Furthermore, it constructs a distributed well history knowledge base based on multi-source heterogeneous data, achieving the fusion of structured and unstructured data for easy reading. It also provides an intent recognition module to support the recognition of user questions, triggering anomaly diagnosis based on intent, and displaying the diagnosis results to the user. This enables continuous questioning of the flowing well, combining anomaly diagnosis with interactive question-and-answer, not only achieving intelligent analysis but also providing users with multi-level question-and-answer sessions to understand the changing trends of the flowing well.

[0096] It should also be noted that the apparatus provided in the above embodiments is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus and method embodiments provided in the above embodiments belong to the same concept, and their specific implementation process can be found in the method embodiments, which will not be repeated here.

[0097] This application also discloses an electronic device. (See reference...) Figure 5 , Figure 5 This is a schematic diagram of the structure of an electronic device according to an embodiment of this application. The electronic device 500 may include: at least one processor 501, at least one network interface 504, a user interface 503, a memory 505, and at least one communication bus 502.

[0098] The communication bus 502 is used to enable communication between these components.

[0099] The user interface 503 may include a display screen and a camera. Optionally, the user interface 503 may also include a standard wired interface and a wireless interface.

[0100] The network interface 504 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).

[0101] The processor 501 may include one or more processing cores. The processor 501 connects to various parts of the server using various interfaces and lines, and performs various server functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in memory 505, and by calling data stored in memory 505. Optionally, the processor 501 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array. The processor 501 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and Modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content required for display; and the modem handles wireless communication. It is understood that the modem may also be implemented as a separate chip without being integrated into the processor 501.

[0102] The memory 505 may include random access memory (RAM) or read-only memory. Optionally, the memory 505 may include a non-transitory computer-readable storage medium. The memory 505 may be used to store instructions, programs, code, code sets, or instruction sets. The memory 505 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-described method embodiments, etc.; the data storage area may store data involved in the above-described method embodiments, etc. Optionally, the memory 505 may also be at least one storage device located remotely from the aforementioned processor 501. (Refer to...) Figure 5 The memory 505, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and an application program for a question-and-answer-based method for diagnosing anomalies in flowing wells based on AI agents.

[0103] exist Figure 5 In the illustrated electronic device 500, the user interface 503 is mainly used to provide an input interface for the user and to acquire user input data; while the processor 501 can be used to call an application stored in the memory 505 for a question-and-answer type self-flowing well anomaly diagnosis method based on an AI agent. When executed by one or more processors 501, the electronic device 500 performs one or more methods as described in the above embodiments. It should be noted that, for the foregoing method embodiments, for the sake of simplicity, they are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, because according to this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0104] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0105] In the various embodiments provided in this application, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some service interface; the indirect coupling or communication connection between apparatuses or units may be electrical or other forms.

[0106] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0107] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0108] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as USB flash drives, portable hard drives, magnetic disks, or optical disks.

[0109] The above are merely exemplary embodiments of this disclosure and should not be construed as limiting the scope of this disclosure. Any equivalent changes and modifications made in accordance with the teachings of this disclosure shall still fall within the scope of this disclosure. Other embodiments of this disclosure will readily conceive of those skilled in the art upon consideration of the specification and the disclosure of practical truths.

[0110] This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not described in this disclosure. The specification and embodiments are to be considered exemplary only, and the scope and spirit of this disclosure are defined by the claims.

Claims

1. A question-and-answer method for diagnosing anomalies in flowing wells based on AI agents, characterized in that, The method includes: Acquire multi-source heterogeneous data of the target flowing well, including daily production data indexed by time series, IoT-collected data, and well history document data associated with well number; Based on the daily production data and the well history document data, a distributed well history knowledge base is constructed. The distributed well history knowledge base includes multiple well history documents, and the query fields are composed of well number and time. The query fields correspond one-to-one with the well history documents. The system obtains the user's inquiry session information, uses the AI ​​agent's intent recognition module to perform intent recognition on the session information to obtain intent information, and matches the intent information with preset prompt word data to obtain matching results. If the matching result indicates an abnormal diagnosis, read the real-time database composed of IoT-collected data and the distributed well history knowledge base, and form multimodal input data based on the read real-time database and the distributed well history knowledge base; The multimodal processing model in the AI ​​agent is used to analyze the multimodal input data to obtain anomaly diagnosis analysis results. These results are then displayed to the user as answers to their questions, prompting the user to ask again.

2. The method according to claim 1, characterized in that, The process of forming multimodal input data based on the read real-time database and the distributed well history knowledge base includes: The real-time database is read using a preset structured language, and the distributed well history knowledge base is read using the query fields to obtain IoT data, wellhead oil pressure, casing pressure, daily liquid production, daily crude oil production, and daily natural gas production. The oil-gas ratio parameter is obtained by calculating the ratio of the daily crude oil production to the daily natural gas production according to the time series. The IoT data, wellhead oil pressure, casing pressure, daily liquid production, daily crude oil production, daily natural gas production, and oil-gas ratio parameters are used to form multimodal input data. The wellhead oil pressure, casing pressure, daily liquid production, daily crude oil production, daily natural gas production, and oil-gas ratio parameters are all sequential data arranged in time.

3. The method according to claim 2, characterized in that, The process of forming multimodal input data from the IoT data, wellhead oil pressure, casing pressure, daily liquid production, daily crude oil production, daily natural gas production, and oil-gas ratio parameters includes: The wellhead oil pressure, the casing pressure, the daily fluid production, and the oil-gas ratio parameters are visualized to generate a visualization image; The visualization image is cleaned of network noise, and different high-contrast colors are assigned to the wellhead oil pressure, casing pressure, daily fluid production and oil-gas ratio parameters according to a preset color mapping table. Calculate the first derivative of the curve in the visualization image, identify the abrupt change in slope, and overlay standardized visual markers at the corresponding coordinate positions in the visualization image to form a visually enhanced trend map; The trend graph is compressed to form image modal data; The IoT data, the daily crude oil production, and the daily natural gas production are standardized, and the standardized data and the image modal data are used to form the multimodal input data.

4. The method according to claim 3, characterized in that, The step of analyzing the multimodal input data using the multimodal processing model in the AI ​​agent to obtain anomaly diagnosis analysis results includes: Query the historical data corresponding to the query field in the distributed well history knowledge base, including anomaly handling record data; The multimodal processing model is used to analyze the multimodal input data to obtain the probability of anomaly types; If the exception handling record data exists, query the last processing time in the exception handling record data, subtract the processing time from the current time to obtain the time difference, and calculate the correction coefficient corresponding to the probability of the exception type based on the time difference. The correction coefficient is multiplied by the probability of the anomaly type to obtain the confidence level, and the anomaly type corresponding to the confidence level is taken as the anomaly diagnosis analysis result.

5. The method according to claim 1, characterized in that, The prompt data includes a unique identifier for the intent, a detailed functional description of the intent, a list of input parameters required by the intent, and usage examples; The step of matching the intent information with preset prompt word data to obtain a matching result includes: The similarity between the intent information and the unique identifier of the intent is calculated to obtain a similarity value; If the similarity value is greater than a preset similarity threshold, the detailed functional description of the intent, the list of input parameters required by the intent, and the usage example are read according to the unique identifier of the intent. If the intent information indicates an anomaly diagnosis category, an anomaly diagnosis process is triggered, the anomaly diagnosis process is used as the matching result, and a detailed functional description of the intent, a list of input parameters required by the intent, and a usage example are recorded.

6. The method according to claim 1, characterized in that, After acquiring the multi-source heterogeneous data of the target flowing well, the method further includes: The daily production data is calculated using the moving average and standard deviation methods to obtain the first outlier-removed data; The moving average and standard deviation methods are used to calculate the second outlier-removed data from the IoT-collected data. Interpolation processing is performed on the first outlier-removed data and the second outlier-removed data respectively to obtain preprocessed data; The distributed well history knowledge base is constructed using the preprocessed daily production data and the well history document data.

7. The method according to claim 6, characterized in that, The step of calculating the first outlier-removed data by performing moving average and standard deviation methods on the daily production data includes: The daily production data is processed using a sliding window according to a preset time window to obtain the average value within each sliding window. The outliers are obtained by applying standard deviation to each of the aforementioned average values. The daily production data is processed to remove outliers, resulting in the first outlier-removed data.

8. A question-and-answer-based anomaly diagnosis system for flowing wells based on AI intelligent agents, characterized in that, The system includes: The data acquisition module is used to acquire multi-source heterogeneous data of the target flowing well. The multi-source heterogeneous data includes daily production data indexed by time series, IoT-collected data, and well history document data based on well number association. The data construction module is used to construct a distributed well history knowledge base based on the daily production data and the well history document data. The distributed well history knowledge base includes multiple well history documents, and the query fields are composed of well number and time. The query fields correspond one-to-one with the well history documents. The conversation acquisition and processing module is used to acquire conversation information queried by the user, use the intent recognition module of the AI ​​agent to perform intent recognition on the conversation information to obtain intent information, and match the intent information with preset prompt word data to obtain matching results; An anomaly triggering module is used to read the real-time database composed of IoT-collected data and the distributed well history knowledge base when the matching result indicates an anomaly diagnosis, and to form multimodal input data based on the read real-time database and the distributed well history knowledge base; The anomaly diagnosis module is used to analyze the multimodal input data using the multimodal processing model in the AI ​​agent, obtain anomaly diagnosis analysis results, display the anomaly diagnosis analysis results to the user as an answer to the user's question, and prompt the user to ask again.

9. An electronic device, characterized in that, The device includes a processor, a memory, a user interface, a communication bus, and a network interface. The processor, the memory, the user interface, and the network interface are respectively connected to the communication bus. The memory is used to store instructions. The user interface and the network interface are used to communicate with other devices. The processor is used to execute the instructions stored in the memory to cause the electronic device to perform the method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed, perform the method as described in any one of claims 1-7.