Real-time detection method and system for abnormal gas field operations based on Rete algorithm

By applying Rete algorithm and Rete network in petrochemical exploration, the problem of inefficiency in the existing technology when processing massive real-time data and complex business rules is solved, efficient and real-time abnormal detection is achieved, and detection efficiency and concurrency are improved.

CN118112672BActive Publication Date: 2024-12-31CHINA PETROLEUM & CHEMICAL CORP +1
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202311513713.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-14
Publication Date
2024-12-31
Estimated Expiration
2043-11-14

AI Technical Summary

Technical Problem

The existing rule engines are inefficient when processing massive real-time data and complex business rules in petrochemical exploration, and cannot meet the needs of high real-time, resulting in a large number of abnormal detections relying on manual intervention, which poses the risk of inefficiency and error proneness.

Method used

Using the real-time detection method of gas field business abnormalities based on Rete algorithm, by building a Rete network, using the α network and β network to quickly filter and relationship judgment on real-time data, combined with Redis cache and scheduling strategies, the rules matching and execution are achieved, and node instances are dynamically expanded. to improve concurrency.

Benefits of technology

It improves detection efficiency, reduces detection errors, improves detection real-timeness, can effectively process massive data and complex business rules, solves the complex reasoning problems of multi-object and multi-index attributes, and achieves high concurrency in rule matching.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118112672B_ABST
    Figure CN118112672B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of petrochemical exploration technology, and in particular to a real-time detection method and system for gas field business anomalies based on the Rete algorithm, including obtaining real-time data during the drilling process and inputting it into a pre-constructed Rete network. The steps of constructing the Rete network include: defining a rule set according to the rules in the drilling process; constructing an α network, the α network is used to quickly filter the input real-time data according to one or more α nodes; constructing a β network, the β network is used to judge the relationship between real-time data and multiple conditions according to one or more β nodes; and performing constraint judgment and execution according to the input real-time data. The present invention can quickly identify and match the massive real-time data obtained during the drilling process, and output the corresponding anomaly detection results, thereby improving the detection efficiency. At the same time, based on rule matching, it reduces the detection error and improves the real-time performance of the detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of petrochemical exploration technology, and in particular to a real-time detection method and system for gas field business anomalies based on a Rete algorithm. Background Art

[0002] When the petrochemical industry conducts geophysical exploration, it detects abnormalities in drilling overflows, including measuring some data such as well depth, inlet and outlet flow, total hydrocarbon content, drilling fluid volume, working conditions, etc., and discovers potential or ongoing abnormalities according to pre-defined rules. The emergence of rule engines is to cope with this complex data environment. The current mainstream rule engines, such as Drools (reference https: / / www.drools.org / ) and EasyRule (reference https: / / github.com / j-easy / easy-rules), provide rich functions and have been widely used.

[0003] As sensors and devices are connected to the network, they generate massive amounts of real-time data, which makes the existing rule engines insufficient to support such scenarios and cannot meet the high real-time requirements in such scenarios. Therefore, a large number of anomaly detection and control processes rely on human intervention and manual operations. This approach is inefficient, error-prone, and difficult to expand. Summary of the invention

[0004] In order to overcome the problems that existing rule engines are difficult to process massive data and manual detection is inefficient, the present invention provides a real-time detection method and system for gas field business anomalies based on the Rete algorithm, which can meet the needs of massive data and complex business rules and improve detection efficiency.

[0005] In order to achieve the above-mentioned object of the invention, the present invention provides the following technical solutions:

[0006] In a first aspect, the present invention provides a method for real-time detection of gas field business anomalies based on a Rete algorithm, the method comprising:

[0007] Acquire real-time data during the drilling process and input it into a pre-built Rete network. The Rete network performs constraint judgment on the real-time data, generates and outputs detection results based on the judgment results;

[0008] The steps of building the Rete network include:

[0009] Define a set of rules based on the rules in the drilling process;

[0010] Building an alpha network, the alpha network is used to quickly filter input real-time data according to one or more alpha nodes;

[0011] Constructing a beta network, wherein the beta network is used to determine the relationship between the real-time data and multiple conditions according to one or more beta nodes;

[0012] Rules are matched and executed based on input real-time data.

[0013] According to a specific implementation method, in the above detection method, the Rete network also includes a Redis cache.

[0014] According to a specific implementation method, in the above detection method, the construction process of the alpha network includes:

[0015] One or more corresponding α nodes Ai are created according to one or more conditions in the rule set, expressed as Ai={Ci, Fi}, where Ci represents the condition and Fi represents the filter function, which is used to determine whether the input real-time data meets the condition Ci;

[0016] According to the logical relationship between the conditions in the rule set, directed edges are established between the α nodes.

[0017] According to a specific implementation method, in the above detection method, the construction process of the beta network includes:

[0018] One or more corresponding β nodes Bk are created according to one or more condition combinations in the rule set, expressed as Bk={Ck, Mk}, where Ck represents the condition combination, and Mk represents the matching function, which is used to determine whether the input fact satisfies the condition combination Ck;

[0019] According to the logical relationship between the conditions in the rule set, directed edges are established between the β nodes.

[0020] According to a specific implementation method, in the above detection method, the rule matching and execution includes:

[0021] Step 1: Select the corresponding α node according to the scheduling strategy to perform constraint judgment on the input real-time data;

[0022] Step 2: Mark the matching real-time data as AM and store it in the Redis cache;

[0023] Step 3: Repeat steps 1 and 2 until there is no real-time data;

[0024] Step 4: Select the corresponding β node according to the scheduling strategy, associate the AM of the previous node with the newly input AM, and make a constraint judgment;

[0025] Step 5: If the constraint judgment passes, determine whether the β node is a termination node. If so, the process ends and the detection result is obtained; if not, the two AMs are merged into PM, stored in the Redis cache, and passed to the next node;

[0026] Step 6: Select another corresponding β node according to the scheduling strategy, associate the PM of the previous node with the newly input AM, and make a constraint judgment;

[0027] Step 7: If the constraint judgment passes, determine whether the other β node is a termination node. If so, the process ends and the detection result is obtained; if not, the PM and the newly input AM are merged into a new PM, stored in the Redis cache, and passed to the next node;

[0028] Step 8: Repeat steps 6 and 7 until the network is completed and the final detection result is obtained.

[0029] According to a specific implementation method, in the above detection method, the α network and the β network communicate with each other through the AM and the queue to be processed.

[0030] According to a specific implementation method, in the above detection method, the scheduling strategy is:

[0031] Detect the waiting queues of all α / β networks and dispatch real-time data to the α / β network with the smallest waiting queue and the corresponding α / β node;

[0032] If the queue to be processed reaches the maximum value, a new α / β network is started to dispatch the real-time data to the network and the corresponding nodes.

[0033] According to a specific implementation method, in the above detection method, the data to be processed is stored in a Redis cache.

[0034] According to a specific implementation method, in the above detection method, when the real-time data and its corresponding detection results are stored in the Redis cache, the real-time data becomes AM.

[0035] In a second aspect, the present invention further provides a real-time detection system for gas field business anomalies based on the Rete algorithm, the system comprising:

[0036] A data acquisition module is used to obtain real-time data during the drilling process;

[0037] A rule set module, used to define a rule set according to the rules in the drilling process;

[0038] Network building module, used to build Rete network;

[0039] Data input module, used for real-time data input;

[0040] Rete network module, used to match and execute rules based on input real-time data and output judgment results;

[0041] A data output module is used to output the detection result according to the judgment result.

[0042] Compared with the prior art, the present invention has the following beneficial effects:

[0043] 1. The present invention provides a real-time detection method and system for gas field business anomalies based on the Rete algorithm. The method is based on a well-constructed Rete network, can quickly identify and match the massive real-time data obtained during the drilling process, and output the corresponding anomaly detection, thereby improving the detection efficiency. At the same time, based on rule matching, the detection error is reduced, and the real-time performance of the detection is improved.

[0044] 2. The present invention utilizes the cloud-native automatic expansion of multiple instances of the Rete network and adds dynamically expandable node instances, solving the complex reasoning problems of multiple objects and multi-index attributes in one rule. The α network and β network can automatically expand node instances according to the strategy, effectively improving the concurrency of rule matching. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 A schematic diagram of a method for real-time detection of abnormalities in gas field operations provided by an embodiment of the present invention;

[0046] Figure 2 A schematic diagram of the Rete network structure provided by an embodiment of the present invention;

[0047] Figure 3 A schematic diagram of the alpha network operation structure provided by an embodiment of the present invention;

[0048] Figure 4 A flowchart of rule matching and execution of a Rete network provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0049] The present invention is further described in detail below in conjunction with test examples and specific implementation methods. However, this should not be understood as the scope of the above subject matter of the present invention being limited to the following embodiments, and all technologies realized based on the content of the present invention belong to the scope of the present invention.

[0050] Example 1

[0051] Please refer to Figure 1 , a real-time detection method for abnormal gas field business based on Rete algorithm is provided in this embodiment, and the method includes:

[0052] Acquire real-time data during the drilling process and input it into a pre-built Rete network. The Rete network performs constraint judgment on the real-time data, generates and outputs detection results based on the judgment results;

[0053] The steps of building the Rete network include:

[0054] Define a set of rules based on the rules in the drilling process;

[0055] Building an alpha network, the alpha network is used to quickly filter input real-time data according to one or more alpha nodes;

[0056] Constructing a beta network, wherein the beta network is used to determine the relationship between the real-time data and multiple conditions according to one or more beta nodes;

[0057] Rules are matched and executed based on input real-time data.

[0058] Wherein, the Rete network also includes Redis cache.

[0059] The construction process of the alpha network includes:

[0060] One or more corresponding α nodes Ai are created according to one or more conditions in the rule set, expressed as Ai={Ci, Fi}, where Ci represents the condition and Fi represents the filter function, which is used to determine whether the input real-time data meets the condition Ci;

[0061] According to the logical relationship between the conditions in the rule set, directed edges are established between the α nodes.

[0062] The construction process of the beta network includes:

[0063] One or more corresponding β nodes Bk are created according to one or more condition combinations in the rule set, expressed as Bk={Ck, Mk}, where Ck represents the condition combination, and Mk represents the matching function, which is used to determine whether the input fact satisfies the condition combination Ck;

[0064] According to the logical relationship between the conditions in the rule set, directed edges are established between the β nodes.

[0065] The rule matching and execution includes:

[0066] Step 1: Select the corresponding α node according to the scheduling strategy to perform constraint judgment on the input real-time data;

[0067] Step 2: Mark the matching real-time data as AM and store it in the Redis cache;

[0068] Step 3: Repeat steps 1 and 2 until there is no real-time data;

[0069] Step 4: Select the corresponding β node according to the scheduling strategy, associate the AM of the previous node with the newly input AM, and make a constraint judgment;

[0070] Step 5: If the constraint judgment passes, determine whether the β node is a termination node. If so, the process ends and the detection result is obtained; if not, the two AMs are merged into PM, stored in the Redis cache, and passed to the next node;

[0071] Step 6: Select another corresponding β node according to the scheduling strategy, associate the PM of the previous node with the newly input AM, and make a constraint judgment;

[0072] Step 7: If the constraint judgment passes, determine whether the other β node is a termination node. If so, the process ends and the detection result is obtained; if not, the PM and the newly input AM are merged into a new PM, stored in the Redis cache, and passed to the next node;

[0073] Step 8: Repeat steps 6 and 7 until the network is completed and the final detection result is obtained.

[0074] The α network and the β network communicate with each other through AM and a queue to be processed.

[0075] The scheduling strategy is:

[0076] Detect the waiting queues of all α / β networks and dispatch real-time data to the α / β network with the smallest waiting queue and the corresponding α / β node;

[0077] If the queue to be processed reaches the maximum value, a new α / β network is started to dispatch the real-time data to the network and the corresponding nodes.

[0078] The data to be processed is stored in the Redis cache.

[0079] When the real-time data and the corresponding detection results are stored in the Redis cache, the real-time data becomes AM.

[0080] The present embodiment provides a real-time detection method and system for gas field business anomalies based on the Rete algorithm. The method is based on a constructed Rete network, can quickly identify and match massive real-time data obtained during the drilling process, and output corresponding detection results, thereby improving detection efficiency. At the same time, based on rule matching, it reduces detection errors and improves detection real-time performance. In addition, the present embodiment utilizes the cloud-native automatic expansion of multiple instances of the Rete network, adds dynamically expandable node instances, and solves the complex reasoning problem of multiple objects and multiple index attributes in one rule. The α network and the β network can automatically expand node instances according to strategies, effectively improving the concurrency of rule matching.

[0081] Example 2

[0082] This embodiment provides a real-time detection method for gas field business anomalies based on the Rete algorithm during the drilling process. The method can match massive data with multiple complex business rules in a multi-instance node environment.

[0083] The overall detection process is divided into two steps. The first step is the rule compilation-network creation process, in which a rule network is created in the rule engine according to the detection set R (Rules Execution Set); the second step is the execution process, in which data objects (InputData objects) are executed in the rule engine according to the corresponding rules and the execution result data (OutputDataObjects) are output.

[0084] Please refer to Figure 1 , which is a structural diagram of the Rete network provided in this embodiment.

[0085] Combined with the attached figure, the rule compilation-network creation process is specifically described:

[0086] 1. Define a rule set: Suppose we have a rule set R, which contains n rules, represented by R = {R1, R2, ..., Rn}.

[0087] 2. Constructing the α network: The purpose of constructing the α network is to quickly filter the input facts. We can use a directed acyclic graph (DAG) to represent the α network, where each node represents a condition and each node is associated with an input fact. ① Define the α node. For each condition Ci in the rule Ri, create a corresponding α node Ai. Each α node Ai can be expressed as Ai = {Ci, Fi}, where Ci represents the condition and Fi represents the filter function, which is used to determine whether the input fact satisfies the condition Ci. ② Connect the α nodes and establish connections between the α nodes based on the relationship between the conditions in the rule Ri. If there is an AND relationship between the two conditions Ci and Cj, then we establish a directed edge between the α nodes Ai and Aj to represent the conditional relationship between Ai and Aj.

[0088] 3. Constructing a β network: The purpose of constructing a β network is to handle the relationship and matching between multiple conditions. We also use a directed acyclic graph (DAG) to represent the β network, where each node represents a connection node, and each node is associated with an α node and other β nodes. ① Define the β node. For each condition combination Ck in the rule Ri, create a corresponding β node Bk. Each β node Bk can be expressed as Bk = {Ck, Mk}, where Ck represents the condition combination and Mk represents the matching function, which is used to determine whether the input fact satisfies the condition combination Ck. ② Connect the β nodes. According to the relationship between the conditions in the rule Ri, establish the connection between the β nodes. If there is an AND relationship between the condition combination Ck and the condition combination Cl, then we establish a directed edge between the β nodes Bk and Bl to represent the conditional relationship between Bk and Bl. If there is an OR relationship between the condition combination Ck and the condition combination Cl, then we establish a directed edge between the β nodes Bk and Bl to represent the conditional relationship between Bk and Bl.

[0089] 4. Rule matching and execution: Based on the input facts F, rule matching and execution are performed through the Rete network.

[0090] Specifically, the multi-instance real-time rule reasoning method provided in this embodiment is applicable to the Rete algorithm. The Rete algorithm includes a Rete network. The Rete network is composed of an α network and a β network. The α network is composed of one or more pods. The number of pods depends on the complexity of the rule conditions and the number of facts. The α network can run multiple pods at the same time. Figure 2 , is a schematic diagram of the α network operation structure of this embodiment, and the β network operation structure is the same as the α network. Then there can be multiple sets of complete Rete networks. Each α (β) network is equipped with a queue Q to be processed (the maximum number of queues is Q-max), and the queue data (Q-num) of the queue Q is stored in Redis. The method steps are:

[0091] Step 1, Scheduling strategy: When fact F is input, all queue statistics of the α network in Redis are retrieved. First, check whether Q-num is equal to Q-max. If not, select the α network with the smallest Q-num and find the corresponding α node; otherwise, start a new α network and schedule fact F to the corresponding node of the network.

[0092] Step 2: Perform calculation and constraint judgment according to the constraint function Fi corresponding to the α node. If the constraint judgment is passed, the fact F is marked as AM (Alpha Match) and stored in the Redis cache. When the α network is started, the cache under the network is loaded into the pod local memory. The next time calculation and constraint judgment are performed, the local cache is queried according to AM. If it exists, the result is used directly.

[0093] Step 3: According to the connection direction of AM, query the next node β of AM and pass the AM data to the β node. According to step 1, find the corresponding β node in the β network.

[0094] Step 4, the β node executes, takes out the previous node AM data (left) and the newly input AM data (right), associates the two AMs according to the node rule, and makes a constraint judgment. If it passes, it determines whether the node β is a termination node. If it is a termination node, the process ends and the result is obtained; if it is not a termination node, the two AMs are merged into PM, and PM (Partial Match) is stored in the Redis cache, and PM is passed to the next node of the β node; if it does not pass, the operation is stopped.

[0095] Step 5. According to the connection direction of the PM node, query the next node βl of the node, and pass the PM data to βl. According to step 1, find the corresponding βl node in the β network. According to the βl rule, associate PM (left) and the newly input AM (right), and make a constraint judgment. If it passes, judge whether the node βl is a terminal node. If it is a terminal node, the process ends and the result is obtained; if it is not a terminal node, PM and AM are merged into a new PM-new, and the new PM-new is stored in the Redis cache, and PM-new is passed to the next node of the βl node; if it does not pass, stop this operation. The β network cache is used in the same way as the α network.

[0096] Repeat step 5 until the network is complete and the result is obtained.

[0097] In summary, this embodiment provides a distributed multi-instance real-time rule reasoning method, which enables the matching and execution of rules to be completed within a specified time, thereby improving real-time performance. The specific advantages of this method include:

[0098] An alpha network or beta network can be constructed by multiple node instances (pods), which can handle complex detection problems of multiple objects and multiple index attributes in industrial detection systems.

[0099] Based on the Rete algorithm and taking advantage of the cloud-native automatic expansion of multiple instances, the α network and β network can automatically expand node instances (pods) according to the strategy. The α network and β network communicate through an AM pending task queue, effectively improving the concurrency of rule matching.

[0100] By caching node matching results, the rule matching speed can be effectively improved.

[0101] Example 3

[0102] In order to make the above features and advantages of the present invention more obvious and easy to understand, the following is a detailed description based on specific implementation examples and the accompanying drawings.

[0103] The Rete network is constructed according to the rule set R provided by the user. The Rete network consists of the α network and the β network. The α network and the β network communicate through AM and the waiting queue Q.

[0104] This embodiment first schedules the α network and the β network to different instances for processing. The α network is mainly used to implement constraint judgment and calculation. In the detection system, there are many things that need to be calculated to complete the constraint judgment. The β network is mainly used for logical connection operations to make judgments on this rule. Therefore, we schedule the α network and the β network separately and allocate different resources. The α network can allocate more CPU resources, and the β network can allocate more memory resources. This allows for more efficient use of resources and faster judgments. Please refer to Figure 3 , which is a rule matching and execution flow chart of the Rete network provided in this embodiment.

[0105] Specifically, the α network is responsible for making constraint judgments on the same object attributes and putting the object attribute constraints into the α node. The present invention schedules an α network instance. The steps are as follows:

[0106] 1) When real-time data arrives at the detection system, the fact F is taken out in turn and the α node corresponding to the fact is found. At this time, the fact Fact is judged, such as: Fact.work-condition = 'drilling' or Fact.well-depth>300m, or Fact.avg(temperature)>20℃, etc. The Fact and the corresponding detection results are saved in the Redis cache, and the Fact becomes AM.

[0107] 2) The AM is transferred to the next node β of the α node. According to the connection relationship of the AM, the AM is scheduled to the corresponding AM waiting queue in the β network.

[0108] 3) Repeat steps 1) to 2) until there are no more facts.

[0109] The beta network instance is responsible for performing logical association calculations on different types of facts and storing the generated results in the Redis cache or triggering rules. The specific steps include:

[0110] 1) When the queue Q is not empty, select the earliest unprocessed β node from the queue Q and let this instance process the task. If all β instances are in full task state, start a new β network and let this network process the β task.

[0111] 2) Queue Q executes in sequence, and according to the rule of node B, takes out PM and corresponding AM, calculates PM and AM, such as: PM-result = true (PM means Fact.work-condition = 'drilling' AND Fact.avg(temperature)>20℃) AND AM = true (AM means Fact.well-depth>300m), and gets the result. If it passes, it determines whether node β is the termination node. If it is the termination node, the process ends and the result is obtained; if it is not the termination node, AM is added to PM to generate a new PM, the new PM is stored in the Redis cache, and PM is passed to the next node of the β node; if it does not pass, the operation is stopped.

[0112] 3) Execute steps 1) to 3) in a loop until the β network queue Q is empty.

[0113] The method of the present invention is further described below in combination with two specific rules and related data.

[0114] 1. Rule 1 (abnormal rise in standpipe pressure)

[0115] IF

[0116] C1: Well.Drilling Status = 'Drilling'

[0117] C2: Well.Completion Status = 'No' OR Well.Completion Status 'Empty'

[0118] C3: (well. pump stroke 1.max + well. pump stroke 2.max + well. pump stroke 3.max) - (well. pump stroke 1.min + well. pump stroke 2.min + well. pump stroke 3.min) <= 10

[0119] C4: Well. Current vertical pressure - Well. 1 minute ago vertical pressure > 2

[0120] THEN

[0121] (Alarm).

[0122] 2. Rule (abnormal drop in standpipe pressure)

[0123] IF

[0124] C1: Well.Drilling Status = 'Drilling'

[0125] C2: Well.Completion Status = 'No' OR Well.Completion Status 'Empty'

[0126] C3: (well. pump stroke 1.max + well. pump stroke 2.max + well. pump stroke 3.max) - (well. pump stroke 1.min + well. pump stroke 2.min + well. pump stroke 3.min) <= 10

[0127] C5: Well. 1 minute ago vertical pressure - Well. Current vertical pressure > 2

[0128] THEN

[0129] (Alarm).

[0130] In the above two rules, each rule R has 4 conditions C. The first three rules are the same, but the last rule is different.

[0131] Table 1: All data

[0132]

[0133] All data arrive at the scheduling node at the same time. According to the scheduling strategy of the scheme, the fact data is scheduled to the α network queue Q-α-i. The queue order is shown in Table 1. The α network takes out the fact data in the queue in turn, finds the corresponding node according to the fact, and executes the operation function on the node. After obtaining the result, the data is cached to the AM cache. At the same time, according to the scheme scheduling strategy, the fact result data is scheduled to the AM pending queue (β network-i).

[0134] Table 2: AM pending queue

[0135]

[0136] The β network reads the fact result data of the AM pending queue in sequence. It reads C1 for the first time and finds the node on the β network. According to the node rule, it associates C2 and takes C1&C2 to get the result C1&C2=true. The current node is not a terminal node, so the β node and the result of C1&C2 are saved and stored in the PM cache. At the same time, the result is passed to the successor β node of the β node (βl). βl takes PM (C1&C2=true) and C3, that is, the result of PM&C3 is PM&C3=true. The current node is not a terminal node. The result is used as the new PM (PM-new) and passed to the successor node of βl, and so on, until the β node is a terminal node or the β network AM pending queue is empty.

[0137] Table 3: β nodes

[0138] β condition Beta Node C1&C2 β1 ((C1&C2), C3) β2 (((C1&C2), C3), C4) β3 (((C1&C2), C3), C5) β4

[0139] Example 4

[0140] In response to monitoring problems in industrial production, we conducted experiments using the real-time anomaly detection method and system based on the Rete algorithm provided by the present invention.

[0141] In the site exploration of the petrochemical industry, it is necessary to detect abnormalities in drilling overflows by measuring some data such as well depth, inlet and outlet flow, total hydrocarbon content, drilling fluid volume, working conditions, etc. to discover potential or ongoing abnormalities.

[0142] According to the specified rule set R, a Rete network is constructed, including an α network and a β network. The α network and the β network are respectively scheduled to different instances for processing.

[0143] During the experiment, a large amount of real-time data is input, including indicator data such as well depth, flow rate, content, liquid volume, etc., and corresponding business rules are defined.

[0144] Through the method of the present invention, the rules are matched and executed in real time to obtain the results of drilling overflow anomaly detection, such as whether an abnormality is found and the specific cause of the anomaly, and to obtain the results of complex detection and control, such as anomaly detection.

[0145] Through the above examples, we have proved the technical advantages and practical application effects of the present invention. Through the application of the real-time abnormal monitoring method and system based on the Rete algorithm, efficient detection and control can be achieved in industrial production, the detection efficiency can be improved, and it can adapt to the situation of massive data and complex business rules, meeting the high real-time requirements in industrial scenarios.

[0146] Example 5

[0147] This embodiment also provides a real-time detection system for gas field business anomalies based on the Rete algorithm, the system comprising:

[0148] A data acquisition module is used to obtain real-time data during the drilling process;

[0149] A rule set module, used to define a rule set according to the rules in the drilling process;

[0150] Network building module, used to build Rete network;

[0151] Data input module, used for real-time data input;

[0152] Rete network module, used to match and execute rules based on input real-time data and output detection results;

[0153] The data output module is used to generate and output the detection results based on the judgment results.

[0154] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A real-time detection method for gas field business anomalies based on Rete algorithm, characterized in that: The method comprises: Acquire real-time data during the drilling process and input it into a pre-built Rete network. The Rete network performs constraint judgment on the real-time data, generates and outputs detection results based on the judgment results; wherein the Rete network also includes a Redis cache; The steps of building the Rete network include: Define a set of rules based on the rules in the drilling process; Build an alpha network, including: One or more corresponding α nodes Ai are created according to one or more conditions in the rule set, expressed as Ai={Ci, Fi}, where Ci represents a condition and Fi represents a filter function, which is used to determine whether the input real-time data meets the condition Ci; directed edges are established between the α nodes according to the logical relationship between the conditions in the rule set; the α network is used to quickly filter the input real-time data according to one or more α nodes; Build a beta network, including: One or more corresponding β nodes Bk are created according to one or more condition combinations in the rule set, expressed as Bk={Ck, Mk}, where Ck represents the condition combination, and Mk represents the matching function, which is used to determine whether the input fact satisfies the condition combination Ck; directed edges are established between the β nodes according to the logical relationship between the conditions in the rule set; the β network is used to determine the relationship between the real-time data and multiple conditions according to one or more β nodes; Constraint judgment and execution are performed based on the input real-time data, including: Step 1: Select the corresponding α node according to the scheduling strategy to perform constraint judgment on the input real-time data; Step 2: Mark the matching real-time data as AM and store it in the Redis cache; Step 3: Repeat steps 1 and 2 until there is no real-time data; Step 4: Select the corresponding β node according to the scheduling strategy, associate the AM of the previous node with the newly input AM, and make a constraint judgment; Step 5: If the constraint judgment passes, determine whether the β node is a termination node. If so, the process ends and the detection result is obtained; if not, the two AMs are merged into PM, stored in the Redis cache, and passed to the next node; Step 6: Select another corresponding β node according to the scheduling strategy, associate the PM of the previous node with the newly input AM, and make a constraint judgment; Step 7: If the constraint judgment passes, determine whether the other β node is a termination node. If so, the process ends and the detection result is obtained; if not, the PM and the newly input AM are merged into a new PM, stored in the Redis cache, and passed to the next node; Step 8: Repeat steps 6 and 7 until the network is completed and the final detection result is obtained.

2. According to claim 1, a real-time detection method for gas field business anomalies based on Rete algorithm is characterized in that: The α network and the β network communicate with each other via AM and a queue to be processed.

3. According to claim 1, a real-time detection method for gas field business anomalies based on Rete algorithm is characterized in that: The scheduling strategy is: Detect the waiting queues of all α / β networks and dispatch real-time data to the α / β network with the smallest waiting queue and the corresponding α / β node; If the queue to be processed reaches the maximum value, a new α / β network is started to dispatch the real-time data to the network and the corresponding nodes.

4. According to claim 3, a real-time detection method for gas field business anomalies based on Rete algorithm is characterized in that: The data to be processed is stored in the Redis cache.

5. According to claim 1, a real-time detection method for gas field business anomalies based on Rete algorithm is characterized in that: When the real-time data and its corresponding detection results are stored in the Redis cache, the real-time data becomes AM.

6. A real-time detection system for gas field business anomalies based on Rete algorithm, characterized in that: The system comprises: A data acquisition module is used to obtain real-time data during the drilling process; A rule set module, used to define a rule set according to the rules in the drilling process; Network building module, used to build Rete network; Data input module, used for real-time data input; Rete network module, used to match and execute rules based on input real-time data and output detection results; A data output module is used to generate and output the detection results according to the judgment results; The Rete network also includes a Redis cache, and the network construction module is specifically used for: Define a set of rules based on the rules in the drilling process; Build an alpha network, including: One or more corresponding α nodes Ai are created according to one or more conditions in the rule set, expressed as Ai={Ci, Fi}, where Ci represents a condition and Fi represents a filter function, which is used to determine whether the input real-time data meets the condition Ci; directed edges are established between the α nodes according to the logical relationship between the conditions in the rule set; the α network is used to quickly filter the input real-time data according to one or more α nodes; Build a beta network, including: One or more corresponding β nodes Bk are created according to one or more condition combinations in the rule set, expressed as Bk={Ck, Mk}, where Ck represents the condition combination, and Mk represents the matching function, which is used to determine whether the input fact satisfies the condition combination Ck; directed edges are established between the β nodes according to the logical relationship between the conditions in the rule set; the β network is used to determine the relationship between the real-time data and multiple conditions according to one or more β nodes; The Rete network module performs constraint judgment and execution based on the input real-time data, specifically for: Step 1: Select the corresponding α node according to the scheduling strategy to perform constraint judgment on the input real-time data; Step 2: Mark the matching real-time data as AM and store it in the Redis cache; Step 3: Repeat steps 1 and 2 until there is no real-time data; Step 4: Select the corresponding β node according to the scheduling strategy, associate the AM of the previous node with the newly input AM, and make a constraint judgment; Step 5: If the constraint judgment passes, determine whether the β node is a termination node. If so, the process ends and the detection result is obtained; if not, the two AMs are merged into PM, stored in the Redis cache, and passed to the next node; Step 6: Select another corresponding β node according to the scheduling strategy, associate the PM of the previous node with the newly input AM, and make a constraint judgment; Step 7: If the constraint judgment passes, determine whether the other β node is a termination node. If so, the process ends and the detection result is obtained; if not, the PM and the newly input AM are merged into a new PM, stored in the Redis cache, and passed to the next node; Step 8: Repeat steps 6 and 7 until the network is completed and the final detection result is obtained.

Citation Information

Patent Citations

  • Rule-based filtering and alerting

    CA2517861A1

  • Rule engine optimizing method based on restraining frequency

    CN107247588A

  • Drilling acceleration influence factor analysis model based on big data

    CN111435344A