Defect processing method and device for line loss monitoring software and storage medium
By monitoring the power grid data and building a graph neural network, quickly locate and repair defects in line loss monitoring software, the problem of difficulty in positioning defects in the existing technology without stopping the software is solved, ensuring the safe operation of the power grid.
Patent Information
- Application Number
- CN202510516391.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-23
- Publication Date
- 2025-08-05
- Estimated Expiration
- 2045-04-23
AI Technical Summary
The prior art is difficult to quickly locate and repair defects after online loss monitoring software is launched, especially when it does not stop working, especially when the line loss monitoring software discovers abnormal line loss based on the power grid data collected in real time, it is difficult to determine whether there are defects and repair them.
By monitoring the power grid data, determining the abnormal line loss type, building a graph neural network, determining the candidate defect set based on the abnormal line loss type, converting the source code into a syntax tree and converting it into an undirected graph, judging the defect node and modifying it.
It realizes rapid positioning and repairs the defects of the wire loss monitoring software, ensures safe operation of the power grid, and reduces the false alarm rate.
Smart Images

Figure CN120429150A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer program vulnerability detection and processing, and in particular to a defect processing method, device and storage medium for line loss monitoring software. Background Art
[0002] After the line-loss monitoring software is launched, it is necessary to determine whether it has defects, that is, whether it has a bug, without stopping its operation. When the line-loss monitoring software detects line loss anomalies based on real-time grid data (primarily voltage, current, real-time power, etc.), and determines that it is not a fault of the acquisition sensor and there is no human power theft, then the line-loss monitoring software has a defect. However, line-loss monitoring software generally consists of hundreds of thousands of lines of code. How to quickly locate the defect so that it can be repaired is a technical challenge. Summary of the Invention
[0003] The present invention aims to solve one or more technical deficiencies in the above-mentioned prior art and proposes the following technical solutions.
[0004] A method for handling defects in line loss monitoring software, the method comprising:
[0005] A monitoring step of processing the power grid data collected in real time by the line loss monitoring software to determine whether there is abnormal line loss and the type of the abnormal line loss;
[0006] a determining step of determining whether the abnormal line loss is caused by a defect in the line loss monitoring software;
[0007] a detection step of determining a candidate defect set for the line loss monitoring software based on the type of the abnormal line loss;
[0008] The processing steps include converting the source code of the line loss monitoring software into a syntax tree, converting the syntax tree into an undirected graph based on the conditional statements and memory operation statements in the source code, mapping each defect in the candidate defect set to a corresponding node in the undirected graph, and determining whether there is a logical error between the node corresponding to the defect and other nodes in the undirected graph. If so, the defect is regarded as a defect of the line loss monitoring software, and the source code corresponding to the node mapped to the defect is modified.
[0009] Furthermore, the operation of the monitoring step is: obtaining historical normal line loss values from the database of the line loss monitoring software, calculating the current line loss value based on the power grid data collected in real time by the line loss monitoring software, and determining whether there is abnormal line loss based on the current line loss value and the historical normal line loss value. If so, determining whether the current line loss type is high line loss or low line loss.
[0010] Furthermore, the operation of the determination step is: locating the position of the abnormal line loss based on the abnormal line loss, determining the identification of the corresponding sensor for collecting power grid data based on the position, obtaining historical data and current data of the sensor from the database of the line loss monitoring software based on the identification of the sensor, judging whether the sensor is faulty based on the historical data and current data, and if not, checking whether there is any human electricity theft at the location, and if not, determining that the line loss monitoring software has a defect.
[0011] Furthermore, the operation of the detection step is: based on the relationship between the constructed line loss type and the line loss monitoring software defect, based on the type of the abnormal line loss, determining the candidate defect set of the line loss monitoring software.
[0012] Furthermore, the operation of determining whether there is a logical error between the node corresponding to the defect and other nodes in the undirected graph is: constructing a graph of the graph neural network, using the nodes corresponding to the conditional statements and memory operation statements as key nodes of the graph of the graph neural network, and using other nodes in the undirected graph as secondary nodes of the graph of the graph neural network.
[0013] Furthermore, the characteristic value CKey of the key node node for:
[0014]
[0015] Among them, Key nodehop Indicates the number of hops of the shortest path from the key node to the node of the defect mapping;
[0016] The eigenvalue CSecond of the secondary node node for:
[0017]
[0018] Among them, Second nodehop Indicates the shortest path hop count from the secondary node to the node with defect mapping, Second keynodehop Indicates the number of hops on the shortest path from the secondary node to the key node.
[0019] Furthermore, the weights of the edges in the graph of the graph neural network are set as follows: 1>weight of the edge between key nodes>weight of the edge between key nodes and secondary nodes>weight of the edge between secondary nodes>0.
[0020] The present invention also proposes a defect processing device for line loss monitoring software, the device comprising:
[0021] The monitoring unit processes the power grid data collected in real time by the line loss monitoring software to determine whether there is abnormal line loss and the type of abnormal line loss;
[0022] a determining unit, determining that the abnormal line loss is caused by a defect in the line loss monitoring software;
[0023] a detection unit, which determines a candidate defect set of the line loss monitoring software based on the type of the abnormal line loss;
[0024] A processing unit converts the source code of the line loss monitoring software into a syntax tree, converts the syntax tree into an undirected graph based on conditional statements and memory operation statements in the source code, maps each defect in the candidate defect set to a corresponding node in the undirected graph, and determines whether there is a logical error between the node corresponding to the defect and other nodes in the undirected graph. If so, the defect is treated as a defect of the line loss monitoring software, and the source code corresponding to the node mapped to the defect is modified.
[0025] Furthermore, the operation of the monitoring unit is: obtaining historical normal line loss values from the database of the line loss monitoring software, calculating the current line loss value based on the power grid data collected in real time by the line loss monitoring software, and determining whether there is abnormal line loss based on the current line loss value and the historical normal line loss value. If so, determining whether the current line loss type is high line loss or low line loss.
[0026] Furthermore, the operation of the determination unit is: locating the position of the abnormal line loss based on the abnormal line loss, determining the identification of the corresponding sensor for collecting power grid data based on the position, obtaining historical data and current data of the sensor from the database of the line loss monitoring software based on the identification of the sensor, judging whether the sensor is faulty based on the historical data and current data, and if not, checking whether there is any human electricity theft at the position, and if not, determining that the line loss monitoring software has a defect.
[0027] Furthermore, the detection unit operates as follows: based on the relationship between the constructed line loss type and the line loss monitoring software defect, and based on the type of the abnormal line loss, a candidate defect set of the line loss monitoring software is determined.
[0028] Furthermore, the operation of determining whether there is a logical error between the node corresponding to the defect and other nodes in the undirected graph is: constructing a graph of the graph neural network, using the nodes corresponding to the conditional statements and memory operation statements as key nodes of the graph of the graph neural network, and using other nodes in the undirected graph as secondary nodes of the graph of the graph neural network.
[0029] Furthermore, the characteristic value CKey of the key nodenode for:
[0030]
[0031] Among them, Key nodehop Indicates the number of hops of the shortest path from the key node to the node of the defect mapping;
[0032] The eigenvalue CSecond of the secondary node node for:
[0033]
[0034] Among them, Second nodehop Indicates the shortest path hop count from the secondary node to the node with defect mapping, Second keynodehop Indicates the number of hops on the shortest path from the secondary node to the key node.
[0035] Furthermore, the weights of the edges in the graph of the graph neural network are set as follows: 1>weight of the edge between key nodes>weight of the edge between key nodes and secondary nodes>weight of the edge between secondary nodes>0.
[0036] The present invention further provides a computer-readable storage medium, wherein the storage medium stores computer program code, and when the computer program code is executed by a computer, any one of the above methods is executed.
[0037] The technical effect of the present invention is: a defect processing method, device and storage medium of line loss monitoring software of the present invention, monitoring step S101, processing the power grid data collected by the line loss monitoring software in real time, determining whether there is abnormal line loss and the type of the abnormal line loss; determining step S102, determining that the abnormal line loss is caused by a defect in the line loss monitoring software; detecting step S103, determining a candidate defect set of the line loss monitoring software based on the type of the abnormal line loss; processing step S104, converting the source code of the line loss monitoring software into a syntax tree, converting the syntax tree into an undirected graph according to the conditional statements and memory operation statements in the source code, mapping each defect in the candidate defect set to a corresponding node of the undirected graph, judging whether there is a logical error between the node corresponding to the defect and other nodes in the undirected graph, and if so, treating the defect as a defect of the line loss monitoring software, and modifying the source code corresponding to the node mapped to the defect. The present invention proposes determining a set of candidate defects of the line loss monitoring software based on the type of line loss, then converting the source code of the line loss monitoring software into a syntax tree, converting the syntax tree into an undirected graph according to the conditional statements and memory operation statements in the source code, mapping each defect in the candidate defect set to a corresponding node of the undirected graph, and judging whether there is a logical error between the node corresponding to the defect and other nodes in the undirected graph. If so, the defect is regarded as a defect of the line loss monitoring software, and the source code corresponding to the node mapped to the defect is modified.That is, after converting the source code into syntax, it is converted into an undirected graph based on the conditional statements and memory operation statements in the source code. That is, when converting the syntax tree into an undirected graph, the two types of nodes are converted as key nodes, and then a graph neural network is constructed to perform graph reasoning calculations. It can be concluded whether there are logical errors between the nodes corresponding to the defect and other nodes in the undirected graph, so that the defects of the software can be quickly located, thereby quickly restoring the normal monitoring function of the line loss software; another key point of the present invention is to construct a graph neural network to determine the defects of the software through graph operations. In the present invention, the main cause of the defects in the line loss software is attributed to the unexpected errors that may occur during the execution of conditional statements and memory operation statements, resulting in memory errors, memory leaks, acquisition thread suspension, and different acquisition threads. Therefore, when constructing the graph of the graph neural network, the nodes corresponding to the conditional statements and memory operation statements are taken as key nodes, and the remaining nodes are taken as secondary nodes. The characteristic values of the key nodes and secondary nodes are calculated based on the shortest path hops from the key node to the node of the defect mapping, the shortest path hops from the secondary node to the node of the defect mapping, and the shortest path hops from the secondary node to the key node (if the secondary node can reach multiple key nodes, the shortest path hops are selected among them), and a specific calculation formula is given. The graph neural network composition method, node weight calculation method, and edge weight setting method have been actually run in a local power grid line loss monitoring software, which can accurately discover the defects of the line loss monitoring software, reduce the false alarm rate of the line loss monitoring software, and ensure the safety of the power grid. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Other features, objects and advantages of the present application will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings.
[0039] Figure 1 The present invention is a flowchart of a method for handling defects in line loss monitoring software according to an embodiment of the present invention.
[0040] Figure 2 4 is a structural diagram of a defect handling device for line loss monitoring software according to an embodiment of the present invention. DETAILED DESCRIPTION
[0041] The present application will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely for the purpose of explaining the relevant invention and are not intended to limit the invention. It should also be noted that, for ease of description, only portions relevant to the relevant invention are shown in the accompanying drawings.
[0042] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in this application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0043] Figure 1 A defect handling method for line loss monitoring software of the present invention is shown, and the method includes:
[0044] Monitoring step S101, processing the power grid data collected in real time by the line loss monitoring software to determine whether there is abnormal line loss and the type of the abnormal line loss;
[0045] Determining step S102, determining that the abnormal line loss is caused by a defect in the line loss monitoring software;
[0046] Detection step S103, determining a candidate defect set of the line loss monitoring software based on the type of the abnormal line loss;
[0047] Processing step S104, converting the source code of the line loss monitoring software into a syntax tree, converting the syntax tree into an undirected graph based on the conditional statements and memory operation statements in the source code, mapping each defect in the candidate defect set to a corresponding node in the undirected graph, and determining whether there is a logical error between the node corresponding to the defect and other nodes in the undirected graph. If so, treating the defect as a defect of the line loss monitoring software and modifying the source code corresponding to the node to which the defect is mapped.
[0048] The present invention is to solve the problem of determining whether the line loss monitoring software has defects, that is, whether there is a Bug, after the line loss monitoring software is put into operation without stopping its operation. That is, when the line loss monitoring software finds that the line loss is abnormal based on the real-time collected power grid data (mainly voltage, current, real-time power, etc.), when it is determined that it is not a failure of the collection sensor and there is no human power theft, it is determined that the line loss monitoring software has a defect. However, software defects are difficult to find. After years of technical research, it is proposed to determine the candidate defect set of the line loss monitoring software based on the type of line loss, and then convert the source code of the line loss monitoring software into a syntax tree. According to the conditional statements and memory operation statements in the source code, the syntax tree is converted into an undirected graph, and each defect in the candidate defect set is mapped to the corresponding node of the undirected graph. It is judged whether there is a logical error between the node corresponding to the defect and other nodes in the undirected graph. If so, the defect is regarded as a defect of the line loss monitoring software, and the source code corresponding to the node mapped with the defect is modified. That is, after converting the source code into syntax, it is converted into an undirected graph based on the conditional statements and memory operation statements in the source code. That is, when converting the syntax tree into an undirected graph, the two types of nodes are converted as key nodes. Subsequently, a graph neural network is constructed to perform graph reasoning calculations. It can be concluded whether there are logical errors between the nodes corresponding to the defects and other nodes in the undirected graph, so that the defects of the software can be quickly located, thereby quickly restoring the normal monitoring function of the line loss software and ensuring the safe operation of the power grid. This is an important inventive concept of the present invention.
[0049] In one embodiment, the operation of the monitoring step S101 is: obtaining historical normal line loss values from the database of the line loss monitoring software, calculating the current line loss value based on the power grid data collected in real time by the line loss monitoring software, and determining whether there is abnormal line loss based on the current line loss value and the historical normal line loss value. If so, determining whether the current line loss type is high line loss or low line loss.
[0050] In one embodiment, the operation of the determination step S102 is: locating the position of the abnormal line loss based on the abnormal line loss, determining the identification of the corresponding sensor for collecting power grid data based on the position, obtaining historical data and current data of the sensor from the database of the line loss monitoring software based on the identification of the sensor, judging whether the sensor is faulty based on the historical data and current data, and if not, checking whether there is any human electricity theft at the position, and if not, determining that the line loss monitoring software has a defect.
[0051] In the monitoring step S101 and the determination step S102, the current line loss value is calculated based on the power grid data collected in real time by the line loss monitoring software, and the current line loss value is processed with the historical normal line loss value to determine whether there is abnormal line loss. If so, it is determined whether the current line loss type is high line loss or low line loss, and whether the sensor is faulty based on the historical data and the current data. Prediction processing can be performed through LSTM or an improved LSTM, or SVM, etc.
[0052] In one embodiment, the operation of the detection step S103 is: based on the constructed relationship between the line loss type and the line loss monitoring software defects, based on the type of the abnormal line loss, determine a candidate defect set of the line loss monitoring software.
[0053] In the present invention, defects corresponding to high line loss are defined: errors caused by the asynchronous threads of the current and voltage data collected by the line loss monitoring software in the power grid data, memory errors caused by excessive amount of collected data, errors caused by abnormal judgment statement process of the software itself, etc.
[0054] The defects corresponding to low line loss are defined: one of the threads collecting power grid data is suspended, resulting in no data being collected, software memory leaks, errors caused by abnormal judgment statement flow in the software itself, etc.
[0055] This is a key point of the present invention. By determining the type of line loss, the set of defects can be quickly determined, so that the nodes that may cause defects can be quickly located in the wireless graph. Subsequent operations based on graph neural networks can accurately locate which node is the root node causing the defect, so that the source code corresponding to the node can be modified and processed, thereby improving the accuracy of defect detection in the line loss monitoring software, thereby improving the rapid recovery application of the line loss software. This is one of the inventive points of the present invention, namely, determining the corresponding defect candidate set according to the different types of line loss.
[0056] In one embodiment, the operation of determining whether there is a logical error between the node corresponding to the defect and other nodes in the undirected graph is: constructing a graph of the graph neural network, using the nodes corresponding to the conditional statements and memory operation statements as key nodes of the graph of the graph neural network, and using other nodes in the undirected graph as secondary nodes of the graph of the graph neural network.
[0057] In one embodiment, the characteristic value CKey of the key node node for:
[0058]
[0059] Among them, Key nodehop Indicates the number of hops of the shortest path from the key node to the node of the defect mapping;
[0060] The eigenvalue CSecond of the secondary node node for:
[0061]
[0062] Among them, Second nodehop Indicates the shortest path hop count from the secondary node to the node with defect mapping, Second keynodehop Indicates the number of hops on the shortest path from the secondary node to the key node.
[0063] In one embodiment, the weights of the edges in the graph of the graph neural network are set as follows: 1> weight of the edge between key nodes> weight of the edge between key nodes and secondary nodes> weight of the edge between secondary nodes> 0. For example, the weight of the edge between key nodes is set to 0.5-0.8, the weight of the edge between key nodes and secondary nodes is set to 0.3-0.5, and the weight of the edge between secondary nodes is set to 0.1-0.3. The theoretical basis for this setting is that the main causes of defects in line loss monitoring software are conditional statements and memory operation statements. Therefore, the weights of the edges between the corresponding nodes can be assigned larger values. The weight of the edge between the key node and the secondary node is less than the weight between the key nodes, and the weight of the edge between these nodes is the smallest. This method is to improve the computational efficiency and defect prediction accuracy of the graph neural network, which is an inventive concept of the present invention.
[0064] Another key point of the present invention is to construct a graph neural network to determine the defects in the software through graph operations. In the present invention, the main reason for the defects in the line loss software is attributed to the unexpected errors that may occur during the execution of conditional statements and memory operation statements, resulting in memory errors, memory leaks, acquisition thread suspension, acquisition thread asynchrony, etc. Therefore, when constructing the graph of the graph neural network, the nodes corresponding to the conditional statements and memory operation statements are used as key nodes, and the remaining nodes are used as secondary nodes. The characteristic values of the key nodes and secondary nodes are calculated based on the shortest path hops from the key node to the node of the defect mapping, the shortest path hops from the secondary node to the node of the defect mapping, and the shortest path hops from the secondary node to the key node (if the secondary node can reach multiple key nodes, the shortest path hops are selected from them), and a specific calculation formula is given. The graph neural network composition method, node weight calculation method, and edge weight setting method have been actually run in a local power grid line loss monitoring software, which can accurately discover the defects of the line loss monitoring software, reduce the false alarm rate of the line loss monitoring software, and ensure the safe operation of the power grid. This is one of the important inventive points of the present invention.
[0065] Figure 2A defect handling device for line loss monitoring software of the present invention is shown, the device comprising:
[0066] A method for handling defects in line loss monitoring software, the method comprising:
[0067] The monitoring unit 201 processes the power grid data collected in real time by the line loss monitoring software to determine whether there is abnormal line loss and the type of abnormal line loss;
[0068] The determining unit 202 determines whether the abnormal line loss is caused by a defect in the line loss monitoring software;
[0069] The detection unit 203 determines a candidate defect set of the line loss monitoring software based on the type of the abnormal line loss;
[0070] The processing unit 204 converts the source code of the line loss monitoring software into a syntax tree, converts the syntax tree into an undirected graph based on the conditional statements and memory operation statements in the source code, maps each defect in the candidate defect set to a corresponding node in the undirected graph, and determines whether there is a logical error between the node corresponding to the defect and other nodes in the undirected graph. If so, the defect is treated as a defect of the line loss monitoring software, and the source code corresponding to the node mapped to the defect is modified.
[0071] The present invention is to solve the problem of determining whether the line loss monitoring software has defects, that is, whether there is a Bug, after the line loss monitoring software is put into operation without stopping its operation. That is, when the line loss monitoring software finds that the line loss is abnormal based on the real-time collected power grid data (mainly voltage, current, real-time power, etc.), when it is determined that it is not a failure of the collection sensor and there is no human power theft, it is determined that the line loss monitoring software has a defect. However, software defects are difficult to find. After years of technical research, it is proposed to determine the candidate defect set of the line loss monitoring software based on the type of line loss, and then convert the source code of the line loss monitoring software into a syntax tree. According to the conditional statements and memory operation statements in the source code, the syntax tree is converted into an undirected graph, and each defect in the candidate defect set is mapped to the corresponding node of the undirected graph. It is judged whether there is a logical error between the node corresponding to the defect and other nodes in the undirected graph. If so, the defect is regarded as a defect of the line loss monitoring software, and the source code corresponding to the node mapped with the defect is modified. That is, after converting the source code into syntax, it is converted into an undirected graph based on the conditional statements and memory operation statements in the source code. That is, when converting the syntax tree into an undirected graph, the two types of nodes are converted as key nodes. Subsequently, a graph neural network is constructed to perform graph reasoning calculations. It can be concluded whether there are logical errors between the nodes corresponding to the defects and other nodes in the undirected graph, so that the defects of the software can be quickly located, thereby quickly restoring the normal monitoring function of the line loss software and ensuring the safe operation of the power grid. This is an important inventive concept of the present invention.
[0072] In one embodiment, the operation of the monitoring unit 201 is: obtaining historical normal line loss values from the database of the line loss monitoring software, calculating the current line loss value based on the power grid data collected in real time by the line loss monitoring software, and determining whether there is abnormal line loss based on the current line loss value and the historical normal line loss value. If so, determining whether the current line loss type is high line loss or low line loss.
[0073] In one embodiment, the operation of the determination unit 202 is as follows: locating the position of the abnormal line loss based on the abnormal line loss, determining the identification of the corresponding sensor for collecting power grid data based on the position, obtaining the historical data and current data of the sensor from the database of the line loss monitoring software based on the identification of the sensor, judging whether the sensor is faulty based on the historical data and current data, and if not, checking whether there is any human electricity theft at the position, and if not, determining that the line loss monitoring software has a defect.
[0074] In the monitoring unit 201 and the determination unit 202, the current line loss value is calculated based on the power grid data collected in real time by the line loss monitoring software, and whether there is abnormal line loss is determined based on the current line loss value and the historical normal line loss value. If so, it is determined whether the current line loss type is high line loss or low line loss, and whether the sensor is faulty based on the historical data and the current data. Prediction processing can be performed through LSTM or an improved LSTM, or SVM, etc.
[0075] In one embodiment, the detection unit 203 operates to determine a candidate defect set of the line loss monitoring software based on the constructed relationship between the line loss type and the line loss monitoring software defect and based on the type of the abnormal line loss.
[0076] In the present invention, defects corresponding to high line loss are defined: errors caused by the asynchronous threads of the current and voltage data collected by the line loss monitoring software in the power grid data, memory errors caused by excessive amount of collected data, errors caused by abnormal judgment statement process of the software itself, etc.
[0077] The defects corresponding to low line loss are defined: one of the threads collecting power grid data is suspended, resulting in no data being collected, software memory leaks, errors caused by abnormal judgment statement flow in the software itself, etc.
[0078] This is a key point of the present invention. By determining the type of line loss, the set of defects can be quickly determined, so that the nodes that may cause defects can be quickly located in the wireless graph. Subsequent operations based on graph neural networks can accurately locate which node is the root node causing the defect, so that the source code corresponding to the node can be modified and processed, thereby improving the accuracy of defect detection in the line loss monitoring software, thereby improving the rapid recovery application of the line loss software. This is one of the inventive points of the present invention, namely, determining the corresponding defect candidate set according to the different types of line loss.
[0079] In one embodiment, the operation of determining whether there is a logical error between the node corresponding to the defect and other nodes in the undirected graph is: constructing a graph of the graph neural network, using the nodes corresponding to the conditional statements and memory operation statements as key nodes of the graph of the graph neural network, and using other nodes in the undirected graph as secondary nodes of the graph of the graph neural network.
[0080] In one embodiment, the characteristic value CKey of the key node node for:
[0081]
[0082] Among them, Key nodehop Indicates the number of hops of the shortest path from the key node to the node of the defect mapping;
[0083] The eigenvalue CSecond of the secondary node node for:
[0084]
[0085] Among them, Second nodehop Indicates the shortest path hop count from the secondary node to the node with defect mapping, Second keynodehop Indicates the number of hops on the shortest path from the secondary node to the key node.
[0086] In one embodiment, the weights of the edges in the graph of the graph neural network are set as follows: 1> weight of the edge between key nodes> weight of the edge between key nodes and secondary nodes> weight of the edge between secondary nodes> 0. For example, the weight of the edge between key nodes is set to 0.5-0.8, the weight of the edge between key nodes and secondary nodes is set to 0.3-0.5, and the weight of the edge between secondary nodes is set to 0.1-0.3. The theoretical basis for this setting is that the main causes of defects in line loss monitoring software are conditional statements and memory operation statements. Therefore, the weights of the edges between the corresponding nodes can be assigned larger values. The weight of the edge between the key node and the secondary node is less than the weight between the key nodes, and the weight of the edge between these nodes is the smallest. This method is to improve the computational efficiency and defect prediction accuracy of the graph neural network, which is an inventive concept of the present invention.
[0087] Another key point of the present invention is to construct a graph neural network to determine the defects in the software through graph operations. In the present invention, the main reason for the defects in the line loss software is attributed to the unexpected errors that may occur during the execution of conditional statements and memory operation statements, resulting in memory errors, memory leaks, acquisition thread suspension, acquisition thread asynchrony, etc. Therefore, when constructing the graph of the graph neural network, the nodes corresponding to the conditional statements and memory operation statements are used as key nodes, and the remaining nodes are used as secondary nodes. The characteristic values of the key nodes and secondary nodes are calculated based on the shortest path hops from the key node to the node of the defect mapping, the shortest path hops from the secondary node to the node of the defect mapping, and the shortest path hops from the secondary node to the key node (if the secondary node can reach multiple key nodes, the shortest path hops are selected from them), and a specific calculation formula is given. The graph neural network composition method, node weight calculation method, and edge weight setting method have been actually run in a local power grid line loss monitoring software, which can accurately discover the defects of the line loss monitoring software, reduce the false alarm rate of the line loss monitoring software, and ensure the safe operation of the power grid. This is one of the important inventive points of the present invention.
[0088] The graph neural network and LSTM used in the present invention need to be trained before use, and the corresponding training parameters such as learning rate, number of iterations, loss function, etc. need to be set.
[0089] In one embodiment of the present invention, a computer storage medium is provided, on which a computer program is stored. When the computer program on the computer storage medium is executed by a processor, the above-mentioned method is implemented. The computer storage medium can be a hard disk, DVD, CD, flash memory or other memory.
[0090] For the convenience of description, the above device is described as being divided into various units according to their functions. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0091] Through the description of the above embodiments, it can be seen that those skilled in the art can clearly understand that the present application can be implemented by means of software plus the necessary general hardware platform. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product can be stored in a storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the devices described in various embodiments of the present application or certain parts of the embodiments.
[0092] Finally, it should be noted that the above embodiments are only intended to illustrate rather than limit the technical solutions of the present invention. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that the present invention can still be modified or replaced by equivalents. Any modification or partial replacement that does not depart from the spirit and scope of the present invention should be included in the scope of the claims of the present invention.
Claims
1. A method for handling defects in line loss monitoring software, characterized in that: The method includes: A monitoring step of processing the power grid data collected in real time by the line loss monitoring software to determine whether there is abnormal line loss and the type of the abnormal line loss; a determining step of determining whether the abnormal line loss is caused by a defect in the line loss monitoring software; a detection step of determining a candidate defect set for the line loss monitoring software based on the type of the abnormal line loss; The processing steps include converting the source code of the line loss monitoring software into a syntax tree, converting the syntax tree into an undirected graph based on the conditional statements and memory operation statements in the source code, mapping each defect in the candidate defect set to a corresponding node in the undirected graph, and determining whether there is a logical error between the node corresponding to the defect and other nodes in the undirected graph. If so, the defect is regarded as a defect of the line loss monitoring software, and the source code corresponding to the node mapped to the defect is modified.
2. The method according to claim 1, characterized in that The operation of the monitoring step is: obtaining historical normal line loss values from the database of the line loss monitoring software, calculating the current line loss value based on the power grid data collected in real time by the line loss monitoring software, and determining whether there is abnormal line loss based on the current line loss value and the historical normal line loss value. If so, determining whether the current line loss type is high line loss or low line loss.
3. The method according to claim 2, characterized in that The operation of the determination step is: locating the position of the abnormal line loss based on the abnormal line loss, determining the identification of the corresponding sensor for collecting power grid data based on the position, obtaining historical data and current data of the sensor from the database of the line loss monitoring software based on the identification of the sensor, judging whether the sensor is faulty based on the historical data and current data, and if not, checking whether there is any human electricity theft at the position, and if not, determining that the line loss monitoring software has a defect.
4. The method according to claim 3, characterized in that The operation of the detection step is: based on the relationship between the constructed line loss type and the line loss monitoring software defect, based on the type of the abnormal line loss, determining the candidate defect set of the line loss monitoring software.
5. The method according to claim 4, characterized in that The operation of determining whether there is a logical error between the node corresponding to the defect and other nodes in the undirected graph is: constructing a graph of the graph neural network, using the nodes corresponding to the conditional statements and memory operation statements as key nodes of the graph of the graph neural network, and using other nodes in the undirected graph as secondary nodes of the graph of the graph neural network.
6. A defect handling device for line loss monitoring software, characterized in that: The device includes: The monitoring unit processes the power grid data collected in real time by the line loss monitoring software to determine whether there is abnormal line loss and the type of abnormal line loss; a determining unit, determining that the abnormal line loss is caused by a defect in the line loss monitoring software; a detection unit, which determines a candidate defect set of the line loss monitoring software based on the type of the abnormal line loss; A processing unit converts the source code of the line loss monitoring software into a syntax tree, converts the syntax tree into an undirected graph based on conditional statements and memory operation statements in the source code, maps each defect in the candidate defect set to a corresponding node in the undirected graph, and determines whether there is a logical error between the node corresponding to the defect and other nodes in the undirected graph. If so, the defect is treated as a defect of the line loss monitoring software, and the source code corresponding to the node mapped to the defect is modified.
7. The device according to claim 6, characterized in that The operation of the monitoring unit is as follows: obtaining historical normal line loss values from the database of the line loss monitoring software, calculating the current line loss value based on the power grid data collected in real time by the line loss monitoring software, and determining whether there is abnormal line loss based on the current line loss value and the historical normal line loss value. If so, determining whether the current line loss type is high line loss or low line loss.
8. The device according to claim 7, characterized in that The operation of the determination unit is as follows: locating the position of the abnormal line loss based on the abnormal line loss, determining the identification of the corresponding sensor for collecting power grid data based on the position, obtaining historical data and current data of the sensor from the database of the line loss monitoring software based on the identification of the sensor, judging whether the sensor is faulty based on the historical data and current data, and if not, checking whether there is any human electricity theft at the position, and if not, determining that the line loss monitoring software has a defect.
9. The device according to claim 8, characterized in that The detection unit operates as follows: based on the established relationship between the line loss type and the line loss monitoring software defect, and based on the type of the abnormal line loss, a candidate defect set of the line loss monitoring software is determined.
10. A computer storage medium, characterized in that The computer storage medium stores a computer program, and when the computer program on the computer storage medium is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Defect code positioning method and device and storage medium
CN112597063A
A Software Defect Localization Method Based on Graph Convolutional Neural Networks
CN114936158A
Active power distribution network line loss monitoring method, device and equipment and readable storage medium
CN115037039A
Software defect prediction method and system based on knowledge graph
CN117312809A
Abnormal positioning method and device, computer equipment and storage medium
CN118277271A