A Power Grid Fault Diagnosis Method Based on BERT
Through the BERT-based power grid fault diagnosis method, the BERT model is used to process power grid alarm information, achieving fast and accurate fault diagnosis, solving the problem that traditional manual diagnosis is difficult to meet the needs of smart power grids, reducing labor costs and improving power grid dispatching intelligence. level.
Patent Information
- Application Number
- CN202210248594.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-14
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2042-03-14
AI Technical Summary
The traditional method of manually processing power grid alarm information is difficult to perform fault diagnosis quickly, accurately, and intelligently, and cannot meet the needs of intelligent power grid dispatching.
The BERT-based power grid fault diagnosis method is used to generate alarm information samples through simulation software, perform data preprocessing and semantic embedding, use the BERT model to train the power grid fault diagnosis model, and output a summary description text of fault characteristics to achieve end-to-end fault diagnosis.
It achieves fast and accurate power grid fault diagnosis, reduces dependence on manual design of diagnostic logic and power grid topology, saves labor costs, and improves the intelligence level of power grid dispatching decisions.
Smart Images

Figure CN114661905B
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of power grid fault diagnosis, and specifically is a power grid fault diagnosis method based on BERT, which is suitable for a fault diagnosis method in which the fault information source is power grid fault alarm information. Background Art
[0002] With the rapid construction of power informatization and the comprehensive promotion of power grid intelligence, massive amounts of text, audio, image and other data are distributed in multiple power grid asset management links such as infrastructure, operation, regulation, and maintenance. Power grid monitoring alarm information, as Chinese text information generated by the Supervisory Control And Data Acquisition (SCADA) system, is an important way for control personnel to monitor the operation status of the power grid.
[0003] Intelligent power grid fault diagnosis is one of the typical applications of intelligent power grid dispatching, which is of great significance for improving the intelligence level of power grid dispatching decision-making and ensuring the reliability of power grid operation. However, faced with massive alarm information including both switch quantity information such as protection action and circuit breaker tripping, as well as non-critical fault information such as device abnormality, voltage exceeding the limit, control circuit disconnection, and energy storage in place, the traditional method of manually processing power grid alarm information has become increasingly unable to meet the current development status of the power grid. How to diagnose power grid faults quickly, accurately, and intelligently has become a difficult point in power grid fault diagnosis research.
[0004] The rise of a new generation of artificial intelligence technologies, represented by natural language processing (NLP) and deep learning technology, has brought new solutions and methods for intelligent power grid diagnosis based on alarm information. Summary of the invention
[0005] In order to solve the above problems, the present invention provides a BERT-based power grid fault diagnosis method. This method first generates alarm information samples in batches through simulation software, and mixes in actual fault samples of a regional power grid to increase sample complexity. The samples are divided into a training set and a test set at a ratio of 8:2. The samples are then subjected to data preprocessing, i.e., word segmentation. The word segmentation results are then subjected to semantic embedding, sentence embedding, and position embedding to obtain the input text vector of the model. Finally, the training set is input into the BERT model to train the power grid fault diagnosis model, and a summary description text of the fault characteristics is output, and the applicability of the model is tested with the test set.
[0006] A BERT-based power grid fault diagnosis method, the method comprising:
[0007] S1. Collect alarm information text when power grid fails;
[0008] S2. Perform word segmentation processing on the warning information text;
[0009] S3, embedding semantic features, sentence features and position features into the warning information text, and adding the three features together to form a model input vector;
[0010] S4. Build a BERT-based power grid fault diagnosis model;
[0011] S5. Input the input vector into a power grid fault diagnosis model, diagnose the power grid fault, and output a diagnosis result.
[0012] Preferably, the input of the BERT-based power grid fault diagnosis method is the alarm information text of the power grid, and the output is a summary description text of the relevant fault characteristics, which gets rid of the dependence on manually designed diagnostic logic, that is, realizes end-to-end power grid fault diagnosis.
[0013] Preferably, the step S1 comprises:
[0014] After a power grid fault occurs, the protection and switch action information related to the faulty equipment will be uploaded to the SCADA system in real time. At the same time, the SCADA system will also receive some alarm information such as device failure and switch mechanism spring failure. This information is recorded in chronological order to generate an alarm information set at the time of the fault. The alarm information set is collected to construct a data sample set for the power grid fault diagnosis model. The samples are divided into a training set and a test set at a ratio of 8:2.
[0015] Preferably, step S2 comprises:
[0016] Based on the Jieba word segmentation technology and supplemented with named entities related to the power field, such as plant name, line name, substation name, etc., a power grid fault diagnosis dictionary is constructed to perform word segmentation on the alarm information text.
[0017] Preferably, step S3 comprises:
[0018] The Word2vec model is used to generate a low-dimensional word vector, namely a semantic feature vector, representing the association between words using the context information of the word segmentation results. The odd-numbered sentence text and the even-numbered sentence text of the warning information text are respectively embedded in EA and EB to learn the logical relationship between adjacent warning information sentences. The word segmentation results are positionally encoded to determine the position information of each word, and the temporal characteristics of each word and the correlation between words are learned.
[0019] Preferably, step S3 comprises:
[0020] For the input alarm information sample, after feature embedding, the three embedding vectors are added, namely the semantic embedding vector, the sentence embedding vector and the position embedding vector, and then input into the BERT model.
[0021] Preferably, step S4 comprises:
[0022] The semantic extraction layer of the BERT model is a multi-layer bidirectional decoder with the Transformer encoder as the basic unit, which mainly includes three parts: attention mechanism, layer normalization and residual connection, and feedforward neural network.
[0023] Preferably, step S4 comprises:
[0024] The attention mechanism consists of multiplying the word embedding matrix by three matrices W Q , W K , W V We get three matrices: Query, Key, and Value, denoted as Q, K, and V, with dimensions of N×d respectively. k , N×d k , N×d v , Q and K have the same dimensions; the calculation formulas for Q, K, and V are:
[0025] Q=Linear(X)=XW Q
[0026] K=Linear(X)=XW K
[0027] V=Linear(X)=XW V
[0028] Where: Linear is a linear mapping; X is a word embedding matrix; W Q , W K , W V is the weight matrix;
[0029] The output of the attention mechanism is:
[0030]
[0031] Where: is to convert the attention mechanism into a standard normal distribution, d k Avoid QK for the penalty factor T Too large; Softmax() is normalization, which means summing the attention weights of each word and other words in the text.
[0032] Layer standardization accelerates the model training of the standard normal distribution by normalizing the hidden layers in the neural network, thereby accelerating the convergence of the model. The calculation formula is:
[0033]
[0034]
[0035]
[0036] Where: x ij For each vector in the word embedding matrix, μ i is the mean value of the matrix rows; σ i 2 is the variance of the matrix row; m is the number of matrix rows; ⊙ is the multiplication of the elements in the matrix; α and β are model training parameters; ε is used to prevent the denominator from being 0;
[0037] The feedforward neural network is formed by 2 layers of linear mapping, activated by the ReLU activation function, and finally the normalized data is input into the feedforward neural network. The calculation formula is:
[0038] X hidden =ReLU(Linear(X))
[0039] Preferably, step S4 comprises:
[0040] The unsupervised pre-training of the BERT model includes two training tasks, namely the Masked Language Model (MLM) and the Next Sentence Prediction (NSP).
[0041] The method of the MLM task is to randomly mask 15% of the input of the warning information samples, and train the model to self-learn and predict the original words of the masked part. Among them, 80% of the masked words are replaced by Masked tokens; 10% are replaced by a random word; and 10% remain unchanged. A Softmax layer is then connected to the corresponding output representation vector to predict the masked words or characters, and the parameters of BERT are trained in the process of multiple predictions.
[0042] The NSP task learns the relationship between two sentences. By pre-training a binary classification model in the fault diagnosis model, in this task, there is a 50% probability of extracting two sentences with continuous context from the corpus, and another 50% probability of extracting two sentences with discontinuous context. The model self-learns to predict whether the two extracted sentences are continuous sentences in the actual article.
[0043] In order to effectively utilize the alarm information data, improve the speed and accuracy of power grid fault diagnosis, and reduce the dependence on manually designed diagnostic strategies and power grid topology, the method of the present invention integrates the batch alarm information samples generated by the simulation software with the measured fault samples of the power grid in a certain area to construct a sample data set of the fault diagnosis model; divides the sample data set into a training set and a test set at a ratio of 8:2; then performs data preprocessing on the samples, i.e., word segmentation; then performs semantic embedding, sentence embedding and position embedding on the word segmentation results to obtain the input text vector of the model; finally, the training set is input into the BERT model to train the power grid fault diagnosis model, and the applicability of the model is tested with the test set. The present invention converts the power grid fault diagnosis problem into a natural language processing problem. By using the deep learning network and natural language processing technology, the model can autonomously learn the fault features in the alarm information text through the input alarm information samples, directly output the summary description text of the fault features, realize end-to-end power grid fault diagnosis, and greatly save labor costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] The drawings described herein are used to provide a further understanding of the embodiments of the present invention, constitute a part of this application, and do not constitute a limitation on the embodiments of the present invention;
[0045] Figure 1 A flowchart of a BERT-based power grid fault diagnosis method according to a preferred embodiment of the present invention
[0046] Figure 2 is the input representation of the BERT model according to a preferred embodiment of the present invention
[0047] Figure 3 The Transformer encoder structure according to a preferred embodiment of the present invention
[0048] Figure 4 A schematic diagram of the MLM task method according to a preferred embodiment of the present invention
[0049] Figure 5 Schematic diagram of the NSP task method according to a preferred embodiment of the present invention DETAILED DESCRIPTION
[0050] The specific implementation of the present invention is further described in detail below in conjunction with the accompanying drawings and examples. The following examples are used to illustrate the present invention, but are not intended to limit the scope of the present invention.
[0051] The present invention provides a BERT-based power grid fault diagnosis method. This method first generates alarm information samples in batches through simulation software, and mixes in fault samples of a certain regional power grid to increase sample complexity. The samples are divided into a training set and a test set at a ratio of 8:2. The samples are then subjected to data preprocessing, i.e., word segmentation. The word segmentation results are then subjected to semantic embedding, sentence embedding, and position embedding to obtain an input text vector of the model. Finally, the training set is input into a BERT model to train a power grid fault diagnosis model, and a summary description text of the fault features is output, and the applicability of the model is tested using a test set.
[0052] See also Figure 1 , the method specifically comprises the following steps:
[0053] S1. Collect alarm information text when power grid fails;
[0054] Specifically, after a power grid failure occurs, the protection and switch action information related to the faulty equipment will be uploaded to the SCADA system in real time. At the same time, the SCADA system will also receive some alarm information such as device failure and switch mechanism spring failure. This information is recorded in chronological order to generate an alarm information set at the time of the failure. The alarm information set is collected to construct a data sample set for the power grid fault diagnosis model. The samples are divided into a training set and a test set at a ratio of 8:2.
[0055] S2. Perform word segmentation processing on the warning information text;
[0056] Specifically, based on the Jieba word segmentation technology and supplemented with named entities related to the power field, such as plant name, line name, substation name and other words, a power grid fault diagnosis dictionary is constructed, thereby performing word segmentation on the alarm information text.
[0057] S3, embedding semantic features, sentence features and position features into the warning information text, and adding the three features together to form a model input vector;
[0058] For details, see Figure 2 , the Word2vec model is used to generate a low-dimensional word vector representing the relationship between words, i.e., a semantic feature vector, by using the word segmentation result and the context information of the word; the odd-numbered sentence text and the even-numbered sentence text of the warning information text are respectively embedded in E A and E B , E A Assign a value of 1, E B The value is assigned as 0 to learn the logical relationship between adjacent alarm information sentences; the word segmentation results are positionally encoded to determine the position information of each word, and the temporal characteristics of each word and the correlation between words are learned.
[0059] For the input alarm information sample, after feature embedding, the three embedding vectors are added together, namely the semantic embedding vector, the sentence embedding vector and the position embedding vector, to obtain the word embedding matrix, which is input into the BERT model.
[0060] S4. Build a BERT-based power grid fault diagnosis model.
[0061] For details, see Figure 3 ,The semantic extraction layer of the BERT model is a multi-layer bidirectional decoder with the Transformer encoder as the basic unit, including three parts: attention mechanism, layer normalization and residual connection, and feedforward neural network. Figure 3 The input shown is the alarm information text to be vector embedded, and the output is the fault condition description text to be decoded.
[0062] The input of the attention mechanism is the word embedding matrix, which is obtained by S3 and multiplied by three matrices W Q , W K , W V We get three matrices: Query, Key, and Value, denoted as Q, K, and V, with dimensions of N×d respectively. k , N×d k , N×d v , Q and K have the same dimension. The calculation formula of Q, K, V is:
[0063] Q=Linear(X)=XW Q
[0064] K=Linear(X)=XW K
[0065] V=Linear(X)=XW V
[0066] Where: Linear is a linear mapping; X is a word embedding matrix; W Q , W K , W V is the weight matrix.
[0067] The output of the attention mechanism is:
[0068]
[0069] Where: is to convert the attention mechanism into a standard normal distribution, d k Avoid QK for the penalty factor T Too large; Softmax() is normalization, which means summing the attention weights of each word and other words in the text.
[0070] Layer normalization accelerates the model training of the standard normal distribution by normalizing the hidden layers in the neural network, thereby accelerating the model convergence. The calculation formula is:
[0071]
[0072]
[0073]
[0074] Where: x ij For each vector in the word embedding matrix, μ i is the average value of the matrix rows solved by the above formula; σ i 2 is the variance of the matrix row solved by the above formula; ⊙ is the multiplication of the elements in the matrix; α and β are model training parameters; ε is used to prevent the denominator from being 0.
[0075] The feedforward neural network is formed by 2 layers of linear mapping, activated by the ReLU activation function, and finally the normalized data is input into the feedforward neural network. The calculation formula is:
[0076] X hidden =ReLU(Linear(X))
[0077] The unsupervised pre-training of the BERT model includes two training tasks, namely the Masked Language Model (MLM) and the Next Sentence Prediction (NSP).
[0078] For details, see Figure 4 The method of the MLM task is to randomly mask 15% of the input of the alarm information samples, and train the model to self-learn and predict the original words of the masked part. Among them, 80% of the masked words are replaced by Masked tokens; 10% are replaced by a random word; and 10% remain unchanged. A Softmax layer is then connected to the corresponding output representation vector to predict the masked words or characters, and the parameters of BERT are trained in the process of multiple predictions.
[0079] For details, see Figure 5 The NSP task learns the association between two sentences. By pre-training a binary classification model in the fault diagnosis model, in this task, there is a 50% probability of extracting two sentences with continuous context from the corpus, and another 50% probability of extracting two sentences with discontinuous context. The model self-learns to predict whether the two extracted sentences are continuous sentences in the actual article.
[0080] When a fault occurs, the alarm information text collected by the SCADA system is embedded through semantic features, sentence features, and position features to generate a word embedding vector matrix that can be recognized by the computer; the vector matrix is input into the Transformer encoder, and the fault features in the text are self-learned through the attention mechanism; and the logical relationship between the context and the previous and next sentences in the text is learned through the MLM task and the NSP task; the fault situation description text vector matrix is generated by combining the learned fault features and logical relationships; and the fault situation description text is output through the decoder.
[0081] In order to effectively utilize the alarm information data, improve the speed and accuracy of power grid fault diagnosis, and reduce the dependence on manually designed diagnostic strategies and power grid topology, the method of the present invention integrates the batch alarm information samples generated by the simulation software with the measured fault samples of the power grid in a certain area to construct a sample data set of the fault diagnosis model; divides the sample data set into a training set and a test set at a ratio of 8:2; then performs data preprocessing on the samples, i.e., word segmentation; then performs semantic embedding, sentence embedding and position embedding on the word segmentation results to obtain the input text vector of the model; finally, the training set is input into the BERT model to train the power grid fault diagnosis model, and the applicability of the model is tested with the test set. The present invention converts the power grid fault diagnosis problem into a natural language processing problem. By using the deep learning network and natural language processing technology, the model can autonomously learn the fault features in the alarm information text through the input alarm information samples, directly output the summary description text of the fault features, realize end-to-end power grid fault diagnosis, and greatly save labor costs.
[0082] The above are only preferred embodiments of the present invention, but do not limit the patent scope of the present invention. Although the present invention is described in detail with reference to the above embodiments, those skilled in the art can still modify the technical solutions recorded in the above embodiments, or replace some of the technical features with equivalent ones. Any equivalent structure made by using the contents of the present invention specification and drawings, directly or indirectly used in other related technical fields, is also within the scope of patent protection of the present invention.
Claims
1. A BERT-based power grid fault diagnosis method, which takes the alarm information text of the power grid as input and outputs a summary description text of the fault characteristics, thus realizing end-to-end power grid fault diagnosis. It is characterized in that The method comprises: S1. Collect alarm information text when power grid fails; including: S11: After a power grid fault occurs, the protection and switch action information related to the faulty equipment will be uploaded to the SCADA system in real time; S12: The SCADA system receives the alarm information of the device failure and the switch mechanism spring, records it in chronological order, and generates an alarm information set at the time of the failure; S13: The collected alarm information sets are used to construct a data sample set for a power grid fault diagnosis model; S2. Perform word segmentation on the warning information text; including: Based on Jieba word segmentation technology and supplemented with named entities related to the power field, a power grid fault diagnosis dictionary is constructed to perform word segmentation on the alarm information text; S3. Embed the semantic features, sentence features and position features of the warning information text, and add the three features to form the model input vector; for the input warning information sample, after feature embedding, add the three embedding vectors, that is, the semantic embedding vector, sentence embedding vector and position embedding vector to obtain the word embedding matrix and input it into the BERT model; including: S31: Using the Word2vec model, the word segmentation results are used to generate low-dimensional word vectors representing the relationship between words, namely semantic feature vectors, using the context information of the words; S32: embed the odd-numbered sentences and even-numbered sentences of the warning information text into E A and E B To learn the logical relationship between adjacent alarm information sentences, E A Assign a value of 1, E B Assign a value of 0; S33: Position encoding is performed on the word segmentation results to determine the position information of each word, and the temporal features of each word and the correlation between words are learned; S4. Construct a BERT-based power grid fault diagnosis model; the semantic extraction layer of the BERT model is a multi-layer bidirectional decoder with a Transformer encoder as a basic unit, including three parts: attention mechanism, layer normalization and residual connection, and feedforward neural network; S5, inputting the input vector into a power grid fault diagnosis model, diagnosing the power grid fault, and outputting a diagnosis result; The attention mechanism input is the word embedding matrix, which is obtained by S3 and multiplied by three matrices W Q , W K , W V We get three matrices: Query, Key, and Value, denoted as Q, K, and V, with dimensions of N×d respectively. k , N×d k , N×d v , Q and K have the same dimensions; the calculation formulas for Q, K, and V are: Q=Linear(X)=XW Q K=Linear(X)=XW K V=Linear(X)=XW V Where: Linear is a linear mapping; X is a word embedding matrix; W Q , W K , W V is the weight matrix; The output of the attention mechanism is: Where: is to convert the attention mechanism into a standard normal distribution, d k Avoid QK for the penalty factor T Too large; Softmax() is normalization, which refers to the sum of the attention weights of each word and other words in the text; Layer standardization accelerates the model training of the standard normal distribution by normalizing the hidden layers in the neural network, thereby accelerating the convergence of the model. The calculation formula is: Where: x ij For each vector in the word embedding matrix, μ i is the mean value of the matrix rows; σ i 2 is the variance of the matrix row; m is the number of matrix rows; ⊙ is the multiplication of the elements in the matrix; α and β are model training parameters; ε is used to prevent the denominator from being 0; The feedforward neural network is formed by 2 layers of linear mapping, activated by the ReLU activation function, and finally the normalized data is input into the feedforward neural network. The calculation formula is X hidden =ReLU(Linear(X)).
2. The method according to claim 1, It is characterized in that The step S4 comprises: The unsupervised pre-training of the BERT model includes two training tasks, namely the masked language model MLM and the next sentence prediction NSP.
3. The method according to claim 2, It is characterized in that The method of the MLM task is to randomly mask 15% of the input of the warning information samples, and train the model to self-learn and predict the original words of the masked part; among them, 80% of the masked words are replaced by Masked tokens; 10% are replaced by a random word; 10% remain unchanged; a Softmax layer is then connected to the corresponding output representation vector to predict the masked words or characters, and the parameters of BERT are trained in the process of multiple predictions; The NSP task learns the association between two sentences. By pre-training a binary classification model in the fault diagnosis model, there is a 50% probability of extracting two sentences with continuous contexts from the corpus in this task, and another 50% probability of extracting two sentences with discontinuous contexts. The model self-learns to predict whether the two extracted sentences are continuous sentences in the actual article. Pre-train a binary classification model. In this task, there is a 50% probability of extracting two sentences with continuous context from the corpus, and another 50% probability of extracting two sentences with discontinuous context. The model self-learns to predict whether the two extracted sentences are continuous sentences in the actual article.
Citation Information
Cited By
Entity relationship joint extraction method and device for partial discharge text of power equipment, and medium
CN116975161A
