Mamba network-based main and distribution cooperative fault detection method, equipment and medium
By adopting a Mamba network-based method in power grid fault diagnosis, combined with LSTM and graph convolutional neural network, the problems of data processing limitations and high edge-end computing resource occupancy in the existing technology are solved, and efficient and accurate fault diagnosis and real-time detection capabilities are achieved.
Patent Information
- Application Number
- CN202510346687.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-24
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2045-03-24
AI Technical Summary
The existing power grid fault diagnosis methods have limitations in dealing with complex data and timing characteristics, and the problems of high computing resource occupancy and model update delay at the edge end are difficult to meet the relay requirements of millisecond response.
The main-coupled collaborative fault detection method based on Mamba network is adopted, and the adjacency matrix and edge feature matrix of the graph are constructed, and the timing feature extraction network LSTM and graph convolutional neural network are combined. The prior knowledge and feature fusion module are used to optimize information propagation, and the joint loss function is trained.
It improves the accuracy and efficiency of power grid fault diagnosis, reduces calculation complexity and resource consumption, and can perform fault detection in real time or near real time to meet relay protection needs.
Smart Images

Figure CN119885083A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of distribution network fault detection, and in particular to a main distribution network coordinated fault detection method, device and storage medium based on a Mamba network. Background Art
[0002] With the continuous growth of electricity demand and the increasing complexity of the power system structure, the stable operation and fault diagnosis of the power grid have become increasingly important. The main and distribution coordinated power grid (referred to as the main and distribution coordinated system) is the core part of the modern power system. It is mainly composed of the main power grid (high-voltage transmission network) and the distribution network (low-voltage distribution network). The main task of the main and distribution coordinated system is to ensure the reliable transmission, dispatching and distribution of electricity, and to achieve rapid diagnosis and repair when a fault occurs.
[0003] In traditional power grid management systems, existing fault diagnosis methods mainly rely on sensors to collect power grid data, which is then processed and analyzed through traditional algorithms. For example, the gradient boosted decision tree (GBDT) algorithm is used for distribution network fault detection, but it may have certain limitations when processing complex data. In addition, deep learning methods, such as models based on convolutional neural networks (CNN) and recurrent neural networks (RNN), are also often used in power grid fault diagnosis, but they often have some shortcomings when processing time series features and graph structure data.
[0004] Therefore, the existing technology also uses a fault diagnosis method based on a graph neural network (GNN), which can effectively process the topological structure information of the power grid and capture the complex relationships between nodes, thereby improving the accuracy and efficiency of fault diagnosis. For example, a power grid fault location method based on a deep graph convolutional neural network uses graph convolution operations to process the topological information of the power grid and achieve accurate location of the fault.
[0005] In addition, the existing technology also combines the hybrid model of the time series feature extraction network (such as the long short-term memory network, LSTM) and the graph convolutional neural network to simultaneously process the time series characteristics and topological structure information of the power grid data. This method can more comprehensively capture the operation status of the power grid and improve the accuracy of fault diagnosis. For example, the existing patent "Cloud-edge collaborative fault diagnosis method" with patent publication number CN119312141A adopts a federated learning framework to implement model iteration, but there are problems such as high edge computing resource occupancy rate (a single station consumes 3.2GB of memory per day on average) and model update delay (the average lag fault occurrence time is 8 minutes), which makes it difficult to meet the millisecond-level response relay protection requirements; for example, the existing patent "High-resistance fault detection device" with patent publication number CN118937891A improves the detection efficiency through the fundamental phase accumulation algorithm, but its computational complexity is still quadratic with the number of distribution network nodes. In an urban distribution network containing 5000+ nodes, a single detection takes more than 2 seconds.
[0006] Or the existing technology also combines spatiotemporal joint modeling technology. For example, the existing patent "irregular graph structure prediction model" with patent publication number CN119044671A constructs a two-dimensional feature space through time series data and topological structure, but its model training needs to rely on complete equipment historical data, and its adaptability to newly connected distributed power sources is insufficient. In the distribution network with a photovoltaic penetration rate of more than 30%, the prediction error exceeds 18%; for example, the existing patent "mobile robot detection system" with patent publication number CN118818218A can improve the response speed of multi-point faults, but its image recognition algorithm has a false detection rate of up to 42% in rainy and foggy weather, and the single-machine inspection coverage radius is less than 2 kilometers.
[0007] Therefore, this application specifically proposes a master-distributor collaborative fault detection method based on the Mamba network to solve the above technical problems. Summary of the invention
[0008] The main purpose of the present invention is to provide a master-distributor collaborative fault detection method based on a Mamba network to solve the technical problems raised in the background technology.
[0009] The present invention adopts the following technical solutions to solve the above technical problems: A master-distributor coordinated fault detection method based on a Mamba network, comprising: S1. Measure and collect main distribution network fault data and build a training set ; S2. The topological structure of the main distribution network is represented by the adjacency matrix of the graph, the adjacency matrix and edge feature matrix of the graph are constructed, and the weight of the edge is defined to obtain the edge feature matrix E and the feature matrix X as prior knowledge; S3. Constructing a Mamba network model for main and distribution coordinated fault detection based on prior knowledge and measurement data, the Mamba network model includes a time series feature extraction network LSTM, a graph convolutional neural network, a prior knowledge and feature fusion module, a Softmax layer and a Mamba network; S4. Use the training set The joint loss function is used to train and test the Mamba network model.
[0010] Preferably, the training set in step S1 is The build process includes: S11. Collect the three-phase voltage, three-phase current and phase angle data of the main distribution network fault equipment, and construct a fault data classification set, recorded as ; represents a three-phase voltage dataset, and , Indicates Three-phase voltage data of the fault data; represents a three-phase current data set, and , Indicates Three-phase current data set of fault data; in, , Indicates the total number of failures; S12. Constructing a classification set of fault data The label information set is recorded as , Indicates The label value of the fault data, and , is the number of fault types; S13. The fault dataset with labels Randomly shuffle the order as a training set .
[0011] Preferably, the specific operation process of step S2 includes: S21. Construct the adjacency matrix A and edge feature matrix E of the graph. The adjacency matrix A is used to describe the connection relationship between the main distribution network nodes. The main distribution network phase angle and the main distribution network power are used as the edge features of the graph, where: The adjacency matrix A is The matrix of is the number of nodes, the elements in the matrix Representation Node and nodes Whether they are connected and the strength of the connection between them are:
[0012] The edge feature matrix E is of dimension The matrix of is the number of edges, is the number of features of each edge, and the elements in the matrix Representation Node and nodes edge The characteristic expression is: ,in It is this side The phase angle, It is this side Power; S22. Collect the actual phase angle and power data of the main distribution network fault equipment, and construct a fault data classification set, recorded as , represents a three-phase phase angle data set, and , Indicates The three-phase phase angle data of the fault data, represents a three-phase phase angle data set, and , Indicates Three-phase power data of each fault data; S23. Construct the feature matrix of each node in the adjacency matrix A , used to represent the electrical parameters of the node. Node characteristic matrix The dimension is ,in is the number of nodes, is the characteristic dimension of each node.
[0013] Preferably, the time series feature extraction network LSTM in step S3 includes a forget gate, an input gate, a memory update unit and an output gate, wherein: The forget gate is used to input the Fault data No. After sampling the time data, the first Fault data In the temporal feature extraction unit Fault characteristic information at each time step ; Input gate, used to calculate the Fault data In the memory unit Input fault information for the time step , Fault modulation information And fault information to be updated ; Memory update unit, used to calculate and obtain the Fault data In the memory unit Time step memory information , The specific calculation formula is:
[0014] in, represents the Hadamard product; Output gate, used to calculate the Fault data In the memory unit The signal of the time step , and combined with the current memory unit state to obtain the final hidden state output.
[0015] Preferably, in the S3 step, the graph convolutional neural network is used to aggregate the features of the node and the features of its neighboring nodes, and at the same time, the edge features are involved in the propagation of node information through feature weighting, and finally the softmax function is used to convert the feature output of each node into a category label, wherein: The specific expression formula for feature aggregation is:
[0016] in, It is The node feature matrix of the layer has initial node features ; It is The learnable weight matrix of the layer; is the adjacency matrix The normalized matrix is It is the degree matrix of the node, which is used to represent the connection strength of the node; sigmoid is a nonlinear activation function; The specific expression formula of feature weighting is:
[0017] in, Indicates Layer Node Features, Indicates Layer Node Features, For the matrix The elements in Representation Node The set of neighbor nodes of Is a node With Node The power characteristics between Is a node With Node The phase angle characteristics between is the weight matrix of the current graph convolution layer, and in each layer of graph convolution, the feature vector of the node is continuously updated through the graph convolution operation. is a set of trainable hyperparameters.
[0018] Preferably, the prior knowledge and feature fusion module in the step S3 is used to dynamically fuse the features extracted by LSTM and GCN through Gaussian kernel function and correlation calculation, and retain the specified prior knowledge, specifically including the following execution steps: L1. Put LSTM in the Time series features extracted at each moment Transform the dimension to make it consistent with the graph convolution network in the first Prior knowledge features extracted at all times Perform feature alignment, and then use a learnable Gaussian kernel function to calculate the similarity between the time series features after dimension transformation and the prior knowledge features; L2. After calculating the similarity between features, set the dynamic threshold , the prior knowledge features are screened, including: ; L3. Based on the retained prior knowledge features, the splicing method is used to fuse the temporal features and prior knowledge characteristics , concatenate the two feature vectors along the feature dimension to obtain a higher-dimensional fusion feature vector , and the fused feature vector Input to the Softmax layer output and make the final prediction:
[0019]
[0020] in, is the weight matrix of the Softmax layer; L4. Input the current input through the Mamba network structure and the state at the previous moment Perform selective updates of the dynamic adjustment status of features and obtain the updated status ,have:
[0021] in, is the selective update function, It is a set of parameters for the Mamba network model.
[0022] Preferably, the joint loss function in step S4 is The specific expression formula is:
[0023] in, is the cross entropy loss function, is the Focal loss function, Defined as a sample With category The improved NENum functions are: Cross Entropy Loss Function The calculation formula is:
[0024] in, is the number of categories, It is Samples in category The real label on The model predicts samples belong to the category The probability of Focal loss function The calculation formula is:
[0025] in, Yes Category The weight of is the exponent of the weighting factor, which is used to control the weight of difficult-to-classify samples.
[0026] Preferably, the calculation and acquisition process of the improved NENum function includes: L1. Calculation acquisition category The dispersion of is calculated as:
[0027] in, Yes Category The covariance matrix of The distribution of sample data, is the direction vector in the feature space, used to indicate the classification boundary direction, for The vector matrix transpose of ; L2. Combine the time series and regional differences of power grid data to improve sample acquisition Weight , there is a definition:
[0028] in, It is a sample Stationarity in time series, Yes Category The regional difference factor is used to reflect the data differences in different areas of the power grid. , , are hyperparameters used to control the influence of dispersion, stability and regional factors respectively. For sample With category The weighting function of For Category The number of samples used to adjust the stationarity hyperparameter the impact on the final weights to compensate for potential bias due to differences in sample size; L3. Based on the predicted probability Adjust the acquisition weighting function ,have:
[0029] in, is a hyperparameter that adjusts the weighted sensitivity, is a preset threshold value used to determine whether a sample is considered as noise. is the predicted probability, For sample The prior probability of L4. Based on the NENum loss function, the time series stationarity is improved to obtain the NENum function:
[0030] in, is a hyperparameter of the stationarity loss.
[0031] On the other hand, the present invention further discloses a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the processor executes the steps of the above method.
[0032] On the other hand, the present invention further discloses a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the above method.
[0033] It can be seen from the above technical solution that the present invention provides a master-distributor coordinated fault detection method based on Mamba network. Compared with the prior art, the present invention has the following advantages: 1. The present invention sets a prior knowledge and feature fusion module, uses the Gaussian kernel function to calculate the similarity between the time series features and the prior knowledge features and adjusts the dimensions. It can easily determine the threshold to screen and retain the prior knowledge after the correlation calculation, avoid noise interference, and make the prior knowledge in the fusion process targeted and accurate.
[0034] 2. Compared with traditional recurrent neural networks and self-attention models, the present invention adopts the Mamba network to construct a network model, and dynamically adjusts the state selective update based on the input features, which can optimize information propagation, does not need to rely on complete device historical data, and has low computational complexity, which can greatly improve the performance and computational efficiency of the model.
[0035] 3. The present invention can efficiently process time series features and graph structures during distribution network fault diagnosis, and use a joint loss function for training during model training and testing. On the basis of the traditional NENum loss function, according to the characteristics of the main distribution coordinated power grid, the consideration of time series stationarity is added, which effectively improves the unbalanced data processing capability in the main distribution coordinated power grid and improves the model training accuracy and effect.
[0036] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present invention, nor is it intended to limit the scope of the present invention. Other features of the present invention will become easy to understand through the following description. Of course, it is not necessary to achieve all of the advantages described above simultaneously for any product implementing the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] The drawings constituting a part of the present application are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings: Figure 1 It is a schematic diagram of the overall system flow of the present invention; Figure 2 Schematic diagram of the LSTM structure of the present invention; Figure 3 It is a schematic diagram of the data processing flow of the prior knowledge and feature fusion module of the present invention. DETAILED DESCRIPTION
[0038] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. In the absence of conflict, the embodiments in this application and the features in the embodiments can be combined with each other. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0039] In the embodiment, see Figures 1 to 3 .
[0040] like Figure 1 The master-distributor coordinated fault detection method based on the Mamba network proposed in the embodiment of the present invention is performed in the following steps: Step 1: Build a training set for the network ; Step 1.1: Collect the three-phase voltage, three-phase current and phase angle data of the faulty equipment and construct a fault data classification set, recorded as ,in: represents a three-phase voltage data set, , Indicates The three-phase voltage data of the fault data, and , represents the voltage data of phase a at the t sampling time of the kth fault data, represents the voltage data of phase b at the t sampling time of the kth fault data, represents the c-phase voltage data at the t-th sampling time of the k-th fault data; represents a three-phase current data set, , Indicates The three-phase current data set of the fault data, and , represents the a-phase current data at the t-th sampling time of the k-th fault data, represents the b-phase current data at the t-th sampling time of the k-th fault data, represents the c-phase current data at the t-th sampling time of the k-th fault data; 1≤k≤K, K represents the total number of faults; 1≤t≤T, T represents the total sampling time; Step 1.2: Construct a classification set of fault data The label information set is recorded as , Indicates The label value of the fault data, and , is the number of fault types; Step 1.3: The labeled fault dataset Randomly shuffle the order as a training set ;and , represents the kth fault data, and , Represents the three-phase voltage and current data at the t-th sampling time of the k-th fault data; Step 2: Build prior knowledge of the network; Step 2.1: Construct the adjacency matrix and edge feature matrix of the graph. The topological structure of the main distribution network is represented by the adjacency matrix of the graph. The adjacency matrix A is used to describe the connection relationship between nodes (generators, loads, substations). The edge features (phase angle and power) will be used as the edge features of the graph and represented by the matrix E. The adjacency matrix A is an N×N matrix, where N is the number of nodes, representing the connection relationship between nodes. The elements in the matrix are Representation Node and nodes Are they connected, and the strength of the connection between them. and nodes There are edges between them. ,otherwise, .
[0041] Step 2.2, define the weight of the edge, Collect the phase angle and power data of the faulty equipment and construct a fault data classification set, recorded as ,in: represents a three-phase phase angle data set, and , Indicates The three-phase phase angle data of the fault data, and , represents the phase angle data of phase a at the t sampling time of the k-th fault data, represents the phase angle data of phase b at the t sampling time of the k-th fault data, Indicates the phase angle data of phase c at the tth sampling time of the kth fault data; represents a three-phase phase angle data set, and , Indicates The three-phase power data of the fault data, and , represents the power data of phase a at the tth sampling time of the kth fault data, represents the power data of phase b at the tth sampling time of the kth fault data, represents the c-phase power data at the t-th sampling time of the k-th fault data; Step 2.3: Construct edge feature matrix E and feature matrix X The edge features (phase angle and power) are stored in the edge feature matrix E. The dimension of the edge feature matrix E is M×G, where M is the number of edges and G is the number of features of each edge. Each row represents the feature of an edge, including the elements in the phase angle and power matrix of the edge Representation Node and nodes The edge of The characteristic expression is: ,in It is this side The phase angle, It is this side of power.
[0042] Finally, the edge feature matrix E will include the phase angle and power features of all edges. The feature matrix of each node Used to represent the electrical parameters of the node. Node characteristic matrix The dimension is N×F, where N is the number of nodes and F is the feature dimension of each node.
[0043] Step 3: Build a Mamba network driven by prior knowledge and measurement data, including: time series feature extraction network LSTM, graph convolutional neural network, prior knowledge and feature fusion module, Mamba network and Softmax layer; Step 3.1: Build Figure 2 The temporal feature extraction network LSTM shown The LSTM network consists of four parts: forget gate, input gate, memory update unit and output gate. The forget gate is used to update the k-th fault data. The data at the tth sampling time Input into the forget gate, the forget gate performs feature extraction operation to obtain the kth fault data Fault characteristic information at the tth time step of the timing feature extraction unit :
[0044] In the formula, Indicates the kth fault data In the forgetting unit The fault information hidden state of the time step; when season ; is the activation function; and Respectively represent the kth fault data The t-th time data and the kth fault data The hidden state of the fault information at the tth time step of the forget unit The weight matrix of the forgetting unit, Indicates the kth fault data The forgetting unit bias vector is obtained by the following formula: Fault data The fault retention information at the tth time step of the memory unit :
[0045] In the formula, × represents the outer product operation, It is Fault data In the memory unit Memory information of time steps; Step 3.1.1. Input Gate The input gate uses the following formula to obtain the Fault data Input fault information at the tth time step of the memory unit , Fault modulation information And fault information to be updated ;
[0046]
[0047]
[0048] In the formula, For the Fault data The fault information to be updated at the tth time step of the memory unit, represents the Hadamard product (element-wise multiplication); and Respectively represent the kth fault data The data at the tth sampling time and the kth fault data In the memory unit Fault information hidden state of time step The input weight matrix is Indicates the kth fault data The input bias vector of and Respectively represent the kth fault data The data at the tth sampling time and the kth fault data In the memory unit Fault information hidden state of time step The weight matrix of Indicates the kth fault data The deviation vector of ⊙ represents element-by-element multiplication operation; is the activation function; Step 3.1.2: The memory update unit obtains the kth fault data using the following formula: Memorize information at the tth time step of the memory unit :
[0049] in, is the memory unit state of the kth fault data at the tth time step.
[0050] In time hour, is the memory cell state at the previous time step, is the output of the forget gate, indicating how much of the memory information of the previous time step has been forgotten. is the current candidate memory information, indicating the modulation information of the current input data; Update the memory cell state by the forget gate and the weighted sum of the candidate memories.
[0051] Step 3.1.3: The output gate obtains the kth fault data using the following formula: The signal at the tth time step of the memory cell :
[0052] in, is the output gate value of the kth fault data at the tth time step, and is the weight matrix of the output gate, is the input data of the kth fault data at the tth time step, is the hidden state (fault information) of the previous time step, is the bias term of the output gate.
[0053] Through the output gate and the current memory cell state, the final hidden state (i.e. output) is:
[0054] in, is the hidden state output of the kth fault data at the tth time step, is the current state of the memory cell, which contains the information updated by the input gate and the forget gate. is an activation function used to perform nonlinear transformation on the state of the memory unit. It is the output information controlled by the output gate.
[0055] Step 3.2: Build a graph convolutional neural network Step 3.2.1: Construct graph convolution layer According to the topological structure processed above, the corresponding graph convolutional neural network is constructed for processing, which is converted into prior knowledge to improve the accuracy of network anomaly detection. The main operation of the graph convolutional neural network is to aggregate the features of the node and the features of its neighboring nodes, which can be expressed as:
[0056] in, It is The node feature matrix of the layer has initial node features ; It is The learnable weight matrix of the layer; is the adjacency matrix The normalized matrix is is the degree matrix of the node, which is used to represent the connection strength of the node; It is a nonlinear activation function, and the ReLU nonlinear function is used here.
[0057] Step 3.2.2: Fusion and propagation of edge features In the process of graph convolution, in order to update the features of nodes, it is necessary not only to aggregate the node features, but also to process the edge features (power and phase angle), mainly because these edge features greatly affect the way information is propagated. In graph convolution, edge features usually participate in the propagation of node information in a weighted manner. The formula can be expressed as:
[0058] in, Indicates Layer Node Features, Indicates Layer Node Features, For the matrix The elements in Representation Node The set of neighbor nodes of Is a node With Node The power characteristics between Is a node With Node The phase angle characteristics between is the weight matrix of the current graph convolutional layer, is a set of trainable hyperparameters.
[0059] In order to capture more detailed global and local information, a multi-layer graph convolutional neural network is used here. In each layer of graph convolution, the feature vector of the node is continuously updated through the graph convolution operation. Specifically, each layer of graph convolution aggregates the features of neighboring nodes and uses this aggregated information to update the features of the current node. In this way, as the network goes deeper, each layer of graph convolution can not only capture the local information of neighboring nodes, but also gradually integrate the global information of distant nodes through a multi-layer structure, thereby obtaining a richer node representation. Finally, the softmax function is used to convert the feature output of each node into a category label.
[0060] Step 3.3: Prior knowledge and feature fusion module In traditional neural network methods, the fusion of prior knowledge and measurement data is usually performed through fixed weight assignment. However, fixed weights often cannot fully tap the most valuable prior knowledge, resulting in interference when the model is used, especially when dealing with large and complex systems, where the impact of the fault location on different nodes varies.
[0061] In order to overcome this problem, this prior knowledge and feature fusion module proposes a dynamic fusion operation method based on Gaussian function and correlation calculation, referring to Figure 3 , which can more accurately fuse the features extracted by LSTM and GCN and retain the prior knowledge that is beneficial to the final prediction.
[0062] Step 3.3.1. Learnable correlation calculation In this part, the time series features extracted by LSTM and prior knowledge features extracted by graph convolutional networks (GCNs) The similarity between them is calculated by a learnable Gaussian function. Since the dimensions of these two features may be different, the time series features must be converted into Perform dimension transformation to align with GCN features. The calculation formula is as follows:
[0063] in is the time series feature extracted by the LSTM network at time t, It is the prior knowledge feature extracted by the GCN network at the tth moment. It is the Euclidean distance between the time series feature and the prior knowledge feature. It is a trainable hyperparameter that controls the width of the Gaussian function and determines the sensitivity of the similarity. Based on the calculated similarity value, the similarity between the time series features and the prior knowledge is judged. The higher the similarity, the more similar the two are.
[0064] Step 3.3.2. Retention of prior knowledge After calculating the similarity between features, we need to decide whether to retain the prior knowledge extracted by GCN based on the similarity. In order to ensure that only the most relevant prior knowledge is retained, a dynamic threshold is set. , when the similarity is greater than the threshold, the corresponding prior knowledge is retained; when the similarity is less than or equal to the threshold, the prior knowledge at that moment is discarded. This retention mechanism makes the prior knowledge in the fusion process targeted and accurate. The retention condition formula is:
[0065] in, is the prior knowledge extracted by GCN at time t. If the similarity is greater than the threshold , the current prior knowledge is retained. If the similarity is less than or equal to the threshold , the prior knowledge is set to 0, that is, the prior knowledge at this moment is discarded. Here the threshold is set to 0.6, which can effectively retain the prior knowledge that is strongly correlated with the time series features, thereby avoiding noise interference.
[0066] Step 3.3.3: Fusion of measurement features and prior knowledge After the prior knowledge is retained, the next step is feature fusion. Depending on whether the prior knowledge is retained, the time series features extracted by LSTM and prior knowledge features extracted by GCN If the prior knowledge at the current moment is retained, the concatenation method is used for fusion, and the two feature vectors are concatenated along the feature dimension to obtain a higher-dimensional feature vector:
[0067] in, It is the time series feature extracted by the LSTM network. is the prior knowledge feature extracted by the GCN network. The fusion method used here is splicing, which splices the LSTM features and GCN features along the feature dimension to obtain a higher-dimensional feature vector. The key to this step is that due to the screening and retention of prior knowledge after the correlation calculation, the spliced fusion feature vector will contain more valuable time series information and prior knowledge information, thereby improving the accuracy of the model. This fused feature vector will be further input into the output layer for the final prediction, which is expressed by the following formula:
[0068] in, is the weight matrix of the output layer, which determines how the fused features are mapped to the final prediction results. Through this fusion method, the model can effectively utilize the complementarity of time series features and prior knowledge, thereby improving the accuracy of prediction.
[0069] Step 3.4: Build a Mamba network Mamba is a linear time series modeling method based on the selective state space model. Compared with traditional recurrent neural networks and self-attention models, Mamba can efficiently process long sequences with linear time complexity, and optimize information propagation by introducing a selective mechanism, thereby improving the performance and computational efficiency of the model. In Mamba, the core idea of the selective state space model is to dynamically adjust the state update method according to the input characteristics. Given the input at the current moment and the state at the previous moment , Mamba decides which information needs to be transmitted and which information can be ignored by selectively updating the state. Specifically, the formula for state update is:
[0070] in, is a selective update function, is the parameter of the model. Through this selective update mechanism, the model can efficiently capture important features in the input sequence and suppress irrelevant information, thereby improving the ability to model long-term dependencies. Mamba introduces hardware-friendly algorithms to optimize memory usage and computational efficiency when running on modern hardware (such as GPUs). By avoiding complex attention mechanisms, Mamba can provide higher throughput and reduce the consumption of computing resources during training and inference. Mamba has made significant progress in many fields, especially in tasks such as language modeling, audio processing, and genomics. In the language modeling task, Mamba not only surpasses the Transformer model of comparable size, but also shows higher efficiency and lower computing resource consumption during inference. Mamba also provides an efficient and powerful way to process long sequence data and has shown leading performance in multiple tasks. In the main distribution coordinated power grid, there is a large amount of data, and the Mamba network can make fine adjustments in computation through hardware optimization algorithms to enable the network to run efficiently. Therefore, Mamba can detect faults in the operation status of the main distribution coordinated in real time or near real time, reducing delays.
[0071] Step 4: Model training and testing In the main distribution coordinated power grid, data is affected by many factors, such as load fluctuations, voltage changes, and equipment failures. In order to effectively deal with the imbalance problem in power grid data, the following aspects are considered: First, power grid data is time-series, volatile and trendy, so the model must pay attention to its time dependence; second, there are differences in the frequency and quality of data collection in different regions, resulting in regional differences; finally, the failure modes of power grid equipment occur at different times and places, resulting in category imbalance. Therefore, when training the model, a joint loss function is used for training. The loss function is composed of the cross entropy loss function, the Focal loss function, and the improved NENum function. Among them, the cross entropy loss function is the most commonly used algorithm in binary classification and multi-classification. This method mainly measures the performance of the model by calculating the difference between the predicted probability and the true label. The formula can be expressed as:
[0072] in: is the number of categories, It is Samples in category The real label on The model predicts samples belong to the category probability.
[0073] Focal Loss is a loss function commonly used in dealing with class imbalance problems, especially in object detection. It gives greater weight to samples that are difficult to classify, thereby preventing the model from paying too much attention to samples that are easy to classify. Focal loss introduces a weighting factor based on cross entropy loss to reduce the focus on samples that are easy to classify. The formula can be expressed as:
[0074] in, The model predicts samples belong to the category The probability of It is Samples in category The real label on Yes Category The weight is usually used to alleviate the problem of class imbalance. is the exponent of the weighting factor, which is used to control the weight of difficult-to-classify samples.
[0075] In order to solve the problem of imbalanced categories in the power grid, data dispersion is used to measure the data dispersion of each category. Dispersion reflects the distribution of data in the feature space and can be measured by the covariance matrix of the category data. The data, defining its dispersion, can be expressed using the formula:
[0076] in, Yes Category The covariance matrix of The distribution of sample data, is the direction vector in the feature space, used to indicate the classification boundary direction, for The vector matrix transpose of .
[0077] In order to deal with unbalanced data, each sample needs to be weighted. Combining the temporal and regional differences of power grid data, an improved sample weight calculation formula is proposed. Weight is defined as:
[0078] in, Yes Category The dispersion of It is a sample The stationarity in the time series is used to measure whether the sample is abnormally volatile. Yes Category The regional difference factor is used to reflect the data differences in different areas of the power grid. Based on the predicted probability The adjusted weighting function is defined as:
[0079] in, is a hyperparameter that adjusts the weighted sensitivity, is the threshold value used to determine whether a sample is considered as noise, , , are hyperparameters that control the influence of the spread, stationarity, and regionality factors, respectively.
[0080] Based on the traditional NENum loss function, according to the characteristics of the main distribution coordinated power grid, the consideration of time series stability is added. The loss function is:
[0081] in, It is a sample The weighted weight of is a hyperparameter of the stationary loss, used to control the impact of the stationary loss, It is a sample The stationarity loss in the time series is used to measure whether the sample is abnormally volatile.
[0082] Finally, the joint loss of the above three loss functions is used to train the model, which is expressed as follows:
[0083] By combining factors such as timing, regional differences and dispersion, this function can effectively improve the unbalanced data processing capability in the main and distribution coordinated power grid, and performs outstandingly in the fault detection task in the main and distribution coordinated power grid.
[0084] In a specific embodiment, data collection and experiments are performed for different data. In the main distribution coordinated power grid, five categories of power grid fault classification tasks include unidirectional grounding, three-phase grounding, phase-to-phase short circuit, high-resistance grounding and normal data. Experiments are performed through different power grid fault classification tasks, and the following data results are obtained:
[0085] The classification accuracy refers to the correct recognition rate of the model in each category. The classification accuracy of "normal data" is relatively high, reaching 99%, while some fault categories such as "phase-to-phase short circuit" are more difficult to classify, with a classification accuracy of 95%.
[0086] In order to comprehensively evaluate the performance of the model in different categories, the comparative experiment also introduced the F1 score, which is the harmonic mean of precision and recall. For example, the F1 score of the "normal data" category is 0.97, showing its good overall performance, while the F1 score of the "phase short circuit" category is 0.93, indicating that the model is also more effective in identifying fault categories.
[0087] On the other hand, the present invention further discloses a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the processor executes the steps of the above method.
[0088] On the other hand, the present invention further discloses a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the above method.
[0089] In another embodiment provided in the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute any of the master-distributor collaborative fault detection methods based on the Mamba network in the above-mentioned embodiments.
[0090] It is understandable that the system provided by the embodiment of the present invention corresponds to the method provided by the embodiment of the present invention, and the explanation, examples and beneficial effects of the relevant contents can refer to the corresponding parts in the above method.
[0091] The embodiment of the present application also provides an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus. Memory, used to store computer programs; The processor is used to implement the above-mentioned master-distributor collaborative fault detection method based on the Mamba network when executing the program stored in the memory.
[0092] The communication bus mentioned in the above electronic device may be a Peripheral Component Interconnect (PCI) bus or an Extended Industrial Standard Architecture (EISA) bus, etc. The communication bus may be divided into an address bus, a data bus, a control bus, etc.
[0093] The communication interface is used for communication between the above electronic device and other devices.
[0094] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0095] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0096] It should also be noted that electronic devices also include terminal devices, which can also be called terminals, user equipment, mobile stations, mobile terminals, etc. Terminal devices can be mobile phones, smart TVs, wearable devices, tablet computers, computers with wireless transceiver functions, virtual reality terminal devices, augmented reality terminal devices, wireless terminals in industrial control, wireless terminals in unmanned driving, wireless terminals in remote surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, wireless terminals in smart homes, etc. The embodiments of this application do not limit the specific technology and specific device form used by the terminal devices.
[0097] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium, or a semiconductor medium (e.g., a solid-state hard disk), etc.
[0098] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
[0099] In addition, it should be noted that if the embodiments of the present invention involve directional indications (such as up, down, left, right, front, back...), the directional indications are only used to explain the relative position relationship, movement status, etc. between the components in a certain specific posture. If the specific posture changes, the directional indication will also change accordingly.
[0100] In addition, if there are descriptions involving "first", "second", etc. in the embodiments of the present invention, the descriptions of "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the meaning of "and / or" appearing in the full text includes three parallel schemes. Taking "A and / or B" as an example, it includes scheme A, or scheme B, or schemes that A and B meet at the same time. In addition, in the embodiments of the present invention, "multiple" refers to more than two. In addition, the technical solutions between the various embodiments can be combined with each other, but it must be based on the ability of ordinary technicians in the field to implement. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.
Claims
1. A master-distributor coordinated fault detection method based on Mamba network, characterized in that: include: S1. Measure and collect main distribution network fault data and build a training set ; S2. The topological structure of the main distribution network is represented by the adjacency matrix of the graph, the adjacency matrix and edge feature matrix of the graph are constructed, and the weight of the edge is defined to obtain the edge feature matrix E and the feature matrix X as prior knowledge; S3. Constructing a Mamba network model for main and distribution coordinated fault detection based on prior knowledge and measurement data, the Mamba network model includes a time series feature extraction network LSTM, a graph convolutional neural network, a prior knowledge and feature fusion module, a Softmax layer and a Mamba network; S4. Use the training set The joint loss function is used to train and test the Mamba network model.
2. The method for detecting master-distributor coordinated faults based on Mamba network according to claim 1, characterized in that: In the S1 step, the training set The build process includes: S11. Collect the three-phase voltage, three-phase current and phase angle data of the main distribution network fault equipment, and construct a fault data classification set, recorded as ; represents a three-phase voltage data set, and , Indicates Three-phase voltage data of the fault data; represents a three-phase current data set, and , Indicates A three-phase current data set containing fault data; in, , Indicates the total number of failures; S12. Constructing a classification set of fault data The label information set is recorded as , Indicates The label value of the fault data, and , is the number of fault types; S13. The fault dataset with labels Randomly shuffle the order as a training set .
3. The master-distributor coordinated fault detection method based on Mamba network as claimed in claim 1, characterized in that: The specific operation process of the S2 step includes: S21. Construct the adjacency matrix A and edge feature matrix E of the graph. The adjacency matrix A is used to describe the connection relationship between the main distribution network nodes. The main distribution network phase angle and the main distribution network power are used as the edge features of the graph, where: The adjacency matrix A is The matrix of is the number of nodes, the elements in the matrix Representation Node and nodes Whether they are connected and the strength of the connection between them are: The edge feature matrix E is of dimension The matrix of is the number of edges, is the number of features of each edge, and the elements in the matrix Representation Node and nodes edge The characteristic expression is: ,in It is this side The phase angle, It is this side Power; S22. Collect the actual phase angle and power data of the main distribution network fault equipment, and construct a fault data classification set, recorded as , represents a three-phase phase angle data set, and , Indicates The three-phase phase angle data of the fault data, represents a three-phase phase angle data set, and , Indicates Three-phase power data of each fault data; S23. Construct the feature matrix of each node in the adjacency matrix A , used to represent the electrical parameters of the node, the node characteristic matrix The dimension is ,in is the number of nodes, is the characteristic dimension of each node.
4. The method for detecting master-distributor coordinated faults based on Mamba network according to claim 1, characterized in that: The time series feature extraction network LSTM in step S3 includes a forget gate, an input gate, a memory update unit and an output gate, wherein: The forget gate is used to input the Fault data No. After sampling the time data, the first Fault data In the temporal feature extraction unit Fault characteristic information at each time step ; Input gate, used to calculate the Fault data In the memory unit Input fault information for time steps , Fault modulation information And fault information to be updated ; Memory update unit, used to calculate and obtain the Fault data In the memory unit Time step memory information , The specific calculation formula is: in, represents the Hadamard product; Output gate, used to calculate the Fault data In the memory unit The signal of the time step , and combined with the current memory unit state to obtain the final hidden state output.
5. The method for detecting master-distributor coordinated faults based on Mamba network according to claim 1, characterized in that: In the S3 step, the graph convolutional neural network is used to aggregate the features of the node and its neighboring nodes, and at the same time, the edge features are involved in the propagation of node information through feature weighting, and finally the softmax function is used to convert the feature output of each node into a category label, where: The specific expression formula for feature aggregation is: in, It is The node feature matrix of the layer has initial node features ; It is The learnable weight matrix of the layer; is the adjacency matrix The normalized matrix is It is the degree matrix of the node, which is used to represent the connection strength of the node; sigmoid is a nonlinear activation function; The specific expression formula of feature weighting is: in, Indicates Layer Node Features, Indicates Layer Node Features, For the matrix The elements in Representation Node The set of neighbor nodes of Is a node With Node The power characteristics between Is a node With Node The phase angle characteristics between is the weight matrix of the current graph convolution layer, and in each layer of graph convolution, the feature vector of the node is continuously updated through the graph convolution operation. is a set of trainable hyperparameters.
6. The master-distributor coordinated fault detection method based on Mamba network according to claim 1, characterized in that: The prior knowledge and feature fusion module in the S3 step is used to dynamically fuse the features extracted by LSTM and GCN through Gaussian kernel function and correlation calculation, and retain the specified prior knowledge, which specifically includes the following execution steps: L1. Put LSTM in the Time series features extracted at each moment Transform the dimension to make it consistent with the graph convolution network in the first Prior knowledge features extracted at all times Perform feature alignment, and then use a learnable Gaussian kernel function to calculate the similarity between the time series features after dimension transformation and the prior knowledge features; L2. After calculating the similarity between features, set the dynamic threshold , the prior knowledge features are screened, including: ; L3. Based on the retained prior knowledge features, the splicing method is used to fuse the temporal features and prior knowledge characteristics , concatenate the two feature vectors along the feature dimension to obtain a higher-dimensional fusion feature vector , and the fused feature vector Input to the Softmax layer output and make the final prediction: in, is the weight matrix of the Softmax layer; L4. Input the current input through the Mamba network structure and the state at the previous moment Perform selective updates of the dynamic adjustment status of features and obtain the updated status ,have: in, is the selective update function, It is a set of parameters for the Mamba network model.
7. The method for detecting master-distributor coordinated faults based on Mamba network according to claim 1, characterized in that: The joint loss function in step S4 The specific expression formula is: in, is the cross entropy loss function, is the Focal loss function, Defined as a sample With category Improved NENum functions.
8. The method for detecting master-distributor coordinated faults based on Mamba network according to claim 7, characterized in that: The calculation and acquisition process of the improved NENum function includes: L1. Calculation acquisition category The dispersion of is calculated as: in, Yes Category The covariance matrix of The distribution of sample data, is the direction vector in the feature space, used to indicate the classification boundary direction, for The vector matrix transpose of ; L2. Combine the time series and regional differences of power grid data to improve sample acquisition Weight , there is a definition: in, It is a sample Stationarity in time series, Yes Category The regional difference factor is used to reflect the data differences in different areas of the power grid. , , are hyperparameters used to control the influence of dispersion, stability and regional factors respectively. For sample With category The weighting function of For Category The number of samples used to adjust the stationarity hyperparameter the impact on the final weights to compensate for potential bias due to differences in sample size; L3. Based on the predicted probability Adjust the acquisition weighting function ,have: in, is a hyperparameter that adjusts the weighted sensitivity, is a preset threshold value used to determine whether a sample is considered as noise. is the predicted probability, For sample The average predicted probability of L4. Based on the NENum loss function, the time series stationarity is improved to obtain the NENum function: in, is a hyperparameter of the stationarity loss.
9. A computer-readable storage medium, characterized in that: A computer program is stored, and when the computer program is executed by a processor, the processor is caused to perform the steps of the method according to any one of claims 1 to 8.
10. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Power distribution network fault detection device
CN118818218A
Power distribution network high-resistance fault detection method and device and computer equipment
CN118937891A
Fault detection method and device and electronic equipment
CN119044671A
Cloud-side cooperative fault diagnosis method and system for intelligent substation equipment
CN119312141A
Priori knowledge-based double-action reinforcement learning spectrum access method and system
CN113747447A
Cited By
Method and device for detecting short-circuit fault of power distribution network
CN120064891A
A detection method and device for short-circuit faults in a distribution network
CN120064891B
Distribution transformer fault detection method and system for photovoltaic transformer area
CN120429645A
Magnetic core loss prediction method based on empirical state space model
CN120492862A
A core loss prediction method based on empirical state space model
CN120492862B