Power grid fault real-time diagnosis method and device based on end-to-end hybrid model, electronic equipment and storage medium

Through the grid fault diagnosis method based on end-to-end hybrid model, combined with Spearman correlation coefficient method and variational autoencoder and generative adversarial network, the accuracy and efficiency of complex fault diagnosis in smart grids are solved, achieving high The balance between accuracy and low operating burden is suitable for fault identification in smart grids.

CN119293606APending Publication Date: 2025-01-10国网新疆电力有限公司营销服务中心
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411361751.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-27
Publication Date
2025-01-10

AI Technical Summary

Technical Problem

Existing grid fault diagnosis methods are difficult to accurately diagnose when facing complex faults, and the number and quality of data sources are insufficient, resulting in low diagnostic efficiency and poor accuracy, especially in the case of large number of equipment and diverse fault forms in smart grids. It is difficult to meet practical application requirements.

Method used

Using the real-time grid fault diagnosis method based on end-to-end hybrid model, fault features are extracted through Spearman correlation coefficient method, and a variational autoencoder (VAE) framework with embedded standard flow is constructed, and it is inserted into the generative adversarial network. In (GAN), appropriate generator and discriminator loss functions are derived, combined with the fault number predictor, and a hybrid model is constructed to improve diagnostic accuracy.

Benefits of technology

It significantly improves the accuracy and efficiency of grid fault diagnosis, can quickly identify faulty equipment in smart grids, reduces the impact of data sample length on training, improves the fault tolerance and scalability of the model, and solves the high accuracy of deep learning networks. The problem between rate and low operating burden.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119293606A_ABST
    Figure CN119293606A_ABST
Patent Text Reader

Abstract

The invention discloses a power grid fault real-time diagnosis method and device based on an end-to-end hybrid model, electronic equipment and a storage medium. According to the invention, the fault diagnosis model based on the hybrid framework generation model can be trained purposefully. The method comprises the following steps: step (1), acquiring system operation data of a full link of a smart power grid, performing fault feature extraction, dividing a training set and a test set, and forming a data sample of a subsequent step; step (2), constructing a variational auto-encoder (VAE) frame embedded with a standard flow (Flow), and deriving a loss function of the frame in subsequent training in a maximum likelihood form; (3) sleeving the model into a generator of a generative adversarial network (GAN), and deducing a proper generator loss function and a discriminator loss function; and step (4), aiming at an actual scene faced by fault diagnosis, constructing a fault number predictor, and providing an alignment matrix for training and derivation of a framework.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a real-time diagnosis technology for power grid faults, and in particular to a real-time diagnosis technology for power grid faults based on an end-to-end hybrid model. Background Art

[0002] Due to the influence of aging power grid equipment and natural disasters, faults are inevitable during the operation of smart grids. Timely and accurate diagnosis of faulty components will help restore the normal operation of the power system. In this case, it is very necessary to resort to advanced diagnostic technology. When power equipment fails, the dispatch center will receive a large number of signals at the same time. How to quickly identify the faulty equipment from a large number of signals, the so-called "fault diagnosis", is of great significance to ensure and improve the safety of system operation, and has become the standard software of the power dispatch center. So far, the main methods of power system fault diagnosis include expert systems, analytical model methods, artificial neural networks, Petri nets, Bayesian networks, multi-agent system methods, genetic algorithms, and methods based on optimization algorithms.

[0003] Expert systems are implemented by building expert knowledge bases and reasoning mechanisms, and judgments on whether equipment is faulty or not are obtained based on expert experience. This type of method has become the most widely used method in actual power system fault diagnosis because of its relatively simple principle and stable operation. Expert systems are combined with fuzzy systems and multi-agent technology to be applied to fault diagnosis problems, and various data sources are used to conduct comprehensive diagnosis of various possible faults of meters and terminals. How to effectively obtain expert experience knowledge and how to make the reasoning mechanism extensible are problems that need to be overcome in this type of method. Petri nets represent the logical relationship of the components of smart grids in a graphical way, and analyze the process of equipment failure from the perspective of the mutual logical relationship of equipment. Petri nets are combined with fuzzy information, and based on Petri nets, possible situations are considered to establish a multi-factor hierarchical model, and the fault tolerance of the model is enhanced by taking into account time constraints. This type of method requires sufficient prior probability data of equipment failure, which is often difficult to obtain, which limits its application accordingly. Artificial neural networks take switch and fault information as network input, and the corresponding equipment failure information as network output, which has the characteristics of simple and fast online operation and strong fault tolerance. However, when facing actual user scenarios, neural networks have many problems, such as complex parameter adjustment process, large impact of hyperparameters on the model, and high computing power requirements, which makes them lack the ability to extrapolate and difficult to meet the needs of actual applications in smart grids. The insufficient number of samples and uneven quality are a major obstacle to the application of deep learning neural network methods to engineering problems. Some scholars have used unsupervised pre-training to improve this problem, but existing methods have not fundamentally solved the problem.

[0004] According to the survey of dispatching centers of multiple power companies, in the process of popularization and application of smart grids, due to the large number of equipment, various manufacturers, and complex networking structures, the faults of power grids are of different forms. The large number of fault indicators and the complex correlation make it difficult to timely troubleshoot and locate the problems. There are even frequent situations where each link shirks responsibility, which affects the normal system maintenance of power companies. With the continuous development of smart grids, fault diagnosis methods based on feature engineering and data mining have gradually attracted attention. Generative adversarial networks (GANs) are a deep learning algorithm that can generate models. The requirements for sample size and parameter adjustment are much lower than those of traditional deep neural networks. They have been applied in the fields of electricity theft detection, network behavior classification, and software defect prediction. In recent years, many researchers have optimized and improved GAN from the aspects of improving training efficiency and accuracy. Some scholars use the confidence screening method to reduce the number of samples involved in training and improve the model training efficiency; some scholars use different loss functions to replace the original loss function to improve the accuracy of the generator based on the design defects of GAN; this patent incorporates variational autoencoders and standard streams on the basis of related research to generate a hybrid model with significant results. Similar to the problems faced by traditional artificial neural networks, the current research on GAN-based power grid fault diagnosis methods is mainly limited by the quantity and quality of data sources, and it is often difficult to meet both requirements at the same time when facing practical applications. Regardless of the model established, the data features extracted from the data are often an important factor affecting the diagnosis results. Summary of the invention

[0005] The technical problem to be solved by the invention is to consider various uncertain situations when complex faults occur, and disclose a real-time diagnosis method, device, electronic device and storage medium for power grid faults based on an end-to-end hybrid model; a Spearman correlation coefficient method is used to filter the historical fault data information of the smart grid; and a fault diagnosis model based on a hybrid framework generation model is purposefully trained to address the problems that traditional optimization algorithms cannot accurately diagnose, are prone to falling into local optimality, and have excessive operating loads.

[0006] In order to achieve the above object, the present invention adopts the following technical solutions:

[0007] In a first aspect, the present invention discloses a real-time power grid fault diagnosis method based on an end-to-end hybrid model, comprising:

[0008] Step (1): Obtain system operation data of the entire link of the smart grid, extract fault features, divide the training set and the test set, and form data samples for subsequent steps;

[0009] Step (2): Construct a variational autoencoder (VAE) framework with standard flow embedded in it, and derive the loss function of the framework in subsequent training in the form of maximum likelihood;

[0010] Step (3): Put the above model into the generator of the generative adversarial network (GAN) to derive the appropriate generator loss function and discriminator loss function;

[0011] Step (4): Build a fault quantity predictor for the actual scenarios faced by fault diagnosis, and provide an alignment matrix for the training and derivation of the framework;

[0012] Step (5): Based on the derived loss function of the hybrid model, the adversarial network model is trained using the samples in the training set. The test set is input into the fault diagnosis model according to the reasoning process of the framework to obtain the fault analysis results and perform model comparison and verification.

[0013] Further: the step (1) is to obtain the system operation data of the whole link of the smart grid, extract fault features, divide the training set and the test set, and form the preliminary work of the data samples for the subsequent steps, wherein:

[0014] A total of 23 different fault features are extracted from the front-end, channel, meter and terminal using the correlation coefficient method. For X n With X′ n The Spearman correlation coefficient of the fault characteristics is analyzed as follows:

[0015]

[0016] Where: X n =(x n ,x n+1 ,…,x n+m ) represents the value of a feature in the m time windows before the power grid fault time after the work order is established; X′ n =(x′ n ,x′ n+1 ,…,x′ n+m ) represents the value of another feature in the same time window; d i Indicates the difference in order.

[0017] Further: When analyzing the problem at the electric energy meter level, the steps to extract the relevant features of the electric meter equipment are as follows:

[0018] S1: Is there any unfinished work order related to the meter? exist , if yes, then it is 1, otherwise it is 0;

[0019] S2: Is there any abnormal event E reported by the meter? exist , if yes, then it is 1, otherwise it is 0;

[0020] S3: The percentage of successful freezing and collection of the meter in the five days before the event occurred;

[0021] S4: Whether the meter freeze data collection was successful one day before the event occurred C data If yes, then it is 1, otherwise it is 0;

[0022] S5: The daily freezing collection success rate of other electric meters under the same terminal on the day of the collection failure.

[0023] Further: In the step (2), a variational autoencoder (VAE) framework with a standard flow embedded is constructed, and the loss function of the framework in subsequent training is derived in the form of maximum likelihood, including:

[0024] Since the framework integrates VAE, Flow and GAN, many related parameters need to be adjusted. Some important adjustments are as follows:

[0025] First is the variational log-likelihood under the VAE framework, which is modified into the following formula in this patent:

[0026]

[0027] p θ With q φ They correspond to the priori coding and the posterior coding respectively, z is the implicit distribution, x is the fault result sample in the posterior coding, and c is the power data sample in the priori coding;

[0028] Next is the loss function of the network in VAE, which uses the form of KL divergence to subtract the log-likelihood of the result data to the implicit distribution in the posterior distribution from the log-likelihood of the input data and the alignment matrix to the implicit distribution in the prior distribution; its formula is as follows:

[0029]

[0030] where c data is the processed input generated by the alignment matrix given by the fault number predictor; A in formula (3) is the alignment matrix between power data and faults, and N(μ(·),σ(·)) is a Gaussian distribution; the above formula (3) is the standard flow formula of Flow from the z distribution in the posterior distribution, that is, the modified form of the log-likelihood of the power data c to the implicit distribution z in the framework:

[0031]

[0032] In step (3), the above model is inserted into the generator of the generative adversarial network (GAN) to derive a suitable generator loss function and a discriminator loss function, including:

[0033] GAN can be abstracted as a maximum and minimum problem, and its objective function is as follows:

[0035]

[0036] In formula (5), represents the mathematical expectation, D(x) represents the probability of judging the input real sample as true, D(G(z)) represents the probability of judging the input generated sample as true, P data (x) represents the real data distribution, P(z) represents the data distribution obeyed by random noise, and V(D,G) represents the degree of difference between the real sample and the generated sample;

[0037] Optimizing the generator is equivalent to calculating P data With P g The minimum JS distance between them is obtained through cyclic alternating optimization training. g(x) Gradually approaching P data(x) , when the two are equal, V(D,G)=-2log2, and D * (x) = 0.5, indicating that the discriminator cannot distinguish whether the current input sample data comes from real samples or generated samples, with a probability of half each, indicating that the global optimal solution is obtained, and the generated data of the optimal generator can fit the real data distribution.

[0038] Further: WGAN is used to generate a hybrid model; WGAN uses Wasserstein distance to measure the difference between two probability distributions, and its measurement is as follows:

[0039]

[0040] ΠP r ,P g is the real sample P r and the generator result P g The set of all possible joint distributions that can be combined, ΠP r ,P g The marginal distribution of each distribution in is P r and P g ; For each possible joint distribution γ, sample (x, y)~γ to obtain a real sample x and a generated sample y, and calculate the distance between the pair of samples ||xy||, and calculate the expected value of the distance between the pairs of samples under the joint distribution γ The lower bound that can be obtained for this expected value among all possible joint distributions is It is defined as the Wasserstein distance;

[0041] The loss function of the GAN part is as follows:

[0042]

[0043]

[0044]

[0045] where f w is the approximate calculation function of Wasserstein distance in the minimum and maximum problem; in addition, L calculated by the above formula (9) fm is the feature matching loss, which is the reconstruction loss measured in the hidden layer of the discriminator; where T represents the total number of layers in the discriminator, N l Indicates the number of feature labels of this layer.

[0046] Further: in the step (4): for the actual scenario faced by fault diagnosis, a fault quantity predictor is constructed to provide an alignment matrix for the training and derivation of the framework, including:

[0047] Since there is no mapping rule between the lengths of power data and fault results, and the likelihood estimation in the posterior distribution is required for the calculation of prior loss, the preprocessed power data will also be introduced into a random length predictor to predict the number of faults corresponding to the power data; the calculation formula of the alignment matrix is ​​as follows:

[0048]

[0049] Two random variables u and v are introduced. They have the same time resolution and dimension as the fault number sequence d, and are used for variational de-equation and variational data augmentation respectively. The support of u is restricted to [0,1), so that the difference du becomes a positive real number sequence, and v and d are connected by channel to form a hidden variable. By approximating the posterior distribution q φ (u,v|d,c data ) samples these two variables; the resulting target is a variational lower bound on the log-likelihood of the fault outcome length, and the log-likelihood is given by:

[0050]

[0051] The final loss function of the GAN training generator is as follows:

[0052] L vae =L kl +L num +L adv (G)+L fm (G) (12)

[0053] Further: in the step (5): training the adversarial network model, testing the fault analysis capability, and performing model comparison verification, including:

[0054] Configure the environment, train and generate multiple hybrid models, comprehensively compare the loss function values ​​and network learning rates of the generator and the discriminator at each model step, select the best model, and compare the diagnostic results of the test set by different models under statistical standard indicators until the comparison basis is sufficient; the present invention compares the hybrid model with deep forest, convolutional neural network, and support vector machine, including the comparison of video memory occupancy and training time of the training process, as well as the accuracy of the reasoning process in each link of the front end, channel, terminal, and electric meter.

[0055] In a second aspect, the present invention further discloses a smart grid fault diagnosis device based on an end-to-end hybrid model, comprising:

[0056] A data acquisition module, used to acquire relevant data of historical faults of the smart grid system;

[0057] The feature extraction module is used to extract the main features that affect power grid failures in the power grid data using the correlation coefficient method, and construct the input samples required by the following modules;

[0058] The artificial intelligence module builds a hybrid model generation framework with data alignment capabilities based on variational autoencoders, standard flows, and generative adversarial networks;

[0059] The model training module calls the hardware and drivers in the current environment to train the fault diagnosis model and embed the fault diagnosis model into the operation system of the entire link of the smart grid (front-end, channel, terminal, and meter);

[0060] The fault diagnosis module defines the fault information of the smart grid fault situation, divides the fault range using historical fault feature data, inputs it into the fault diagnosis model, and obtains the fault analysis results.

[0061] In a third aspect, the present invention further discloses an electronic device, including a processor and a storage medium;

[0062] The storage medium is used to store instructions;

[0063] The processor is used to operate according to the instructions to execute the steps according to any of the aforementioned methods.

[0064] In a fourth aspect, the present invention further discloses a computer-readable storage medium having a computer program stored thereon, which implements the steps of any of the aforementioned methods when executed by a processor.

[0065] The beneficial effects of the present invention are:

[0066] (1) A method based on the Spearman correlation coefficient is used to filter the historical fault data information of the entire link of intelligent front-end, channel, terminal, and meter, so as to extract the correlation of the entire link, better extract features, and improve the accuracy of the model;

[0067] (2) A hybrid model of variational autoencoder, standard flow and generative adversarial network is used for fault diagnosis. The hybrid framework model can automatically learn high-level representation of features, better capture key information of the problem, and solve the problem of high accuracy and low operating burden of deep learning networks.

[0068] (3) We utilized the fault data collected from the power consumption systems of provincial power companies in China to construct a variational autoencoder framework. We learned hidden representations through the variational autoencoder by minimizing the difference between the encoder and decoder, embedded the standard stream, and constructed the loss function required for the adversarial network training model. At the same time, we considered the actual scenario of reasoning, introduced the alignment matrix and the fault quantity predictor, and reduced the impact of different data sample lengths on training. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] Figure 1 A schematic diagram of the training and reasoning process of an embodiment of the present invention;

[0070] Figure 2 A schematic diagram of the variational autoencoder principle of an embodiment of the present invention;

[0071] Figure 3 A schematic diagram of a generative adversarial network structure according to an embodiment of the present invention;

[0072] Figure 4 A schematic diagram of a generator training process according to an embodiment of the present invention;

[0073] Figure 5 A schematic diagram of a discriminator training process according to an embodiment of the present invention;

[0074] Figure 6 The figure is a schematic diagram of a learning rate variation process according to an embodiment of the present invention. DETAILED DESCRIPTION

[0075] The specific implementation of the present invention is described below in conjunction with the accompanying drawings and embodiments:

[0076] In a first aspect, the present invention provides a real-time power grid fault diagnosis method based on an end-to-end hybrid model, comprising:

[0077] Obtain system operation data of the entire link of the smart grid, extract fault features, divide the training set and test set, and form data samples for subsequent steps;

[0078] Construct a variational autoencoder (VAE) framework with standard flow embedded in it, and derive the loss function of the framework in subsequent training in the form of maximum likelihood;

[0079] Put the above model into the generator of the generative adversarial network (GAN) to derive the appropriate generator loss function and discriminator loss function;

[0080] Aiming at the actual scenarios faced by fault diagnosis, a fault quantity predictor is constructed to provide an alignment matrix for the training and derivation of the framework;

[0081] According to the derived loss function of the hybrid model, the adversarial network model is trained using the samples in the training set. The test set is input into the fault diagnosis model according to the reasoning process of the framework to obtain the fault analysis results, and the model comparison and verification is performed.

[0082] Furthermore, the system operation data of the entire link of the smart grid is obtained, fault feature extraction is performed, and training and test sets are divided to form the preliminary work of data samples for subsequent steps.

[0083] A total of 23 different fault features are extracted from the front-end, channel, meter and terminal using the correlation coefficient method. For X n With X′ n The Spearman correlation coefficient of the fault characteristics is analyzed as follows:

[0084]

[0085] Where: X n =(x n ,x n+1 ,…,x n+m ) represents the value of a feature in the m time windows before the power grid fault time after the work order is established; X′ n =(x′ n ,x′ n+1 ,…,x′ n+m ) represents the value of another feature in the same time window; d i Indicates the difference in order.

[0086] Taking the electric meter as an example, when analyzing problems at the electric energy meter level, we often analyze the alarm events reported by the electric energy meter, the inspection and maintenance work orders, and the data reported by other electric meters under the same terminal, and extract the relevant features of the electric meter equipment as follows:

[0087] 1) Is there any unfinished work order related to the meter? exist , if yes, then it is 1, otherwise it is 0;

[0088] 2) Is there any abnormal event E reported by the meter? exist , if yes, then it is 1, otherwise it is 0;

[0089] 3) The percentage of successful daily freezing and data collection of the meter in the five days before the event occurred;

[0090] 4) Whether the meter freeze data collection was successful one day before the event occurred C data If yes, then it is 1, otherwise it is 0;

[0091] 5) Collect the daily freezing collection success rate of other electric meters under the same terminal on the day of the failure.

[0092] Furthermore, the construction of a variational autoencoder (VAE) framework with a standard flow embedded therein, and the derivation of the loss function of the framework in subsequent training in the form of maximum likelihood, includes:

[0093] Since the framework integrates VAE, Flow and GAN, many related parameters need to be adjusted. Some important adjustments are as follows:

[0094] First is the variational log-likelihood under the VAE framework, which is modified into the following formula in this patent:

[0095]

[0096] This formula is derived from VAE. θ With q φ They correspond to the priori coding and the posterior coding respectively, z is the implicit distribution, x is the fault result sample in the posterior coding, and c is the power data sample in the priori coding.

[0097] Next is the loss function of the network in VAE, which uses the form of KL divergence to subtract the log-likelihood of the result data to the implicit distribution in the posterior distribution from the log-likelihood of the input data and the alignment matrix to the implicit distribution in the prior distribution. The formula is as follows:

[0098]

[0099] where c data It is not simply the input power data in digital form, but the processed input generated by the alignment matrix given by the fault quantity predictor. A in the formula is the alignment matrix between power data and faults, and N(μ(·),σ(·)) is the Gaussian distribution. Formula (5) is the standard flow formula of the Flow from the z distribution in the posterior distribution, that is, the modified form of the log-likelihood of the power data c to the implicit distribution z in the framework:

[0100]

[0101] In this way, the impact of the Flow process on the loss function is included in formula (4), which simplifies the calculation.

[0102] Furthermore, the above model is inserted into the generator of the generative adversarial network (GAN) to derive a suitable generator loss function and discriminator loss function, including:

[0103] GAN can be abstracted as a maximum and minimum problem, and its objective function is as follows:

[0104]

[0105] In the formula, represents the mathematical expectation, D(x) represents the probability of judging the input real sample as true, D(G(z)) represents the probability of judging the input generated sample as true, P data (x) represents the real data distribution, P(z) represents the data distribution that random noise obeys, which is generally a Gaussian distribution, and V(D,G) represents the degree of difference between the real sample and the generated sample. For the generator G, the larger the D(G(z)) value, the better, and V(D,G) becomes smaller. Therefore, for the generator G, min(G) is sought, which is only related to the second term in the formula. For the discriminator D, the smaller the D(G(z)) value, the better, and V(D,G) increases, so max(D) is sought for the discriminator D. It can be seen that the goals of the generator G and the discriminator D are opposite, and the training principle is that the generator and the discriminator are trained alternately and iteratively separately.

[0106] Optimizing the generator is equivalent to calculating P data With P g The minimum JS distance between them is obtained through cyclic alternating optimization training. g(x) Gradually approaching P adta(x) , when the two are equal, V(D,G)=-2log2, and D * (x) = 0.5, indicating that the discriminator cannot distinguish whether the current input sample data comes from real samples or generated samples, with a probability of half each, indicating that the global optimal solution is obtained, and the generated data of the optimal generator can fit the real data distribution.

[0107] In practical applications, the original GAN ​​loss function has a problem: when the discriminator is close to the optimal state, the gradient of the generator disappears. Therefore, this patent uses a special GAN ​​network, WGAN, to generate a hybrid model. Compared with the original JS divergence, WGAN uses Wasserstein distance to measure the difference between two probability distributions, and its measurement is as follows.

[0108]

[0109] The explanation is as follows:r ,P g is the real sample P r and the generator result P g The set of all possible joint distributions that can be combined, conversely, ΠP r ,P g The marginal distribution of each distribution in is P r and P g For each possible joint distribution γ, we can sample (x, y)~γ to get a real sample x and a generated sample y, and calculate the distance between the two samples ||xy||, so we can calculate the expected value of the distance between the two samples under the joint distribution γ. The lower bound that can be obtained for this expected value among all possible joint distributions is It is defined as the Wasserstein distance.

[0110] Compared with KL divergence and JS divergence, even if the two distributions do not overlap, Wasserstein distance can still reflect their distance. After substitution, the loss function of the GAN part is as follows:

[0111]

[0112]

[0113]

[0114] where f w is the approximate calculation function of Wasserstein distance in the minimum and maximum value problem. In addition, L calculated by the above formula (11) fm It is not a common GAN loss function. It means feature matching loss, which is the reconstruction loss measured in the hidden layer of the discriminator. Where T represents the total number of layers in the discriminator, N l Indicates the number of feature labels of this layer. Under extreme conditions, the discriminator can also be used as an alternative to the element-by-element reconstruction loss in the VAE framework.

[0115] Furthermore, for the actual scenarios faced by fault diagnosis, a fault quantity predictor is constructed to provide an alignment matrix for the training and derivation of the framework, including:

[0116] Since there is no mapping rule between the length of power data and fault results, and the likelihood estimation in the posterior distribution is required for the calculation of prior loss, the preprocessed power data will also be introduced into a random length predictor, which is responsible for predicting the number of faults corresponding to the power data. The calculation formula of the alignment matrix is ​​as follows:

[0117]

[0118] As for why it is necessary to give an alignment matrix in the fault quantity predictor, it is not difficult to find from the above formula that the alignment matrix requires the fault result x in the training sample to participate in the calculation steps. Problems will be encountered in actual operation: there is a sequence relationship in the overall training process, that is, when processing the prior distribution, the result accepted from the posterior distribution cannot be directly used for calculation.

[0119] This patent introduces variational dequantization and variational data augmentation to construct the loss function of the fault number predictor. Specifically, we introduce two random variables u and v, which have the same time resolution and dimension as the fault number (fault length) sequence d, for variational dequantization and variational data augmentation respectively. We restrict the support of u to [0,1), make the difference du a positive real number sequence, and connect v and d by channel to form a higher dimensional latent variable. We approximate the posterior distribution q φ (u,v|d,c data ) to sample these two variables. The resulting objective is a variational lower bound on the log-likelihood of the fault outcome length, and the log-likelihood is formulated as follows:

[0120]

[0121] Naturally, the loss function L num This is the lower bound of the above formula, which is the expression on the right side of the inequality. Combining all the above loss functions, the final loss function of the GAN training generator is shown in the following formula.

[0122] L vae =L kl +L num +L adv (G)+L fm (G) (12)

[0123] Furthermore, the adversarial network model is trained, the fault analysis capability is tested, and the model is compared and verified. This includes:

[0124] Configure the environment, train and generate multiple hybrid models, comprehensively compare the loss function values ​​and network learning rates of the generator and the discriminator at each model step, select the best model, and compare the diagnostic results of the test set by different models under statistical standard indicators until the comparison basis is sufficient; the present invention compares the hybrid model with deep forest, convolutional neural network, and support vector machine, including the comparison of video memory occupancy and training time of the training process, as well as the accuracy of the reasoning process in each link of the front end, channel, terminal, and electric meter.

[0125] In a second aspect, the present invention provides a smart grid fault diagnosis device based on an end-to-end hybrid model, comprising:

[0126] A data acquisition module, used to acquire relevant data of historical faults of the smart grid system;

[0127] The feature extraction module is used to extract the main features that affect power grid failures in the power grid data using the correlation coefficient method, and construct the input samples required by the following modules;

[0128] The artificial intelligence module builds a hybrid model generation framework with data alignment capabilities based on variational autoencoders, standard flows, and generative adversarial networks;

[0129] The model training module calls the hardware and drivers in the current environment to train the fault diagnosis model and embed the fault diagnosis model into the operation system of the entire link of the smart grid (front-end, channel, terminal, and meter);

[0130] The fault diagnosis module defines the fault information of the smart grid fault situation, divides the fault range using historical fault feature data, inputs it into the fault diagnosis model, and obtains the fault analysis results.

[0131] In a third aspect, the present invention provides an electronic device, including a processor and a storage medium;

[0132] The storage medium is used to store instructions;

[0133] The processor is configured to operate according to the instructions to execute the steps of any of the aforementioned methods.

[0134] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the aforementioned methods.

[0135] In order to test the effectiveness of the proposed smart grid real-time fault diagnosis model, the patent focuses on the time range from January 1, 2022 to December 31, 2023, and uses the indicator information of the faults in all links of the whole link of the power grid collected during the system operation of multiple provincial power companies such as Jiangsu, Zhejiang, and Anhui. From these data, 4,380 normal operation samples were extracted, and the number of samples of front-end, channel, terminal, and meter related faults were extracted, respectively, 1,950, 1,931, 1,979, and 1,969, totaling 12,209 samples. In the experiment, 90% of the samples were selected for training and 10% of the samples were used for testing.

[0136] The training environment is configured as cuda11.7+Python3.8+Torch1.17. During the training process, a model is saved every 800 iterations. After adding the pre-trained models G_0.pth and D_0.pth, the number of training steps is greatly reduced. A total of 3400 steps are trained, and 4 models are obtained with training steps of 800, 1600, 2400 and 3200. The generator loss function L in model training vae , discriminator loss function L adv (D) and the learning rate change trend with the number of training steps are automatically generated by Tensorboard, such as Figure 4 , Figure 5 , Figure 6 As shown in the figure. Due to the up and down oscillation characteristics of each training supervision indicator during GAN training, the figure uses dark lines to process the curve for easy observation. Figure 4 It can be seen that the performance of the generator in the 1600-step and 3200-step models is better, but Figure 5 It shows that the discriminator performance of these two models is poor, resulting in a low reference value of the generator loss function. Therefore, the 2400-step model with a more balanced and lower learning rate is selected as the best model for this training. The generator loss function starts to rise periodically from 3200 to 3400 steps, so the training is terminated.

[0137] Furthermore, the test set is used to verify and illustrate the method in the embodiment of the present invention. When designing the experiment, the VAE+Flow+GAN hybrid model proposed in this patent, as well as the deep forest and support vector machine algorithms are used for comparison, and their training time, inference time, video memory usage, and accuracy are recorded. The comparison is shown in Table 2.

[0138] Comparison Items Hybrid Model Deep Forest Convolutional Networks Support Vector Machine Training time / h 3.60 5.85 3.20 3.15 Reasoning time / s 12.50 18.99 32.07 11.75 Video memory usage / GB 5.42 7.32 4.87 4.52 Accuracy 95.88 92.11 83.27 76.71

[0139] Table 1 Comparison of training quality between hybrid model and other models

[0140] As can be seen from Table 1, after the hybrid framework of this patent, compared with the deep forest, the training time, test time, and memory usage of the hybrid model as a fault diagnosis model are greatly reduced, and the overall classification accuracy is also improved, which has obvious advantages over the classification accuracy of convolutional networks and support vector machines. For the data fault diagnosis scenario of massive equipment in smart grids, it is of great significance to reduce the model training time and resource consumption while maintaining high accuracy, which can significantly reduce the cost of model application and improve the efficiency of diagnosis.

[0141] The channel fault detection rate is slightly lower because the actual situation of some sample faults is complicated and it is difficult to clearly distinguish the fault causes using the currently available indicator information. The present invention also repeats the sampling of the above models 10 times, compares the average accuracy and accuracy range of the mixture, and studies the stability of each fault diagnosis model (see Table 2).

[0142] Link accuracy Prefix / % Channel / % terminal / % Electricity meter / % Hybrid Model 94.58 93.65 96.86 98.43 Deep Forest 92.53 91.16 92.33 92.42 Convolutional Networks 89.76 80.57 82.63 80.12 Support Vector Machine 79.54 72.13 75.52 79.65

[0143] Table 2 Comparison of indicators in different links

[0144] As can be seen from Table 2, compared with convolutional neural networks and support vector machines, the hybrid model can achieve better classification accuracy, and the diagnostic accuracy of each experiment is more stable. Compared with deep forest, the hybrid model has a higher average accuracy and will not cause significant fluctuations in accuracy due to changes in training / testing samples.

[0145] In the present invention, the reason why the accuracy of the model results fluctuates greatly and overfitting frequently occurs during training is the interference of uncertain information, missing information, and abnormal information in the data. Therefore, the model of this patent extracts a variety of feature information from various links of the smart grid, and uses the full-link fault data of the front end, channel, terminal, and meter, combined with the correlation coefficient method for optimization. A hybrid framework generation model is proposed to solve the problem that the high accuracy and low operating burden of deep learning networks cannot be achieved at the same time. After experimental verification, the fault diagnosis accuracy rate reached 95.88%, the model training time and memory occupancy were greatly improved compared to the deep forest, and the diagnostic performance was significantly better than other models. The hybrid model can better provide decision-making for auxiliary dispatchers when facing complex power grid equipment failure scenarios. The algorithm has strong data feature extraction and diagnosis capabilities, and can quickly and accurately obtain fault results.

[0146] The preferred embodiments of the present invention are described in detail above in conjunction with the accompanying drawings, but the present invention is not limited to the above embodiments. Various changes can be made within the knowledge scope of ordinary technicians in the field without departing from the purpose of the present invention. These changes involve related technologies well known to those skilled in the art, which all fall within the scope of protection of the patent of the present invention.

[0147] Many other changes and modifications may be made without departing from the concept and scope of the present invention.It should be understood that the present invention is not limited to the specific embodiments, and the scope of the present invention is defined by the appended claims.

Claims

1. A real-time diagnosis method for power grid faults based on an end-to-end hybrid model, comprising: Step (1): Obtain system operation data of the entire link of the smart grid, extract fault features, divide the training set and the test set, and form data samples for subsequent steps; Step (2): Construct a variational autoencoder (VAE) framework with standard flow embedded in it, and derive the loss function of the framework in subsequent training in the form of maximum likelihood; Step (3): Put the above model into the generator of the generative adversarial network (GAN) to derive the appropriate generator loss function and discriminator loss function; Step (4): Build a fault quantity predictor for the actual scenarios faced by fault diagnosis, and provide an alignment matrix for the training and derivation of the framework; Step (5): Based on the derived loss function of the hybrid model, the adversarial network model is trained using the samples in the training set. The test set is input into the fault diagnosis model according to the reasoning process of the framework to obtain the fault analysis results and perform model comparison and verification.

2. The method according to claim 1, characterized in that: The step (1) is to obtain the system operation data of the entire link of the smart grid, extract fault features, divide the training set and the test set, and form the preliminary work of the data samples for the subsequent steps, wherein: A total of 23 different fault features are extracted from the front-end, channel, meter and terminal using the correlation coefficient method; For X n With X′ n The Spearman correlation coefficient of the fault characteristics is analyzed as follows: Where: X n =(x n ,x n+1 ,…,x n+m ) represents the value of a feature in the m time windows before the power grid fault time after the work order is established; X′ n =(x′ n ,x′ n+1 ,…,x′ n+m ) represents the value of another feature in the same time window; d i Indicates the difference in order.

3. The method according to claim 2, characterized in that: When analyzing problems at the electric energy meter level, the steps to extract relevant features of the electric energy meter equipment are as follows: S1: Is there any unfinished work order related to the meter? exist , if yes, then it is 1, otherwise it is 0; S2: Is there any abnormal event E reported by the meter? exist , if yes, then it is 1, otherwise it is 0; S3: The percentage of successful freezing and collection of the meter in the five days before the event occurred; S4: Whether the meter freeze data collection was successful one day before the event occurred C data If yes, then it is 1, otherwise it is 0; S5: The daily freezing collection success rate of other electric meters under the same terminal on the day of the collection failure.

4. The method according to claim 1, characterized in that: In the step (2), a variational autoencoder (VAE) framework with a standard flow embedded is constructed, and the loss function of the framework in subsequent training is derived in the form of maximum likelihood, including: Since the framework integrates VAE, Flow and GAN, many related parameters need to be adjusted. Some important adjustments are as follows: First is the variational log-likelihood under the VAE framework, which is modified into the following formula in this patent: p θ With q φ They correspond to the priori coding and the posterior coding respectively, z is the implicit distribution, x is the fault result sample in the posterior coding, and c is the power data sample in the priori coding; Next is the loss function of the network in VAE, which uses the form of KL divergence to subtract the log-likelihood of the result data to the implicit distribution in the posterior distribution from the log-likelihood of the input data and the alignment matrix to the implicit distribution in the prior distribution; its formula is as follows: L kl =log q φ (z|x)-logp θ (z|c data ,A) (3) z~q φ (z|x)=N(z;μ φ (x),σ φ (x)) c=[c data ,A] where c data is the processed input generated by the alignment matrix given by the fault number predictor; A in formula (3) is the alignment matrix between power data and faults, and N(μ(·),σ(·)) is a Gaussian distribution; the above formula (3) is the standard flow formula of Flow from the z distribution in the posterior distribution, that is, the modified form of the log-likelihood of the power data c to the implicit distribution z in the framework: In step (3), the above model is inserted into the generator of the generative adversarial network (GAN) to derive a suitable generator loss function and a discriminator loss function, including: GAN can be abstracted as a maximum and minimum problem, and its objective function is as follows: In formula (5), represents the mathematical expectation, D(x) represents the probability of judging the input real sample as true, D(G(z)) represents the probability of judging the input generated sample as true, P data (x) represents the real data distribution, P(z) represents the data distribution obeyed by random noise, and V(D,G) represents the degree of difference between the real sample and the generated sample; Optimizing the generator is equivalent to calculating P data With P g The minimum JS distance between them is obtained through cyclic alternating optimization training. g(x) Gradually approaching P data(x) , when the two are equal, V(D,G)=-2log2, and D * (x) = 0.5, indicating that the discriminator cannot distinguish whether the current input sample data comes from real samples or generated samples, with a probability of half each, indicating that the global optimal solution is obtained, and the generated data of the optimal generator can fit the real data distribution.

5. The method according to claim 4, characterized in that: WGAN is used to generate the hybrid model; WGAN uses Wasserstein distance to measure the difference between two probability distributions, which is measured as follows: ΠP r ,P g is the real sample P r and the generator result P g The set of all possible joint distributions that can be combined, ΠP r ,P g The marginal distribution of each distribution in is P r and P g ; For each possible joint distribution γ, sample (x, y)~γ to obtain a real sample x and a generated sample y, and calculate the distance between the pair of samples ||xy||, and calculate the expected value of the distance between the pairs of samples under the joint distribution γ The lower bound that can be obtained for this expected value among all possible joint distributions is It is defined as the Wasserstein distance; The loss function of the GAN part is as follows: where f w is the approximate calculation function of Wasserstein distance in the minimum and maximum value problem; in addition, L calculated by the above formula (9) fm is the feature matching loss, which is the reconstruction loss measured in the hidden layer of the discriminator; where T represents the total number of layers in the discriminator, N l Indicates the number of feature labels of this layer.

6. The method according to claim 1, characterized in that: In the step (4), a fault quantity predictor is constructed for the actual scenario faced by fault diagnosis, and an alignment matrix is ​​provided for the training and derivation of the framework, including: Since there is no mapping rule between the lengths of power data and fault results, and the likelihood estimation in the posterior distribution is required for the calculation of prior loss, the preprocessed power data will also be introduced into a random length predictor to predict the number of faults corresponding to the power data; the calculation formula of the alignment matrix is ​​as follows: Two random variables u and v are introduced. They have the same time resolution and dimension as the fault number sequence d, and are used for variational de-equation and variational data augmentation respectively. The support of u is restricted to [0,1), so that the difference du becomes a positive real number sequence, and v and d are connected by channel to form a hidden variable. By approximating the posterior distribution q φ (u,v|d,c data ) samples these two variables; the resulting target is a variational lower bound on the log-likelihood of the fault outcome length, and the log-likelihood is given by: The final loss function of the GAN training generator is as follows: L vae =L kl +L num +L adv (G)+L fm (G) (12)。 7. The method according to claim 1, characterized in that: In the step (5): training the adversarial network model, testing the fault analysis capability, and performing model comparison and verification, including: Configure the environment, train and generate multiple hybrid models, comprehensively compare the loss function values ​​and network learning rates of the generator and the discriminator at each model step, select the best model, and compare the diagnostic results of the test set by different models under statistical standard indicators until the comparison basis is sufficient; the present invention compares the hybrid model with deep forest, convolutional neural network, and support vector machine, including the comparison of video memory occupancy and training time in the training process, as well as the accuracy of the reasoning process in each link of the front end, channel, terminal, and electric meter.

8. A smart grid fault diagnosis device based on an end-to-end hybrid model, comprising: A data acquisition module, used to acquire relevant data of historical faults of the smart grid system; The feature extraction module is used to extract the main features that affect power grid failures in the power grid data using the correlation coefficient method, and construct the input samples required by the following modules; The artificial intelligence module builds a hybrid model generation framework with data alignment capabilities based on variational autoencoders, standard flows, and generative adversarial networks; The model training module calls the hardware and drivers in the current environment to train the fault diagnosis model and embed the fault diagnosis model into the operation system of the entire link of the smart grid (front-end, channel, terminal, and meter); The fault diagnosis module defines the fault information of the smart grid fault situation, divides the fault range using historical fault feature data, inputs it into the fault diagnosis model, and obtains the fault analysis results.

9. An electronic device, characterized in that: including processor and storage medium; The storage medium is used to store instructions; The processor is configured to operate according to the instructions to execute the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the program is executed by a processor, the steps of any method of any of claims 1 to 7 are implemented.