Strategy module testing method and device, computer equipment, storage medium and computer program product

By converting the input information into a structure array and unifying the format, automatically correlating and generating test reports, the problem of low manual association efficiency of strategy modules is solved, efficient testing and report generation is achieved, and the stable operation of the power system is ensured.

CN120386727APending Publication Date: 2025-07-29CHINA SOUTHERN POWER GRID COMPANY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510440311.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-09
Publication Date
2025-07-29

AI Technical Summary

Technical Problem

In the prior art, the association between policy modules depends on manual operation efficiency and error-prone, and the generation of test cases is complex, making it difficult to ensure the comprehensiveness and targetedness of the test.

Method used

Convert the input information into a structure array and unify the format, determine the target structure array based on the test requirements, associate the test logic data, and input test cases under the normal working state of the power system to automatically generate a test report.

Benefits of technology

It improves the correlation efficiency and testing efficiency of the strategy module, reduces manual operation errors, ensures the comprehensiveness and targetedness of the test, and improves the stability and reliability of the power system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120386727A_ABST
    Figure CN120386727A_ABST
Patent Text Reader

Abstract

The invention relates to a strategy module testing method and device, computer equipment, a storage medium and a computer program product. Relates to the technical field of power systems. The method comprises the following steps: converting multiple kinds of pre-acquired input information into a plurality of structural body arrays, and converting variables of each structural body array into variables in a preset format; based on a preset test requirement of each to-be-tested strategy module, determining a target structure array corresponding to each to-be-tested strategy module in the plurality of structure arrays, and inputting the target structure array to the corresponding to-be-tested strategy module; according to the variable name of each target structure array, associating test logic data of each to-be-tested strategy module; and under the condition of determining that the power system is in a normal working state based on the test logic data, inputting a pre-generated target test case into the to-be-tested strategy module to obtain a test report of the to-be-tested strategy module. By adopting the method, the association efficiency and the test efficiency of the strategy module can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of power systems, and particularly to a method, device, computer device, storage medium, and computer program product for testing a policy module. Background Art

[0002] The security and stability control device is crucial for ensuring the reliable operation of the power system. Among them, the policy module of the security and stability control device is usually used to process a large amount of complex input information and plays a key role in the stable operation of the power system. Therefore, associating each policy module and testing each policy module have become problems to be solved.

[0003] Currently, the association between each policy module often relies on manual operation, which is not only inefficient but also error-prone. At the same time, when testing the policy module, the generation of test cases usually relies on complex manual calculations and editing, increasing the workload and difficulty of testers, and it is difficult to ensure the comprehensiveness and pertinence of testing. Therefore, there are currently problems of low association efficiency and low testing efficiency of the policy module. Summary of the Invention

[0004] Based on this, it is necessary to provide a method, device, computer device, computer-readable storage medium, and computer program product for testing a policy module in view of the above technical problems of low association efficiency and low testing efficiency of the policy module.

[0005] In a first aspect, the present application provides a method for testing a policy module, including:

[0006] Converting a variety of pre-acquired input information into multiple structure arrays, and converting the variables of each of the structure arrays into preset format variables; the input information is used to represent the operating parameters in the power system;

[0007] Based on the preset test requirements of each to-be-tested policy module, determining the target structure array corresponding to each to-be-tested policy module in the multiple structure arrays, and inputting the target structure array into the corresponding to-be-tested policy module;

[0008] Associating the test logic data of each to-be-tested policy module according to the variable names of each target structure array;

[0009] When it is determined that the power system is in a normal working state based on the test logic data, inputting a pre-generated target test case into the to-be-tested policy module to obtain a test report of the to-be-tested policy module.

[0010] In one embodiment, the converting the pre-acquired multiple input information into multiple structure arrays and converting the variables of each of the structure arrays into preset format variables includes: determining multiple information types corresponding to the pre-acquired multiple input information, and converting each of the input information into the corresponding structure array based on the information type; converting the variables of each of the structure arrays into preset format variables based on preset format conversion rules.

[0011] In one embodiment, the pre-acquired multiple input information includes first input information received by a communication channel and second input information locally collected; the determining multiple information types corresponding to the pre-acquired multiple input information and converting each of the input information into the corresponding structure array based on the information type includes: determining multiple information types corresponding to the first input information and converting each of the first input information into the corresponding structure array based on the information type; determining multiple information types corresponding to the second input information and converting each of the second input information into the corresponding structure array based on the information type.

[0012] In one embodiment, before inputting the pre-generated target test case into the to-be-tested policy module, it further includes: generating candidate test cases based on the preset test requirements of each of the to-be-tested policy modules and the operating conditions of the power system; performing a simulation test on the test cases to obtain a target test case that meets the preset test requirements of the to-be-tested policy module.

[0013] In one embodiment, the performing a simulation test on the test cases to obtain a target test case that meets the test requirements of the to-be-tested policy module includes: combining the data characteristics of the fault data of historical engineering examples and preset message action information, and performing a simulation execution on the test cases to obtain a target test case that meets the test requirements of the to-be-tested policy module.

[0014] In one embodiment, the step of inputting the pre-generated target test case into the to-be-tested policy module to obtain a test report of the to-be-tested policy module includes: inputting the target test case into the to-be-tested policy module and starting a test execution program; the test execution program is used to simulate multiple fault scenarios; inputting preset fault data into the to-be-tested policy module based on the test execution program to obtain an output result; comparing the output result with preset message action information, and when the output result is consistent with the preset message action information, determining that the test result of the target test case passes; when the output result is inconsistent with the preset message action information, determining that the test result of the target test case fails, and recording the data corresponding to the test result; generating the test report based on the test result.

[0015] In a second aspect, the present application further provides a test device for a policy module, including:

[0016] A variable format conversion module, configured to convert a variety of pre-acquired input information into multiple structure arrays, and convert the variables of each of the structure arrays into preset format variables; the input information is used to represent operation parameters in a power system;

[0017] A target determination module, configured to determine, based on the preset test requirements of each to-be-tested policy module, the target structure array corresponding to each to-be-tested policy module in the multiple structure arrays, and input the target structure array into the corresponding to-be-tested policy module;

[0018] A data association module, configured to associate the test logic data of each to-be-tested policy module according to the variable names of each target structure array;

[0019] A report generation module, configured to input the pre-generated target test case into the to-be-tested policy module to obtain a test report of the to-be-tested policy module when it is determined based on the test logic data that the power system is in a normal working state.

[0020] In a third aspect, the present application further provides a computer device, which includes a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0021] Convert a variety of pre-acquired input information into multiple structure arrays, and convert the variables of each of the structure arrays into preset format variables; the input information is used to represent operation parameters in a power system;

[0022] Based on the preset test requirements of each to-be-tested policy module, determine the target structure array corresponding to each to-be-tested policy module in the multiple structure arrays, and input the target structure array into the corresponding to-be-tested policy module;

[0023] According to the variable names of the respective target structure arrays, associate the test logic data of each to-be-tested policy module;

[0024] When it is determined based on the test logic data that the power system is in a normal operating state, input the pre-generated target test cases into the to-be-tested policy module to obtain the test report of the to-be-tested policy module.

[0025] Fourthly, the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0026] Convert the pre-acquired multiple input information into multiple structure arrays, and convert the variables of each structure array into preset format variables; the input information is used to represent the operating parameters in the power system;

[0027] Based on the preset test requirements of each to-be-tested policy module, determine the target structure array corresponding to each to-be-tested policy module in the multiple structure arrays, and input the target structure array into the corresponding to-be-tested policy module;

[0028] According to the variable names of the respective target structure arrays, associate the test logic data of each to-be-tested policy module;

[0029] When it is determined based on the test logic data that the power system is in a normal operating state, input the pre-generated target test cases into the to-be-tested policy module to obtain the test report of the to-be-tested policy module.

[0030] Fifthly, the present application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0031] Convert the pre-acquired multiple input information into multiple structure arrays, and convert the variables of each structure array into preset format variables; the input information is used to represent the operating parameters in the power system;

[0032] Based on the preset test requirements of each to-be-tested policy module, determine the target structure array corresponding to each to-be-tested policy module in the multiple structure arrays, and input the target structure array into the corresponding to-be-tested policy module;

[0033] Associate the test logic data of each of the to-be-tested policy modules according to the variable names of each target structure array;

[0034] When it is determined based on the test logic data that the power system is in a normal operating state, input the pre-generated target test cases into the to-be-tested policy module to obtain the test report of the to-be-tested policy module.

[0035] In the above method, device, computer device, storage medium, and computer program product for testing a policy module, during the testing process of the policy module, first convert a variety of pre-acquired input information into multiple structure arrays, and convert the variables of each structure array into preset format variables; the input information is used to represent the operating parameters in the power system; then, based on the preset test requirements of each to-be-tested policy module, determine the target structure array corresponding to each to-be-tested policy module in the multiple structure arrays, and input the target structure array into the corresponding to-be-tested policy module; then, according to the variable names of each target structure array, associate the test logic data of each to-be-tested policy module; finally, when it is determined based on the test logic data that the power system is in a normal operating state, input the pre-generated target test cases into the to-be-tested policy module to obtain the test report of the to-be-tested policy module. In the above process, by converting the variables of each structure array into preset format variables, the format and naming can be unified, making the subsequent association between to-be-tested policy modules more efficient; by separately determining the target structure arrays corresponding to different to-be-tested policy modules and inputting the corresponding target structure arrays into the corresponding to-be-tested policy modules, the association speed between each to-be-tested policy module is accelerated; by inputting the pre-generated target test cases into the to-be-tested policy module, the test report can be automatically generated, saving the generation time of the test report; therefore, through the above steps, the association efficiency and test efficiency of the policy module are improved. Description of the Drawings

[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following will briefly introduce the drawings required for use in the description of the embodiments or related technologies. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0037] Figure 1 It is a schematic flowchart of the method for testing a policy module in one embodiment;

[0038] Figure 2 It is a schematic flowchart of the method for testing a policy module in another embodiment;

[0039] Figure 3Schematic flowchart of the test method for the policy module in yet another embodiment;

[0040] Figure 4 Schematic flowchart of the acquisition process of the data structure in one embodiment;

[0041] Figure 5 Schematic flowchart of the automatic association of the policy module in one embodiment;

[0042] Figure 6 Schematic flowchart of the automatic test of the policy module in one embodiment;

[0043] Figure 7 Block diagram of the structure of the test device for the policy module in one embodiment;

[0044] Figure 8 Internal structure diagram of a computer device in one embodiment. Detailed implementation manners

[0045] In order to make the objectives, technical solutions and advantages of the present application more clear and understandable, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0046] In one embodiment, as Figure 1 shown, a test method for a policy module is provided. In this embodiment, the application of this method to a terminal is taken as an example for illustration. It can be understood that this method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is realized through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:

[0047] Step S102, convert a variety of pre-acquired input information into multiple structure arrays, and convert the variables of each structure array into preset format variables; the input information is used to represent the operation parameters in the power system.

[0048] Among them, the structure array can be used to aggregate different types of input information; the input information can be the parameter information required during the operation of the power system; the preset format variable refers to the variable after unifying the format of each variable.

[0049] Optionally, the input information may include electrical quantities, equipment status, and power system operation modes, etc., and the electrical quantities may be voltage and current, etc., and the equipment status may be switch positions and disconnector status; each structure array may include a variety of input information; the preset format refers to naming the elements in accordance with the relevant standards and specifications of the power system to ensure the consistency of variable names among different policy modules.

[0050] Step S104 , based on the preset test requirements of each strategy module to be tested, determining a target structure array corresponding to each strategy module to be tested from a plurality of structure arrays, and inputting the target structure array into the corresponding strategy module to be tested.

[0051] Among them, the preset test requirements refer to different test requirements of different strategy modules to be tested; the strategy module to be tested refers to the logic module that needs to be tested; the target structure array refers to the structure data related to the strategy module to be tested, which is screened out from the multiple structures generated in step S102 according to different test requirements.

[0052] Step S106 , associating the test logic data of each strategy module to be tested according to the variable name of each target structure array.

[0053] Among them, test logic data refers to the basis for driving the test strategy module to be tested, which includes the logic and conditions required to execute the test; variable name association refers to the process of matching the variable name in the target structure array with the logic in the test logic data.

[0054] Step S108 , when it is determined based on the test logic data that the power system is in a normal working state, the pre-generated target test case is input into the strategy module to be tested to obtain a test report of the strategy module to be tested.

[0055] Among them, normal working status refers to the operation of the power system within a safe and stable parameter range; target test cases refer to pre-designed test scenarios or conditions used to verify the performance of the power system under specific conditions; the test report can be the final output result document, which includes pass and fail results, as well as multiple sets of data during the test process corresponding to the fail.

[0056] In the above test method of the policy module, during the test of the policy module, first, a variety of pre-acquired input information is converted into multiple structure arrays, and the variables of each structure array are converted into preset format variables; the input information is used to represent the operating parameters in the power system; then, based on the preset test requirements of each policy module to be tested, the target structure array corresponding to each policy module to be tested is determined from the multiple structure arrays, and the target structure array is input into the corresponding policy module to be tested; then, according to the variable names of each target structure array, the test logic data of each policy module to be tested is associated; finally, when it is determined that the power system is in a normal working state based on the test logic data, the pre-generated target test case is input into the policy module to be tested to obtain the test report of the policy module to be tested. In the above process, by converting the variables of each structure array into preset format variables, the format and naming can be unified, making the subsequent association between the policy modules to be tested more efficient; by respectively determining the target structure arrays corresponding to different policy modules to be tested and inputting the corresponding target structure arrays into the corresponding policy modules to be tested, the association speed between the policy modules to be tested is accelerated; by inputting the pre-generated target test case into the policy module to be tested, the test report can be automatically generated, saving the generation time of the test report; therefore, through the above steps, the association efficiency and test efficiency of the policy module are improved.

[0057] In an exemplary embodiment, step S102 of converting a variety of pre-acquired input information into multiple structure arrays and converting the variables of each structure array into preset format variables includes:

[0058] Determine multiple information types corresponding to the variety of pre-acquired input information, and convert each input information into a corresponding structure array based on the information type; based on the preset format conversion rules, convert the variables of each structure array into preset format variables.

[0059] Among them, the variety of pre-acquired input information may refer to the data or parameters collected from different sources before the association test of the policy module, which may be data from sensors, user inputs, database records, etc.; the multiple information types refer to that the input information can be divided into different categories according to its nature or use; the structure array can be a data structure that organizes multiple records with the same data type into an array and can contain multiple variables and attributes; the preset format conversion rules refer to the standard operations for converting the input information into the required output format.

[0060] As an example, the information types corresponding to the input information may include numeric type, string type, boolean type, etc. For example, the current value is of numeric type, the device name is of string type, and the status indication is of boolean type.

[0061] In this embodiment, by classifying and converting the input information, the accuracy and consistency of the data in the power system test are ensured, enabling it to effectively support the operation of various strategies and logic modules; and by converting the input information into a structure array, it is convenient to uniformly process information of different types and their sets, laying a foundation for the association of subsequent strategy modules.

[0062] In one embodiment, after inputting the target structure array into the corresponding strategy module to be tested in step S104, it further includes:

[0063] The multiple input information obtained in advance includes the first input information received by the communication channel and the second input information collected locally; determining the multiple information types corresponding to the multiple input information obtained in advance, and converting each input information into a corresponding structure array based on the information type, including: determining the multiple information types corresponding to the first input information, and converting each first input information into a corresponding structure array based on the information type; determining the multiple information types corresponding to the second input information, and converting each second input information into a corresponding structure array based on the information type.

[0064] Among them, the communication channel can be a network or communication facility for data exchange, and may include serial ports, Ethernet, etc.; the first input information received by the communication channel can be the input information of components at a relatively long distance, and the second input information collected locally can be the input information of components at a relatively short distance; the multiple information types corresponding to the first input information can include information such as voltage and current, power, frequency, and digital input / output; the multiple information types corresponding to the second input information can also include information such as voltage and current, power, frequency, and digital input / output.

[0065] In this embodiment, by separately obtaining the first input information of the communication channel and the second input information collected locally, different sources and different types of data can be flexibly processed, enabling the power system to adapt to different input information faster; by separately converting the first input information and the second input information into structure arrays, the server can use a unified method to process information from different sources, improving efficiency.

[0066] Further, in one embodiment, before inputting the pre-generated target test case into the strategy module to be tested in step S108, it further includes:

[0067] Generating candidate test cases based on the preset test requirements of each strategy module to be tested and the operating conditions of the power system; performing simulation tests on the test cases to obtain target test cases that meet the preset test requirements of the strategy module to be tested.

[0068] Among them, the preset test requirements can refer to the test plans or requirements formulated according to specific standards and goals. Usually based on the considerations of the functions, performance, and safety of the power system. For example, the policy module may need to perform functions such as load forecasting, real-time monitoring of current, or detection of faults; the operating conditions of the power system refer to various states and conditions shown during the actual operation of the power system, including equipment status, load conditions, environmental factors, etc., such as high-load conditions, equipment failure states, etc.; generating candidate test cases refers to formulating specific test scenarios and conditions for verifying the module functions based on the function requirements of the policy module to be tested and the operating conditions of the power system. And the test cases usually cover normal and abnormal operating scenarios; simulation testing can be to verify the test cases through computer models or simulation tools; the target test cases refer to the finally selected test cases that can best meet the test requirements.

[0069] In this embodiment, by generating a large number of candidate test cases, different operating conditions and function requirements can be covered, ensuring that each policy module is tested under various conditions; simulation testing can identify potential problems and faults in advance, ensuring that the power system remains stable and reliable in various situations.

[0070] Furthermore, in one embodiment, performing simulation testing on the test cases to obtain target test cases that meet the test requirements of the policy module to be tested includes:

[0071] Combining the data characteristics of the fault data of historical engineering examples and the preset message action information, performing simulated execution on the test cases to obtain target test cases that meet the test requirements of the policy module to be tested.

[0072] Among them, the fault data of historical engineering examples refers to the fault events and their related data recorded in historical engineering projects, which can include information such as fault types, occurrence times, influence ranges, handling measures and their effects, etc.; data characteristics refer to the descriptive statistical attributes of the fault data, such as fault occurrence frequency, duration, post-fault recovery time, etc.; the preset message action information refers to the action information defined in advance during the test, usually transmitted to the policy module to be tested in the form of messages; the target test cases refer to the test cases that have been screened and optimized.

[0073] In this embodiment, by combining the fault data characteristics of historical engineering examples with the preset message action information and performing simulated execution of the test cases, the performance and functions of the policy module to be tested can be more effectively verified, thereby improving the overall reliability and safety of the power system.

[0074] In an exemplary embodiment, step S108 inputs the pre-generated target test cases into the policy module to be tested to obtain a test report of the policy module to be tested, including:

[0075] Input the target test case into the strategy module under test and start the test execution program; the test execution program is used to simulate various fault scenarios; input the preset fault data into the strategy module under test based on the test execution program to obtain the output result; compare the output result with the preset message action information, and when the output result is consistent with the preset message action information, determine that the test result of the target test case passes; when the output result is inconsistent with the preset message action information, determine that the test result of the target test case fails and record the data corresponding to the test result; generate a test report based on the test result.

[0076] Among them, simulating various fault scenarios means that the test execution program can reproduce historical faults or designed fault situations to test the response and processing capabilities of the strategy module under test in different situations; the test result refers to the determination basis for determining whether the test case passes or fails based on the comparison between the output result and the preset message action information; the test report refers to a document that systematically organizes the execution status of all test cases, the passed and failed test cases, relevant data, and fault analysis and other information based on the test execution results.

[0077] In this embodiment, by inputting the target test case into the strategy module under test and using the test execution program to simulate fault scenarios, the response and processing capabilities of the module in different situations are verified; by comparing the output result with the preset message action information, the test result is clarified and a test report is generated, ensuring a comprehensive evaluation of the strategy module under test.

[0078] This application provides a method for testing a strategy module. To better understand the process of the above method for testing a strategy module, in combination with Figure 2 as shown below, the specific process of a method for testing a strategy module of this application is elaborated in detail, including the following steps:

[0079] Step S202, establish a standardized structure data model and determine the variables of the power system components.

[0080] Among them, the standardized structure corresponds to a structure array that converts the variables of each structure array into variables of a preset format; the input information of the policy module of the security and stability control device in the power system is defined as a structure array, and the variables of each structure array are named according to a unified standardized name; different modules input different structure arrays according to their respective functional requirements, automatically match and associate the information required by the logic of the policy module according to the variable names of the structure array variables, construct the logical discrimination relationship between each policy module, so as to realize the execution of the policy logic between each policy module, and at the same time visually display the information required by the policy module to realize the correctness detection of the input information of the logical function; according to the input information characteristics of the policy module (policy module to be tested) of the security and stability control device, it is divided into different types of components, and each component corresponds to a specific category of input information.

[0081] As an example, for electrical quantity input, the structure array can be expressed as:

[0082] typedef struct

[0083] {

[0084] int16 Power;

[0085] int16 Current;

[0086] int16 Voltage;

[0087] int16 Frequency; .......

[0089] }Unit_line

[0090] Among them, Power is the power variable, Current is the current variable, Voltage is the voltage variable, and Frequency is the frequency variable.

[0091] Step S204, complete the connection configuration of the policy module and complete the automatic association between the policy modules.

[0092] Among them, the connection configuration can represent the association relationship between the policy modules. Different policy modules perform policy logic discrimination by associating relevant variables of the structure array according to their respective functional requirements. Each module selects corresponding variables from the defined structure array as the input of the logic module (policy module to be tested) according to the control policy function to be realized by itself, so as to realize the execution of the policy logic.

[0093] Step S206, obtain the target test case and generate a test report after completing the test of the policy module.

[0094] Among them, based on the pre-set existing test cases (candidate test cases), the fault data of the specific instantiated project and the preset message action information parsed and generated are used to automatically generate comprehensive and highly targeted target test cases; the generated target test cases are used to test the security and stability control device to verify the action accuracy and reliability of the policy module under various working conditions; in addition, the target test cases can also be generated by analyzing the existing test case library, combining the fault data characteristics of the specific instantiated project and the preset message action information format, through specific algorithms and rules.

[0095] Furthermore, the testing process of the policy module can be to input the generated test cases into the security and stability control device testing platform, simulate various working conditions, monitor the action output of the device, and compare it with the expected results to judge the action accuracy and reliability of the policy module.

[0096] In this embodiment, by defining the structure array with a unified standardized name, the consistency and accuracy of the elements during association between different modules are ensured; the policy discrimination module automatically associates the relevant variables of the input structure array according to the functional requirements to achieve the automatic association of the policy module, avoiding complex manual association operations and improving efficiency.

[0097] In one embodiment, as Figure 3 shown, the process of the testing method of the policy module may include: introducing an information preprocessing module for preprocessing various input information. The information preprocessing module receives the voltage, current, power, frequency, switch quantity, etc. of each component collected locally (at close range); and the voltage, current, power, frequency, switch quantity, etc. of each component received through the communication channel (at long range); and further inputs them into the stability control policy module. At the same time, input the module test cases into the stability control policy module (the policy module to be tested of the stability control device in the power system), obtain some important power, current, and switch quantity information that the module needs to display and the execution result of the module, and the testing ends.

[0098] Furthermore, in one embodiment, as Figure 4 shown, it is the acquisition process of the standardized data structure (the structure array corresponding to the variables of the structure array converted into preset format variables), including: after receiving various input information, introducing an information preprocessing module. The information processing module receives the voltage and current of each relevant component received through the communication channel; the voltage, current, power, frequency, switch quantity, etc. of each component collected locally; the function pressure plate and other information of the stability control device, as well as other information, and preprocesses the received information to obtain the standardized data structure.

[0099] Furthermore, each strategy module determines the structure arrays it needs to introduce based on its functional requirements and connects the modules. Once connected, the modules automatically associate the required variables based on the variable names. For example, an overcurrent protection strategy module may only need to associate the current variable (Current) of the structure array, while a voltage stability control module needs to associate the voltage and frequency variables (Frequency) of the structure array. Different strategy modules associate related elements of components through programming based on their functional requirements. For example, a strategy module used to determine whether a power grid is overloaded will associate component elements related to the current of each line and determine whether an overload exists based on the set current threshold and calculation logic. In software programming, element association and logical operations are achieved by calling the corresponding component element interface.

[0100] Furthermore, in one embodiment, Figure 5 As shown, the process of automatic association of strategy modules includes: the standardized data structure of element 1 (the element corresponding to the variable), the standardized data structure of element 2, the standardized data structure of element 3, and the standardized data structure of element 4 are automatically associated with the power of element 1, the power of element 2, the power of element 3, and the frequency of element 4, respectively, and the power of elements 1, 2, and 3 and the frequency of element 4 are input to the temperature control strategy function module (the strategy module in the stabilization device corresponding to the power system) as inputs to the logic module (composed of each strategy module to be tested), the relevant logic is executed, and the results are output.

[0101] In one embodiment, Figure 6 The figure shows the process of automatic testing of the strategy module, which includes: introducing the functional modules in the power system, and automatically preprocessing the input information and test cases of the functional modules. Then, the obtained instantiated test cases (target test cases) are input into the temperature control strategy functional module (strategy module to be tested) to obtain the test results.

[0102] In addition, the selected test cases can be prepared by organizing a professional testing team and power system experts to write detailed test cases based on the functional requirements of each functional module and the various operating conditions of the power system. For example, for the overcurrent protection module, the test cases should include test scenarios with different current amplitudes (normal current, current near the overcurrent threshold, and current far exceeding the current threshold) and different current change rates. The written test cases are internally reviewed, and developers and quality assurance personnel are invited to participate in the review process. A comprehensive review is conducted from the aspects of functional coverage, logical rationality, and executable feasibility. By simulating the execution of the test cases, loopholes and unreasonable points are checked to ensure that the test cases meet the testing requirements of the functional modules.

[0103] Further, after instantiating the functional modules, a test case generation tool is developed. This tool reads the information of the associated structure array and the pre-prepared test cases. For example, according to the value ranges and variation rules of voltage, current, and frequency in the electrical quantity structure array, combined with the requirements for the current amplitude in the overcurrent protection test case, specific virtual fault data is generated; for the preset message action information, according to the control instructions that the policy module should issue under different fault conditions, such as trip instructions, alarm signals, etc., corresponding preset messages are generated. For example, when an overcurrent fault is detected, the preset message should include information such as the device number to trip and the action time; through programming, the automation of the test case generation tool is realized, enabling it to quickly and accurately generate comprehensive and targeted target test cases according to different functional modules and structure array information.

[0104] The target test cases are input into the test environment of the safety and stability control device policy module, and the test execution program is started. The test execution program simulates various fault scenarios, inputs virtual fault data to the policy module, and monitors the output results of the policy module; compares the actual output results of the policy module with the preset message action information to judge the action accuracy and reliability of the policy module under various working conditions. If the output results are consistent with the preset, it is determined that the test case passes; if not, the error information is recorded in detail, including fault data, actual output, expected output, etc.; after the test is completed, a test report is generated. The test report should include the execution status of the test cases, the number of passed and failed test cases, the detailed error information of the failed test cases, etc.; according to the test report, developers can optimize and improve the policy module targeted to improve the performance of the power system safety and stability control device.

[0105] In the above embodiments, by defining the input information as elements and standardizing the element naming or order, a good foundation is laid for subsequent automatic association and testing, ensuring the consistency and accuracy of the system, realizing the automatic association of the policy module, reducing the errors and time consumption caused by manual operations, and improving work efficiency; automatically generating test cases reduces the workload and difficulty of testers, while ensuring the comprehensiveness and pertinence of the test cases, thereby improving test efficiency, more effectively verifying the action accuracy and reliability of the policy module under various working conditions, and strongly guaranteeing the safe and stable operation of the power system.

[0106] It should be understood that although the steps in the flowcharts involved in the above-described embodiments are sequentially shown according to the indications of the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear indication in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-described embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be executed alternately or in turn with at least a part of other steps or steps or stages in other steps.

[0107] Based on the same inventive concept, an embodiment of the present application also provides a test device for a policy module for implementing the test method of the policy module described above. The solution provided by this device for solving problems is similar to the solution described in the above method. Therefore, the specific limitations in one or more embodiments of the test device for the policy module provided below can refer to the limitations on the test method of the policy module in the above text, and will not be repeated here.

[0108] In an exemplary embodiment, as Figure 7 shown, a test device for a policy module is provided, including: a variable format conversion module 701, a target determination module 702, a data association module 703, and a report generation module 704, where:

[0109] The variable format conversion module 701 is configured to convert a plurality of pre-acquired input information into a plurality of structure arrays, and convert the variables of each structure array into preset format variables; the input information is used to represent the operating parameters in the power system.

[0110] The target determination module 702 is configured to determine, based on the preset test requirements of each policy module to be tested, the target structure array corresponding to each policy module to be tested in the plurality of structure arrays, and input the target structure array into the corresponding policy module to be tested.

[0111] The data association module 703 is configured to associate the test logic data of each policy module to be tested according to the variable names of each target structure array.

[0112] The report generation module 704 is configured to, when it is determined based on the test logic data that the power system is in a normal working state, input the pre-generated target test case into the policy module to be tested to obtain the test report of the policy module to be tested.

[0113] Furthermore, in one embodiment, the variable format conversion module 701 is also used to determine multiple information types corresponding to multiple input information obtained in advance, and convert each input information into a corresponding structure array based on the information type; based on the preset format conversion rules, the variables of each structure array are converted into preset format variables.

[0114] Furthermore, in one embodiment, the target determination module 702 is also used to determine multiple information types corresponding to the first input information, and convert each first input information into a corresponding structure array based on the information type; determine multiple information types corresponding to the second input information, and convert each second input information into a corresponding structure array based on the information type.

[0115] Furthermore, in one embodiment, the target determination module 702 is also used to generate test cases to be selected based on the preset test requirements of each strategy module to be tested and the operating conditions of the power system; and perform simulation tests on the test cases to obtain target test cases that meet the preset test requirements of the strategy module to be tested.

[0116] Furthermore, in one embodiment, the data association module 703 is also used to combine the data characteristics of the fault data of the historical engineering instance and the preset message action information to simulate the execution of the test case to obtain the target test case that meets the test requirements of the strategy module to be tested.

[0117] Furthermore, in one embodiment, the report generation module 704 is also used to input the target test case into the policy module to be tested and start the test execution program; the test execution program is used to simulate multiple fault scenarios; based on the test execution program, preset fault data is input into the policy module to be tested to obtain an output result; the output result is compared with the preset message action information, and when the output result and the preset message action information are consistent, the test result of the target test case is determined to be passed; when the output result and the preset message action information are inconsistent, the test result of the target test case is determined to be failed, and the data corresponding to the test result is recorded; and a test report is generated based on the test result.

[0118] Each module in the aforementioned policy module testing device may be implemented in whole or in part through software, hardware, or a combination thereof. Each module may be embedded in or independent of a processor in a computer device in the form of hardware, or may be stored in a memory in the computer device in the form of software, so that the processor can call and execute the corresponding operations of each module.

[0119] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 8As shown in the figure. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O), and a communication interface. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store the test data of the policy module. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals through a network connection. When the computer program is executed by the processor, it implements a test method for a policy module.

[0120] Those skilled in the art can understand that Figure 8 the structure shown in the figure is only a block diagram of some structures related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.

[0121] In an exemplary embodiment, a computer device is provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, the steps in the above method embodiments are implemented.

[0122] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by the processor, the steps in the above method embodiments are implemented.

[0123] In one embodiment, a computer program product is provided, including a computer program. When the computer program is executed by the processor, the steps in the above method embodiments are implemented.

[0124] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with relevant regulations.

[0125] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memories. Non-volatile memories can include read-only memory (ROM), magnetic tapes, floppy disks, flash memories, optical memories, high-density embedded non-volatile memories, resistive random access memories (ReRAM), magnetoresistive random access memories (MRAM), ferroelectric random access memories (FRAM), phase change memories (PCM), graphene memories, etc. Volatile memories can include random access memory (RAM) or external cache memories, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in the present application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in the present application can be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, data processing logics based on quantum computing, etc., without limitation.

[0126] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope recorded in this specification.

[0127] The above-described embodiments merely represent several implementation manners of the present application. The description thereof is relatively specific and detailed, but it should not be construed as a limitation on the patent scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.

Claims

1. A testing method for a policy module, characterized in that, The method comprises: Converting a plurality of pre-acquired input information into a plurality of structure arrays, and converting variables of each structure array into variables of a preset format; wherein the input information is used to represent operating parameters in the power system; Based on the preset test requirements of each strategy module to be tested, determining a target structure array corresponding to each strategy module to be tested in the plurality of structure arrays, and inputting the target structure array into the corresponding strategy module to be tested; Associating the test logic data of each of the strategy modules to be tested according to the variable name of each of the target structure arrays; When it is determined based on the test logic data that the power system is in a normal working state, a pre-generated target test case is input into the strategy module to be tested to obtain a test report of the strategy module to be tested.

2. The method according to claim 1, characterized in that The converting of the pre-acquired multiple input information into multiple structure arrays, and converting the variables of each structure array into variables in a preset format, includes: Determining multiple information types corresponding to the multiple input information obtained in advance, and converting each input information into the corresponding structure array based on the information type; Based on a preset format conversion rule, each variable of the structure array is converted into a preset format variable.

3. The method according to claim 2, wherein The pre-acquired multiple input information includes first input information received via a communication channel and second input information collected locally; The determining of multiple information types corresponding to the multiple input information obtained in advance, and converting each input information into the corresponding structure array based on the information type, includes: Determining a plurality of information types corresponding to the first input information, and converting each piece of the first input information into a corresponding structure array based on the information type; A plurality of information types corresponding to the second input information are determined, and each piece of the second input information is converted into the corresponding structure array based on the information type.

4. The method according to claim 1, characterized in that: Before inputting the pre-generated target test case into the strategy module to be tested, the method further includes: Generate test cases to be selected based on the preset test requirements of each of the strategy modules to be tested and the operating conditions of the power system; A simulation test is performed on the test case to obtain a target test case that meets the preset test requirements of the policy module to be tested.

5. The method according to claim 4, characterized in that, The simulating test of the test case to obtain a target test case that meets the test requirements of the policy module to be tested includes: Combined with the data characteristics of the fault data of the historical engineering instance and the preset message action information, the test case is simulated and executed to obtain the target test case that meets the test requirements of the strategy module to be tested.

6. The method according to any one of claims 1 or 5, characterized in that The step of inputting the pre-generated target test case into the strategy module to be tested to obtain a test report for the strategy module to be tested includes: Input the target test case into the to-be-tested policy module and start the test execution program; the test execution program is used to simulate various fault scenarios; Based on the test execution program, input preset fault data into the to-be-tested policy module to obtain an output result; Compare the output result with the preset message action information. When the output result is consistent with the preset message action information, determine that the test result of the target test case passes; when the output result is inconsistent with the preset message action information, determine that the test result of the target test case fails and record the data corresponding to the test result; Generate the test report based on the test result.

7. A test device for a policy module, characterized in that, The device includes: A variable format conversion module, configured to convert a variety of pre-acquired input information into multiple structure arrays, and convert the variables of each of the structure arrays into preset format variables; the input information is used to represent the operating parameters in the power system; A target determination module, configured to determine the target structure array corresponding to each to-be-tested policy module in the multiple structure arrays based on the preset test requirements of each to-be-tested policy module, and input the target structure array into the corresponding to-be-tested policy module; A data association module, configured to associate the test logic data of each to-be-tested policy module according to the variable names of each target structure array; A report generation module, configured to input the pre-generated target test case into the to-be-tested policy module to obtain the test report of the to-be-tested policy module when it is determined that the power system is in a normal working state based on the test logic data.

8. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.

9. 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 method according to any one of claims 1 to 6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the method according to any one of claims 1 to 6.