Power grid communication network combined fault diagnosis method and system
The graph neural network method is used to integrate and extract features from the equipment point data and network topology map of the power grid communication network, solving the problems of low fault handling efficiency and misjudgment in the field of joint fault diagnosis of the power grid communication network, and achieving efficient fault diagnosis and Boundary determination.
Patent Information
- Application Number
- CN202410689461.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-30
- Publication Date
- 2024-09-24
AI Technical Summary
There is a lack of effective methods and systems in the field of joint fault diagnosis of power grid communication networks, resulting in low fault handling efficiency, high possibility of misjudgment, and lack of cross-region and cross-network fault diagnosis capabilities.
The graph neural network method is used to integrate the equipment point data and network topology diagram of the power grid communication network. Through feature extraction and graph data structure construction, the graph neural network second classification task is performed to achieve accurate fault diagnosis. Specific steps include data fusion, feature extraction, graph data structure construction and model training. The PyTorchGeometric framework is used to optimize the graph neural network model.
It improves the accuracy and timeliness of fault diagnosis, reduces the time and cost of manual inspection, realizes joint fault boundary determination of power grid and communication network, and improves fault handling efficiency.
Smart Images

Figure CN118690224A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of power grid communication network joint fault diagnosis, and in particular to a power grid communication network joint fault diagnosis method and system. Background Art
[0002] As the power transmission and communication capabilities of the power grid communication network continue to improve, the reliability and stability requirements of communication equipment are also increasing. Since the communication network is an important basic guarantee facility for the operation of the power grid, and communication dispatching management is an important part of the power grid dispatching, the integrated control of communication and power grid is an important breakthrough point for improving the intelligent control capabilities of the power grid. Therefore, it is of great practical significance to realize the fault boundary determination of the power grid and the communication network, which can improve the ability and efficiency of fault handling, promote the realization of digital control and operation of the backbone optical communication system of the large power grid, and improve the intelligent control capabilities of the power grid.
[0003] At present, relatively mature graph neural network technologies and methods have been formed at home and abroad, such as the Graph Enhanced Memory Network (GAMENet), the dynamic graph recursive convolutional neural network model Dynamic-GRCNN, the conversation recommendation based on the neighborhood-aware graph neural network (NA-GNN), the graph convolutional neural network based on the global random graph, and other algorithms and technologies, which have proven their effectiveness in research and actual production.
[0004] In the field of joint fault diagnosis, some experts and scholars have proposed joint fault location algorithms based on bipartite graph models, joint fault location of communication information networks based on bipartite graph models, optical cable fault location technology based on the fusion of communication networks and positioning networks, and online location technology for optical cable faults based on the fusion of communication networks and positioning networks. These methods and systems are usually studies on joint fault diagnosis of other similar networks and equipment in power systems. Fault diagnosis is performed on fused features through methods such as naive Bayes, text mining, and binary search, forming a set of fault diagnosis methods and systems.
[0005] However, since the field of joint fault diagnosis of power grid and communication network is a professional field, there are problems such as failure to establish a complete fault-derived knowledge graph for various communication resource faults such as optical cables, transmission, power supply, etc. across regions and networks. In addition, the topological structure of the power grid and communication network is more suitable to be represented by a graph structure, and the graph neural network can model the overall characteristics of the data from both structural and functional aspects. Therefore, the research method of the graph neural network can be used to obtain an effective model.
[0006] In addition, most existing fault location and diagnosis methods lack research on joint fault diagnosis of power grid and communication network. Therefore, they are more for research and guidance, but do not solve the problems existing in the production process. At present, the backbone optical communication system has not formed a complete knowledge system for equipment fault handling, but relies on manual on-site inspection, equipment manual query, fault confirmation, reporting and maintenance. Manual query of equipment fault manual requires high time and labor costs, and there is a possibility of misjudgment. Summary of the invention
[0007] In view of the above-mentioned problems, the present invention is proposed.
[0008] Therefore, the technical problem solved by the present invention is: how to improve the operation and maintenance efficiency of the power grid and communication network and reduce the economic losses and safety risks caused by failures.
[0009] In order to solve the above technical problems, the present invention provides the following technical solutions: a power grid communication network joint fault diagnosis method, which comprises the following steps:
[0010] Integrate the equipment point data in the power grid communication network and the network topology diagram of the power grid communication network.
[0011] Perform feature extraction on the integrated data, build the first end-to-end data set, determine node features, edge relationships, and graph labels, characterize the components of the graph, and build a graph neural network model with data in the form of a graph.
[0012] In the figure, based on the first end-to-end dataset, the second end-to-end dataset is reconstructed, and the graph neural network binary classification task is performed. The graph neural network model is optimized through training, and the final binary classification result is output.
[0013] As a preferred solution of the power grid communication network joint fault diagnosis method described in the present invention, the equipment point data in the power grid communication network and the network topology diagram of the power grid communication network include two-endpoint topology data of relay protection and three-endpoint topology data of security control.
[0014] The data fusion includes image regression and principal component transformation.
[0015] By fusing text data, single data or data of different categories are integrated, and the channels between the two sites of the two-endpoint network topology of relay protection and the three-endpoint network topology of security control are merged into a one-to-one relationship.
[0016] The image regression is to subtract the original pixel value of the relay protection two-end point network topology data and the security control three-end point network topology data from the predicted value calculated by the regression equation to obtain the regression residual image of the relay protection two-end point network topology data and the security control three-end point network topology data.
[0017] The principal component transformation is to transfer the two-terminal topology data of relay protection and the three-terminal topology data of security control into principal component information by removing redundancy, summarize and eliminate the correlation of the data, and use a coefficient matrix or a covariance matrix to eliminate the correlation of the original data.
[0018] As a preferred solution of the power grid communication network joint fault diagnosis method described in the present invention, wherein: the construction of the first end-to-end data set and the determination of node characteristics, edge relationships, and graph labels are to characterize the components of the graph based on the characteristics of the original data, and the components of the graph include nodes, edges, and labels.
[0019] The node feature is a point where a fault alarm occurs in a fault. There are several nodes in the graph depending on how many fault alarms occur among the seven points. Referring to the features in the original data, the nodes are classified into features of four dimensions.
[0020] The features of the four dimensions include location, device type, alarm 1 type, and alarm 2 type.
[0021] The edge relationship is the connection status of the nodes, which is a fully connected undirected graph. According to the number of nodes, it can be summarized into four cases: 1, 2, 3, and 4 nodes.
[0022] The graph label includes a fault as a graph, the nodes in the graph are fault alarm points, the location of the fault belongs to the characteristics of the entire graph, and the graph label is set to indicate that when the fault location is the power grid, the graph label is 0, and when the fault location is the communication network, the graph label is 1.
[0023] According to the composition data of the graph, image regression and principal component transformation methods are used for fusion to build a complete end-to-end dataset.
[0024] As a preferred solution of the power grid communication network joint fault diagnosis method described in the present invention, wherein: the reconstruction of the second end-to-end data set is based on the first end-to-end data set, and the second end-to-end data set is constructed. PyTorchGeometric generalizes the convolution operator to a simple message passing API in an irregular domain, defines a message function, an update function, and selects an aggregation scheme.
[0025] As a preferred solution of the power grid communication network joint fault diagnosis method described in the present invention, wherein: the reconstructing the second end-to-end data set includes using the torch_geometric.data.Data class to build a graph, using the torch_geometric.data.Dataset class to build a graph data set, and checking the characteristics of the graph and the graph data set, and checking whether the constructed graph and graph data set meet the threshold.
[0026] If the threshold is met, the graph Mini-batch method is used to perform the PyTorchGeometric-based graph neural network binary classification task. If it is not met, it is rebuilt.
[0027] As a preferred scheme of the power grid communication network joint fault diagnosis method described in the present invention, the graph neural network binary classification task is to construct a graph neural network model, select Graph Convolutional Network as the main network layer of the graph neural network model, select ReLU function as the activation function, substitute the graph data into the graph neural network model for training, set the epoch value, output the accuracy and loss value of each epoch, and perform result analysis and model adjustment.
[0028] In the process of analyzing the training results, the batch_size, hidden_channels and lr parameters are adjusted according to the loss function oscillation to obtain the optimal parameters.
[0029] According to the binary classification results of the graph neural network based on PyTorchGeometric, fault knowledge is extracted, a fault database is established, and a binary classification of faults for the power grid and communication network is formed. When new faults and fault alarms occur, the graph neural network model is further used for classification and prediction.
[0030] Another object of the present invention is to provide a power grid and communication network joint fault diagnosis system, which can solve the problems of slow fault detection speed and low diagnostic accuracy of existing methods by efficiently integrating and analyzing data from the power grid and communication network.
[0031] To solve the above technical problems, the present invention provides the following technical solutions: a power grid communication network joint fault diagnosis system, comprising: a data fusion and preprocessing module, a feature extraction and data set construction module, a graph data structure construction module, and a model training and parameter optimization module.
[0032] The data fusion and preprocessing module integrates the equipment point data in the power grid communication network and the network topology diagram of the power grid communication network.
[0033] The feature extraction and dataset construction module extracts features from the integrated data and constructs the first end-to-end dataset.
[0034] The graph data structure construction module determines the node features, edge relationships, and graph labels, characterizes the components of the graph, and constructs a graph neural network model with the data in the form of a graph.
[0035] The model training and parameter optimization module reconstructs the second end-to-end dataset based on the first end-to-end dataset in the graph, performs the graph neural network binary classification task, optimizes the graph neural network model through training, and outputs the final binary classification result.
[0036] As a preferred solution of the power grid communication network joint fault diagnosis system described in the present invention, the data fusion and preprocessing module includes using image regression and principal component transformation methods to process the two-terminal topology data of relay protection and the three-terminal topology data of security control.
[0037] The data fusion includes integrating single data or data of different categories, and merging the channels between two sites of the relay protection two-end point network topology and the security control three-end point network topology into a one-to-one relationship.
[0038] The image regression is to subtract the original pixel value of the relay protection two-end point network topology data and the security control three-end point network topology data from the predicted value calculated by the regression equation to obtain the regression residual image of the relay protection two-end point network topology data and the security control three-end point network topology data.
[0039] The principal component transformation is to transfer the two-terminal topology data of relay protection and the three-terminal topology data of security control into principal component information by removing redundancy, summarize and eliminate the correlation of the data, and use a coefficient matrix or a covariance matrix to eliminate the correlation of the original data.
[0040] The feature extraction and dataset construction module includes characterizing the components of the graph according to the characteristics of the original data, determining the node characteristics, edge relationships, and graph labels, fusing the graph's component data using image regression and principal component transformation methods, and constructing a complete end-to-end dataset.
[0041] The graph data structure construction module includes building a second end-to-end dataset based on the first end-to-end dataset, PyTorchGeometric generalizes the convolution operator to a simple message passing API in irregular domains, defines message functions, update functions and selects aggregation schemes, uses the Data and Dataset classes in PyTorchGeometric to build a data structure suitable for graph neural networks, and uses node feature matrices, edge indices and graph labels to define the structure of the graph.
[0042] The model training and parameter optimization module includes using the PyTorchGeometric graph neural network architecture to train and optimize the model, set network parameters, select activation functions, and adjust the learning rate, monitor the loss value and accuracy during training, and find the optimal network parameter settings.
[0043] A computer device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the above-mentioned power grid and communication network joint fault diagnosis method are implemented.
[0044] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the above-mentioned method for joint fault diagnosis of a power grid and a communication network.
[0045] Beneficial effects of the present invention: The present invention integrates the power grid business segment information and the communication network transmission segment information, realizes the fault analysis of the entire link channel based on the integration of various types of information, and improves the efficiency of defensive business channel fault handling from the entire link level. The present invention realizes the application of graph neural networks in the joint diagnosis of power grids and communication networks, and obtains a model that can be widely used in the joint fault diagnosis of power grids of all levels and types and their communication networks, helping to improve the accuracy and timeliness of fault location diagnosis. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:
[0047] Figure 1 An overall flow chart of a power grid communication network joint fault diagnosis method provided by the first embodiment of the present invention;
[0048] Figure 2 The principle of the Mini-batch method in the figure of a power grid communication network joint fault diagnosis method provided by the first embodiment of the present invention;
[0049] Figure 3 A data comparison diagram in a power grid communication network joint fault diagnosis method provided by the first embodiment of the present invention;
[0050] Figure 4 An image of a ReLU function of a power grid communication network joint fault diagnosis method provided by the first embodiment of the present invention;
[0051] Figure 5 A main part diagram of a 3-layer GCN model of a power grid communication network joint fault diagnosis method provided by the first embodiment of the present invention;
[0052] Figure 6 A graph pooling layer of a power grid and communication network joint fault diagnosis method provided by the first embodiment of the present invention;
[0053] Figure 7 A fully connected layer diagram of a power grid communication network joint fault diagnosis method provided by the first embodiment of the present invention;
[0054] Figure 8 A loss function diagram of a power grid communication network joint fault diagnosis method provided by the first embodiment of the present invention;
[0055] Fig. 9 An overview diagram of a network model of a power grid communication network joint fault diagnosis method provided by the first embodiment of the present invention;
[0056] Fig.10 A power grid and communication network joint fault diagnosis system structure is provided for the first embodiment of the present invention. DETAILED DESCRIPTION
[0057] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.
[0058] Example 1
[0059] Reference Figure 1 As an embodiment of the present invention, a power grid and communication network joint fault diagnosis method is provided, which is characterized by:
[0060] In recent years, deep learning technology has been widely used in many fields, such as image processing and natural language understanding, and is mainly used to process Euclidean data in the form of images, voice, text, etc. However, deep learning technology has always been difficult to efficiently process unstructured graph data. As a general data representation method that mainly describes relationships, graphs can naturally represent the complex relationships between entities in real scenarios, and have a wider range of application scenarios in the industry. For example, in scenarios such as social networks and the Internet of Things, data often appears in the form of graphs. Inspired by deep learning technology, Marco Gori first combined deep learning technology with graph data in 2005 and proposed the concept of Graph Neural Networks (GNN), which enabled deep learning to be effectively used in scenarios related to graph data. GNN has a wide range of applications, including pharmaceutical medicine, traffic flow, recommendation systems, image processing, and other fields.
[0061] In the field of pharmaceutical medicine, a graph-enhanced memory network (GAMENet) was proposed, which integrates drug-drug interaction knowledge graphs by implementing a storage module of a graph convolutional network and models longitudinal patient records as queries. After end-to-end training, it can provide safe and personalized drug combination recommendations. In the field of traffic flow, Peng proposed a new dynamic graph recursive convolutional neural network model Dynamic-GRCNN to more accurately predict urban traffic passenger flow and capture the spatiotemporal nature of traffic passenger flow, achieving good results in both effectiveness and efficiency of prediction. In the field of recommendation systems, He Qianqian et al. proposed a conversational recommendation based on neighborhood-aware graph neural network (NA-GNN), which combines the item representations of the conversation layer and the global neighborhood layer captured by the attention mechanism aggregation, and maximizes the mutual information between conversation sequences into network training, thereby improving the performance of conversational recommendation. In the field of image processing, Zhang Chaozi proposed a graph convolutional neural network based on a global random graph and applied it to hyperspectral remote sensing image classification. In the field of environmental resources, Li explored the application potential of graph neural network (GNN) technology in the field of heavy metal prediction for the first time, improving the prediction accuracy.
[0062] Of course, there is no shortage of applications of graph neural networks in the fields of power grids and communication networks, because power grids and communication networks are very suitable for expression with graph structures. Tian Shuo proposed a smart grid anomaly detection algorithm based on graph neural networks. On the basis of building the smart grid as a graph model, he further built a graph neural network detection model to achieve an effective anomaly detection algorithm. Wang Zhengcheng proposed a method for transient stability assessment of power systems based on steady-state data based on a message passing graph neural network (MPNN), which has better performance in operating scenario data sets with frequent topology changes and has stronger generalization capabilities. Nauck Christian studied the application of different graph neural networks (GNNs) to predict the stability of complex power grid synchronization dynamics and compared the performance.
[0063] However, there are not many studies on the application of graph neural networks in the fault location and diagnosis of power grids and communication networks, let alone the research on the joint fault location and diagnosis of power grids and communication networks. Xu Kehang et al.
[28] proposed a research method for quantitative calculation of power communication network faults based on graph convolutional neural networks, which achieved accurate quantitative calculation of fault indicators based on alarm information in the power communication network, thereby supporting the design and deployment of more flexible and scalable fault alarm systems. Jonas Teixeira de Freitas proposed an automatic fault location method for distribution networks based on gated graph neural networks. The main advantage is that it is immune to network reconstruction and allows a single trained model to be used on multiple feeders.
[0064] According to the above content, there are many studies on fault location diagnosis in the field of power grid or communication network, but there is a lack of research on joint fault diagnosis of power grid and communication network. Considering that the communication network is an important basic guarantee facility for power grid operation, communication dispatching management is an important part of power grid dispatching, and realizing the integrated regulation of communication and power grid is an important breakthrough point for improving the intelligent regulation capability of power grid. Therefore, this study focuses on the joint fault diagnosis of power grid and communication network. In terms of research methods, although the naive Bayes, text mining, binary search and other methods used in previous studies can also realize fault diagnosis, considering that the topological structure of power grid and communication network is more suitable for representation by graph structure, and graph neural network can model the overall characteristics of data from two aspects: structure and function. Structure refers to the mutual correlation of existing data itself, and function refers to the process of information propagation and mutual influence in the graph, which is very suitable for describing the structural pattern of mutual connection and influence between power grid and communication network. Therefore, this paper adopts the research method of graph neural network, aiming to first construct a joint model of power grid and communication network, and then abstract the jointly constructed network topology structure into a graph structure, so as to realize the application of graph neural network in the joint diagnosis of power grid and communication network, and obtain a model that can be widely used in joint fault diagnosis of power grids of all levels and types and their communication networks, which helps to improve the accuracy and timeliness of fault location diagnosis.
[0065] The purpose of this method invention is to solve the core problems in the field of joint fault diagnosis of power grid communication network, such as how to deepen the communication digitization of the integration of communication and power grid, how to reduce the impact of communication system operation adjustment on the safe operation of power grid, and how to achieve end-to-end rapid positioning of communication faults integrated with large power grid. The deep learning methods such as graph neural network related theories and feature engineering are used to overcome the difficulties of ultra-long distance, cross-level and cross-network of large power grid communication system, and improve the accuracy of fault boundary determination of power grid and communication network. At the same time, machine learning methods such as Mini-batch method of graph and PyTorchGeometric framework are introduced to design graph neural network model: extract graph structure, specify the category and scale of graph, design loss function, and use calculation module to build model. This method invention establishes a relatively complete set of joint fault diagnosis methods for power grid communication network, realizes the joint fault boundary determination of power grid and communication network, helps to reduce the time and energy consumed by manual on-site investigation, improves the ability and efficiency of fault handling, and promotes the realization of digital control and operation of large power grid backbone optical communication system.
[0066] Graph neural network (GNN) is an important technical means in machine learning. Whether in the fields of pharmaceutical medicine, traffic flow, recommendation system, image processing, etc., strict requirements are placed on the processing flow and data of graph neural network.
[0067] However, the field of joint fault diagnosis of power grid communication network is a professional field. There are problems such as the lack of integration of communication dispatching and power grid dispatching in terms of business processes and business data, and the lack of communication and power grid fault event transmission derivative models. When a fault occurs, it is impossible to conduct collaborative analysis and quickly determine the fault boundary. The existing joint fault diagnosis methods and systems in professional fields are mostly conducted on-site by consuming manpower, and the efficiency of fault handling is low. On-site investigation by manpower will bring high labor costs and maintenance costs, and it is difficult to migrate and apply the model, and it is difficult to promote the sustainable development of the knowledge system. The model trained and migrated in the open field will face the problems of high model training cost, poor applicability, and unsatisfactory output effect. In addition, most of the existing technologies cannot establish a complete fault derivative knowledge graph for various communication resource faults such as optical cables, transmission, power supply, etc. across regions and networks, so it is impossible to achieve full-route end-to-end cause analysis of communication faults. When a fault occurs, it is impossible to quickly locate the cause, and it is difficult to make emergency plans efficiently and accurately, and it is difficult to form an effective joint fault diagnosis model.
[0068] Currently, we have data and information about each device. When a fault occurs, these devices may be the fault point, the fault alarm point, or nothing at all. However, when diagnosing a fault, we must combine the data and information of these device points. Therefore, the joint strategy is to conduct joint search and detection of these device points, aggregate their data and information for joint fault diagnosis.
[0069] The joint search and detection of equipment points in the power grid and communication network requires the determination of two elements: one is the equipment points to be searched and detected, and the other is the search and detection path, that is, the relationship between these equipment points.
[0070] The equipment locations subject to search and detection and the search and detection paths will be determined based on the characteristics of the power grid and communication network, the experience of professional employees and historical data, and will be determined based on the actual operation of the physical entities of the existing power grid and communication network, and on the principles of comprehensiveness and simplicity.
[0071] After determining the equipment points to be searched and detected, and the search and detection paths, a network topology diagram that combines the data and information of the equipment points of the power grid and the communication network can be obtained. When a fault occurs, the equipment points where the fault alarm occurs and the relationship between the points are extracted into a network topology subgraph. By analyzing the data and information on the network topology subgraph, it can be determined whether the fault occurred in the power grid or the communication network, that is, the graph attributes of the network topology subgraph are classified into two categories. In this way, the location of the fault can be jointly diagnosed. If it is in the power grid, the power grid will be further checked later; if it is in the communication network, the communication network will be further checked later. In this way, at least half of the time and manpower can be saved, and the speed and efficiency of fault discovery and handling can be greatly accelerated.
[0072] The purpose of the present invention is to overcome the shortcomings of the prior art, such as high training cost and poor applicability. The fault boundary judgment of the power grid and communication network is realized through the fault-derived knowledge graph, the power grid and communication network related data, etc., and the joint network topology involved is determined according to the joint strategy, which helps to integrate the power grid business segment information and the communication network transmission segment information. Based on the integration of various types of information, the fault judgment of the full-link channel is realized, and the efficiency of defensive business channel fault handling is improved from the full-link level.
[0073] S1. Through the data fusion method, one of the following operations is performed on the power grid communication network data such as the relay protection "two-end point" topology data and the security control "three-end point" topology data of the network topology diagram of the data and information of the equipment points of the joint power grid communication network: image regression, principal component transformation;
[0074] S2. Use feature extraction and construction to build a complete end-to-end data set, determine node features, edge relationships, graph labels, and classify nodes into the following categories: location of alarm point, device type of alarm point, alarm 1 type of alarm point, and alarm 2 type of alarm point. Repeat step (1) to perform data fusion and perform model training again;
[0075] S3. Based on the end-to-end dataset improved in step (2), the end-to-end dataset is reconstructed using the graph representation in PyTorchGeometric. The reconstruction is performed according to the following steps:
[0076] The torch_geometric.data.Data class builds a graph, uses the torch_geometric.data.Dataset class to build a graph dataset, and checks the graph and graph dataset. The graph dataset trained in steps (2) and (3) can be directly input into the PyTorchGeometric-based graph neural network framework for processing and training.
[0077] S4. Integrate the graph datasets in step (2) and step (3), use the graph mini-batch to perform binary classification of graph neural network based on PyTorchGeometric, study the characteristics of the dataset to determine the parameters, improve the network model and train it, and adjust the parameters according to the training results during the training process;
[0078] S5. Based on the binary classification results of the graph neural network based on PyTorchGeometric established in step (4), the fault knowledge is extracted and a fault database is established to form a binary classification of faults for the power grid and the communication network.
[0079] It should be further explained that the machine learning and deep learning frameworks have no specific requirements for the data format of input training. For custom data sets, as long as the data preprocessing is done, it can be directly input for training. However, the PyTorchGeometric framework and library have specific format requirements for the data and data sets input for neural network training, namely the torch_geometric.data.Data class and the torch_geometric.data.Dataset class. Therefore, for custom data sets, after completing the data preprocessing, the processed data and data sets need to be reconstructed and stored according to the PyTorchGeometric data format.
[0080] S1. Data fusion methods include image regression, principal component transformation, etc. By fusing text data, single data or data of different categories can be integrated to eliminate the redundancy and contradiction between multi-source data, complement each other, improve the timeliness and reliability of data extraction, and improve the efficiency of data use. This study focuses on the microscopic "end-to-end" and the channel between two sites. Since the channels between the two sites of the two-end network topology of relay protection and the three-end network topology of security control are "one-to-one", the two data sets can be combined for consideration. The process of each method is as follows:
[0081] Image regression: First, assume that the pixel value of the two-terminal network topology data of relay protection is a linear function of the three-terminal network topology data of security control, and perform regression using the least squares method. Then, use the predicted value calculated by the regression equation to subtract the original pixel value of the data to obtain the regression residual image of the two data.
[0082] Principal component transformation: By removing redundancy and transferring the remaining [protection] and [security control] data information into a small amount of information (i.e., principal components), a large amount of data is summarized and correlation is eliminated, and a correlation coefficient matrix or covariance matrix is used to eliminate the correlation of the original data to achieve the purpose of removing redundancy.
[0083] S2. Use feature extraction and well-constructed end-to-end datasets to characterize the components of the graph based on the features of the original data. The components of the graph include nodes, edges, labels, etc. The specific process is as follows:
[0084] Node features: A node is a point where a fault alarm occurs in a fault. There are several nodes in this graph depending on how many fault alarms occur among the seven points. Referring to the features in the original data, set the features of the nodes in four dimensions: location, device type, alarm 1 type, and alarm 2 type.
[0085] Edge relationship: It refers to the connection status of nodes. The edge relationship is relatively simple, and it is a fully connected undirected graph. Therefore, it can be summarized into four cases with 1, 2, 3, and 4 nodes according to the number of nodes.
[0086] Graph label: A fault is a graph, and the nodes in the graph are the fault alarm points. The location of the fault belongs to the characteristics of the entire graph, and a graph label should be set to represent it. When the fault is located in the power grid, the graph label is 0; when the fault is located in the communication network, the graph label is 1.
[0087] S3. Based on the end-to-end dataset improved in step 2, reconstruct the end-to-end dataset using the graph representation in PyTorchGeometric. PyTorch Geometric (PyTorchGeometric) provides a simple message passing API that can generalize the convolution operator to irregular domains. It only requires defining message functions, update functions, and selecting aggregation schemes to achieve better performance than the method implemented by matrix multiplication. The specific process is as follows:
[0088] Use the torch_geometric.data.Data class to build a graph: an object in the torch_geometric.data.Data class represents a graph, where x represents the feature matrix of the node, edge_index represents the relationship between the edges in the graph, and y represents the training label; a graph has a graph-level label of 0, then the y attribute of this graph is data.y = tensor([0], dtype = tensor.long), and when viewing the entire data object, it is displayed as data = Data(y = [1], ..., ...).
[0089] Use the torch_geometric.data.Dataset class to build a graph dataset: The torch_geometric.data.Dataset class is used to build large, non-memory datasets; it has two more main functions than the torch_geometric.data.InMemoryDataset class, and supports subsequent Mini-batch. The functions and methods that need to be rewritten in the class include the __init__() function, raw_file_names() function, process() function, get() function, etc.
[0090] Checking graphs and graph datasets: After building a graph using the torch_geometric.data.Data class and a graph dataset using the torch_geometric.data.Dataset class, you can use the methods and properties of the classes and objects to view some features of the graph and graph dataset, and also to check whether the graph and graph dataset are successfully built as required.
[0091] It should be further explained that in PyTorchGeometric, an object in the torch_geometric.data.Data class is used to represent a graph. The class and object have the following main default properties:
[0092] x: represents the feature matrix of the node. The essential shape is an n*m matrix, where n represents the number of nodes in this graph and m represents the dimension of the node features; when viewing the entire data object, the shape is [num_nodes, num_node_features], where num_nodes represents the number of nodes in this graph and num_node_features represents the dimension of the node features.
[0093] The method to construct the x attribute of the data object is to assign the n*m tensor value to the x attribute according to the graph to be constructed, and then use data=Data(x=x, ..., ...) to use the Data class to write the x attribute into the data object.
[0094] For example, a graph has 3 nodes, each node has a 4-dimensional feature, namely [1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], then the x attribute of this graph is data.x = tensor([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]], dtype = torch.long), and when viewing the entire data object, it is displayed as data = Data(x = [3, 4], ..., ...).
[0095] edge_index: indicates the relationship between edges in the graph. Instead of using an adjacency matrix, the COO format is used. The essential shape is a 2*n matrix, where n represents the number of edges in the graph; when viewing the entire data object, the shape is [2, num_edges], where num_edges represents the number of edges in the graph.
[0096] COO is a method used to describe sparse matrices. Simply put, non-zero elements in the matrix are represented by coordinates and values, and zero elements are not represented to save space. In edge_index, the first row indicates the starting point number of all edges, and the second row indicates the target node number corresponding to the edge.
[0097] The method to construct the edge_index attribute of the data object is to assign a 2*n tensor value to the edge_index attribute according to the graph to be constructed, and then use data=Data(edge_index=edge_index, ..., ...) to use the Data class to write the edge_index attribute into the data object.
[0098] For example, an undirected graph (note that if two nodes in an undirected graph are connected, there are two opposite edges between the two nodes) has three nodes, node 1 is connected to node 2, and node 2 is connected to node 3, that is, there are four edges. Then the edge_index attribute of this graph is edge_index = tensor([[0, 1, 1, 2], [1, 0, 2, 1]], dtype = tensor.long), and when viewing the entire data object, it is displayed as data = Data(edge_index = [2, 4], ..., ...).
[0099] y: represents the training label (may have any shape). If it is a node-level label, the essential shape is an n-dimensional vector, where n is the number of nodes in the graph; when viewing the entire data object, the shape is [num_nodes], where num_nodes is the number of nodes in the graph. If it is a graph-level label, the essential shape is a 1-dimensional vector; when viewing the entire data object, the shape is [1].
[0100] The method to construct the y attribute of the data object is to assign a 1*n or 1*1 tensor value to the y attribute according to the graph to be constructed, and then use data=Data(y=y, ..., ...) to use the Data class to write the y attribute into the data object.
[0101] For example, if a graph has a graph-level label of 0, then the y attribute of this graph is data.y = tensor([0], dtype = tensor.long), and when viewing the entire data object, it is displayed as data = Data(y = [1], ..., ...).
[0102] Use the torch_geometric.data.Dataset class to build a graph dataset
[0103] After building the graph using the torch_geometric.data.Data class, you need to put them into a dataset to form a PyTorchGeometric standard format graph dataset that can be used for storage and subsequent training. The above process of building a graph using the torch_geometric.data.Data class is only part of the process of building a graph dataset using the PyTorchGeometric class.
[0104] The PyTorchGeometric framework and library provide two base classes for building datasets: the torch_geometric.data.Dataset class and the torch_geometric.data.InMemoryDataset class. The torch_geometric.data.InMemoryDataset class inherits the torch_geometric.data.Dataset class, indicating whether the entire dataset is loaded into memory.
[0105] The difference between these two classes is that the torch_geometric.data.Dataset class is used to build large, non-memory datasets, while the torch_geometric.data.InMemoryDataset class is used to build small, memory datasets. In addition, the torch_geometric.data.Dataset class has two more main functions than the torch_geometric.data.InMemoryDataset class, and supports subsequent Mini-batch. The present invention chooses to use the torch_geometric.data.Dataset class to build a graph dataset.
[0106] First of all, according to the custom of torchvision, each dataset needs to specify a root directory, which needs to be divided into two folders, one is the raw_dir folder, which indicates the storage location of the downloaded raw data, and the other is processed_dir, which indicates the storage location of the processed dataset.
[0107] The following is a detailed description of the functions and rewriting methods that need to be rewritten in the torch_geometric.data.Dataset class:
[0108] __init__() function: used for initialization. Transform, pre_transform and pre_filter are all None by default. The transform() function is used for dynamic transformation of data objects before they are loaded and used (generally used for data enhancement); the pre_transform() function is used for transformation of data objects before they are saved to disk, that is, it is called before the data files in processed_dir are obtained (generally used for complex preprocessing processes that only need to be calculated once); the pre_filter() function is used for filtering before data is saved. In the research of this invention, these operations are not required, so they are all set to None.
[0109] raw_file_names() function: used to return a string list of all data file names stored in the raw_dir directory, in the form of ['file_1', 'file_2, ...'], which is used for the download check process. In order to avoid duplicate downloads, when downloading a dataset, it will check whether a file with the same name already exists. If it already exists, it will not be downloaded repeatedly, but the corresponding file will be returned directly. Since the research in this invention is a custom dataset, it does not need to be downloaded, so it is sufficient to directly return the original dataset file name to be used.
[0110] processed_file_names() function: used to return a string list of the file names of all processed data stored in the processed_dir directory, in the form of ['data1.pt', 'data2.pt', ...], which is used for the inspection process when processing data. In order to avoid repeated processing of data, when the data is processed, it will detect whether a processed file with the same name already exists. If it already exists, it will not be processed repeatedly, but the corresponding file will be returned directly. The present invention studies storing a picture as a file, which will result in more files and a longer file list, so the idx parameter is added to help define the storage file name and subsequent retrieval.
[0111] download() function: used to download data to the raw_dir directory. Since the research in this invention is a custom data set, no download is required, so a pass is directly written to this function to skip the data download step.
[0112] process() function: used to process the data in raw_dir and store it in processed_dir. This function is the core of the entire data set creation process, and it is necessary to design the data reading logic, processing logic, and storage logic in it.
[0113] The data reading logic is to use the pandas library to read the contents of the excel file, which can be easily implemented using the read_excel() function in the pandas library.
[0114] The data processing logic is the content of "Using torch_geometric.data.Data class to build a graph" mentioned above, which can be summarized as follows: according to the graph to be built, assign a tensor value of n*m to the x attribute, a tensor value of 2*n to the edge_index attribute, and a tensor value of 1*n or 1*1 to the y attribute, and then use data=Data(x=x, edge_index=edge_index, y=y) to use the Data class to write the three attributes of x, edge_index, and y into the data object.
[0115] The data storage logic is to use the save() function of the torch library to implement storage. The torch.save() function needs to pass two parameters, namely the data to be stored and the stored file object; the os.path.join() function is used to connect the two path name components, namely the file path and the file name, to form a complete file object as the second parameter of the torch.save() function. In addition, since the present invention studies the storage of a graph as a file, the idx variable is added to the file name parameter to help define the stored file name and facilitate subsequent access. The file name is numbered according to the order in which the data is processed and stored.
[0116] len() function: used to return the number of files in a dataset, which is unique to the torch_geometric.data.Dataset class. Returns the number of files of processed data in the processed_dir directory; since the processed_file_names function returns a string list of the file names of processed data, the len function is used to return the length of the list returned by the processed_file_names function. In the present invention, a graph is stored as a file, and the number of files in a dataset is the number of graphs in the dataset. This function can be used to check the number of graphs in the dataset, and whether the graphs that need to be processed and stored in the dataset have been successfully processed and stored.
[0117] get() function: used to implement the loading logic for a single data (generally a single graph in the case of a graph dataset). The dataset studied in this invention is a graph dataset, that is, it is used to load and retrieve a single graph from a dataset, and is implemented using the load() function of the torch library. The torch.load() function needs to pass a parameter, which is a file object or a string containing a file name, and then uses the os.path.join() function to connect the two path name components, namely the file path and the file name, to form a complete file object as a parameter of the torch.load() function; the file name parameter also needs to pass the idx parameter to pass the number in the file name to be loaded and retrieved, and the file path is the above-mentioned process_dir.
[0118] After building the graph using the torch_geometric.data.Data class, use
[0119] After the torch_geometric.data.Dataset class builds the graph dataset, you can use the methods and attributes of the class and object to view some characteristics of the graph and graph dataset, and also check whether the graph and graph dataset are successfully built as required.
[0120] The methods and properties of the two classes torch_geometric.data.Data and torch_geometric.data.Dataset are shown in Table 1.
[0121] Table 1 Methods and properties of Dataset and Data classes
[0122]
[0123] After building a graph using the torch.geometric.Data class and a graph dataset using the torch_geometric.data.Dataset class, you need to partition the dataset to support subsequent experiments. The steps required to partition the dataset and the properties and methods used are as follows:
[0124] (1) Setting the random number seed: To facilitate the subsequent reproduction of the training process and results and to facilitate comparison and improvement of experiments, the manual.seed() function of the torch class is used to generate a random number seed on the CPU.
[0125] (2) Shuffle the order of the data set: In order to reduce the impact of the data set order on the training results, select the shuffle() function to shuffle the constructed data set.
[0126] (3) Select the method and ratio for dividing the data set: In machine learning algorithms, there are generally three methods for dividing the data set: holdout method, cross-validation method, and bootstrap method. Each method is suitable for different data sets and scenarios. It is necessary to reasonably select the most appropriate data set division method based on the characteristics of the data set.
[0127] The data set division ratio will affect the experimental results to a certain extent. If the test set is too small, the variance of the evaluation results will increase; if the training set is too small, the deviation will be too large. Therefore, 2 / 3 to 4 / 5 of the samples are generally used as the training set. Common data set division ratios include 7:3, 7.5:2.5, 8:2, etc.
[0128] (4) Check the divided data set: After dividing the data set, you can output the number of data in the training set and the test set to confirm that the data set has been divided as required.
[0129] S4. Integrate the graph datasets in steps 2 and 3, and use the graph mini-batch to perform PyTorchGeometric-based s. Usually, you can use the open source artificial neural network library Keras, the Torch-based machine learning library Pytorch, the end-to-end open source machine learning platform TensorFlow and other dependent libraries and platforms for programming and model learning. The specific process is as follows:
[0130] Reference Figure 2 In the graph mini-batch method, the adjacency matrix is stacked in a diagonal manner, that is, a huge graph containing multiple independent subgraphs is created, and the node dimensions in the node and target features are simply connected. For example, A1 is Figure 2 The adjacency matrix of Figure 2 The node feature matrix of Figure 2 The adjacency matrix of Figure 2 A1 and A2 are stacked in a diagonal manner (it can be regarded as a diagonal matrix because there are many 0 elements, that is, sparse matrix storage), X1 and X2 are simply connected up and down, and then the adjacency matrix and the node feature matrix are combined to form a large graph containing two independent subgraphs, realizing the parallelization of two graph instances; the same is true for multiple graphs.
[0131] Compared with other batch processing programs, graph mini-batch has the following advantages:
[0132] The parallel graphs are independent of each other and do not interfere with each other. Since messages still cannot be exchanged between two nodes belonging to different graphs, GNN operators that rely on message passing schemes do not need to be modified.
[0133] There is no additional computational or memory overhead. This batching process does not require padding of node or edge features at all. Because they are stored in a sparse manner, only existing edges are saved, so there is no additional memory overhead for the adjacency matrix.
[0134] How to implement Mini-batch of graphs in PyTorchGeometric: The torch_geometricy.data.Dataloader in the PyTorchGeometric framework and library can help PyTorchGeometric automatically batch multiple graphs into a huge graph. You only need to define three parameters, namely dataset parameter, batch_size parameter, and shuffle parameter. Using this method, by setting the above three parameters, you can implement Mini-batch of graphs, and divide the graphs in the entire training set into several batches. A batch is a huge graph containing batch_size independent subgraphs. There are several batches, and several gradient descents are required in one epoch.
[0135] It is further explained that the torch_geometricy.data.Dataloader in the PyTorchGeometric framework and library can help PyTorchGeometric automatically batch multiple graphs into a huge graph. Only three parameters need to be defined, namely:
[0136] (1) dataset parameter: the dataset that needs to be batch processed.
[0137] (2) batch_size parameter: the number of graphs grouped in a small batch, that is, the number of independent subgraphs contained in a large graph. batch_size has an impact on the training results to a certain extent. If the batch_size is too small, it will take a long time and the gradient will oscillate severely, which is not conducive to convergence. If the batch_size is too large, the gradient direction of different batches will not change at all, and it is easy to fall into the local minimum. It is necessary to set an appropriate batch_size according to the actual situation of the data set.
[0138] (3) Shuffle parameter: whether to reorder the data at the beginning of each epoch.
[0139] Using this method, by setting the above three parameters, you can implement mini-batch of graphs, dividing the graphs in the entire training set into several batches. A batch is a huge graph containing batch_size independent subgraphs. There are several batches and several gradient descents in one epoch.
[0140] At the same time, each batch will have a batch vector batch, which is used to match the nodes in the batch with their original graphs. For example, a batch contains three independent subgraphs, which have 3, 2, and 4 nodes respectively, then batch = [0, 0, 0, 1, 1, 2, 2, 2, 2]. In this way, even though a huge graph is synthesized, the nodes in the huge graph can still be matched with the independent subgraphs, which is convenient for subsequent graph pooling.
[0141] Build the network: The general design process of the graph neural network model is to extract the graph structure, specify the type and scale of the graph, design the loss function, and use the calculation module to build the model. Select the Graph Convolutional Network (GCN), that is, the convolutional layer of the graph convolutional neural network, as the main network layer of the graph neural network model, and select the ReLU function as the activation function.
[0142] Model parameter determination: After determining several parameters based on the characteristics of the data set, the network model can be completed and trained. During the training process, these parameters can be adjusted according to the training results. For example, the hidden_channels parameter appears in the GCN layer, graph pooling layer, and fully connected layer, representing the dimension of the node state vector. Based on the amount of data and data characteristics of this study, the value of hidden_channels is initially set to 32. The lr parameter appears in the Adam optimizer and represents the learning rate of the optimizer. In this study, it is initially set to 0.01 based on actual conditions.
[0143] Model training and adjustment: set the epoch value, output the accuracy and loss value of each epoch, and perform result analysis and model adjustment. In the process of analyzing the training results, according to the loss function oscillation, the batch_size, hidden_channels and lr parameters were repeatedly adjusted and tried. The adjusted parameter combination is: batch_size = 64, hidden_channels = 32 and lr = 0.007.
[0144] Reference Figure 3 ,Table 2 Performance evaluation and comparison: Use accuracy, recall rate, and F1 value to evaluate the performance of the model, and record the effect of each training; The accuracy of the model on the training set shows an overall upward trend, and finally stabilizes at 92.31%. The loss value of the model is small and overall shows a downward trend and converges, fluctuating between 0.1 and 0.14 in the middle and late stages.
[0145] Based on the data set of this study, the graph neural network model achieved better results in the two major comparison models. In the graph neural network model, the GAT model achieved the best results, better than the GCN used in this study; in the traditional two-class model, SVM achieved better results than Logistic regression, but their results were far inferior to those of the graph neural network model.
[0146] Table 2 Model comparison results
[0147]
[0148] S5. According to the binary classification results of the graph neural network based on PyTorchGeometric established in step 4, by extracting fault knowledge and establishing a fault database, a binary classification of faults for the power grid and communication network is formed. When new faults and fault alarms occur, while using the model for classification and prediction, the database is referenced as an aid.
[0149] It should be further explained that the present invention selects Graph Convolutional Network (GCN), that is, the convolutional layer of the graph convolutional neural network.
[0150] In the propagation module of graph neural networks, the convolution operator is the most frequently used information propagation operator. Its characteristic is that in the process of feature extraction, it not only considers its own features but also considers and aggregates the features of its neighborhood, thereby achieving efficient feature extraction.
[0151] GCN is a widely used network using convolution operators. It is a first-order local approximation of spectral graph convolution and a multi-layer graph convolutional neural network. Each convolution layer only processes first-order neighborhood information. By superimposing several convolution layers, multi-order neighborhood information can be transmitted. The graph studied in this paper has up to 3rd-order neighborhood information. In order to make full use of the neighborhood information, three convolution layers are set.
[0152] The propagation rule of each convolutional layer plus the activation function is shown in formula (1):
[0153]
[0154] in, A represents the adjacency matrix of an undirected graph plus self-connection, I N is the identity matrix, yes The degree matrix of is calculated as shown in formula (2):
[0155]
[0156] Among them, H (l)is the activation unit matrix of the lth layer, that is, the state matrix of the node. The unit matrix H of the first layer (input layer) 0 is the feature matrix X of the node, that is, the feature matrix H of the input node of the input layer 0 , the state matrix H of the output node at time 1 1 The state matrix H of the input node of the second layer (convolutional layer 1) at time 1 is 1 , output the state matrix H of the node at time 2 2 , and so on, W (l) is the parameter matrix of the lth layer, and σ is the activation function.
[0157] Each convolutional layer of the multi-layer GCN is connected through the adjacency matrix A and the feature matrix H (l) (When l = 0, it is the node feature matrix; when l > 0, it is the node state matrix) multiply to get the summary of the features of each vertex and its neighboring vertices, and then multiply it by the parameter matrix W (l) Add activation function σ to make a nonlinear transformation to get the state matrix H of aggregated adjacent vertex features (l+1) .
[0158] As shown in formula (1), an activation function σ is added to each convolutional layer of GCN to process the output of this convolutional layer, introduce nonlinear factors, and then use it as the input of the next convolutional layer, so that the neural network can approximate any nonlinear function, increase its nonlinear expression ability, and improve the model robustness to varying degrees, alleviate the gradient vanishing problem, and accelerate model convergence.
[0159] Common activation functions include Sigmoid function, Tanh function, ReLU function, etc. In actual experimental research, a suitable activation function is selected according to actual conditions and needs; in the present invention, the ReLU function is initially selected. Figure 4 The image and formula of the ReLU function are shown in formula (3).
[0160] ReLU(x)=max(0,x) (3)
[0161] The formula of the ReLU function is very simple. If the input value is less than 0, the output is 0; if the input value is greater than 0, the output is the input value itself. Therefore, its image is y=0 when x is less than 0; and y=x when x is greater than 0.
[0162] The reasons why the present invention uses the ReLU function are as follows:
[0163] The range of the input eigenvalues of the data set of the present invention is not large, and there is no need to compress the eigenvalues to a certain range like the Sigmoid function and the Tanh function. The ReLU function does not constrain the data amplitude. Therefore, when the input is positive, the ReLU function does not have a saturation problem, that is, the gradient vanishing problem is solved, making the deep network trainable.
[0164] The output required by the present invention is the score of each image with respect to the two categories, rather than the probability of each image being divided into two categories. Therefore, the Sigmoid function is suitable for models that take the predicted probability as output because its output range is (0, 1), which is not applicable here.
[0165] The formula is very simple, and only needs to determine whether the input value is greater than 0, so the calculation speed is very fast. And because the output will make some neurons 0, it not only brings network sparsity, but also reduces the correlation between parameters, which alleviates the problem of overfitting to a certain extent.
[0166] The convergence speed is much faster than the Sigmoid function and the Tanh function.
[0167] After multiple GCN convolutional layers are added with activation functions, the main part of the GCN model is formed. Taking the GCN model with three convolutional layers as an example, suppose a batch consisting of three independent subgraphs is input. The three subgraphs have 3, 2, and 4 nodes respectively, and the node feature dimension is 4, such as Figure 5 shown.
[0168] Each neuron inputs and outputs a node feature (or node state). The input layer inputs the 4-dimensional feature vector of each node, and the convolution layer i (i=1, 2, 3) collects the features of the i-th order adjacent nodes according to the connection relationship of the graph, and outputs the hidden_channels (can be specified)-dimensional state vector of each node.
[0169] The present invention studies tasks at the graph level, and what is obtained through the above three-layer GCN with activation function is the state vector of the node, that is, the representation of the node. Therefore, it is necessary to aggregate the representation of the node into the representation of the graph. This process is called graph pooling, or graph readout.
[0170] The main methods for aggregating node representations into graph representations include summing, averaging, and taking the maximum value. This study chooses to average the node representations to calculate the graph representation, using the global_mean_pool() function in the PyTorchGeometric framework and library and the batch vector corresponding to the nodes in the batch and the independent graph in the graph Mini-batch to achieve this. The formula is shown in formula (4):
[0171]
[0172] Where: h G represents the vector representing the graph G, V represents the set of nodes belonging to the graph G, Represents the state vector of node v at time l.
[0173] Continuing with the above example, Figure 6 shown.
[0174] Convolutional layer 3 outputs a node state vector of hidden_channels dimension, matches nodes and independent subgraphs according to the batch allocation vector, and obtains the graph representation vector of each graph after processing by the pooling layer.
[0175] After the graph representation is obtained through the graph pooling layer, the classifier can be trained on the graph representation. The commonly used classifier is generally softmax, but since the cross entropy loss function is used in the present invention, the cross entropy loss function CrossEntropyLoss() in PyTorchGeometric requires the input of not the category probability but the category score, and softmax outputs the category probability, so there is no need to use softmax, but use the fully connected layer to calculate the category scores of each graph for two categories, and map the graph representation vector of each graph with hidden_channels dimension to the category score vector of dimension two.
[0176] Continuing with the above example, Figure 7 shown.
[0177] The pooling layer outputs a hidden_channels-dimensional image representation vector, which is processed by the pooling layer to obtain a 2D image category vector for each image.
[0178] The present invention selects the most commonly used loss function in classification problems, namely the cross entropy loss function (CrossEntropyLoss). Cross entropy can measure the degree of difference between two different probability distributions in the same random variable, which is expressed here as the difference between the true probability distribution and the predicted probability distribution. The smaller the value of the cross entropy, the better the model prediction effect. As shown in formula (5), the calculation formula of the cross entropy loss function is:
[0179]
[0180] Where: N represents the number of samples, that is, the number of graphs, y i Indicates the label of image i, the positive class is 1, the negative class is 0, and p i Represents the probability that image i is predicted to be a positive class.
[0181] Cross entropy is often used in classification problems in a standard way with softmax. Softmax processes the output results so that the sum of the predicted values of multiple categories is 1, and then the loss is calculated through cross entropy. However, the cross entropy loss function CrossEntropyLoss() in PyTorchGeometric requires the input not of the category probability after softmax processing, but of the category score that has not been processed by softmax, which is the category score output by the fully connected layer classifier of 4.5.4 in the present invention. This means that this function first performs a softmax operation on the input data, converts it into a probability, and then calculates it with the real label according to the cross entropy loss function above. Therefore, the present invention does not need to set softmax, and directly inputs the category score output by the fully connected layer classifier and the real category into the cross entropy loss function CrossEntropyLoss() in PyTorchGeometric to calculate the loss.
[0182] Continuing with the above example, Figure 8 shown.
[0183] The connection layer outputs the category score vector of each image, and the cross entropy loss function CrossEntropyLoss() in PyTorchGeometric is used to calculate the loss value of the entire batch. Then, the loss is back-propagated and the network is optimized with the optimizer.
[0184] The present invention selects one of the most popular optimizers for deep learning, namely the Adam optimizer. The Adam optimizer combines the advantages of AdaGrad and RMSProp, uses the same learning rate for each parameter, and adapts independently as learning proceeds. In addition, Adam is a momentum-based algorithm that also uses historical information of gradients. Therefore, the Adam optimizer is suitable for many problems, including models with sparse or noisy gradients. Its easy fine-tuning feature enables it to quickly obtain good results, and the default parameter configuration can usually achieve good results.
[0185] Connect them into a complete network and get an overview of the network model from a holistic perspective, such as Fig. 9 shown.
[0186] The present invention preliminarily sets three GCN convolutional layers, a graph pooling layer and a fully connected layer. After the data is processed in the PyTorchGeometric data format, it is input into the first convolutional layer. After the processing of the first convolutional layer, the node state vector at time t1 is obtained (the dimension hidden_channels of the state vector is set according to the actual situation), and then it is input into the second convolutional layer after processing by the ReLU function. After the processing of the second convolutional layer, the node state vector at time t2 is obtained. After the processing of the ReLU function, it is input into the third convolutional layer, and the node state vector at time t3 is obtained after the processing of the third convolutional layer. The node state vector at time t3 is input into the graph pooling layer of global_mean_pool, and the representation of each graph is obtained after processing. The representation of each graph is then input into the fully connected layer, and the category score of each graph is obtained after processing. The category with a high score is the predicted category of this graph.
[0187] After obtaining the category score of each graph, input it together with the actual category into the cross entropy loss function CrossEntropyLoss() in PyTorchGeometric to get the loss, and then use the loss.backward() function to perform gradient backpropagation, and calculate the gradient for the variables that need gradient calculation, and then use the Adam optimizer and optimizer.step() function to update the network parameters according to the gradient.
[0188] Based on the physical entity joint relationship between the power grid and the communication network, a digital joint strategy for the power grid and the communication network is proposed to complete the joint of the power grid and the communication network, and construct a network topology structure for the joint of the power grid and the communication network, which are the "relay protection two-end point network topology" and the "security and control three-end point network topology", as well as the aggregated "end-to-end network topology".
[0189] Design of joint fault diagnosis model for power grid and communication network based on graph neural network
[0190] First, we select the graph neural network framework and library Pytorch Geometric (PyTorchGeometric); secondly, we explain the method of converting graphs that have undergone data processing and feature engineering into graphs and datasets in the PyTorchGeometric data format in subsequent actual case studies, as well as the method of dividing datasets and graphs into Mini-batches; then we select the graph neural network model GCN used, as well as the various network layers, activation functions, propagation mechanisms, loss functions, and optimizers contained in the model to form a complete graph neural network model.
[0191] Practical case study of joint fault diagnosis model:
[0192] Using the data provided by NARI Technology Co., Ltd., based on the network topology of the power grid and communication network, data processing and feature engineering are performed to construct the corresponding graph, which is then converted into a graph and data set that meets the model input requirements according to the PyTorchGeometric data format. After data set division and mini-batch of the graph, the constructed model is input for training and parameter adjustment to achieve joint fault diagnosis of the power grid and communication network, that is, to perform binary classification on whether the fault location is in the power grid or the communication network. In addition, the model is compared with two other graph neural network models and two traditional binary classification models, and the results are analyzed.
[0193] At present, in the fault boundary determination link between the power grid and the communication network, since the communication dispatching and the power grid dispatching have not been integrated in terms of business processes and business data for a long time, and the communication and power grid fault event transmission derivative model has not been constructed, it has caused the situation that it is impossible to collaboratively analyze and quickly determine the fault boundary when a fault occurs. When a fault occurs, it can only consume manpower to conduct on-site investigation, and the fault handling efficiency is low. Therefore, the present invention focuses on the joint fault diagnosis of the power grid and the communication network, realizes the two-classification of the fault location in the power grid or the communication network, helps the power grid business segment information and the communication network transmission segment information to be integrated, and based on the integration of various types of information, realizes the fault analysis of the full-link channel, and improves the defensive business channel fault handling efficiency from the full-link level.
[0194] In addition, the current communication network has not formed a complete fault knowledge system. When a fault occurs, it needs to rely on manual inspection and maintenance in combination with the equipment manual. The labor cost and time cost are both high, and there is also the possibility of misjudgment of the fault. Therefore, the present invention adopts a power grid communication network joint fault diagnosis method and system, which aims to first construct a joint model of the power grid and the communication network, and then abstract the jointly constructed network topology structure into a graph structure, so as to realize the application of graph neural network in the joint diagnosis of the power grid and the communication network, and obtain a model that can be widely used in the joint fault diagnosis of various levels and types of power grids and their communication networks, helping to improve the accuracy and timeliness of fault location diagnosis.
[0195] Example 2
[0196] Reference Fig.10 , which is an embodiment of the present invention, provides a system for a power grid communication network joint fault diagnosis method, characterized in that it includes a data fusion and preprocessing module, a feature extraction and data set construction module, a graph data structure construction module, and a model training and parameter optimization module.
[0197] The data fusion and preprocessing module integrates the equipment point data in the power grid communication network and the network topology diagram of the power grid communication network.
[0198] The feature extraction and dataset construction module extracts features from the integrated data and constructs the first end-to-end dataset.
[0199] The graph data structure construction module determines the node features, edge relationships, and graph labels, characterizes the components of the graph, and constructs a graph neural network model with the data in the form of a graph.
[0200] The model training and parameter optimization module reconstructs the second end-to-end dataset based on the first end-to-end dataset in the graph, performs the graph neural network binary classification task, optimizes the graph neural network model through training, and outputs the final binary classification result.
[0201] The data fusion and preprocessing module includes the use of image regression and principal component transformation methods to process the two-terminal topology data of relay protection and the three-terminal topology data of security control.
[0202] Data fusion includes integrating single data or data of different categories, and merging the channels between the two sites of the two-endpoint network topology of relay protection and the three-endpoint network topology of security control into a one-to-one relationship.
[0203] Image regression is to subtract the original pixel value of the relay protection two-terminal network topology data and the security control three-terminal network topology data from the predicted value calculated by the regression equation to obtain the regression residual image of the relay protection two-terminal network topology data and the security control three-terminal network topology data.
[0204] The principal component transformation is to remove redundancy, transfer the two-terminal topology data of relay protection and the three-terminal topology data of security control into principal component information, summarize and eliminate the correlation of the data, and use the coefficient matrix or covariance matrix to eliminate the correlation of the original data.
[0205] The feature extraction and dataset construction module includes characterizing the components of the graph based on the characteristics of the original data, determining the node features, edge relationships, and graph labels, and fusing the graph's component data using image regression and principal component transformation methods to build a complete end-to-end dataset.
[0206] The graph data structure construction module includes building a second end-to-end dataset based on the first end-to-end dataset, PyTorchGeometric generalizes the convolution operator to a simple message passing API for irregular domains, defines message functions, update functions, and selects aggregation schemes, uses the Data and Dataset classes in PyTorchGeometric to build data structures suitable for graph neural networks, and uses node feature matrices, edge indices, and graph labels to define the structure of the graph.
[0207] The model training and parameter optimization module includes using PyTorchGeometric's graph neural network architecture to train and optimize the model, set network parameters, select activation functions, and adjust the learning rate, monitor the loss value and accuracy during training, and find the optimal network parameter settings.
[0208] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program code.
[0209] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.
[0210] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.
[0211] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0212] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. A joint fault diagnosis method for power grid and communication network, It is characterized in that include: Integrate the equipment point data in the power grid communication network and the network topology diagram of the power grid communication network; Extract features from the integrated data, build the first end-to-end data set, determine node features, edge relationships, and graph labels, characterize the components of the graph, and build a graph neural network model with data in the form of a graph; In the figure, based on the first end-to-end dataset, the second end-to-end dataset is reconstructed, and the graph neural network binary classification task is performed. The graph neural network model is optimized through training, and the final binary classification result is output.
2. A power grid and communication network joint fault diagnosis method as claimed in claim 1, Features: The equipment point data in the power grid communication network and the network topology diagram of the power grid communication network include two-end point topology data of relay protection and three-end point topology data of security control; The data fusion includes image regression and principal component transformation; By fusing text data, single data or data of different categories are integrated, and the channels between two sites of the two-endpoint network topology of relay protection and the three-endpoint network topology of security control are merged into a one-to-one relationship; The image regression is to obtain the regression residual image of the two-end point network topology data of relay protection and the three-end point network topology data of security control by subtracting the original pixel value of the two-end point network topology data of relay protection and the three-end point network topology data of security control from the predicted value calculated by the regression equation; The principal component transformation is to transfer the two-terminal topology data of relay protection and the three-terminal topology data of security control into principal component information by removing redundancy, summarize and eliminate the correlation of the data, and use a coefficient matrix or a covariance matrix to eliminate the correlation of the original data.
3. A power grid and communication network joint fault diagnosis method as claimed in claim 2, Features: The step of constructing the first end-to-end data set and determining the node features, edge relationships, and graph labels is to characterize the components of the graph according to the features of the original data, where the components of the graph include nodes, edges, and labels; The node feature is a point where a fault alarm occurs in a fault. There are several nodes in the graph according to the number of fault alarms in the 7 points. With reference to the features in the original data, the nodes are classified into features of four dimensions. The features of the four dimensions include location, device type, alarm 1 type, and alarm 2 type; The edge relationship is the connection status of the nodes, which is a fully connected undirected graph. According to the number of nodes, it can be summarized into four cases: 1, 2, 3, and 4 nodes. The graph label includes a fault as a graph, the nodes in the graph are fault alarm points, the location of the fault belongs to the characteristics of the entire graph, and the graph label is set to indicate that when the fault location is the power grid, the graph label is 0, and when the fault location is the communication network, the graph label is 1; According to the composition data of the graph, image regression and principal component transformation methods are used for fusion to build a complete end-to-end dataset.
4. A power grid and communication network joint fault diagnosis method as claimed in claim 3, Features: The reconstructed second end-to-end dataset is based on the first end-to-end dataset to construct the second end-to-end dataset. PyTorchGeometric generalizes the convolution operator to a simple message passing API in an irregular domain, defines a message function, an update function, and selects an aggregation scheme.
5. A power grid and communication network joint fault diagnosis method as claimed in claim 4, Features: The reconstructing the second end-to-end data set includes constructing a graph using the torch_geometric.data.Data class, constructing a graph data set using the torch_geometric.data.Dataset class, and checking the features of the graph and the graph data set, and checking whether the constructed graph and the graph data set meet a threshold; If the threshold is met, the graph Mini-batch method is used to perform the PyTorchGeometric-based graph neural network binary classification task. If it is not met, it is rebuilt.
6. A power grid and communication network joint fault diagnosis method as claimed in claim 5, Features: The task of performing the binary classification of graph neural network is to build a graph neural network model, select Graph ConvolutionalNetwork is the main network layer of the graph neural network model. The ReLU function is selected as the activation function. The graph data is substituted into the graph neural network model for training. The epoch value is set, and the accuracy and loss value of each epoch are output to analyze the results and adjust the model. In the process of analyzing the training results, the batch_size, hidden_channels and lr parameters are adjusted according to the loss function oscillation to obtain the optimal parameters; According to the binary classification results of the graph neural network based on PyTorchGeometric, fault knowledge is extracted, a fault database is established, and a binary classification of faults for the power grid and communication network is formed. When new faults and fault alarms occur, the graph neural network model is further used for classification and prediction.
7. A power grid and communication network joint fault diagnosis system, It is characterized in that include: Data fusion and preprocessing module, feature extraction and data set construction module, graph data structure construction module, and model training and parameter optimization module; The data fusion and preprocessing module integrates the equipment point data in the power grid communication network and the network topology diagram of the power grid communication network; The feature extraction and dataset construction module extracts features from the integrated data and constructs the first end-to-end dataset; The graph data structure construction module determines the node features, edge relationships, and graph labels, characterizes the components of the graph, and constructs a graph neural network model whose data form is a graph; The model training and parameter optimization module reconstructs the second end-to-end dataset based on the first end-to-end dataset in the graph, performs the graph neural network binary classification task, optimizes the graph neural network model through training, and outputs the final binary classification result.
8. A system using the power grid communication network joint fault diagnosis method as claimed in claim 7, Features: The data fusion and preprocessing module includes processing the two-end point topology data of relay protection and the three-end point topology data of security control using image regression and principal component transformation methods; The data fusion includes integrating single data or data of different categories, and merging the channels between two sites of the two-end point network topology of relay protection and the three-end point network topology of security control into a one-to-one relationship; The image regression is to obtain the regression residual image of the two-end point network topology data of relay protection and the three-end point network topology data of security control by subtracting the original pixel value of the two-end point network topology data of relay protection and the three-end point network topology data of security control from the predicted value calculated by the regression equation; The principal component transformation is to remove redundancy, transfer the two-terminal topology data of relay protection and the three-terminal topology data of security control into principal component information, summarize and eliminate the correlation of the data, and use the coefficient matrix or covariance matrix to eliminate the correlation of the original data; The feature extraction and dataset construction module includes characterizing the components of the graph according to the characteristics of the original data, determining the node characteristics, edge relationships, and graph labels, fusing the graph component data using image regression and principal component transformation methods, and constructing a complete end-to-end dataset; The graph data structure construction module includes building a second end-to-end dataset based on the first end-to-end dataset, generalizing the convolution operator to a simple message passing API of irregular domains by PyTorchGeometric, defining message functions, update functions and selecting aggregation schemes, using the Data and Dataset classes in PyTorchGeometric to build a data structure suitable for graph neural networks, and defining the structure of the graph using node feature matrices, edge indices and graph labels; The model training and parameter optimization module includes using the PyTorchGeometric graph neural network architecture to train and optimize the model, set network parameters, select activation functions, and adjust the learning rate, monitor the loss value and accuracy during training, and find the optimal network parameter settings.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program. It is characterized in that When the processor executes the computer program, the steps of a power grid and communication network joint fault diagnosis method described in any one of claims 1 to 6 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of a power grid and communication network joint fault diagnosis method as described in any one of claims 1 to 6 are implemented.
Citation Information
Cited By
Air conditioner detector and fault display method thereof
CN119934631A
Automobile fault intelligent diagnosis method and system based on AI
CN122567246A
