A rule engine-based power system fault waveform batch processing analysis method and system, and a storage medium
Patent Information
- Application Number
- CN202611128108.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-28
- Publication Date
- 2026-10-30
AI Technical Summary
[0007]本发明的目的在于克服现有技术中的不足,提供一种基于规则引擎的电力系统故障波形批处理分析方法及系统、存储介质,可有效解决大模型在电力故障分析中存在的逻辑幻觉与交互延迟问题,适用于保护动作行为评估、故障录波智能分析等场景,显著提升电力系统故障诊断的可靠性与处理效率
本发明通过规则引擎固化业务逻辑,消除了大语言模型(LLM)在工具调用过程中的幻觉风险,确保分析流程的严谨性;将多次LLM工具调用合并为一次批处理调用,避免了多次LLM推理的开销;结合并发调度,显著降低了整体分析时间;新增分析功能仅需新增JSON规则模板,无需修改代码逻辑,降低了系统维护成本,有助于提升电力系统保护运维的智能化水平。
Smart Images

Figure CN123012409A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a method and system for batch processing and analyzing power system fault waveforms based on a rule engine, as well as a storage medium, belonging to the field of power system automation technology. Background Technology
[0002] With the maturation of Large Language Model (LLM) technology, its application in power system fault analysis is becoming increasingly widespread. Existing orchestration platforms based on LLM typically rely on LLM to autonomously determine the order of tool calls and parameter passing.
[0003] However, existing technologies suffer from the following technical bottlenecks: (1) Unreliable logic (illusion problem): LLM is prone to logical confusion in long chain reasoning, which may lead to omission of key analysis steps, incorrect call order, or even input of parameters that do not conform to physical constraints, resulting in analysis failure.
[0004] (2) High latency in interaction: For complex protection logic (such as bus differential), it is necessary to call the underlying tools multiple times. If the loop mode of "LLM thinking - calling tools - LLM thinking again" is adopted, the multiple round-trip communication results in excessively high overall analysis latency, which cannot meet the real-time requirements of power operation and maintenance.
[0005] (3) Lack of branch control: Existing technologies usually delegate logical branches (such as Switch-Case) to LLM for judgment. This not only consumes a lot of tokens, but the judgment result of LLM is greatly affected by prompt engineering and lacks certainty.
[0006] Therefore, there is an urgent need for a technical solution that can standardize complex analysis processes, determine the execution process, and efficiently collaborate with LLM. Summary of the Invention
[0007] The purpose of this invention is to overcome the shortcomings of the prior art and provide a method and system for batch processing analysis of power system fault waveforms based on a rule engine, as well as a storage medium. This method can effectively solve the problems of logical illusion and interaction delay in power fault analysis of large models. It is applicable to scenarios such as protection action behavior evaluation and intelligent analysis of fault recording waveforms, and significantly improves the reliability and processing efficiency of power system fault diagnosis.
[0008] To achieve the above objectives, the present invention is implemented using the following technical solution: In a first aspect, the present invention provides a method for batch processing and analysis of power system fault waveforms based on a rule engine, comprising: Obtain the batch processing call request of the large language model, wherein the batch processing call request includes the target rule identifier and user input parameters; The calculation steps are obtained by loading the protection rule base according to the target rule identifier; Dependency analysis is performed on each computation step, and topological sorting and concurrent scheduling are performed based on the dependencies to obtain concurrent topology computation steps; The concurrent topology execution steps are executed, and during the execution process, the step parameters are parsed using bisyntactic interpolation in conjunction with the user input parameters to obtain the execution results of each step; The results of each step are combined into structured data and then returned to the large language model.
[0009] Furthermore, the protection rule base includes a switch branch structure.
[0010] Furthermore, the step of loading the protection rule base according to the target rule identifier to obtain the corresponding calculation step includes: When the rules are loaded, the Switch branch structure is statically expanded to obtain multiple calculation steps with preconditions; The corresponding calculation step is obtained by calling from multiple calculation steps with preconditions based on the target rule identifier.
[0011] Furthermore, the static expansion of the Switch branch structure yields multiple calculation steps with preconditions, including: Read the condition variables and branch options of the Switch node in the Switch branch structure; Iterate through each Switch node, convert its branch options into independent computation steps, and remove the Switch node after setting the entry condition of the branch as a prerequisite attribute for the independent computation step. Repeat this process until all Switch nodes have been traversed, resulting in multiple computation steps with prerequisites.
[0012] Furthermore, the step of performing dependency analysis on each computation step and then performing topological sorting and concurrent scheduling based on the dependencies to obtain concurrent topology computation steps includes: Construct a directed acyclic graph based on the dependencies between each computational step; Topological sorting is performed on the directed acyclic graph to ensure that the computation steps that are depended upon are executed before the computation steps that depend on them, thus obtaining concurrent topological computation steps.
[0013] Furthermore, topological sorting also includes placing computational steps that are independent of each other into the same concurrent task group to achieve parallel dispatch execution.
[0014] Furthermore, the topology sorting employs a depth-first search algorithm.
[0015] Furthermore, the dual-syntax interpolation parsing includes a first syntax parsing and a second syntax parsing, wherein, The first syntax parsing includes: identifying the first syntax format in the parameter string and dynamically replacing it with the corresponding user input parameter; The second syntax parsing includes: identifying the second syntax format in the parameter string and dynamically replacing it with the execution result of the corresponding prior computation step in the topological sorting.
[0016] In a second aspect, the present invention also provides a power system fault waveform batch processing analysis apparatus based on a rule engine, used to implement the power system fault waveform batch processing analysis method based on a rule engine as described in any of the first aspects, comprising: The batch processing call request acquisition module is configured to acquire batch processing call requests for a large language model, wherein the batch processing call request includes a target rule identifier and user input parameters; The calculation step loading module is configured to load the protection rule base to obtain the calculation steps based on the target rule identifier; The concurrent topology sorting module is configured to perform dependency analysis on each computation step, and perform topology sorting and concurrent scheduling based on the dependencies to obtain concurrent topology computation steps; The parameter parsing and execution module is configured to execute concurrent topology execution steps, and during the execution process, performs double syntax interpolation parsing on the step parameters to obtain the execution results of each step; The execution result feedback module is configured to combine the execution results of each step into structured data and return it to the large language model.
[0017] Thirdly, the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the rule engine-based power system fault waveform batch processing analysis method as described in any one of the first aspects.
[0018] Compared with the prior art, the beneficial effects achieved by the present invention are as follows: This invention solidifies business logic through a rule engine, eliminating the illusionary risk of Large Language Models (LLM) during tool invocation and ensuring the rigor of the analysis process. It merges multiple LLM tool invocations into a single batch invocation, avoiding the overhead of multiple LLM inferences. Combined with concurrent scheduling, it significantly reduces the overall analysis time. Adding new analysis functions only requires adding JSON rule templates without modifying the code logic, reducing system maintenance costs and helping to improve the intelligence level of power system protection and operation. Attached Figure Description
[0019] Figure 1 This is a flowchart illustrating a rule-based power system fault waveform batch processing analysis method in one embodiment of the present invention. Detailed Implementation
[0020] The present invention will be further described below with reference to the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and should not be used to limit the scope of protection of the present invention. Example 1
[0021] like Figure 1 As shown in the figure, this embodiment of the invention provides a batch processing analysis method for power system fault waveforms based on a rule engine, specifically including the following steps: Accept batch processing call requests from the Large Language Model (LLM), which include the target rule identifier and user input parameters.
[0022] Build a protection rule base, which contains a Switch branch structure, and the Switch branch structure contains multiple Switch nodes.
[0023] The calculation steps are obtained by loading the protection rule base based on the target rule identifier. During rule loading, the Switch branch structure is statically expanded, specifically: Read the condition variables and branch options of the Switch node in the Switch branch structure.
[0024] Iterate through each Switch node, convert its branch options into independent computation steps, and remove the Switch node after setting the entry condition of the branch as a prerequisite attribute for the independent computation step. Repeat this process until all Switch nodes have been traversed, resulting in multiple computation steps with prerequisites.
[0025] Dependency analysis is performed on each computation step. A directed acyclic graph is constructed based on the depends_on dependencies between the computation steps, and topological sorting is performed. In this embodiment, the topological sorting uses a depth-first search algorithm to ensure that the dependent steps are executed before the steps that depend on them. In some embodiments, steps without data dependencies are identified and concurrently scheduled. The identified steps without dependencies are placed in the same concurrent task group for parallel dispatch and execution, ultimately resulting in concurrent topological computation steps.
[0026] The concurrent topology execution steps are executed, and during execution, user input parameters are incorporated into the step parameters for dual-syntax interpolation parsing. Dual-syntax interpolation parsing includes first-syntax parsing and second-syntax parsing. First-syntax parsing involves identifying the first syntax format in the parameter string and dynamically replacing it with the corresponding user input parameters. Second-syntax parsing involves identifying the second syntax format in the parameter string, retrieving the values of specified fields from the result cache of already executed steps based on step dependencies, and injecting these values into the input parameters of the current step.
[0027] The following section provides a further description based on a batch analysis of fault recordings from a specific 220kV substation bus differential protection system.
[0028] Step 1: Construct a rule base for the analysis rules of 220kV bus differential protection. The rule base includes a switch branch structure, as detailed below: Bus quantity adaptation: The condition variable is whether the waveform recording includes the III bus channel, corresponding to two branch options: if the III bus is included, the full calculation of all three bus segments is performed; if the III bus is not included, only the calculation of the I and II buses is performed.
[0029] Differential protection validity judgment: The condition variable is whether there is a valid differential switch channel, corresponding to three branch options: if there is a valid differential bit, judge according to the switch quantity; if not, judge according to the protection activation control word; if neither exists, judge according to the combination of pressure plate + control word.
[0030] Step 2: Obtain the batch processing call request for the large language model. The target rule identifier specifies the call to the 220kV bus differential protection analysis rule. The user input parameters are: List of paths to 100 fault waveform files to be analyzed; Voltage blocking fixed thresholds: phase voltage 40V, zero-sequence voltage 6V, negative-sequence voltage 4V; Default value for differential starting current: 0.1A; Threshold for determining saturation outside the zone: 3ms.
[0031] Step 3: Load the protection rule base according to the target rule identifier to obtain the calculation steps. Read the condition variables and all branch options of the Switch node; Each branch option is converted into an independent computation step, and the entry condition for that branch is appended as a prerequisite to the step, for example: Step A: The prerequisite is the existence of a valid differential switching channel. The execution logic is to determine the validity of the differential based on the status of the switching signal. Step B: The prerequisite is that there is no effective differential switching channel and there is a differential protection activation control word. The execution logic is to determine the validity of the differential protection based on the control word. Step C: The prerequisite is that neither of the first two conditions exists. The execution logic is to determine the validity based on the combination of soft pressure plate + control word + hard pressure plate.
[0032] Then, the corresponding Switch node is removed from the rule base until all Switch nodes have been traversed, resulting in multiple calculation steps with preconditions. These calculation steps with preconditions are then registered in the rule registry.
[0033] Step 4: Perform dependency analysis on each calculation step, as follows: Bus voltage channel analysis, differential current channel analysis, setpoint reading, and switch quantity analysis: No prerequisites required; Calculation of RMS voltage / sequence component: dependent on bus voltage path analysis; Calculation of differential current effective value: depends on differential current channel analysis; Differential validity determination: relies on switch quantity analysis and setpoint reading; Voltage blocking / opening judgment: depends on the effective value of voltage / sequence component calculation; Differential flow action criteria: depends on differential flow effective value calculation and fixed value reading; CT saturation analysis outside the region: voltage-dependent timing point extraction and differential current timing point extraction; Comprehensive action determination: relies on differential effectiveness judgment, voltage lockout opening judgment, differential current action criterion, and external CT saturation analysis; Dead zone fault diagnosis: relies on switch quantity analysis and bus tie current calculation; Final result generation: depends on comprehensive action judgment and dead zone fault diagnosis.
[0034] Based on the above dependencies, a directed acyclic graph (DAG) is constructed. A depth-first search algorithm is used to perform topological sorting to ensure that the computation steps that are depended upon are executed before the computation steps that depend on them, thus obtaining concurrent topological computation steps.
[0035] Step 5: Execute the concurrent topology execution steps, and during the execution process, combine the user input parameters to perform bi-syntax interpolation parsing to obtain the execution results of each step.
[0036] Taking a typical waveform recording within the batch (phase A ground fault of bus I) as an example, the core results after execution are as follows: effective value of phase A voltage of bus I is 12.3V, differential phase A current is 2.6A, differential start setting is 0.5A, voltage blocking is open, differential current condition is met, voltage and differential current change time difference is 1ms (less than 3ms), saturation outside the zone is excluded, and it is finally determined that the differential protection of phase A of bus I should operate correctly.
[0037] Step Six: After assembling the results of all fault recording steps into structured data, return it to the large language model. Example 2
[0038] This embodiment also provides a rule engine-based power system fault waveform batch processing and analysis device for implementing the rule engine-based power system fault waveform batch processing and analysis method as described in Embodiment 1, which includes: The batch processing call request acquisition module is configured to acquire batch processing call requests for a large language model. The batch processing call request includes the target rule identifier and user input parameters. The calculation step loading module is configured to load the protection rule base to obtain the calculation steps based on the target rule identifier; The concurrent topology sorting module is configured to perform dependency analysis on each computation step, and perform topology sorting and concurrent scheduling based on the dependencies to obtain concurrent topology computation steps; The parameter parsing and execution module is configured to execute concurrent topology execution steps, and during the execution process, performs double syntax interpolation parsing on the step parameters to obtain the execution results of each step; The execution result feedback module is configured to combine the execution results of each step into structured data and return it to the large language model. Example 3
[0039] This embodiment also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the rule engine-based power system fault waveform batch processing analysis method as described in Embodiment 1.
[0040] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A batch processing analysis method for power system fault waveforms based on a rule engine, characterized in that, include: Obtain the batch processing call request of the large language model, wherein the batch processing call request includes the target rule identifier and user input parameters; The calculation steps are obtained by loading the protection rule base according to the target rule identifier; Dependency analysis is performed on each computation step, and topological sorting and concurrent scheduling are performed based on the dependencies to obtain concurrent topology computation steps; The concurrent topology execution steps are executed, and during the execution process, the step parameters are parsed using bisyntactic interpolation in combination with user input parameters to obtain the execution results of each step; The results of each step are combined into structured data and then returned to the large language model.
2. The method for batch processing and analysis of power system fault waveforms based on a rule engine according to claim 1, characterized in that, The protection rule base includes a Switch branch structure.
3. The method for batch processing and analysis of power system fault waveforms based on a rule engine according to claim 2, characterized in that, The step of loading the protection rule base according to the target rule identifier to obtain the corresponding calculation step includes: When the rules are loaded, the Switch branch structure is statically expanded to obtain multiple calculation steps with preconditions; The corresponding calculation step is obtained by calling from multiple calculation steps with preconditions based on the target rule identifier.
4. The power system fault waveform batch processing analysis method based on a rule engine according to claim 3, characterized in that, The static expansion of the Switch branch structure yields multiple calculation steps with preconditions, including: Read the condition variables and branch options of the Switch node in the Switch branch structure; Iterate through each Switch node, convert its branch options into independent computation steps, and remove the Switch node after setting the entry condition of the branch as a prerequisite attribute for the independent computation step. Repeat this process until all Switch nodes have been traversed, resulting in multiple computation steps with prerequisites.
5. The method for batch processing and analysis of power system fault waveforms based on a rule engine according to claim 1, characterized in that, The process of performing dependency analysis on each computation step and then performing topological sorting and concurrent scheduling based on the dependencies to obtain concurrent topology computation steps includes: Construct a directed acyclic graph based on the dependencies between each computational step; Topological sorting is performed on the directed acyclic graph to ensure that the computation steps that are depended upon are executed before the computation steps that depend on them, thus obtaining concurrent topological computation steps.
6. The method for batch processing and analysis of power system fault waveforms based on a rule engine according to claim 5, characterized in that, Topological sorting also includes placing computational steps that are independent of each other into the same concurrent task group to achieve parallel dispatch execution.
7. The method for batch processing and analysis of power system fault waveforms based on a rule engine according to claim 5, characterized in that, The topology sorting uses a depth-first search algorithm.
8. The method for batch processing and analysis of power system fault waveforms based on a rule engine according to claim 1, characterized in that, The bisyntactic interpolation parsing includes a first syntactic parsing and a second syntactic parsing, wherein, The first syntax parsing includes: identifying the first syntax format in the parameter string and dynamically replacing it with the corresponding user input parameter; The second syntax parsing includes: identifying the second syntax format in the parameter string and dynamically replacing it with the execution result of the corresponding prior computation step in the topological sorting.
9. A power system fault waveform batch processing and analysis device based on a rule engine, characterized in that, A method for implementing the rule engine-based power system fault waveform batch processing analysis method as described in any one of claims 1 to 8, comprising: The batch processing call request acquisition module is configured to acquire batch processing call requests for a large language model, wherein the batch processing call request includes a target rule identifier and user input parameters; The calculation step loading module is configured to load the protection rule base to obtain the calculation steps based on the target rule identifier; The concurrent topology sorting module is configured to perform dependency analysis on each computation step, and perform topology sorting and concurrent scheduling based on the dependencies to obtain concurrent topology computation steps; The parameter parsing and execution module is configured to execute concurrent topology execution steps, and during the execution process, performs double syntax interpolation parsing on the step parameters to obtain the execution results of each step; The execution result feedback module is configured to combine the execution results of each step into structured data and return it to the large language model.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the rule engine-based power system fault waveform batch processing analysis method as described in any one of claims 1 to 8.
