A substation programmed operation ticket execution logic sequence test method
By constructing a knowledge graph of substation operations and using a hybrid strategy to generate test paths, the problems of insufficient test coverage and low efficiency in existing technologies are solved, realizing fully automated testing of substation programmed operation tickets and ensuring the integrity and systematic nature of the tests.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- STATE GRID HUBEI ELECTRIC POWER RES INST
- Filing Date
- 2026-03-30
- Publication Date
- 2026-06-09
AI Technical Summary
In existing technologies, manually designed test cases are difficult to fully cover the complex state space of substation programmed operation tickets. They lack a systematic path generation mechanism and cannot effectively construct abnormal test scenarios, resulting in insufficient test coverage and low efficiency.
By parsing the substation configuration file, the five-prevention logic configuration file, and the operating procedures, a substation operation knowledge graph is constructed. A hybrid strategy is used to generate test paths, and test sequences are automatically generated by combining forward search algorithms and backward reasoning algorithms. The test cases are then optimized through a set coverage algorithm and transformed into executable scripts that are automatically executed on the simulation platform.
It has achieved fully automated testing of substation programmed operation tickets, improved test coverage and efficiency, ensured the integrity and systematic nature of the five-prevention interlocking logic, and reduced repetitive manual analysis work.
Smart Images

Figure CN122173405A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of power system automation technology, specifically to a method for testing the logic sequence of substation programmed operation ticket execution. Background Technology
[0002] With the rapid development of smart substation technology, programmed operation (one-click sequential control) has been widely used in substations. Programmed operation tickets automatically complete equipment switching operations through pre-programmed control command sequences, which can effectively improve operational efficiency and reduce human error. However, if the programmed operation ticket is incorrectly programmed or has logical defects, it may lead to equipment malfunction, failure to operate, or even serious power grid safety accidents. Therefore, before being put into practical application, its execution logic sequence must be fully tested and verified. Existing testing methods mainly rely on testers to manually analyze the operation ticket steps, manually design test cases, and execute and verify them one by one in a simulation environment, based on documents such as substation configuration files, five-prevention logic rules, and operating procedures.
[0003] The main drawbacks of existing technologies are: manual test case design makes it difficult to achieve comprehensive coverage of complex state spaces. When the substation topology is complex and the number of devices is large, the combinations of device states increase exponentially. Test cases designed by testers based on experience often only cover common operation paths and typical scenarios, and are prone to overlooking boundary conditions, abnormal state transitions, and hidden logical conflicts under the interaction of multiple safety rules, resulting in insufficient test coverage. In addition, manual testing methods lack a systematic path generation mechanism, and cannot automatically infer all possible legal operation sequences from the initial state to the target state, nor can they reverse-engineer abnormal scenarios that violate safety rules to verify the effectiveness of the five-prevention interlocking logic. When the substation configuration or operation rules change, a lot of manual analysis and test case design work needs to be carried out again, resulting in low testing efficiency. This test mode that relies on manual experience cannot guarantee the integrity and systematicness of the test, and has become a key bottleneck restricting the reliable application of programmed operation tickets. Summary of the Invention
[0004] The purpose of this invention is to address the problems in existing technologies, such as the difficulty in achieving comprehensive coverage of complex state spaces through manually designed test cases, the lack of a systematic path generation mechanism, and the inability to effectively construct abnormal test scenarios. Therefore, this invention proposes a test method for the execution logic sequence of programmed operation tickets in substations.
[0005] The technical solution of the present invention to solve the above-mentioned technical problems is as follows:
[0006] A method for testing the execution logic sequence of a substation programmed operation ticket includes the following steps:
[0007] S1: By parsing the substation configuration description file, the five-prevention logic configuration file and the operation procedure, extract the equipment class, status class, operation class and rule class entity nodes, as well as the topology connection, electrical association, state, precondition, interlock and subsequent operation relationship edges, and construct the substation operation knowledge graph;
[0008] S2: Employing a hybrid strategy, test paths are generated based on the substation operation knowledge graph constructed in S1, including: a forward search algorithm based on state space transitions, which initializes the initial state... Add to the search queue, iteratively query the knowledge graph for legal operations that meet the preconditions, and infer the subsequent state. And record the operation sequence path until the target state is reached. A rule-triggered reverse reasoning algorithm traverses dangerous operations marked by the `lockedBy` relation in the knowledge graph, reverse-analyzes the reasons for locking, and constructs an abnormal initial state that violates security conditions. Generate abnormal test sequences;
[0009] S3: Optimize all test paths generated in S2 using a set coverage algorithm, select the smallest subset to cover all key device states and operation types, convert the optimized test cases into executable scripts, automatically execute them on the simulation platform, and compare the device status signals with the expected results.
[0010] Based on the above technical solution, the present invention can be further improved as follows.
[0011] Furthermore, in S1, the equipment entity nodes include circuit breakers, disconnect switches, grounding switches, busbars, and lines; the status entity nodes include macroscopic states such as operating status, hot standby status, and maintenance status, as well as microscopic states such as closed and open positions; the operation entity nodes include closing operations, opening operations, activation operations, and deactivation operations; the rule entity nodes include five-prevention rules such as rules to prevent closing grounding switches under energized conditions and rules to prevent accidental opening and closing of circuit breakers; and the knowledge graph formed by storing data in the graph database Neo4j or Nebula Graph enables structured storage and efficient querying of nodes and relationships.
[0012] Furthermore, the forward search algorithm in S2 specifically includes:
[0013] Initialize the search queue and the initial state with empty path As a binary pair Add to queue;
[0014] Circular from queue Retrieve the current state and its path Search the knowledge graph for conditions that meet the criteria. All legal operations ;
[0015] For each legal operation Through the state transition function Calculate the subsequent states, where Indicates operation State The effects;
[0016] Record extended path ;
[0017] when At that time, the path Save as a valid test case;
[0018] Otherwise Add to queue Continue the search.
[0019] Furthermore, the reverse reasoning algorithm in S2 specifically includes:
[0020] Traverse the knowledge graph to obtain the set of all dangerous operations with the lockedBy relationship. ;
[0021] For each hazardous operation Extract its set of locked security conditions. ,in Representing a knowledge graph;
[0022] Constructing an abnormal initial state ,in This is the normal initial state. For safety conditions, This is a violation of the conditions;
[0023] Generate test sequences The expected result is that the operation is blocked and an alarm is triggered.
[0024] Furthermore, the set covering algorithm in S3 is optimized by constructing a covering matrix M, where the matrix elements... Indicates the first The test cases cover the first... One test target, This indicates no coverage; the optimization objective function is defined as follows: The constraints are ,in Indicate whether to select the first There are 10 test cases; a greedy algorithm is used to solve them, and each time the test case that covers the most uncovered targets is selected until all test targets are covered.
[0025] Furthermore, the topological connections of the substation operation knowledge graph are represented by an adjacency matrix. For n device nodes, an n×n matrix A is constructed, where... Indicates equipment With equipment There is a physical connection. It indicates no connection; electrical relationships are represented by a hierarchical structure tree, with the root node being the substation, intermediate nodes being voltage levels and bays, and leaf nodes being specific equipment; the topology is traversed using depth-first search or breadth-first search algorithms to identify electrical loops and power flow paths.
[0026] Furthermore, the state transition function It employs a rule-based reasoning mechanism, including: defining a set of rules governing the impact of operations. Each rule is in the form of , indicating the previous state Execute the following operation After transitioning to the post-position state For compound operations, sequential combination operators are used. Introduce a state consistency check function. Verification status Whether physical and logical constraints are satisfied, ensuring that the generated state sequence is reachable in the actual system.
[0027] Furthermore, it includes a test case prioritization step: calculating test case weights based on operational risk level, equipment importance, and historical failure frequency. ;
[0028] in These are the weighting coefficients. To assign a risk level score, Rate the importance of the equipment. Historical failure frequency;
[0029] Test cases are sorted in descending order of weight, with high-weight test cases executed first, to implement a risk-oriented testing strategy.
[0030] Furthermore, the executable script in S3 is generated using a state machine-based description language, including: defining a state transition script template, containing an initialization segment, an operation execution segment, and a verification segment; mapping each operation in the test path to a sequence of control instructions, including device selection instructions, operation type instructions, and parameter configuration instructions; inserting a verification point after each operation, and checking whether the device status signal is consistent with expectations through assertion statements; the generated script supports the GOOSE and MMS communication protocols of the IEC 61850 standard, realizing standardized interface docking with the simulation platform.
[0031] Furthermore, it includes an incremental knowledge graph update mechanism: monitoring changes to substation configuration files and operating procedures, identifying newly added, modified, and deleted entities and relationships through differential algorithms; and using a graph edit distance algorithm to calculate the difference between the knowledge graph before and after the update. ,in These represent the sets of deletion, insertion, and replacement operations, respectively. When the difference exceeds the threshold, an incremental update of the test cases is triggered, regenerating only the test cases for the affected paths while maintaining the validity of unaffected test cases, thus achieving efficient utilization of test resources.
[0032] Compared with the prior art, the technical solution of this application has the following beneficial technical effects:
[0033] This invention constructs a substation operation knowledge graph by parsing multiple types of documents and extracting entity nodes and relational edges. This transforms fragmented equipment information and logical rules into a structured knowledge system, avoiding information omissions and misunderstandings caused by manual document interpretation, and providing complete support for subsequent automated testing. Secondly, a hybrid strategy addresses the problems of incomplete test case coverage and single scenario: the forward search algorithm can automatically traverse all legal operation sequences from the initial state to the target state, covering complex state combinations and boundary conditions that are difficult for humans to handle; the reverse reasoning algorithm analyzes the locking reasons of dangerous operations, constructs abnormal initial states, verifies the five-prevention locking logic, and investigates hidden conflicts, making up for the deficiency of the inability of humans to systematically generate abnormal scenarios. Finally, a set coverage algorithm is used to select the minimum test subset to ensure coverage of key states and operations and reduce redundancy. The test cases are transformed into executable scripts for automatic comparison of results, improving efficiency. When the substation configuration or rules change, only the knowledge graph needs to be updated to quickly regenerate test cases, eliminating the need for repeated manual analysis and reducing costs. Attached Figure Description
[0034] Figure 1 This is a flowchart of a method for testing the execution logic sequence of a substation programmed operation ticket according to the present invention;
[0035] Figure 2 This is a flowchart illustrating the knowledge graph construction and forward search process of this invention.
[0036] Figure 3 This is a flowchart illustrating the reverse reasoning and anomaly testing generation process of this invention.
[0037] Figure 4 This is a flowchart illustrating the test case optimization and execution process of this invention. Detailed Implementation
[0038] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0039] like Figure 1 As shown, the present invention provides a method for testing the execution logic sequence of a substation programmed operation ticket, comprising the following steps:
[0040] S1: By parsing the substation configuration description file, the five-prevention logic configuration file and the operation procedure, extract the equipment class, status class, operation class and rule class entity nodes, as well as the topology connection, electrical association, state, precondition, interlock and subsequent operation relationship edges, and construct the substation operation knowledge graph;
[0041] S2: Employing a hybrid strategy, test paths are generated based on the substation operation knowledge graph constructed in S1, including: a forward search algorithm based on state space transitions, which initializes the initial state... Add to the search queue, iteratively query the knowledge graph for legal operations that meet the preconditions, and infer the subsequent state. And record the operation sequence path until the target state is reached. A rule-triggered reverse reasoning algorithm traverses dangerous operations marked by the `lockedBy` relation in the knowledge graph, reverse-analyzes the reasons for locking, and constructs an abnormal initial state that violates security conditions. Generate abnormal test sequences;
[0042] S3: Optimize all test paths generated in S2 using a set coverage algorithm, select the smallest subset to cover all key device states and operation types, convert the optimized test cases into executable scripts, automatically execute them on the simulation platform, and compare the device status signals with the expected results.
[0043] This invention provides a method for testing the execution logic sequence of programmed operation tickets in substations, transforming the test case generation process into the construction, traversal, and reasoning process of a knowledge graph, thereby realizing a paradigm shift from manual enumeration to machine reasoning.
[0044] First, a customized parser reads substation configuration description files (e.g., CIM / XML format), five-prevention logic configuration files (e.g., SCL format), and field operation procedures (e.g., PDF or text format) to extract structured information such as equipment topology, electrical parameters, and operating rules. After parsing, the extracted information is mapped to nodes and edges of a knowledge graph according to a predefined ontology model. Nodes include equipment entities, state entities, operation entities, and rule entities, while edges include topology connections, electrical associations, states, preconditions, interlocking relationships, and subsequent operation relationships. The completed knowledge graph is then efficiently traversed and pattern matched using Cypher or Gremlin query languages.
[0045] The forward search algorithm starts from a given initial device state. Starting with (e.g., all circuit breakers and disconnectors in operation), the state and empty path are stored in a queue. In each iteration, the current state is retrieved from the queue, and a Cypher query is used in the knowledge graph to find all operations whose preconditions are satisfied by the current state. For each valid operation, a state transition function is applied to calculate the new state, and the expanded path is recorded. When the new state matches the target state... (For example, when a line is switched to maintenance status), the path is saved. The reverse reasoning algorithm obtains all dangerous operations and their locking conditions by querying the graph MATCH (o:Operation)-[:lockedBy]->(c:Condition), constructs an abnormal state that violates its safety conditions for each dangerous operation, and generates a test sequence that is expected to be locked.
[0046] All generated test paths are modeled as a set of test cases, and all device states and operation types that need to be covered are modeled as a set of test targets, constructing a binary coverage matrix. A greedy strategy is used to iteratively select test cases that cover the most uncovered targets until all targets are covered. The optimized test cases are converted into a state machine-based scripting language, which contains device operation instructions and status verification assertions. The scripts are automatically executed on a simulation platform that supports the IEC 61850 protocol, reading device status signals through GOOSE messages or MMS services, comparing them item by item with the expected results, and automatically determining whether the test passes or fails.
[0047] In S1, equipment entity nodes include circuit breakers, disconnectors, earthing switches, busbars, and lines; status entity nodes include macro-level states such as operating status, hot standby status, and maintenance status, as well as micro-level states such as closed and open positions; operation entity nodes include closing operations, opening operations, activation operations, and deactivation operations; rule entity nodes include five-prevention rules, such as rules to prevent closing earthing switches while energized and rules to prevent accidental opening or closing of circuit breakers. A knowledge graph, stored using the graph database Neo4j or Nebula Graph, enables structured storage and efficient querying of nodes and relationships. During the knowledge graph construction process, equipment nodes are concretized as circuit breakers, disconnectors, earthing switches, busbars, and lines, etc., each with a unique identifier and equipment attributes. Status nodes are divided into two levels: macro-level states include three operating states: operating, hot standby, and maintenance; micro-level states include two switch positions: closed and open. Operation-type nodes include four basic operations: Close, Open, Put In, and Withdraw. Rule-type nodes encapsulate five-prevention rules, such as the rule to prevent closing the grounding switch while the line is energized, defined as: IF Line is energized THEN Prohibit closing the grounding switch.
[0048] When using Neo4j graph database for storage, nodes are created using the CREATE statement, such as CREATE (b:Breaker{id:'QF101', name:'Main Transformer High Voltage Side Circuit Breaker'}). Relationships are established using the MATCH and CREATE statements, such as MATCH(b:Breaker), (bus:Busbar) WHERE b.id='QF101' AND bus.id='Bus1' CREATE (b)-[:CONNECTED_TO]->(bus). The graph database's indexing mechanism supports fast querying of all relationships for a specific device, with query efficiency reaching millisecond levels.
[0049] like Figure 2 As shown, the forward search algorithm in S2 specifically includes:
[0050] Initialize the search queue and the initial state with empty path As a binary pair Add to queue;
[0051] Circular from queue Retrieve the current state and its path Search the knowledge graph for conditions that meet the criteria. All legal operations ;
[0052] For each legal operation Through the state transition function Calculate the subsequent states, where Indicates operation State The effects;
[0053] Record extended path ;
[0054] when At that time, the path Save as a valid test case;
[0055] Otherwise Add to queue Continuing the search, in the detailed implementation of the forward search algorithm, the search queue uses a first-in-first-out (FIFO) structure to implement breadth-first search, or a priority queue to implement heuristic search. During initialization... Joining the team, among them Represented as a set of device states, such as .
[0056] When performing a loop query, the query is executed through a graph database:
[0057] MATCH (o:Operation)-[:prerequisiteFor]->(c:Condition)WHERE c IN $S_i$RETURN o, retrieves all operations that meet the preconditions. For the retrieved operations... State transition function The implementation method is: from the current state Remove old status entries that have been changed by the operation and add new status entries generated by the operation. For example, when operating on the closing circuit breaker QF101, At the same time, the state of indirect influence is deduced based on the topological relationship, such as the busbar becoming energized after the switch is closed.
[0058] Path records are in the form of operation sequences, such as When detected Status of all devices in the middle and When the defined target state is consistent, Save to the result set and continue searching for other possible paths to achieve multi-path coverage.
[0059] like Figure 3 As shown, the reverse reasoning algorithm in S2 specifically includes:
[0060] Traverse the knowledge graph to obtain the set of all dangerous operations with the lockedBy relationship. ;
[0061] For each hazardous operation Extract its set of locked security conditions. ,in Representing a knowledge graph;
[0062] Constructing an abnormal initial state ,in This is the normal initial state. For safety conditions, This is a violation of the conditions;
[0063] Generate test sequences The expected result is that the operation is blocked and an alarm is triggered.
[0064] The reverse reasoning algorithm first performs a graph traversal: MATCH (o:Operation)-[:lockedBy]->(rule:Rule)-[:requires]->(c:Condition) RETURN o, c, to obtain dangerous operations and their safety conditions. For example, it identifies that the operation of closing the grounding switch DK201 is blocked by the rule to prevent the grounding switch from being closed while energized, and the safety condition is that line 201 is de-energized.
[0065] When constructing an abnormal initial state;
[0066] From normal state Departure, delete the safety condition line 201: no voltage, add the violation condition line 201: voltage;
[0067] get In this state, attempting to close DK201 will trigger the system's interlocking logic and generate an alarm prohibiting operation: Closing the grounding switch is prohibited while the line is energized.
[0068] The generated anomaly test sequence consists of three parts: an initial state setting script, an operation execution script, and a result verification script. The verification script uses assertions to check that the operation execution state is locked and that the alarm message matches the expected text. This method can systematically cover all five prevention rules, ensuring that no locking logic is omitted.
[0069] like Figure 4 As shown, the set covering algorithm in S3 is optimized by constructing a covering matrix M, where the matrix elements... Indicates the first The test cases cover the first... One test target, This indicates no coverage; the optimization objective function is defined as follows: The constraints are ,in Indicate whether to select the first There are 10 test cases; a greedy algorithm is used to solve this problem, selecting the test case that covers the most uncovered targets each time, until all test targets are covered. In the implementation of the set coverage algorithm, it is assumed that 10 test cases are generated. Each test case needs to cover There are 20 test targets (including 20 device states and 10 operation types). A 50×30 coverage matrix is constructed. ,in Represents test cases Coverage test target The optimization objective is to select the fewest test cases, which can be formalized as an integer programming problem: minimization. Each objective is constrained to be covered by at least one selected test case, i.e. For all Established.
[0070] The specific steps of the greedy algorithm are as follows: Initialize the set of covered targets to empty, and the set of uncovered targets to contain all 30 targets. In each iteration, calculate the number of uncovered targets that each candidate test case can cover, select the test case with the most coverage and add it to the result set, then update the covered set. Repeat this process until the uncovered set is empty. Experiments show that this method can optimize 50 original test cases to 15-20, maintaining 100% coverage, and reducing test execution time by more than 60%.
[0071] The topological connections of a knowledge graph are represented by an adjacency matrix. For n device nodes, an n×n matrix A is constructed, where... Indicates equipment With equipment There is a physical connection. The topology indicates no connection; electrical relationships are represented by a hierarchical structure tree, with the root node being the substation, intermediate nodes representing voltage levels and bays, and leaf nodes representing specific equipment. The topology is traversed using depth-first search or breadth-first search algorithms to identify electrical loops and power flow paths. For a 110kV substation containing 15 primary devices, a 15×15 adjacency matrix A is constructed to represent the topology connections. For example... This indicates that Equipment 1 (the high-voltage side circuit breaker of the main transformer) and Equipment 2 (the high-voltage busbar) are physically connected. This indicates that device 1 and device 3 are not directly connected. The sparsity of the matrix reflects the local connectivity characteristics of the substation topology.
[0072] The electrical relationships are organized using a tree structure: the root node is the XX substation, the second level consists of nodes at two voltage levels, 110kV and 10kV, the third level consists of nodes for main transformer bay 1, line bay 1, etc., and the leaf nodes are specific equipment. The tree structure is stored through parent-child pointers or adjacency lists, supporting quick location of the bay and voltage level to which a specific piece of equipment belongs.
[0073] Depth-first search (DFS) starts from the bus node and recursively visits adjacent devices along the topological connections, marking visited nodes and identifying complete electrical loops. For example, starting from the bus, a closed loop is formed through circuit breakers, lines, and transformers; this loop information is used for power flow calculations and N-1 checks. Breadth-first search (BFS), on the other hand, is used to calculate the shortest electrical distance between devices, aiding in fault impact range analysis.
[0074] State transition function It employs a rule-based reasoning mechanism, including: defining a set of rules governing the impact of operations. Each rule is in the form of , indicating the previous state Execute the following operation After transitioning to the post-position state For compound operations, sequential combination operators are used. Introduce a state consistency check function. Verification status Does it satisfy physical and logical constraints, ensuring that the generated state sequence is reachable in the actual system, and what is the state transition function? Implemented based on a rule base. The rule base contains 30-50 rules affecting operations, each defined as a triple. For example, rule... : (Closing circuit breaker QF, {QF: Open, Busbar: Voltaged}, {QF: Closed, Circuit: Energized}) indicates that when the circuit breaker is in the open position and the busbar is voltaged, after the closing operation is performed, the circuit breaker switches to the closed position and the downstream circuit is energized.
[0075] For sequentially executed compound operations, such as a power supply operation sequence that includes two steps: closing the disconnect switch and closing the circuit breaker, state transitions are achieved through function composition.
[0076] Let the initial state be ;
[0077] Step 1 back;
[0078] get ;
[0079] Second step back;
[0080] get The overall effect is equivalent to .
[0081] State consistency check function Verify physical and logical constraints. Physical constraints include that the same device cannot be in both the closed and open positions simultaneously, and that when a circuit breaker is closed, at least one side must be under voltage. Logical constraints include that the grounding switch must be in the closed position during maintenance, and that the grounding switch must be in the open position during operation. (Function) State Each device state in the queue undergoes a constraint check, returning a boolean value indicating whether the state is valid. Invalid states will not be added to the search queue.
[0082] The method also includes a test case prioritization step: calculating test case weights based on operational risk level, equipment importance, and historical failure frequency. ;
[0083] in These are the weighting coefficients. To assign a risk level score, Rate the importance of the equipment. Historical failure frequency;
[0084] Test cases are sorted in descending order of weight, with higher-weight cases executed first, implementing a risk-oriented testing strategy. This test case priority ranking mechanism incorporates a risk-oriented testing strategy. (Operational risk level) Values are assigned based on operation type: operations involving main equipment (main transformer, busbar) are scored 10, operations involving lines are scored 7, and operations involving protection devices are scored 5. Equipment Importance Assigning values based on the importance of power supply load: Important users' power supply equipment is rated 10, while general users are rated 5. Historical fault frequency. The score is determined by counting the number of defect records related to this operation over the past year. More than 5 defect records result in a score of 10, 1-5 defects result in a score of 5, and no record results in a score of 0.
[0085] Weighting coefficients are adjusted according to the testing strategy, and a risk-first strategy is set.
[0086] Historical defect priority strategy settings
[0087] For test cases involving the operation of the main transformer circuit breaker, it is assumed that... The weights are calculated using a risk-first strategy. .
[0088] All test cases are sorted in descending order of weight and executed sequentially. Prioritizing higher-weight test cases allows for the early detection of high-risk defects when time is limited, improving testing efficiency. An execution plan is generated after sorting, recording the execution order, estimated execution time, and priority label for each test case.
[0089] The executable script is generated using a state machine-based description language, including: defining a state transition script template containing an initialization segment, an operation execution segment, and a verification segment; mapping each operation in the test path to a sequence of control instructions, including device selection instructions, operation type instructions, and parameter configuration instructions; inserting verification points after each operation to check whether the device status signals are consistent with expectations using assertion statements; the generated script supports the IEC 61850 standard GOOSE and MMS communication protocols, achieving standardized interface docking with the simulation platform; and the executable script is generated using a JSON-like state machine description language. The script template contains three sections: the initialization section defines the device state settings before the test begins, such as init: {QF101: open, QS101: open, Bus1: no_voltage}; the operation execution section defines the operation sequence, such as operations: [{device:QS101, action: close, delay: 2000}, {device: QF101, action: close, delay:2000}], where delay represents the operation interval in milliseconds; and the verification section defines the state assertions after each operation step, such as verifications: [{point: after_op1, expected: {QS101: close}}, {point: after_op2, expected: {QF101: close, Bus1: has_voltage}}].
[0090] Control commands are mapped to data objects in the IEC 61850 standard: Device selection is achieved through logical node references, such as XCBR1$CO$Oper$ctlVal. The operation type is specified by a control value: true indicates closing, and false indicates opening. Parameter configuration includes control mode (direct-with-normal-security) and synchronization timestamp.
[0091] The generated script is sent to the virtual IED on the simulation platform via the MMS client. After receiving the control commands, the IED simulates device actions and publishes status changes via GOOSE messages. The test execution engine subscribes to GOOSE messages, extracts the status information, compares it with the expected field of the verification section, and records detailed error information and terminates the test when an assertion fails.
[0092] The method also includes an incremental knowledge graph update mechanism: monitoring changes to substation configuration files and operating procedures, identifying newly added, modified, and deleted entities and relationships through a differential algorithm; and using a graph edit distance algorithm to calculate the difference between the knowledge graph before and after the update. ,in These represent the sets of deletion, insertion, and replacement operations, respectively. When the difference exceeds a threshold, an incremental update of the test cases is triggered, regenerating only the test cases for the affected paths while maintaining the validity of unaffected test cases, thus achieving efficient utilization of test resources. The incremental knowledge graph update mechanism monitors configuration file changes in real time through a file monitoring service. When a modification to the substation configuration file is detected, a differential algorithm compares the old and new versions of the XML structure tree to identify newly added nodes (e.g., adding a line), modified nodes (e.g., changing the circuit breaker model), and deleted nodes (e.g., equipment decommissioning). Each type of change is mapped to entities and relational operations in the knowledge graph.
[0093] The graph edit distance algorithm calculates the update cost: deletion costs 1, insertion costs 1, and replacement costs 2. For example, adding a new line requires inserting 1 line node and 2 connections, resulting in a total cost of 3. The algorithm calculates the edit distance between the old and new graphs. ,when When the change is considered small, only a local update is triggered; when The system considers the change to be significant and triggers a full regeneration.
[0094] The partial update algorithm locates affected test paths through graph lookup. For example, when adding line L3, it queries all test cases containing L3-related equipment, regenerates only these test cases, and marks other irrelevant test cases as valid and retains them. Experiments show that the partial update mechanism can reduce the workload of test case regeneration by 90%, supporting agile iteration of substation configuration.
[0095] Anomaly test sequence generation also includes boundary condition testing and combined anomaly testing: boundary condition testing analyzes the range of values for numerical state parameters, constructs test states near boundary values, and verifies the system's behavior under extreme conditions; combined anomaly testing generates composite anomaly scenarios by arranging and combining multiple independent anomaly conditions. in The number of abnormal conditions in the combination is determined; orthogonal experimental design method is used to reduce combination explosion, and representative abnormal combinations are selected for testing.
[0096] The test results comparison employs a multi-level verification strategy: signal-level verification checks whether the equipment switch position signals and electrical measurement signals are consistent with expectations; logic-level verification checks whether the five-prevention interlocking logic is correctly triggered and whether the operation sequence meets the requirements of the regulations; system-level verification verifies whether the system steady state after operation meets the N-1 criterion through power flow calculation; a fault feature library is established, and typical defect types exposed during the test are automatically identified through pattern matching algorithms, generating a structured test report containing defect location, cause analysis, and repair suggestions. Boundary condition testing targets numerical state parameters, such as bus voltage and line current. The normal value range of parameters is analyzed; for example, the normal range of bus voltage is 95kV-121kV. Test states are constructed near the boundary values of 94kV, 95kV, 121kV, and 122kV to verify the system's judgment logic under critical conditions. For example, at 94kV (undervoltage boundary), the line commissioning operation is tested to see if the undervoltage alarm is correctly triggered.
[0097] Combined anomaly testing addresses scenarios where multiple independent anomaly conditions intersect. For example, anomaly condition 1 is circuit breaker failure to operate, anomaly condition 2 is communication interruption, and anomaly condition 3 is protection malfunction; these three conditions combined produce... Various scenarios. Adopted Orthogonal arrays were used to select representative combinations, compressing eight scenarios into four typical combinations for testing. This ensured coverage of the interaction effects of multiple factors while avoiding an excessive number of test cases due to combination explosion.
[0098] In the implementation of the multi-level verification strategy, signal-level verification directly reads the stVal field of the GOOSE message and compares the switch position signal (0 / 1) with the analog signal (voltage / current value). Logic-level verification checks the operation execution log to confirm that the five-prevention interlocking logic is correctly triggered under abnormal scenarios and that the operation sequence complies with the procedure requirement of breaker first, then disconnector. System-level verification calls the power flow calculation engine, inputs the topology and equipment parameters after the operation, calculates the steady-state power flow distribution of the system, checks for equipment overload or voltage exceeding limits, and verifies that the system meets the N-1 criterion after the operation (the system can still operate safely after any line or main transformer goes out).
[0099] The fault feature library predefines 20 typical defect patterns, such as operation sequence errors, missing interlocking conditions, and abnormal state feedback, with each pattern associated with a feature vector. During testing, features of failed test cases are extracted, and the closest defect type is matched using cosine similarity or KNN algorithms to automatically generate a structured report. The report includes a defect title, reproduction steps, root cause analysis, and remediation suggestions.
[0100] This invention transforms the substation operation testing problem into a knowledge graph construction, reasoning, and optimization problem, thereby achieving a paradigm shift from manual experience enumeration to machine intelligent generation.
[0101] First, the system reads multi-source heterogeneous documents from the substation using a customized parser. These documents include configuration files describing the equipment topology, five-prevention logic files defining safety rules, and operating procedures specifying operational processes. The parser employs natural language processing and XML parsing techniques to automatically extract structured information from these documents and map it into a knowledge graph according to a predefined ontology model. This graph represents equipment, states, operations, and rules in the substation as nodes, and topological connections, electrical associations, and logical dependencies between operations and states as directed edges, forming a complete semantic network. The knowledge graph is stored in a database that supports efficient graph traversal, providing a foundation for subsequent automated reasoning.
[0102] During the test path generation phase, the system employs a hybrid strategy combining forward search and backward reasoning. Forward search starts from a given initial device state and automatically identifies all legally executable operations in the current state by querying the precondition relationships in the knowledge graph. For each legal operation, the system applies a state transition function to calculate the new state after execution and records the complete operation path. This process iterates continuously, using breadth-first or heuristic search strategies to traverse the state space until the target state is reached, thereby generating multiple complete operation sequences from the initial state to the target state. Backward reasoning, from a security perspective, traverses all dangerous operations in the knowledge graph that are blocked by the five-prevention rules, reverse-analyzes the security conditions that block them, artificially constructs abnormal initial states that violate these conditions, and generates abnormal test sequences that are expected to be blocked by the system to verify the completeness and correctness of the five-prevention logic.
[0103] Due to the large number of automatically generated test paths, the system introduces a set coverage optimization algorithm to streamline the test case set. This algorithm defines all device states and operation types that need to be covered as test targets, constructs a coverage matrix between test cases and test targets, and uses a greedy strategy to iteratively select test cases that cover the most uncovered targets until all targets are fully covered. The optimized test cases are converted into executable scripts based on state machines. These scripts contain device initialization instructions, operation execution sequences, and state verification assertions. These scripts are automatically executed on a simulation platform supporting the IEC 61850 standard protocol. The system subscribes to device status signals, compares the actual execution results with the expected results item by item, automatically determines whether the test passes or fails, and generates a detailed test report. The entire process requires no manual intervention, achieving full automation, high coverage, and high efficiency in programmed operation ticket testing.
[0104] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "include," "contain," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that includes a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the statement "includes a…" does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes the element.
[0105] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A method for testing the execution logic sequence of a substation programmed operation ticket, characterized in that, Includes the following steps: S1: By parsing the substation configuration description file, the five-prevention logic configuration file and the operation procedure, extract the equipment class, status class, operation class and rule class entity nodes, as well as the topology connection, electrical association, state, precondition, interlock and subsequent operation relationship edges, and construct the substation operation knowledge graph; S2: Employing a hybrid strategy, test paths are generated based on the substation operation knowledge graph constructed in S1, including: a forward search algorithm based on state space transitions, which initializes the initial state... Add to the search queue, iteratively query the knowledge graph for legal operations that meet the preconditions, and infer the subsequent state. And record the operation sequence path until the target state is reached. A rule-triggered reverse reasoning algorithm traverses dangerous operations marked by the `lockedBy` relation in the knowledge graph, reverse-analyzes the reasons for locking, and constructs an abnormal initial state that violates security conditions. Generate abnormal test sequences; S3: Optimize all test paths generated in S2 using a set coverage algorithm, select the smallest subset to cover all key device states and operation types, convert the optimized test cases into executable scripts, automatically execute them on the simulation platform, and compare the device status signals with the expected results.
2. The method for testing the logic sequence of a substation programmed operation ticket execution according to claim 1, characterized in that, In S1, equipment entity nodes include circuit breakers, disconnectors, grounding switches, busbars, and lines; status entity nodes include macroscopic states such as operating status, hot standby status, and maintenance status, as well as microscopic states such as closed and open positions; operation entity nodes include closing operations, opening operations, activation operations, and deactivation operations; rule entity nodes include five-prevention rules such as rules to prevent closing grounding switches under energized conditions and rules to prevent accidental opening and closing of circuit breakers; and a knowledge graph formed by storing data in graph databases such as Neo4j or Nebula Graph enables structured storage and efficient querying of nodes and relationships.
3. The method for testing the logic sequence of a substation programmed operation ticket execution according to claim 1, characterized in that, The forward search algorithm in S2 specifically includes: Initialize the search queue and the initial state With empty path As a binary pair Add to queue; Circular from queue Retrieve the current state and its path Search the knowledge graph for conditions that meet the criteria. All legal operations ; For each legal operation Through the state transition function Calculate the subsequent states, where Indicates operation State The effects; Record extended path ; when At that time, the path Save as a valid test case; Otherwise Add to queue Continue the search.
4. The method for testing the logic sequence of a substation programmed operation ticket execution according to claim 1, characterized in that, The reverse reasoning algorithm in S2 specifically includes: Traverse the knowledge graph to obtain the set of all dangerous operations with the lockedBy relationship. ; For each hazardous operation Extract its set of locked security conditions. ,in Representing a knowledge graph; Constructing an abnormal initial state ,in This is the normal initial state. For safety conditions, This constitutes a violation of the conditions; Generate test sequences The expected result is that the operation is blocked and an alarm is triggered.
5. The method for testing the logic sequence of a substation programmed operation ticket execution according to claim 1, characterized in that, The set covering algorithm in S3 is optimized by constructing a covering matrix M, where the matrix elements... Indicates the first The test cases cover the first... One test target, This indicates no coverage; the optimization objective function is defined as follows: The constraints are ,in Indicate whether to select the first There are 10 test cases; a greedy algorithm is used to solve them, and each time the test case that covers the most uncovered targets is selected until all test targets are covered.
6. The method for testing the logic sequence of a substation programmed operation ticket execution according to claim 2, characterized in that, The topological connections of the substation operation knowledge graph are represented by an adjacency matrix. For n device nodes, an n×n matrix A is constructed, where... Indicates equipment With equipment There is a physical connection. Indicates no connection; Electrical relationships are represented by a hierarchical structure tree, with the root node being the substation, intermediate nodes being voltage levels and bays, and leaf nodes being specific equipment. The topology is traversed using depth-first search or breadth-first search algorithms to identify electrical loops and power flow paths.
7. The method for testing the logic sequence of a substation programmed operation ticket execution according to claim 3, characterized in that, The state transition function It employs a rule-based reasoning mechanism, including: defining a set of rules governing the impact of operations. Each rule is in the form of , indicating the previous state Execute the following operation After transitioning to the post-position state For compound operations, sequential combination operators are used. Introduce a state consistency check function. Verification status Whether physical and logical constraints are satisfied, ensuring that the generated state sequence is reachable in the actual system.
8. The method for testing the logic sequence of a substation programmed operation ticket execution according to claim 1, characterized in that, It also includes a test case prioritization step: calculating test case weights based on operational risk level, equipment importance, and historical failure frequency. ; in These are the weighting coefficients. Assess risk levels. Rate the importance of the equipment. Historical failure frequency; Test cases are sorted in descending order of weight, with high-weight test cases executed first, to implement a risk-oriented testing strategy.
9. A method for testing the execution logic sequence of a substation programmed operation ticket according to claim 1, characterized in that, The executable script in S3 is generated using a state machine-based description language, including: defining a state transition script template, which includes an initialization segment, an operation execution segment, and a verification segment; mapping each operation in the test path to a sequence of control instructions, including device selection instructions, operation type instructions, and parameter configuration instructions; inserting a verification point after each operation, and checking whether the device status signal is consistent with expectations through assertion statements; the generated script supports the GOOSE and MMS communication protocols of the IEC 61850 standard, realizing standardized interface docking with the simulation platform.
10. A method for testing the logic sequence of a substation programmed operation ticket execution according to claim 1, characterized in that, It also includes an incremental knowledge graph update mechanism: monitoring changes to substation configuration files and operating procedures, identifying newly added, modified, and deleted entities and relationships through differential algorithms; and using a graph edit distance algorithm to calculate the difference between the knowledge graph before and after the update. ,in These represent the sets of delete, insert, and replace operations, respectively. When the difference exceeds the threshold, an incremental update of the test cases is triggered, which only regenerates the test cases for the affected paths, maintaining the validity of the unaffected test cases and achieving efficient utilization of test resources.