Deep learning power distribution network fault classification detection method and system based on attention mechanism
By applying a deep learning method based on attention mechanism in the fault detection of distribution networks, using the LSTM-Attention model to process grid data, the problem of low efficiency and design relies on manual experience in the existing technology is solved, and efficient and accurate Fault detection and diagnosis reduces costs and improves portability.
Patent Information
- Application Number
- CN202411194277.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2044-08-28
AI Technical Summary
The existing distribution network fault detection methods are inefficient in solving large-scale systems and their designs rely on manual experience, resulting in redesign when the grid topology changes, increasing costs and reducing portability.
The deep learning method based on attention mechanism is adopted, and timing grid data is processed through the LSTM-Attention model, fault labels are automatically generated, feature weights are dynamically adjusted, and fault detection accuracy and adaptability are improved.
It significantly improves the accuracy and efficiency of fault detection, reduces costs, enhances the portability of the model, and can effectively diagnose faults in different scenarios.
Smart Images

Figure CN119179970A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of power grid fault classification detection, and in particular relates to a distribution network fault classification detection method and system based on a deep learning attention mechanism. Background Art
[0002] With the advancement of science and technology and the acceleration of industrial development, the complexity and criticality of power systems are becoming increasingly apparent. In a highly interconnected modern network, the reliability and continuity of power supply are crucial to social operation. Therefore, in order to cope with various possible risks and challenges, it is necessary to continuously optimize the monitoring system and emergency response mechanism to ensure that power supply can be quickly and effectively restored when a sudden fault occurs, thereby minimizing the negative impact of power outages and ensuring the stable operation of the national economy. As a graph structure, the distribution network topology consists of electrical nodes and wire branches, which contains rich graph information. At present, the distribution network fault detection methods are mainly divided into methods for solving by establishing mathematical models and methods based on neural networks. Traditional distribution network fault detection methods are usually solved by establishing an explicit mathematical model of the system. However, for large-scale distribution network systems, in order to ensure the solvability of the model, it is often necessary to make certain assumptions and simplifications, which may cause the model to deviate from the actual situation. In addition, there are still many challenges in efficiently solving optimization problems. Taking the optimization of a distribution network with discrete control devices as an example, due to the nonlinearity of the system constraints and the discreteness of the control variables, the optimization problem is non-convex and is usually modeled as a mixed integer programming problem and solved by a solver. However, the current solvers are inefficient in solving mixed integer nonlinear programming problems and it is difficult to provide answers within a reasonable time. Although the existing traditional power grid fault diagnosis methods can solve the fault diagnosis problems of complex power grids to a certain extent, these methods are usually designed for the fault diagnosis problems of specific power grid topologies, and their design is highly dependent on manual experience. Therefore, when the power grid topology changes, the fault diagnosis method needs to be redesigned, which increases the cost and has poor portability. With the emergence of graph neural networks (GNNs), the more mature neural networks are extended to the graph domain, realizing the combination of deep learning and graph data. At present, the most widely used graph neural networks are mainly graph convolutional networks. Although GNNs can effectively process graph structure data, they are not as efficient as deep learning methods based on attention mechanisms when processing very complex nonlinear relationships. The attention mechanism performs better in processing dependencies and changing trends in time series, and can more accurately locate and diagnose faults. In addition, deep learning methods based on attention mechanisms are more stable in different scenarios due to their ability to adaptively adjust feature weights.
[0003] Through the above analysis, the problems and defects of the prior art are as follows:
[0004] Current solvers have low efficiency in solving mixed integer nonlinear programming problems and it is difficult to provide answers within a reasonable time. Although existing traditional power grid fault diagnosis methods can solve the fault diagnosis problems of complex power grids to a certain extent, these methods are usually designed for fault diagnosis problems of specific power grid topologies, and their design is highly dependent on manual experience. Therefore, when the power grid topology changes, the fault diagnosis method needs to be redesigned, which increases the cost and has poor portability. Summary of the invention
[0005] In view of the problems existing in the prior art, the present invention provides a distribution network fault classification and detection method based on deep learning of attention mechanism.
[0006] The present invention is implemented as follows: a deep learning distribution network fault classification detection method based on attention mechanism, comprising:
[0007] Step 1, data preparation;
[0008] Step 2, data processing;
[0009] Step 3: Build the LSTM-Attention model;
[0010] Step 4, decoding and output;
[0011] Step 5: Training and model tuning.
[0012] Further, the data preparation:
[0013] Use unsupervised learning methods to identify abnormal patterns in waveforms and match them with known fault types to automatically generate labels. By inputting a large amount of unlabeled raw data and analyzing a large amount of unlabeled power grid operation data, the model will capture the common characteristics of data signals at the time of faults during training, automatically detect possible fault characteristics, and label them accordingly. At the same time, combined with clustering algorithms, similar abnormal patterns are grouped and compared with historical fault data to generate more accurate labels.
[0014] Furthermore, the data processing:
[0015] The read_data(dir_list) function receives a directory list dir_list as a parameter, removes the data and label types, and returns the data and label types. The random_split function is used to randomly split the data set into a training set and a test set, where the ratio of the training set to the test set is 8:2.
[0016] The purpose of fault_type_to_index is to convert the string representation of the fault type into an integer index. First, define the fault type dictionaries: cut_shrot_type_dict and fault_type_dict, and map each fault type to a unique integer. By building a mapping relationship in the dictionary, check the validity of the input.
[0017] Data preprocessing and slicing: Slice the time series data with a length of 400 into fault waveforms and non-fault waveforms according to the fault time, with a length of 100 and labels of 18 waveform types: 7 short circuits, 10 short circuits, and 1 normal;
[0018] In the IEEE33 node scenario, the data set consists of 30 fault points, voltage, current values and phase numbers from the start to the end of the time period; phase A, phase B, and phase C; the node voltage is the voltage of the current node, and the node current is the total current flowing into the current node; the fault types include 10 types of faults: AG, BG, CG, ABG, ACG, BCG, AB, AC, BC, and ABC.
[0019] Further, the LSTM-Attention model is constructed:
[0020] The model mainly uses the LSTM-Attention model, which consists of a feature extraction layer, an LSTM layer, a CNN layer, and a self-attention mechanism processing layer.
[0021] Further, the decoding and output:
[0022] Perform matrix multiplication of the context vector context and the hidden state of the current time step to obtain the output feature x, and finally use the MLP output with the output channel num_class to calculate the final output, and finally output the prediction result probability array through the softmax layer.
[0023] Furthermore, the training and model tuning:
[0024] Move the model to the specified device;
[0025] Determine and set the data set model parameters;
[0026] Define the optimizer Adam and the loss function BCELoss.
[0027] Another object of the present invention is to provide a deep learning distribution network fault classification detection system based on attention mechanism, comprising:
[0028] A data preparation module that uses unsupervised learning methods to identify abnormal patterns in waveforms and match them to known fault types to automatically generate labels;
[0029] The data processing module is used to receive a directory list dir_list as a parameter through the read_data(dir_list) function, remove the data and label types, and return the data and label types; the random_split function is used to randomly split the data set into a training set and a test set, where the ratio of the training set to the test set is 8:2;
[0030] Build a model module for using the LSTM-Attention model, which consists of a feature extraction layer, an LSTM layer, a CNN layer, and a self-attention mechanism processing layer;
[0031] The decoding output module is used to perform matrix multiplication on the context vector context and the hidden state of the current time step to obtain the output feature x, and finally use the MLP output with the output channel num_class to calculate the final output, and finally output the prediction result probability array through the softmax layer;
[0032] The tuning module is used to move the model to the specified device; determine and set the data set model parameters; define the optimizer Adam and the loss function BCELoss.
[0033] Another object of the present invention is to provide a computer device, comprising 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 deep learning distribution network fault classification detection method based on the attention mechanism.
[0034] Another object of the present invention is to provide a computer-readable storage medium storing a computer program, which, when executed by a processor, enables the processor to perform the steps of the deep learning distribution network fault classification detection method based on the attention mechanism.
[0035] Another object of the present invention is to provide an information data processing terminal, which is used to implement the deep learning distribution network fault classification detection system based on the attention mechanism.
[0036] In combination with the above technical solutions and the technical problems solved, the advantages and positive effects of the technical solutions to be protected by the present invention are as follows:
[0037] First, the present invention is based on the real-time monitoring technology of power data in the distribution network, combined with the computer deep learning algorithm model, and through the attention mechanism, useless information is suppressed as much as possible, important data is highlighted, and the accuracy of fault detection is effectively improved. This method uses the attention mechanism and performs well in processing time series data, and can effectively capture the dependencies and changing trends in time series. This is very helpful for analyzing the changes in the state of the power grid before and after the fault occurs, and for accurate fault location and diagnosis. It has higher generalization ability in different data sets and application scenarios. In contrast, the traditional mathematical model method needs to be readjusted and calibrated in new scenarios. The algorithm model is highly portable, which is more convenient for fault diagnosis in different scenarios, reducing costs and improving efficiency.
[0038] An unsupervised learning method is used to identify abnormal patterns in waveforms and match them with known fault types to automatically generate labels. This method can not only reduce the cost of manual labeling, but also improve the accuracy and richness of labels. The three sets of current and voltage input values at the same position are put into a feature extraction network composed of MLP and Relu activation function to extract high-dimensional features between current and voltage at the same position. The number of parameters of the model is effectively reduced, the training effect is improved, and the training speed is accelerated. At the same time, the feature extraction method of a single model is difficult to fully extract the features of voltage and current information, while multi-dimensional feature extraction can deeply explore information features, so that the relationship between features and fault labels can be fully extracted before fault diagnosis data training. Such input is more suitable for deep learning algorithm models, which helps to gradually improve the accuracy of fault classification and identification. The deep learning model based on the attention mechanism proposed in the present invention can simultaneously extract local low-level features and global context features through the self-attention mechanism, thereby maximizing the use of useful information.
[0039] A deep learning method based on attention mechanism is proposed and applied to distribution network fault detection.
[0040] A data processing method based on multi-dimensional feature extraction of multi-source data fusion is proposed to improve the accuracy and robustness of fault identification.
[0041] Automatically generate fault labels for data using unsupervised deep learning.
[0042] Second, the present invention proposes a deep learning distribution network fault classification detection method based on attention mechanism, which aims to improve the sensitivity and accuracy of distribution network fault detection and solve the problems of low fault detection accuracy and slow response speed in the prior art.
[0043] Existing distribution network fault detection methods often have difficulty in accurately and timely detecting and classifying fault types when faced with complex power system operating environments. This is because traditional methods cannot fully capture the long-term dependencies of time series data in power systems, and it is difficult to dynamically adjust the importance assessment of data at different time steps, resulting in certain limitations in practical applications.
[0044] In order to solve the above problems, the present invention proposes a new detection method, which specifically comprises the following steps:
[0045] 1) Data preparation:
[0046] Collect historical operating data of the distribution network, including key parameters such as voltage, current, power and frequency.
[0047] Label known fault types and corresponding time periods to build training and test data sets.
[0048] Unsupervised learning methods are used to identify abnormal patterns in waveforms, match them with known fault types, and automatically generate labels.
[0049] Combined with clustering algorithms, similar abnormal patterns are grouped and compared with historical fault data to generate accurate labels.
[0050] 2) Data processing:
[0051] The data is denoised, normalized and feature extracted, and the time series data is divided into time windows suitable for LSTM network processing.
[0052] The function receives a directory list as a parameter, processes the data and labels, and randomly splits them into training and test sets.
[0053] Convert the fault type string representation to an integer index and build the corresponding mapping relationship.
[0054] The time series data is sliced according to the fault time to form fault and non-fault waveforms, and the data set for the IEEE33 node scenario is processed.
[0055] 3) Build LSTM-Attention model:
[0056] The electrical quantity feature extraction layer is constructed to process and analyze high-dimensional electrical quantity data from the distribution network, such as voltage, current, active power, etc. The complex high-dimensional data is converted into concise low-dimensional feature vectors.
[0057] The LSTM layer is constructed to capture the long-term dependencies in time series data and learn the time series characteristics of the distribution network operation status.
[0058] Construct an attention mechanism layer to dynamically assign weights to data at different time steps, highlight information at critical moments, and improve the sensitivity and accuracy of fault detection.
[0059] 4) Decoding and output:
[0060] The feature vector processed by the attention mechanism is input into the decoding layer to classify the fault type and output the final detection result, including the fault type and occurrence time.
[0061] 5) Training and model tuning:
[0062] The model is trained using the preprocessed dataset and the model parameters are optimized using the loss function and back propagation algorithm.
[0063] Adjust model hyperparameters (such as learning rate and batch size) and improve model generalization ability through cross-validation.
[0064] Compared with the traditional method, the technical solution of the present invention can not only better capture the time series characteristics of the distribution network operation status by introducing LSTM and attention mechanism, but also dynamically focus on the data information at key moments, greatly improving the accuracy and real-time performance of fault detection. In addition, through unsupervised learning and clustering algorithms, more accurate fault labels can be automatically generated, further improving the training effect of the model.
[0065] In summary, the present invention has achieved significant technical progress in the field of distribution network fault detection and has important application value. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] Figure 1 It is a flow chart of a distribution network fault classification detection method based on deep learning of attention mechanism provided in an embodiment of the present invention.
[0067] Figure 2 It is a structural block diagram of a deep learning distribution network fault classification detection system based on an attention mechanism provided in an embodiment of the present invention.
[0068] Figure 3 It is a data processing diagram provided by an embodiment of the present invention.
[0069] Figure 4 This is a diagram of building an LSTM-Attention model provided by an embodiment of the present invention.
[0070] Figure 5 It is a graph of loss and accuracy of training provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0071] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0072] The application examples of the deep learning distribution network fault classification detection method based on the attention mechanism in the industry are as follows:
[0073] Example 1: Smart Grid Fault Detection and Classification System
[0074] 1) System background:
[0075] With the rapid development of smart grids, the complexity and data volume of power grids are increasing. To ensure the stable operation of the power grid, timely and accurate detection and classification of faults are crucial.
[0076] 2) Application method:
[0077] Data integration: First, the system collects key parameters such as voltage, current, and power of each node in the smart grid to build a huge historical operation database.
[0078] Model deployment: Deploy the trained LSTM-Attention model on the server side of the system for real-time fault detection.
[0079] Real-time monitoring and early warning: The system receives grid operation data in real time and inputs the data into the model through preprocessing steps (such as denoising, normalization, etc.).
[0080] Fault classification and response: The model outputs the prediction results of fault type and occurrence time. The system automatically triggers the early warning mechanism based on this information and notifies maintenance personnel to respond quickly.
[0081] 3) Results and Impact:
[0082] The accuracy and efficiency of fault detection are improved and the cost of manual inspection is reduced.
[0083] Through real-time monitoring and early warning, the impact of faults on power grid operations is greatly reduced.
[0084] It provides strong guarantee for the safe and stable operation of smart grid.
[0085] Example 2: Power distribution automation management system
[0086] 1) System background:
[0087] The distribution network is an important part of the power system, and its stable operation is directly related to the reliability and quality of power supply. Therefore, it is particularly important to develop a system that can automatically detect and manage distribution network faults.
[0088] 2) Application method:
[0089] Intelligent data collection: The system collects the operation data of the distribution network in real time through intelligent devices such as μPMU.
[0090] Fault detection and classification: Use the LSTM-Attention model to analyze collected data in real time to automatically detect and classify faults.
[0091] Automated management: Based on the fault type and occurrence time output by the model, the system automatically generates a maintenance work order and assigns it to the nearest maintenance personnel.
[0092] Remote monitoring and control: The system supports remote monitoring of the distribution network status and remote control when necessary to mitigate the impact of failures.
[0093] 3) Results and Impact:
[0094] It realizes the automated management of the distribution network and improves the efficiency and accuracy of fault handling.
[0095] The need for manual intervention is reduced, saving operating costs.
[0096] Improved the reliability and quality of power supply and enhanced customer satisfaction.
[0097] A deep learning distribution network fault classification and detection method based on attention mechanism.
[0098] Step 1: Data Preparation
[0099] Collect historical operation data of the distribution network, including key parameters such as voltage, current, power, and frequency.
[0100] Label known fault types and corresponding time periods to build datasets for training and testing.
[0101] Step 2: Data Processing
[0102] The collected data are preprocessed, including denoising, normalization, and feature extraction.
[0103] Divide time series data into time windows suitable for LSTM (Long Short-Term Memory) processing.
[0104] Step 3: Build LSTM-Attention model
[0105] LSTM layer: used to capture long-term dependencies in time series data and learn the time series characteristics of the distribution network operation status.
[0106] Attention layer: used to dynamically assign weights to data at different time steps, highlight information at critical moments, and improve the model’s sensitivity and accuracy for fault detection.
[0107] This technical solution proposes a deep learning model based on LSTM layer, attention mechanism layer and electrical quantity feature extraction layer, which aims to efficiently capture and analyze the time series characteristics of the distribution network operation status, thereby improving the sensitivity and accuracy of fault detection. First, the electrical quantity feature extraction layer is designed to process and analyze high-dimensional electrical quantity data from the distribution network, such as voltage, current, active power, etc. Through dimensionality reduction algorithms (such as PCA or Autoencoder), this layer can convert complex high-dimensional data into more concise low-dimensional feature vectors, while retaining the core information of the electrical quantity and avoiding information redundancy.
[0108] Next, the feature abstraction part in the feature extraction module further processes these low-dimensional feature vectors and extracts key information closely related to the operating status of the distribution network through algorithms such as convolutional layers or fully connected layers. These processed feature vectors not only reduce the data dimension, but also provide concise and efficient input data for subsequent time series analysis. The feature fusion layer concatenates or weighted sums the feature vectors of different electrical quantities to generate a comprehensive feature vector, so that multiple electrical quantity information can be fully utilized in time series analysis.
[0109] The LSTM layer is one of the core parts of the model, which is specially used to process time series data. Through its unique gating mechanism, the LSTM layer can effectively capture and learn the long-term dependencies in the operating status of the distribution network, especially the time series changes before and after the fault occurs. After the input data is processed by the LSTM layer, hidden state vectors containing time series features are generated, which represent the operating status of the distribution network at each time step.
[0110] Subsequently, the attention mechanism layer dynamically assigns weights to the hidden state vector generated by the LSTM layer. This mechanism can calculate and assign weights based on the importance of each time step, highlighting the key moment information related to fault detection. Through weighted summation, the attention mechanism layer generates a comprehensive time series feature vector, which more accurately reflects the abnormal points in the operation status of the distribution network.
[0111] Finally, the comprehensive feature vector is input into the fault detection classifier, which is usually composed of a fully connected layer and a Softmax layer. The classifier outputs the probability distribution of fault detection by analyzing the comprehensive feature vector, helping the decision-making system to quickly determine whether a fault exists. In order to ensure the efficiency and reliability of the model, the cross entropy loss function is used in the model training process, and the LSTM layer and the attention mechanism layer are combined for joint training. The model continuously iterates and optimizes parameters during the training and verification process to achieve the best fault detection performance, and ensures its robustness in practical applications through hyperparameter tuning.
[0112] Step 4: Decoding and Output
[0113] The feature vector processed by the attention mechanism is input into the decoding layer to classify the fault type.
[0114] Output the final fault detection results, including fault type and occurrence time.
[0115] Step 5: Training and model tuning
[0116] The LSTM-Attention model is trained using the preprocessed dataset, and the model parameters are optimized using the loss function and back propagation algorithm.
[0117] Adjust the model's hyperparameters, such as learning rate, batch size, etc., and use methods such as cross-validation to improve the model's generalization ability.
[0118] 2 specific industrial application examples.
[0119] 1. Power company distribution network fault detection system
[0120] Application scenario: Power companies need to monitor the operating status of distribution networks in real time, detect and locate faults quickly and accurately, and ensure the stability and reliability of power supply.
[0121] Implementation steps:
[0122] Collect real-time operation data and historical fault records of the distribution network, and prepare and process the data.
[0123] Build and train the LSTM-Attention model, and use the trained model for real-time fault detection.
[0124] The model is deployed in the power monitoring center to analyze the distribution network data in real time and notify maintenance personnel in time to handle the faults after they are detected.
[0125] Effect:
[0126] The accuracy and timeliness of fault detection are improved, and fault handling time and power outage losses are reduced.
[0127] The stability and safety of the distribution network are enhanced by predicting and preventing potential failures in advance.
[0128] 2. Smart City Energy Management System
[0129] Application scenario: In the construction of smart cities, the energy management system needs to efficiently monitor and manage the urban distribution network to cope with complex and changing electricity demand and failure risks.
[0130] Implementation steps:
[0131] Integrate various data sources of urban distribution networks, including smart meters, sensors and monitoring systems, for data collection and processing.
[0132] Build an LSTM-Attention model, train and tune the model to suit the specific needs of urban distribution networks.
[0133] The model is embedded in the energy management platform of the smart city to monitor the operating status of the distribution network in real time, automatically identify and classify faults, and provide decision support.
[0134] Effect:
[0135] It improves the intelligence level of urban energy management and enables rapid fault location and processing.
[0136] It optimizes energy distribution, reduces energy waste caused by failures, and improves energy utilization efficiency.
[0137] This deep learning distribution network fault classification detection method based on attention mechanism captures time series features through LSTM and highlights key information through attention mechanism, which significantly improves the accuracy and real-time performance of fault detection. Its application in power companies and smart city energy management demonstrates its great potential and practical effect in ensuring the stable operation of distribution networks and improving energy management efficiency.
[0138] like Figure 1 As shown, a deep learning distribution network fault classification detection method based on attention mechanism provided by an embodiment of the present invention includes the following steps:
[0139] S101, data preparation;
[0140] S102, data processing;
[0141] S103, build LSTM-Attention model;
[0142] S104, decoding and output;
[0143] S105, training and model tuning.
[0144] Data preparation provided by the embodiment of the present invention:
[0145] Use unsupervised learning methods to identify abnormal patterns in waveforms and match them with known fault types to automatically generate labels. By inputting a large amount of unlabeled raw data and analyzing a large amount of unlabeled power grid operation data, the model will capture the common characteristics of data signals at the time of faults during training, automatically detect possible fault characteristics, and label them accordingly. At the same time, combined with clustering algorithms, similar abnormal patterns are grouped and compared with historical fault data to generate more accurate labels.
[0146] Data processing provided by the embodiment of the present invention:
[0147] The read_data(dir_list) function receives a directory list dir_list as a parameter, removes the data and label types, and returns the data and label types. The random_split function is used to randomly split the data set into a training set and a test set, where the ratio of the training set to the test set is 8:2.
[0148] The purpose of fault_type_to_index is to convert the string representation of the fault type into an integer index. First, define the fault type dictionaries: cut_shrot_type_dict and fault_type_dict, and map each fault type to a unique integer. By building a mapping relationship in the dictionary, check the validity of the input.
[0149] Data preprocessing and slicing: Slice the time series data with a length of 400 into fault waveforms and non-fault waveforms according to the fault time, with a length of 100 and labels of 18 waveform types: 7 short circuits, 10 short circuits, and 1 normal;
[0150] In the IEEE33 node scenario, the data set consists of 30 fault points, voltage, current values and phase numbers from the start to the end of the time period; phase A, phase B, and phase C; the node voltage is the voltage of the current node, and the node current is the total current flowing into the current node; the fault types include 10 types of faults: AG, BG, CG, ABG, ACG, BCG, AB, AC, BC, and ABC.
[0151] The LSTM-Attention model provided in the embodiment of the present invention is as follows:
[0152] The model mainly uses the LSTM-Attention model, which consists of a feature extraction layer, an LSTM layer, a CNN layer, and a self-attention mechanism processing layer.
[0153] The decoding and output provided by the embodiment of the present invention are:
[0154] Perform matrix multiplication of the context vector context and the hidden state of the current time step to obtain the output feature x, and finally use the MLP output with the output channel num_class to calculate the final output, and finally output the prediction result probability array through the softmax layer.
[0155] The training and model tuning provided by the embodiments of the present invention:
[0156] Move the model to the specified device;
[0157] Determine and set the data set model parameters;
[0158] Define the optimizer Adam and the loss function BCELoss.
[0159] like Figure 2 As shown, a deep learning distribution network fault classification detection system based on attention mechanism provided by an embodiment of the present invention includes:
[0160] A data preparation module that uses unsupervised learning methods to identify abnormal patterns in waveforms and match them to known fault types to automatically generate labels;
[0161] The data processing module is used to receive a directory list dir_list as a parameter through the read_data(dir_list) function, remove the data and label types, and return the data and label types; the random_split function is used to randomly split the data set into a training set and a test set, where the ratio of the training set to the test set is 8:2;
[0162] Build a model module for using the LSTM-Attention model, which consists of a feature extraction layer, an LSTM layer, a CNN layer, and a self-attention mechanism processing layer;
[0163] The decoding output module is used to perform matrix multiplication on the context vector context and the hidden state of the current time step to obtain the output feature x, and finally use the MLP output with the output channel num_class to calculate the final output, and finally output the prediction result probability array through the softmax layer;
[0164] The tuning module is used to move the model to the specified device; determine and set the data set model parameters; define the optimizer Adam and the loss function BCELoss.
[0165] Another object of the present invention is to provide a computer device, comprising 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 deep learning distribution network fault classification detection method based on the attention mechanism.
[0166] Another object of the present invention is to provide a computer-readable storage medium storing a computer program, which, when executed by a processor, enables the processor to perform the steps of the deep learning distribution network fault classification detection method based on the attention mechanism.
[0167] Another object of the present invention is to provide an information data processing terminal, which is used to implement the deep learning distribution network fault classification detection system based on the attention mechanism.
[0168] The present invention is specifically implemented:
[0169] 1. Data preparation:
[0170] Unsupervised learning methods are used to identify abnormal patterns in waveforms and match them with known fault types to automatically generate labels. By inputting a large amount of unlabeled raw data and analyzing a large amount of unlabeled power grid operation data, the model will capture the common characteristics of data signals at the time of faults during training, automatically detect possible fault characteristics, and label them accordingly. At the same time, combined with clustering algorithms such as K-means or hierarchical clustering, similar abnormal patterns can be grouped and compared with historical fault data to generate more accurate labels.
[0171] 2. Data processing Figure 3 :
[0172] Data preprocessing,
[0173] The read_data(dir_list) function receives a directory list dir_list as a parameter, removes the data and label types, and returns the data and label types. The random_split function is used to randomly split the data set into training and test sets, with a ratio of 8:2 between the training and test sets.
[0174] The purpose of fault_type_to_index is to convert the string representation of the fault type into an integer index. First, define the fault type dictionary: cut_shrot_type_dict and fault_type_dict, and map each fault type to a unique integer. By building a mapping relationship in the dictionary, check the validity of the input.
[0175] Data preprocessing and slicing: Slice the time series data with a length of 400 into fault waveforms and non-fault waveforms according to the fault time, with a length of 100 and labels of 18 waveform types (7 short circuits, 10 short circuits, and 1 normal). In the IEEE33 node scenario, the data set is 30 fault points, the voltage, current value, and phase number (phase A, phase B, phase C) from the start to the end time period. The node voltage is the voltage of the current node, and the node current is the total current flowing into the current node. There are 10 types of faults: AG, BG, CG, ABG, ACG, BCG, AB, AC, BC, ABC. The meanings of each fault type are as follows:
[0176] ■AG: A phase ground fault
[0177] ■BG: B phase ground fault
[0178] ■CG: C phase ground fault
[0179] ■ABG: Phase A and Phase B are short-circuited to ground
[0180] ■G: Phase-to-ground short circuit fault
[0181] ■ACG: Phase A and Phase C are short-circuited to ground
[0182] ■BCG: Phase B and Phase C are short-circuited to ground
[0183] ■AB: A phase and B phase short circuit fault
[0184] ■AC: A phase and C phase short circuit fault
[0185] ■BC: B-phase and C-phase short circuit fault
[0186] ■ABC: three-phase short circuit fault
[0187] 3. Construct LSTM-Attention model as follows Figure 4 :
[0188] The model mainly uses the LSTM-Attention model, which consists of a feature extraction layer, an LSTM layer, a CNN layer, and a self-attention mechanism processing layer.
[0189] The feature extraction layer uses linear transformation, relu activation function, and linear transformation in succession. At the same time, the feature extraction layer designs specific feature extraction methods for different types of input data. For example, for time series data, the LSTM layer can be used to extract time series features; for other auxiliary information (such as node voltage, three-phase values of current, ambient temperature, device status, etc.), convolutional neural network (CNN) is used to extract features. Then, these features are fused and input into the self-attention mechanism processing layer for classification.
[0190] The LSTM layer uses a single-layer bidirectional LSTM to extract time series features, and the CNN layer uses convolution to extract features from other auxiliary information. The forward and backward outputs of the LSTM layer are accumulated with the output of the CNN layer and handed over to the downstream Attention classifier for processing.
[0191] The self-attention layer uses the Linear transformation to calculate the attention weight weight of the upstream output out. The weight is used to highlight useful feature information and suppress irrelevant information. After the BMM batch matrix multiplication calculation, the out is multiplied by the weight, and the score is normalized using the softmax function. The context vector context is obtained.
[0192] 4. Decoding and output:
[0193] Perform matrix multiplication of the context vector context and the hidden state of the current time step to obtain the output feature x, and finally use the MLP output with the output channel num_class to calculate the final output, and finally output the prediction result probability array through the softmax layer.
[0194] 5. Training and model tuning:
[0195] 5.1. Move the model to the specified device (CPU or GPU).
[0196] 5.2. Determine and set the data set model parameters. The main parameters are as follows:
[0197] ○embedding_size: The dimension of the input vector, indicating the number of features of the input data.
[0198] ○embedding_size_2: vector dimension after extracting electrical quantity features
[0199] ○num_classes: The number of categories in the classification task, here is 18 categories.
[0200] ○fault_num_no_normal and fault_num_normal: Indicates the number of fault types
[0201] ○sentence_max_len: The maximum length of a single sentence, applicable to sequence data. 100
[0202] ○ hidden_size: The size of the LSTM hidden layer, which indicates the number of neurons in each LSTM layer.
[0203] ○num_layers: The number of LSTM layers, here there is only 1 layer.
[0204] ○num_directions: The number of directions of LSTM, here it is bidirectional (BiLSTM).
[0205] ○lr: learning rate, which controls the step size of model parameter update.
[0206] ○batch_size: batch size, the number of samples used in each training.
[0207] ○ epochs: The number of training iterations.
[0208] 5.3. Define the optimizer (Adam) and loss function (BCELoss)
[0209] a. Select Adam as the optimizer.
[0210] Adam optimizer (AdaptiveMomentEstimation) is an optimization algorithm widely used in deep learning.
[0211] It combines the advantages of Momentum and RMSProp and can achieve efficient parameter updates when training neural networks. The following is a detailed explanation of the working principle and characteristics of the Adam optimizer.
[0212] Gradient calculation
[0213] In each iteration, the gradient gt of the current parameter is first calculated.
[0214] First moment estimate
[0215] Use the exponentially weighted average method to calculate the first moment estimate of the gradient (i.e. the average value of the gradient):
[0216] m t =β1m t-1 +(1-β1)g t
[0217] Among them, β1 is a hyperparameter that controls the decay rate of the first-order moment (usually 0.9).
[0218] Second moment estimate
[0219] Similarly, the exponentially weighted average method is used to calculate the second moment estimate of the gradient (that is, the average of the squared gradient):
[0220]
[0221] Among them, β2 is a hyperparameter that controls the decay rate of the second-order moment (usually set to 0.999).
[0222] bias correction
[0223] Since both mt and vt are close to 0 initially, bias correction is needed to improve the accuracy of the estimate:
[0224]
[0225] Parameter Update
[0226] Use the corrected estimates to update the parameters:
[0227]
[0228] Here, α is the learning rate and ∈ is a small constant to prevent division by zero errors (usually 10-8).
[0229] b. Loss function uses BCELoss
[0230] BCELoss (BinaryCrossEntropyLoss) is a commonly used loss function, especially suitable for binary classification problems.
[0231] It is used to evaluate the difference between the predicted probability and the actual label, helping the model to better optimize parameters. The following is a detailed explanation:
[0232] The formula for BCELoss is as follows:
[0233]
[0234] in:
[0235] N is the total number of samples.
[0236] y i is the actual label (0 or 1) of the i-th sample.
[0237] pi is the predicted probability of the ith sample (model output, ranging between 0 and 1).
[0238] BCELoss aims to minimize the difference between the actual label and the predicted probability. The closer the predicted probability is to the actual label, the smaller the loss value.
[0239] The logarithmic function (log) is used to transform the probability into logarithmic space, which helps to deal with numerical stability issues. At the same time, it can amplify small differences and make the model more sensitive to small errors during training.
[0240] 6. Model application:
[0241] The trained model is deployed in the fault station short system for fault identification and the fault classification results are obtained.
[0242] a. Deploy the model to the fault monitoring system of the monitoring center, start the model and connect the monitoring center and the result visualization module.
[0243] b. The current, voltage and phase number data of the lines between topological nodes during the monitoring period are obtained through the intelligent monitoring equipment installed at the grid nodes. The sampling interval of the monitoring data is 0.00005 seconds.
[0244] c. Store the sampled data and perform preprocessing: for each row of data, perform bidirectional mapping between the starting point, end point and phase sequence and the index corresponding to each column.
[0245] d. Send the preprocessed data to the fault detection system to detect line faults in real time and obtain fault classification results.
[0246] e. Output the fault classification results to the visualization module and the fault classification result database for data aggregation and analysis. 7. Specific implementation methods
[0248] 1) Data acquisition based on XX distribution network XX monitoring technology: The present invention is based on a sufficiently large amount of data sets and obtains corresponding data through XX distribution network XX monitoring technology.
[0249] 2) Data preprocessing: By preprocessing the current and voltage data sets and using multidimensional feature extraction methods, similar data can be characterized multiple times.
[0250] 3) Training a deep learning model based on LSTM and Attention mechanism: Based on the LSTM deep learning framework, the model is trained using existing data sets, and the Attention mechanism is introduced to suppress useless information, helping the model to obtain more important information for learning during the training process, adjusting parameters to optimize the model and improve accuracy.
[0251] 4) Fault diagnosis based on real-time data: After obtaining the deep learning model, it is deployed on the server. Then the real-time data can be input into the model to obtain fault diagnosis results with high accuracy within an acceptable time.
[0252] 1. Specific application fields or related products of the present invention.
[0253] The present invention can be applied to the urban distribution network fault analysis and diagnosis platform. The present invention can be applied to the urban power grid risk perception and emergency response mechanism under the background of extreme events, so as to facilitate timely and accurate fault detection, formulate emergency measures, and improve disposal efficiency. The present invention can provide technical support for software development and system improvement for power grid headquarters (branches), provincial companies, and municipal companies.
[0254] The present invention has been integrated into a city panoramic situation assessment and risk active defense decision support system based on strong artificial intelligence and digital twins, and is used in cooperation with a power grid company to quickly identify and locate power grid faults, improve identification efficiency and accuracy, support emergency response decisions, and reduce the social impact and economic losses caused by distribution network failures in extreme weather conditions.
[0255] 2. Relevant evidence of the technical effects obtained by the embodiments of the present invention.
[0256] The present invention has conducted experiments on fault classification and location on the electrical quantity simulation data of IEEE 33-node power grid faults. The experimental process is as follows.
[0257] Simulink is used to simulate the electrical data of IEEE 33 nodes in four topological structures under different types of faults. The simulation time is 0.2s, and data is recorded every 0.0005s, including the current and voltage values of the three-phase AC power of each node ABC. The time series data with a length of 400 is sliced into fault waveforms and non-fault waveforms according to the fault time, with a length of 100, and labels for 19 waveform types (7 short circuits, 10 short circuits, and 2 normal), with a total data size of 34Gb.
[0258] The sample size of each fault type data is as follows:
[0259]
[0260] Construct the model described in the present invention and train the data. The training loss and accuracy are as follows: Figure 5 Shown:
[0261] The best accuracy obtained was 94.7%.
[0262] Thereby verifying the validity of the invention.
[0263] It should be noted that the embodiments of the present invention can be implemented by hardware, software, or a combination of software and hardware. The hardware part can be implemented using dedicated logic; the software part can be stored in a memory and executed by an appropriate instruction execution system, such as a microprocessor or dedicated design hardware. It can be understood by a person of ordinary skill in the art that the above-mentioned devices and methods can be implemented using computer executable instructions and / or contained in a processor control code, such as a carrier medium such as a disk, CD or DVD-ROM, a programmable memory such as a read-only memory (firmware), or a data carrier such as an optical or electronic signal carrier. Such code is provided on the carrier medium. The device and its modules of the present invention can be implemented by hardware circuits such as very large-scale integrated circuits or gate arrays, semiconductors such as logic chips, transistors, etc., or programmable hardware devices such as field programmable gate arrays, programmable logic devices, etc., can also be implemented by software executed by various types of processors, and can also be implemented by a combination of the above-mentioned hardware circuits and software, such as firmware.
[0264] The above description is only a specific implementation mode of the present invention, but the protection scope of the present invention is not limited thereto. Any modifications, equivalent substitutions and improvements made by any technician familiar with the technical field within the technical scope disclosed by the present invention and within the spirit and principle of the present invention should be covered by the protection scope of the present invention.
Claims
1. A deep learning distribution network fault classification detection method based on attention mechanism, characterized in that: The following steps are involved: Step 1, data preparation: Collect historical operation data of the distribution network, including key parameters such as voltage, current, power and frequency, mark known fault types and corresponding time periods, and build data sets for training and testing; Step 2, data processing: Preprocess the collected data, including denoising, normalization, and feature extraction, and divide the time series data into time windows suitable for long short-term memory network processing; Step 3: Build the LSTM-Attention model: Construct an LSTM layer to capture long-term dependencies in time series data and learn the time series characteristics of the distribution network operation status; Construct an attention mechanism layer to dynamically assign weights to data at different time steps, highlight information at critical moments, and improve the model’s sensitivity and accuracy in fault detection; Step 4, decoding and output: The feature vector processed by the attention mechanism is input into the decoding layer to classify the fault type and output the final fault detection result, including the fault type and occurrence time; Step 5, training and model tuning: Use the preprocessed dataset to train the LSTM-Attention model and optimize the model parameters through the loss function and back propagation algorithm; Adjust the model's hyperparameters, including learning rate and batch size, and use cross-validation methods to improve the model's generalization ability.
2. The deep learning distribution network fault classification detection method based on the attention mechanism as claimed in claim 1 is characterized in that: The data preparation: Use unsupervised learning methods to identify abnormal patterns in waveforms and match them with known fault types to automatically generate labels. By inputting a large amount of unlabeled raw data and analyzing a large amount of unlabeled power grid operation data, the model will capture the common characteristics of data signals at the time of faults during training, automatically detect possible fault characteristics, and label them accordingly. At the same time, combined with clustering algorithms, similar abnormal patterns are grouped and compared with historical fault data to generate more accurate labels.
3. The deep learning distribution network fault classification detection method based on attention mechanism as claimed in claim 1 is characterized in that: The data processing: The read_data(dir_list) function receives a directory list dir_list as a parameter, removes the data and label types, and returns the data and label types. The random_split function is used to randomly split the data set into a training set and a test set, where the ratio of the training set to the test set is 8:
2. The purpose of fault_type_to_index is to convert the string representation of the fault type into an integer index. First, define the fault type dictionaries: cut_shrot_type_dict and fault_type_dict, and map each fault type to a unique integer. Check the validity of the input by building a mapping relationship in the dictionary; Data preprocessing and slicing: Slice the time series data with a length of 400 into fault waveforms and non-fault waveforms according to the fault time, with a length of 100 and labels of 18 waveform types: 7 short circuits, 10 short circuits, and 1 normal; In the IEEE33 node scenario, the data set consists of 30 fault points, voltage, current values and phase numbers from the start to the end of the time period; phase A, phase B, and phase C; the node voltage is the voltage of the current node, and the node current is the total current flowing into the current node; the fault types include 10 types of faults: AG, BG, CG, ABG, ACG, BCG, AB, AC, BC, and ABC.
4. The deep learning distribution network fault classification detection method based on attention mechanism as claimed in claim 1 is characterized in that: The construction of LSTM-Attention model: The model mainly uses the LSTM-Attention model, which consists of a feature extraction layer, an LSTM layer, a CNN layer, and a self-attention mechanism processing layer.
5. The deep learning distribution network fault classification detection method based on attention mechanism as claimed in claim 1, characterized in that: The decoding and output: Perform matrix multiplication of the context vector context and the hidden state of the current time step to obtain the output feature x, and finally use the MLP output with the output channel num_class to calculate the final output, and finally output the prediction result probability array through the softmax layer.
6. The deep learning distribution network fault classification detection method based on attention mechanism as claimed in claim 1 is characterized in that: The training and model tuning: Move the model to the specified device; Determine and set the data set model parameters; Define the optimizer Adam and the loss function BCELoss.
7. A deep learning distribution network fault classification detection system based on an attention mechanism that implements the deep learning distribution network fault classification detection method based on an attention mechanism as described in any one of claims 1 to 6, characterized in that: The deep learning distribution network fault classification detection system based on the attention mechanism includes: A data preparation module that uses unsupervised learning methods to identify abnormal patterns in waveforms and match them to known fault types to automatically generate labels; The data processing module is used to receive a directory list dir_list as a parameter through the read_data(dir_list) function, remove the data and label types, and return the data and label types; the random_split function is used to randomly split the data set into a training set and a test set, where the ratio of the training set to the test set is 8:2; Build a model module for using the LSTM-Attention model, which consists of a feature extraction layer, an LSTM layer, a CNN layer, and a self-attention mechanism processing layer; The decoding output module is used to perform matrix multiplication on the context vector context and the hidden state of the current time step to obtain the output feature x, and finally use the MLP output with the output channel num_class to calculate the final output, and finally output the prediction result probability array through the softmax layer; The tuning module is used to move the model to the specified device; determine and set the data set model parameters; define the optimizer Adam and the loss function BCELoss.
8. A computer device, characterized in that: The computer device includes a memory and a processor, the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the deep learning distribution network fault classification detection method based on the attention mechanism as described in any one of claims 1-6.
9. A computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the processor executes the steps of the deep learning distribution network fault classification detection method based on the attention mechanism as described in any one of claims 1 to 6.
10. An information data processing terminal, characterized in that: The information data processing terminal is used to implement the deep learning distribution network fault classification detection system based on the attention mechanism as described in claim 7.
Citation Information
Patent Citations
voltage sag disturbance classification method based on LSTM
CN109766853A
Power distribution network high-resistance grounding fault diagnosis method based on semi-supervised learning and attention mechanism
CN112016473A
Federal learning-based power distribution station fault prediction method
CN114219147A
High-voltage cable partial discharge diagnosis method based on CNN-LSTM-Attention neural network
CN114563671A
Power grid management system and method
CN115136439A
Cited By
Distribution network line loss abnormity diagnosis method and device
CN119720045A
Power grid planning, construction, operation and maintenance integrated modeling method and system based on semantic system
CN120013369A
Monitoring event analysis model construction method and system based on artificial intelligence
CN120873823A
Active power distribution network situation prediction method and system based on multiple attention mechanisms
CN121076792A
Power distribution network fault identification method combining deep learning and attention
CN121388818A
