A method for balancing power grid edge device instruction set data based on a federated learning framework
By using a federated learning framework and conditional generative adversarial networks, the problem of imbalanced instruction data for power grid edge devices was solved, generating a balanced dataset, improving the accuracy of the anomaly detection model, and ensuring the safety of the power system.
Patent Information
- Application Number
- CN202310579195.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-23
- Publication Date
- 2026-01-16
- Estimated Expiration
- 2043-05-23
AI Technical Summary
The number of instruction data packets for grid edge devices is small and unbalanced, making it difficult for anomaly detection models to effectively learn anomaly features. Furthermore, existing data balancing methods cannot share datasets while considering privacy protection, resulting in low anomaly detection accuracy.
A conditional generative adversarial network based on a federated learning framework is adopted. Data is securely shared and trained between regions using the RSA encryption algorithm to generate a balanced dataset for training a model for detecting abnormal commands of power grid edge devices.
While ensuring privacy, a balanced dataset of various sample types is generated, which improves the accuracy of the anomaly detection model, detects attacks on power grid edge devices, and ensures the security of the power system.
Smart Images

Figure CN116739055B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of power grid power systems, and more particularly, to a method for balancing of power grid edge device instruction set data based on a federated learning framework. BACKGROUND
[0002] With the increasing number of edge devices connected to the national power grid, it is difficult to quickly and accurately locate the security of the instructions issued by the edge devices in the face of a large number of edge devices. Deep learning-based edge device instruction anomaly detection models are widely used, but there are some technical defects in the power grid edge device instruction anomaly detection model: first, the number of instruction data packets of the power grid edge device is small, and the data set is seriously unbalanced, with much more abnormal samples than normal samples, so the anomaly detection model cannot effectively learn the characteristics of the abnormal samples, resulting in a bottleneck in the accuracy of anomaly detection; second, the previous data balancing methods do not take into account the privacy protection of the data distribution in different clients and the sharing of the data set; third, the previous data balancing based on the generative adversarial network cannot guarantee that the generated samples are balanced. SUMMARY
[0003] The purpose of the embodiments of the present application is to provide a method for balancing of power grid edge device instruction set data based on a federated learning framework, which can make full use of the data sets of each client to train a conditional generative adversarial network under the premise of privacy protection, obtain a powerful conditional generative adversarial network, generate a balanced data set of each type of sample, and then realize data balancing of the power grid edge device instruction set in each region, train the power grid edge device instruction anomaly detection model of each region using a large-scale balanced data set, and accurately assess the security vulnerabilities of the devices.
[0004] To achieve the above purpose, the present application provides the following technical scheme:
[0005] The embodiments of the present application provide a method for balancing of power grid edge device instruction set data based on a federated learning framework, comprising the following specific steps:
[0006] (1) For the power grid systems in n regions, collect the instruction information D of the power grid edge devices and the type L of the instructions;
[0007] (2) Construct a feature vector matrix of the device instruction information, construct a feature vector matrix of the device instruction information collected in step (1), and perform one-hot encoding on the type information of the instruction information collected in step (1);
[0008] (3) Initialize the conditional generative adversarial network model on the server, including the generator and the discriminator; the server generates an RSA public-private key pair at the same time, and sends the public key to the power grid system of each region, and the server sends the model to the power grid system of each region;
[0009] (4) In the power grid system of region i, the conditional generative adversarial network is trained using the instruction data set and the label set collected in this region; first, fix the generator parameters unchanged, train the discriminator, then fix the discriminator parameters unchanged, train the generator, and the discriminator and the generator are trained by each other until Tc times of training;
[0010] (5) After the training is completed, the model Wi is transmitted to the server through the public key of the server, the server decrypts it with its own private key, then a power grid system of a remaining region j is randomly selected, and then the server transmits the decrypted model Wi parameters of region i to the power grid system of region j through the public key of region j, until the power grid systems of n regions all complete the training of the conditional generative adversarial network model through their own data sets;
[0011] (6) Through the federal scheduling of the server, a generative adversarial network trained by the data sets of all n regions is obtained, and then the generator is used on the server to generate a data set balanced in each type of instruction, and the generated data set is input into the discriminator for screening and filtering to obtain DG;
[0012] (7) The DG is encrypted using the public keys of each region and transmitted to the power grid systems of each region, and the data sets of each region form a large-scale balanced data set to train the instruction set classification model or the abnormal instruction detection model, further improve the classification performance of the model or the accuracy of the abnormal detection, and discover attacks on the edge devices of the power grid to ensure the safety of the power system.
[0013] The information collection range of the power grid edge device in step (1) includes: the operating state signals of circuit breakers, disconnectors, grounding switches, transformers, and reactive voltage compensation devices; the operating state signals, action signals, self-checking information, and event recording information of protection, automation, and communication equipment, AC and DC station power and auxiliary equipment.
[0014] In step (2), for each data flow packet, the character type features are one-hot encoded, and then the instruction information is extracted to construct an instruction feature vector matrix. If the power grid edge device data set contains n data packets, each data packet extracts features to form an m-dimensional feature vector:
[0015] Fi={f1,f2,...,fm}.
[0016] In step (3), the loss function of the generator is: loss= E z~Pz(z) [-log D(G(z|y))], G(z|y) represents the generated sample of the generator under the input of noise z and the planned generation type y, and D(G(z|y) represents the evaluation of the discriminator on the generated sample G(z|y).
[0017] The loss function of the discriminator in step (3) is: D loss = 1 / 2 E x~Pdata(x) [-log D(x|y)] + 1 / 2 E z~pz(z) [-log(1-D(G(z|y)))], D(x|y) represents the evaluation of the discriminator on the real sample x and its type y.
[0018] Compared with the prior art, the beneficial effects of the present application are: by applying the federated learning framework, the edge device instruction data sets of various regions are fully utilized under the premise of data privacy and data security; based on the RSA symmetric encryption algorithm, the model parameters and the weight values are encrypted, and many privacy risks brought by traditional machine learning source data aggregation are reduced. BRIEF DESCRIPTION OF DRAWINGS
[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the embodiments of the present application will be briefly introduced below, and it should be understood that the following drawings only show some embodiments of the present application, and therefore should not be regarded as a limitation on the scope, and for those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.
[0020] Figure 1 The method flowchart of the application;
[0021] Figure 2 The generator network structure diagram of the generative adversarial network generated by the application;
[0022] Figure 3 The discriminator network structure diagram of the generative adversarial network generated by the application. DETAILED DESCRIPTION
[0023] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application. It should be noted that similar reference numerals and letters represent similar items in the following drawings, and therefore, once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.
[0024] The terms "comprise", "comprising", or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element preceded by "comprises a" does not, without more constraints, foreclose the existence of additional identical elements in the process, method, article, or apparatus that comprises the recited element.
[0025] The terms "first", "second", and the like are used only to distinguish one entity or operation from another, and do not indicate or imply relative importance or any such actual relationship or order between such entities or operations.
[0026] A method for balancing the instruction set of power grid edge devices based on a federated learning framework, comprising the following steps:
[0027] (1) For an n-region power grid system, collect the instruction information D of the power grid edge devices and the type L to which the instruction belongs; D = {D1, D2, D3,..., Dn}, L = {L1, L2, L3,..., Ln};
[0028] (2) Construct a feature vector matrix of device instruction information, construct a feature vector matrix for the device instruction information collected in step one, and perform one-hot encoding on the type information collected in step one;
[0029] (3) Initialize a conditional generative adversarial network model on the server, including a generator and a discriminator; the server simultaneously generates its own RSA public and private key pair, and sends its own public key to each regional power grid system; the server sends the model to each regional power grid system.
[0030] (4) The server maintains a secret key management system, and generates a respective RSA public and private key pair for each regional power grid system, and simultaneously sends the generated private key to each regional power grid system.
[0031] (5) In the i-region power grid system, use the instruction data set and label set collected in step one to train the conditional generative adversarial network; first fix the generator parameters unchanged, train the discriminator, then fix the discriminator parameters unchanged, train the generator, and the discriminator and the generator are trained by mutual game until Tc times of training.
[0032] (6) Randomly select a power grid system of a region i, and perform step (5). After the region completes the training, the model Wi is transmitted to the server through the public key of the server, the server decrypts it with its own private key, then randomly selects a power grid system of a remaining region j, and the server transmits the decrypted model Wi parameters of the i region to the power grid system of the j region through the public key of the j region, until the power grid systems of the n regions are all trained on the conditional generative adversarial network model through their own data sets.
[0033] (7) Through the federal scheduling of the central trusted server, a generative adversarial network in which all n regions participate in the training is obtained, and then the server uses the generator to generate a data set balanced in each type of instruction. The generated data set is input into the discriminator for screening and filtering to obtain DG.
[0034] (8) The DG is encrypted using the public key of each region and transmitted to the power grid system of each region, and a large-scale balanced data set is formed with their own data set to train the instruction set classification model or the abnormal instruction detection model, further improve the classification performance of the model or the accuracy of the abnormal detection, and discover attacks on the edge devices of the power grid to ensure the safety of the power system.
[0035] The information collection range of the power grid edge device in step (1) includes: the operating state signals of circuit breakers, disconnectors, grounding switches, transformers, and reactive voltage compensation devices; the operating state signals, action signals, self-checking information, and event records of protection, automation, and communication devices, and auxiliary devices of AC and DC station power consumption.
[0036] In step (2), for each data flow packet, the character type features are one-hot encoded, and then the instruction information is extracted to construct an instruction feature vector matrix. If the power grid edge device data set contains n data packets, each data packet extracts features to form an m-dimensional feature vector:
[0037] Fi={f1,f2,...,fm}
[0038] In step (3), the training process of the generator in the conditional generative adversarial network is as follows: a. Generator gradient is zero; b. Generator generates samples; c. Discriminator evaluates loss; d. Backward gradient calculation; e. Update generator parameters.
[0039] In step (3), the training process of the discriminator in the conditional generative adversarial network is as follows: a. Discriminator gradient is zero; b. Calculate the loss of real samples; c. Calculate the loss of generated samples; d. Backward gradient calculation; e. Update discriminator parameters.
[0040] In step (3), the network structure of the generator in the conditional generative adversarial network is as follows:
[0041] a. Random noise and type labels are connected to different fully connected layers respectively;
[0042] b. Two fully connected layers are connected in series;
[0043] c. Then go through two fully connected layers;
[0044] d. Reshape the matrix shape;
[0045] All activation functions use ReLU.
[0046] In step (3), the network structure of the discriminator in the conditional generative adversarial network is as follows:
[0047] a. Data samples and type labels are indirectly connected to different fully connected layers, and the activation function uses ReLU;
[0048] b. Two fully connected layers are connected in series;
[0049] c. A fully connected layer, and the activation function uses ReLU;
[0050] d. A fully connected layer containing only one neuron, and the activation function uses sigmoid.
[0051] The loss function of the generator is: G loss = E z~Pz(z) [-log D(G(z|y))], G(z|y) represents the generated sample under the input of noise z and the generated type y. D(G(z|y) represents the evaluation of the discriminator on the generated sample G(z|y).
[0052] The loss function of the discriminator is: D loss = 1 / 2 E x~Pdata(x) [-log D(x|y)] + 1 / 2 E z~pz(z) [-log(1-D(G(z|y)))] D(x|y) represents the evaluation of the discriminator on the real sample x and its type y.
[0053] In step (4), the server uniformly manages the key system, the server acts as a trusted third party, and the communication between each participant will not be carried out. Network parameters are transmitted through key encryption to avoid information leakage of network parameters. Under the protection of the privacy of each participant, the conditional generative adversarial network is trained to achieve data balance.
[0054] The network structure of the generator and the network structure of the discriminator in the conditional generative adversarial network are not limited to the above design, and can be adjusted and designed according to the data set and the experiment.
[0055] In the field of power systems, different regional power systems refuse to disclose their own edge device instruction set information due to privacy issues, and in the instruction set of a single region, the number of abnormal instructions is much smaller than the number of normal instructions. In order to better train the edge device instruction set anomaly detection model, a well-trained privacy protection data balancing model is implemented through a conditional GAN based on federated learning. For different regional power systems, the data set of each client can be fully utilized to train the conditional generative adversarial network under the premise of ensuring privacy, obtain a powerful conditional generative adversarial network, generate a balanced data set of various types of samples, and then realize the data balancing of the edge device instruction set of each regional power grid. The edge device instruction anomaly detection model of each region is trained using a large-scale balanced data set, and the security vulnerabilities of the equipment are accurately evaluated.
[0056] The above only describes the embodiments of the present application and is not used to limit the protection scope of the present application. For those skilled in the art, the present application can have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for balancing power grid edge device instruction set data based on a federated learning framework, characterized in that, The method comprises the following specific steps: (1) For an n-region power grid system, collect the instruction information D of the edge equipment of the power grid and the type L to which the instruction belongs; (2) Construct a feature vector matrix of the equipment instruction information, one-hot encode the instruction information type information collected in step (1); (3) Initialize the conditional generative adversarial network model on the server, including the generator and the discriminator; the server generates an RSA public-private key pair at the same time, sends the public key to each regional power grid system, and sends the model to each regional power grid system; (4) In the i-region power grid system, train the conditional generative adversarial network using the instruction data set and the label set collected in the region; first fix the generator parameters unchanged, train the discriminator, then fix the discriminator parameters unchanged, train the generator, and the discriminator and the generator are trained by mutual game until Tc times of training; (5) After the training is completed, the model Wi is encrypted and transmitted to the server through the public key of the server, the server decrypts it with its own private key, then a remaining region j power grid system is randomly selected, and then the server encrypts the decrypted i-region model Wi parameters through the public key of the j-region power grid system and transmits them to the j-region power grid system, until the n-region power grid system is trained through its own data set; (6) Through the federal scheduling of the server, a generative adversarial network trained by all n-region data sets is obtained, and then the generator is used on the server to generate a balanced data set of each type of instruction, and the generated data set is input into the discriminator for screening and filtering to obtain DG; (7) The DG is encrypted using the public key of each region and transmitted to each regional power grid system, and a large-scale balanced data set is formed with the data set of each regional power grid system to train the instruction set classification model or the abnormal instruction detection model, further improve the classification performance of the model or the accuracy of the abnormal detection, and discover attacks on the edge equipment of the power grid to ensure the safety of the power system.
2. The method of claim 1, wherein, The information collection range of the edge equipment of the power grid in step (1) includes: the running state signals of circuit breakers, disconnectors, grounding switches, transformers and reactive voltage compensation equipment; the running state signals, action signals, self-checking information and event recording information of protection, automation and communication equipment, AC and DC station power and auxiliary equipment.
3. The method of claim 1, wherein, In step (2), for each data flow packet, the character features are one-hot encoded, and then the instruction information is extracted to construct an instruction feature vector matrix. If the power grid edge device data set contains n data packets, each data packet extracts features to form an m-dimensional feature vector: Fi={f1,f2,...,fm}.
4. The method of claim 1, wherein, The loss function of the generator in step (3) is: G loss = E z~Pz(z) [-log D(G(z|y))], G(z|y) represents the generated sample of the generator under the input of noise z and the generated type y, and D(G(z|y) represents the evaluation of the discriminator on the generated sample G(z|y).
5. The method of claim 1, wherein, The loss function of the discriminator in step (3) is: D loss = 1 / 2E x~Pdata(x) [-log D(x|y)] + 1 / 2E z~pz(z) [-log(1-D(G(z|y)))], D(x|y) represents the evaluation of the discriminator on the real sample x and its type y.
Citation Information
Patent Citations
Optimization method for transverse federated learning
CN112734032A
Federal generative adversarial network-oriented privacy enhancement method
CN115329388A