Intelligent power grid communication data abnormal flow monitoring and predicting method

Through the combined method of federated learning and gray wolf optimization algorithm, the problem of abnormal traffic monitoring of communication data in smart grids is solved, accurate prediction and early identification of abnormal traffic is achieved, and the safety and stability of the power grid is enhanced.

CN119025948APending Publication Date: 2024-11-26HEILONGJIANG UNIV
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202410976421.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-20
Publication Date
2024-11-26

AI Technical Summary

Technical Problem

In smart grids, it is difficult for the prior art to effectively monitor and predict abnormal traffic of communication data, resulting in difficult to detect network attacks and system failures in the early stage, affecting the stability and security of the power grid.

Method used

Using a federated learning method, combining the Gray Wolf optimization algorithm and the Dlinear time series prediction model, the abnormal traffic monitoring and prediction of smart grid communication data is realized through collaborative training of local nodes and central servers, and the Gray Wolf optimization algorithm is used to enhance the model Optimize ability to improve the accuracy of identifying abnormal behaviors.

Benefits of technology

It improves the accuracy of identifying abnormal behaviors of smart grids, enhances safety protection capabilities, and can accurately predict periodic and trending flow changes, ensuring the stable operation and safety of the power grid.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119025948A_ABST
    Figure CN119025948A_ABST
Patent Text Reader

Abstract

The invention discloses a communication data abnormal flow monitoring and predicting method for a smart power grid, and the method comprises the steps: issuing an initial random model parameter to a local node through a central server, and carrying out the training of a local model through combining with the time sequence data on each local node in the smart power grid; then, constructing a global model, automatically adjusting and optimizing parameters of the local model through a grey wolf optimization algorithm, and aggregating weights of the local model to obtain an optimal global model so as to adapt to unstable power grid conditions and equipment nodes; and then, on each local node of the smart power grid, predicting the communication data traffic of the local node by using the Dlinear time sequence prediction model. According to the invention, real-time and accurate prediction and monitoring can be provided for the operation of the intelligent power grid in the aspect of communication data abnormity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of abnormal flow monitoring of smart grid systems, relates to a meta-heuristic algorithm, and in particular to a method for predicting and generating power data based on federated learning, in particular to a method for monitoring and predicting abnormal flow of communication data for smart grids. Background Art

[0002] In order to protect the security of grid communication and take real-time monitoring and control to improve the stability of the grid, it is necessary to access the communication data in home IoT devices to train machine learning models. However, the communication data in home IoT devices contains quite private sensitive information. This data needs to be carefully processed and protected, so technologies such as data anonymization, encryption, and differential privacy have recently emerged. However, even with strong privacy and security guarantees, users are generally reluctant to access their electricity usage data.

[0003] In this context, federated learning models have great potential and can be used specifically in situations where data owners do not want to share their data due to privacy issues. They are effective in ensuring the confidentiality and security of data in IoT devices, and they enable multiple local nodes to collaboratively train machine learning models without sharing data, which is kept locally. Local machine models are trained on the user's device and then transmitted to a central server, which aggregates and integrates them into a shared global model. The central server sends the learned global model back to the user's device for further improvement and eventual use.

[0004] Existing solutions have begun to focus on taking advanced aggregation methods to deal with the complexity of the search space. In this context, the present invention considers that biologically inspired population-based heuristics are more suitable than average-based solutions to perform more optimized aggregation on a central server. The population-based metaheuristic uses initialization and iterative evolution phases to explore the solution space and produce high-quality solutions. An initial population is generated and evaluated, and the best individuals are identified.

[0005] Among the metaheuristic algorithms proposed in the past few years, the Gray Wolf Optimization Algorithm has shown effectiveness in the field of the Internet of Things and in certain cases of optimization cases. It is inspired by the hunting behavior and social hierarchy of gray wolves. It simulates the encirclement, tracking and attack strategies of gray wolves to find the optimal solution, thereby achieving effective exploration and utilization of the solution space. The Gray Wolf Optimization Algorithm excels in maintaining the diversity of the population and exploring the global optimal solution, ensuring that it is not easy to fall into the local optimal solution when solving the optimization problem. In various optimization use cases, the Gray Wolf Optimization exhibits low computational complexity and good convergence performance. Considering these characteristics, the Gray Wolf Optimization Algorithm has become a promising candidate for solving the optimization challenges brought by the federated model. The present invention is to integrate the algorithm into the practical and specific application of smart grids.

[0006] The present invention is particularly suitable for real-time monitoring of the flow of communication data such as voltage, current, and power under smart grids. By comparing the predicted value with the real-time data, the abnormal flow in the system can be quickly and accurately monitored. This is crucial for early detection of network attacks, system failures, prevention of power outages, and avoidance of potential equipment damage. In the field of power grid security, monitoring and preventing network attacks and data tampering is a major challenge. The present invention can improve the accuracy of identifying abnormal behaviors through the federated learning model enhanced by the Gray Wolf Optimization Algorithm, thereby strengthening the security protection of smart grids. By early monitoring of potential security threats, such as network attacks or system tampering, defensive measures can be quickly taken to prevent the occurrence of security accidents and protect the power grid from malicious attacks. Summary of the invention

[0007] Purpose of the invention: The purpose of the present invention is to provide a method for monitoring and predicting abnormal traffic of communication data for smart grids. The method uses the Gray Wolf Optimization Algorithm to reasonably predict the communication data traffic of smart grids, thereby improving the accuracy of prediction and the efficiency of abnormal traffic monitoring. In-depth analysis of historical communication data can accurately predict periodic and trend traffic changes, and obtain data changes of users' IoT devices. This analysis helps the system identify trends in data traffic changes; monitor and control the state of the power grid in real time, respond to changes in power grid load and potential faults, improve the reliability and economy of the power grid, and ensure efficient and stable operation of the power grid.

[0008] Technical solution: A method for monitoring and predicting abnormal traffic of communication data for smart grids. The method is based on the deployment of local models and global models in geographically distributed local nodes in the smart grid. The local models and the overall models include training using a Dlinear time series prediction model, and the communication data traffic of local nodes is monitored and predicted through the Dlinear time series prediction model.

[0009] The method is based on a federated learning framework, which obtains time series data on each local node in the smart grid and stores it on the local node; then forms K clusters on the edge node through clustering, each cluster aggregates a group of local nodes with isomorphic time series data, and the edge node is used to coordinate global model aggregation and local model parameter update in training;

[0010] The training and optimization of the local model and the global model include the following steps:

[0011] First, the central server sends the initial random model parameters to the local nodes for initial local model training; the edge node sends each cluster after aggregation to the central server to apply the Gray Wolf Optimization Algorithm for aggregation, and then returns the aggregated model parameters to the edge node, which sends the model parameters to the corresponding local node for local model training to complete the initial training of the local model; at the same time, the Gray Wolf Optimization Algorithm is used in each cluster to aggregate the local model parameters trained on each local node to generate a global prediction model. In the training after the initial round, each round of local models trained by the local nodes is directly uploaded to the central server for multiple iterations until full convergence.

[0012] Furthermore, the method adopts a federated learning framework to obtain time series data through IoT metering devices distributed at each node in the smart grid and store the data locally. The collected time series data includes data flow of power consumption, environmental parameters and user behavior patterns;

[0013] Then, K clusters are formed on the edge nodes through clustering. Each cluster brings together a group of local nodes with homogeneous data, and the edge nodes coordinate the federated model aggregation and model parameter updates.

[0014] The K-Means algorithm is used to cluster the non-independent and identically distributed data on different edge nodes, so as to cluster the data with similar data traffic scale values; the K-Means algorithm groups the IoT nodes with similar data traffic scales, and then groups the similar data into K clusters, and applies the Grey Wolf Optimization Algorithm in each cluster to achieve data aggregation.

[0015] In the above method, the preprocessing of time series data includes:

[0016] Normalization processing, scaling the time series data to the same range, and also includes calculating the correlation between various data features using the Pearson correlation coefficient;

[0017] Data reconstruction is done to meet the model input format requirements. The corresponding time intervals are obtained according to the time series data and converted into an input sequence of corresponding time steps. Each time step contains data features including power consumption, environmental parameters and user behavior patterns.

[0018] The reconstructed time series data is converted into tensor format for passing into the local model for training and prediction.

[0019] In combination with the above method, the present invention sets a central node as the central server N C , in each cluster, the central server N C Run the Gray Wolf Optimization algorithm to determine the optimal weight vector, i.e., the model parameter min heuristic , and then cluster to generate the best global model GL with the minimum global loss, expressed as:

[0020]

[0021] Based on the Grey Wolf Optimization Algorithm, we find an optimal solution (ω C ,L,Ω), where ω C is a set of candidate solutions, representing the vector parameters of the clustering model, and L is the loss function or objective function to be minimized; L NC is the loss function or objective function to be minimized corresponding to the global model, Ω represents the constraint condition; N represents the number of local nodes;

[0022] Combined with the federated learning algorithm, the value range of the decision variables forms the search space of the optimization problem, which is represented as the constraint set Ω. The learned model parameters are formally defined as:

[0023]

[0024] The role of Ω is to constrain the weights to be non-negative.

[0025] After performing federated training at each cluster level, if the performance is found to be improved, the local model weights of the nodes are updated, thereby achieving the best weight aggregation process and clustering model construction in terms of maintaining overall accuracy and performance. The updated local model parameters are then sent down to the local nodes through the edge nodes, expressed as:

[0026]

[0027] When the trained model weight NNc at a certain clustering level performs better than the original weight W on the local node, the weight is updated.

[0028] At each cluster level, local model optimization is achieved through a specific number of rounds of communication between local nodes and the central server;

[0029] After receiving the weight data of all local models, the central server aggregates the weights based on the aggregation strategy of the federal grey wolf algorithm to obtain a new initial model and broadcast it to the local models; after the local model receives the initial model sent by the central server, it performs a convergence check on the initial model; if the model has reached convergence, the participant exits the federated learning; if the model has not reached convergence, a new round of federated learning is started using the global model.

[0030] Furthermore, the Gray Wolf Optimization Algorithm updates the population of weight vectors by applying exploration and development strategies to each weight vector in the population. After the first round of clustering, the model parameters returned by the edge node to the local node are labeled. After the first round, there is no need to cluster the local model again in each subsequent round. The corresponding local device node only needs to pass the local model to the central server for aggregation by the Gray Wolf Optimization Algorithm within the cluster according to the corresponding label; at the end of each iteration, the Gray Wolf Optimization Algorithm identifies the best weight vector in the updated population by evaluating the global loss value of the weight vector and selecting the one with the smallest loss as the best weight vector.

[0031] Furthermore, the specific process of aggregating the weights of the local models through the Grey Wolf Optimization Algorithm includes:

[0032] When the gray wolf optimization algorithm is running, it first divides the population individuals into four types of gray wolves, namely α, β, δ and ω, according to their hunting methods. Gray wolf α is responsible for formulating the hunting plan of the wolf pack and represents the optimal solution to the problem. Gray wolf β represents the suboptimal solution to the problem and manages the search plan of the subordinate individuals for prey while following the orders issued by gray wolf α. Gray wolf δ is responsible for assisting gray wolf α and gray wolf β to complete the capture of prey. The others belong to gray wolf ω and are the basis of the entire gray wolf population. They must obey gray wolf α, gray wolf β and gray wolf δ.

[0033] The mathematical model of the Grey Wolf Algorithm is shown in formula (1):

[0034]

[0035] After finding the location of the prey, the gray wolf α leads the gray wolf β and gray wolf δ to command the wolf pack to encircle the prey. The location of the prey can be determined based on the positions of the three gray wolves α, β and δ. The formula (2) for updating the position of the gray wolf is as follows:

[0036]

[0037] Respectively represent the position vectors of α, β, and δ in the current population; represents the position vector of the gray wolf; They represent the distances between the current candidate gray wolf and the best three wolves respectively; When the gray wolves try to disperse in different areas and search for prey, When hunting, gray wolves will focus on searching for prey in one or more areas;

[0038] Respectively represent the distance vectors between gray wolf α, gray wolf β, gray wolf δ and their prey; The three equations represent the direction and distance of other gray wolves moving toward gray wolf α, gray wolf β, and gray wolf δ; It refers to the remaining gray wolves updating their own positions to search for prey under the leadership of three types of optimal wolves including gray wolf α, gray wolf β, and gray wolf δ; The three equations represent the updated position information of the gray wolf ω. It represents the final location of the prey searched by the gray wolf population, which is the optimal solution to the problem to be solved.

[0039] Furthermore, the weights of local models need to establish a unified fitness-based evaluation criterion in the global model aggregation stage to reduce data heterogeneity;

[0040] The fitness value measures the quality of the solution returned by the Grey Wolf Algorithm and is calculated using the loss function L defined for the local and global federated models;

[0041] The convergence rate is used to quantify the improvement rate of the fitness value during the algorithm iteration process. The expression is as follows:

[0042]

[0043] Where L opt is the best fitness obtained by the federal grey wolf optimization algorithm in T iterations, L t is the fitness of the current iteration T, L Goal represents the target fitness, T is the number of iterations;

[0044] Diversity is used to evaluate the ability of the gray wolf to explore the search space and determine the optimal parameter vector of the global federated model from the learned local model. The diversity of each iteration is calculated using the Euclidean distance:

[0045]

[0046] When the fitness value of the algorithm changes less than a preset threshold, the algorithm stops iterating.

[0047] In the above method, the Dlinear time series prediction model takes into account the characteristics of time series data, including a trend layer and a seasonal layer to separate trend and seasonal components, and improve the accuracy of capturing the communication data flow and predicting the traffic pattern of the local model;

[0048] The trend layer is used to identify and predict long-term data traffic trends, providing the local model with insights into long-term changes in the local node of the smart grid;

[0049] The seasonality layer is used to identify and predict periodic data traffic fluctuations, including daily peaks and valleys, as well as seasonal effects.

[0050] Furthermore, the Dlinear time series prediction model includes introducing a regularization method to demonstrate the complexity of the model and avoid overfitting.

[0051] Based on the above scheme, the method analyzes the abnormal communication flow value that exceeds the predicted normal threshold and can diagnose the cause of the abnormal value, including:

[0052] 1) Abnormally increased traffic, which may be caused by DDoS attacks on the power grid, resulting in a large influx of junk traffic; or smart devices in the smart grid are infected with malware and send a large amount of data;

[0053] 2) Abnormally reduced traffic, the reasons for which include failure of certain sensors or communication equipment, resulting in obstruction of data transmission; or network configuration errors or communication path problems leading to reduced data traffic;

[0054] 3) Data suddenly becomes very regular: The reasons include that the communication traffic may be controlled by malware or attackers to hide attack behavior or conduct data leakage;

[0055] 4) Temporary data distortion or service interruption: The reasons include temporary interruption due to system upgrade, maintenance or software update; also include service interruption due to hardware failure or power supply problem;

[0056] 5) Instantaneous power consumption peak: The causes include a sudden increase in load in a certain part of the power grid, and also include the protection device in the smart grid causing an instantaneous consumption peak;

[0057] 6) Sudden interruption of data flow: The reasons include problems due to failure or damage of communication equipment;

[0058] 7) Communication delay or packet loss: The reasons include communication delay due to network congestion or insufficient bandwidth, as well as data packet loss due to damage to the physical medium;

[0059] When an abnormality in the communication data traffic on a local node is detected, by analyzing the above reasons, the abnormal node can be isolated to prevent the impact and spread to other local nodes in the smart grid.

[0060] Beneficial effects: Compared with the prior art, the federated learning model enhanced by the Gray Wolf Optimization Algorithm in the present invention can improve the accuracy of identifying abnormal behaviors, thereby strengthening the security protection of smart grids. By early detection of potential security threats, such as network attacks or system tampering, defensive measures can be taken quickly to prevent the occurrence of security accidents and protect the power grid from malicious attacks. Secondly, by integrating the intelligent search capability of the Gray Wolf Optimization Algorithm with the distributed training characteristics of federated learning, and utilizing its powerful convergence, through in-depth analysis of historical data, the system can accurately predict periodic and trend changes in communication data, and provide strong guarantees for timely monitoring of abnormal changes in traffic, so as to take corresponding protection measures in time according to abnormal changes and maintain the stability of the smart grid. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] Figure 1 A model diagram for the implementation of the present invention;

[0062] Figure 2 This is a flow chart of the gray wolf optimization algorithm of the present invention. DETAILED DESCRIPTION

[0063] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0064] The problem to be solved by the present invention is that in the field of abnormal flow monitoring of communication data in smart grids, a large amount of user energy data is involved, and users attach great importance to the privacy protection of personal usage data. Distributed data can be effectively processed to avoid privacy leakage and data security problems caused by centralized storage and transmission of data. Compared with existing methods, the present invention improves prediction accuracy, reliability and data utilization efficiency.

[0065] The present invention provides a method for monitoring and predicting abnormal traffic of communication data for smart grids. The method includes combining federated learning and metaheuristic algorithms, building a global model through the gray wolf optimization algorithm and federated learning, and improving the accuracy and efficiency of communication data prediction in smart grid operations. The normal value of the future time series under normal conditions is obtained. When the actual measured value exceeds the set prediction threshold, the system can timely monitor the abnormal state, thereby realizing the monitoring of abnormal communication data traffic under the smart grid. And it has extremely important practical significance and application value for preventing the occurrence of major fault events. The model combines the intelligent search capability of the gray wolf optimization algorithm and the analysis of the traffic, and uses its strong convergence characteristic to achieve efficient and accurate prediction of data traffic. The core of the model is to use the gray wolf optimization algorithm to automatically adjust the weight parameters to adapt to unstable grid conditions and device nodes. Through in-depth analysis of historical power usage data, the system can accurately predict short-term to medium-term time series prediction tasks, especially in capturing and predicting changes with obvious trends and periodicity, to provide support for grid operations.

[0066] A method for monitoring and predicting abnormal traffic of smart grid communication data, combined with Figure 1 In general, first, the central server randomly sends the initial random model parameters to the local machine model to train the local model on the device node to be predicted; this is the initial training. During this process, the present invention performs clustering operations through the K-Means clustering algorithm, deploys an edge node, transmits the time series data of the local nodes contained in the edge node to the edge node for clustering operations, and sends each cluster after aggregation to the central server to apply the Grey Wolf Optimization Algorithm for aggregation; then, the aggregated model parameters are returned to the edge node, and the edge node sends the model parameters to the corresponding device node; after the initial training, each round of local models trained by the local node is directly uploaded to the central server, and multiple iterations are performed until complete convergence.

[0067] (I) The data grouping operation is realized through clustering algorithm. The detailed description is as follows.

[0068] First, consider that in smart grids, each local node is equipped with advanced IoT metering devices to collect key time series data. This type of data is usually collected at fixed time intervals (such as every second, every hour, every day, every month, etc.) and used to record the changes in one or more variables over time. Such as power consumption, environmental parameters or user behavior patterns. These devices can monitor and record data in real time, providing high-quality, high-resolution data input to support accurate analysis and prediction; finally, each local node stores the collected time series data locally. The data is geographically distributed and stored in the nodes, and is not shared with the central server or other participants, allowing better use of resources while respecting privacy protection requirements, easier maintenance, and avoiding single points of failure.

[0069] Data based on this model is in the form of a time series, where data points are ordered and indexed by time, denoted as t. This time series represents a series of observations, denoted as o, recorded by IoT measurement devices at specific and equal time intervals. This type of data structure allows energy measurements to be captured at a higher level of granularity, providing valuable insights into how energy production patterns change over time.

[0070]

[0071] The present invention collects smart grid time series data and uses K-Means algorithm for clustering, which is helpful for data grouping and data preprocessing, and provides a better data foundation for the training and optimization of the federated learning model. Specifically, it includes:

[0072] (1) Data grouping: The K-Means clustering algorithm can group values ​​with similar data flow scales. This helps to form local node clusters with similar data characteristics in the federated learning model, thereby better utilizing local data for model training and optimization. This reduces the problem of data imbalance, which may affect data analysis and machine learning model training, causing the model to favor a larger number of categories when predicting or classifying, thereby reducing the ability to recognize a minority of categories and overall performance.

[0073] (2) Data processing location: Set up edge nodes and perform K-Means clustering algorithm on edge nodes to divide homogeneous data into K clusters. Perform aggregation operation of Grey Wolf Optimization Algorithm on each cluster.

[0074] (3) Data preprocessing: Clustering with the K-Means algorithm can preprocess non-independent and identically distributed data to better adapt to the training process of the federated learning model. This helps solve the problem of uneven data distribution and improve the training efficiency and performance of the model. Its loss function form is:

[0075]

[0076] In order to find the extreme value, we make the partial derivative of the loss function equal to 0;

[0077] Once clusters are formed, federated learning models can be trained on these clusters, allowing for more customized and more effective models that reflect the specific characteristics and patterns of each group.

[0078] Edge nodes can coordinate this process, collecting only the necessary model information from each cluster to build a comprehensive federated model without compromising data privacy.

[0079] It is further supplemented that the communication data of the smart grid has the problem of non-independent and identically distributed data, as well as the heterogeneity of the processed data and the change of the energy generation mode. Clustering operation is performed based on the data traffic size (high traffic or low traffic) generated by the diversity of different users' behaviors and device types. The data in the local node may differ in characteristics and distribution. The K-Means clustering algorithm is used to divide users with similar communication data scale into different clusters on the edge node, and the clustering operation only occurs in the first round. After the first round of clustering, the model parameters returned by the edge node to the local node are labeled, that is, which category the IoT device belongs to. There is no need to perform clustering operation again in each round thereafter. The local node is directly transmitted to the central server, and the aggregation operation of the gray wolf optimization algorithm is performed within the cluster according to the category in the label. The sampling method can effectively solve the problem of unbalanced data volume, which may affect the training of data analysis and machine learning models, causing the model to be biased towards a larger number of categories when predicting or classifying, thereby reducing the recognition ability of a few categories and the overall performance. Further, in the first round of training, the trained local model is uploaded to the edge node N. e Group data with similar characteristics or distribution:

[0080] C={n e ,e∈1..k∧f d (n e ,n e+1 )<ε}

[0081] Among them, f d It is a function that measures the similarity between data using various criteria (such as maximum, minimum, median, pattern matching, etc.), n e is the e-th cluster after clustering. And the clusters are considered to be different and there is no overlap between them:

[0082]

[0083] At the cluster level, our goal is to infer a global distribution model on each cluster by optimally aggregating the weights of each local model and utilizing the data acquired by each local node.

[0084]

[0085] Among them, NN C is the neural network trained on the central server for each class, NN is the neural network trained on each local node data, and W i is the set of weight vectors in the local node that is specific to the trained model.

[0086] For the time series data clustering operation on the local node, the present invention divides several geographically distributed local nodes with similar data structures into a cluster, and deploys an edge node (edge ​​server) to perform the operation: K-Means clustering operation is performed on the local model generated by the local user node, which can more effectively process the heterogeneous data that is not independent and identically distributed, improve the interpretability and availability of the data, and help to better utilize the data for analysis and application.

[0087] After edge node clustering, the edge node will label each local model (which local node it belongs to). When the model parameters after aggregation by the central server are returned to the edge node, the edge node can return the trained local model to its local node according to the label and then proceed to the next round of training.

[0088] Edge nodes can process and store data to reduce the communication burden on central servers and reduce communication delays, saving bandwidth and reducing costs, and improving the reliability and robustness of the system.

[0089] (ii) The Dlinear time prediction model is used instead of the traditional LSTM model for training.

[0090] The Dlinear time prediction model is a time series prediction model that decomposes the time series into two components: trend and seasonality based on the decomposition method. This model is particularly suitable for data sets with obvious trend and seasonal characteristics. The communication data traffic in the context of the smart grid will have certain periodic changes due to seasons, weather and other reasons, so the Dlinear time prediction model is more suitable for this environment than the traditional LSTM.

[0091] 1) The Dlinear time prediction model can more accurately capture and predict the periodic and long-term trends in communication traffic by decomposing the time series into trend and seasonal components, making it easier to understand the usage patterns of the network.

[0092] The trend layer of the Dlinear time prediction model focuses on identifying and predicting long-term trends in communication data traffic, which helps power grid operators understand long-term traffic trends and plan and adjust resources accordingly. The seasonal layer of the model can identify and predict periodic traffic fluctuations, such as daily peaks and troughs, as well as seasonal change patterns, so that the power grid can better cope with predictable traffic fluctuations. At the same time, the Dlinear time prediction model focuses on decomposing and predicting specific components of time series, which can avoid overfitting of short-term fluctuations and ensure the generalization ability of the model.

[0093] 2) Compared with deep learning models such as LSTM, the Dlinear time prediction model can adaptively learn features in time series data, capture patterns and regularities in power grid communication data, and effectively extract key features, thereby improving the accuracy of predictions. It is more computationally efficient and requires fewer computing resources, which makes it more suitable for deployment in resource-constrained environments.

[0094] 3) The Dlinear temporal prediction model can quickly adapt to the nonlinear and non-stationary characteristics of communication traffic data, especially when the data exhibits a significant non-Gaussian distribution or has a special structure.

[0095] 4) In communication traffic forecasting, it is often able to provide higher prediction accuracy, including providing real-time traffic forecasting, which helps network operators respond quickly to traffic changes, provides rapid response and decision support for power grid operators, and helps them optimize network resource allocation and improve power grid reliability.

[0096] The present invention trains the local model and the global model through the Dlinear time series prediction model. Before the time series data is passed into the Dlinear time prediction model, the following preprocessing is required:

[0097] (1) The time series data is normalized to scale the data to the same range to avoid the difference between different data affecting the training effect of the model. The Pearson correlation coefficient is used to calculate the correlation between each data feature. By selecting features with higher correlation, the author reduces the dimensionality of the data and improves the training efficiency and accuracy of the model.

[0098] (2) Reconstruct the time series data into a format suitable for model input. The Dlinear time prediction model usually converts the time series data into an input sequence of multiple time steps, each time step containing multiple features. More specifically, the time series data is reconstructed into a sequence of length 96, each sequence containing energy production data within 24 hours of the previous day, sampled every 15 minutes. Then, these sequences are passed into the Dlinear model for training and prediction. During the training process, the batch gradient descent method is used to update the model parameters in order to improve the training efficiency and accuracy of the model. When using a neural network to predict the energy value 4 time points in advance. Energy prediction is performed one hour before the current time. Since the data set contains 4 samples per hour, each sample is 15 minutes apart. As input, it contains a sequence of 96 energy readings, which can consider the energy reading values ​​of the previous day (24 hours) for each prediction.

[0099] (3) Convert the reconstructed time series data into tensor format so that the data can be passed into the Dlinear time prediction model for training and prediction.

[0100] (4) The serialized data is divided into batches for model training and prediction. Batching improves the efficiency and accuracy of model training and avoids memory overflow. A batch size of 16 is used in training.

[0101] The Pearson correlation coefficient is used to calculate the correlation between each data feature. By selecting features with higher correlation, the author reduces the dimension of the data and improves the training efficiency and accuracy of the model.

[0102] The preprocessed local node time series data is applied to the Dlinear time series prediction model to predict the local power usage data, as follows:

[0103] At each local grid node, the Dlinear time series forecasting model is specifically used to predict the communication data traffic of that node. The design of this model takes into account the characteristics of time series data. By separating the trend and seasonal components, the model is able to capture and predict traffic patterns more accurately.

[0104] Each Dlinear model consists of two main components:

[0105] 1) Trend layer: focuses on identifying and predicting long-term data traffic trends, providing the model with insights into long-term changes.

[0106] 2) Seasonality layer: responsible for identifying and predicting periodic data traffic fluctuations, such as daily peaks and valleys, as well as any seasonal effects.

[0107] In order to prevent overfitting, the Dlinear time series prediction model introduces regularization technology. It does not directly use the dropout layer, but adopts other regularization methods including L1 or L2 regularization to limit the complexity of the model and reduce overfitting of the training data. In addition, the training process of the Dlinear time series prediction model includes the use of the Adam optimizer to improve the training efficiency and prediction performance of the model. After the training of the local model of each local node (trained by the Dlinear time series prediction model) is completed, its parameters and features are used to update and improve the prediction ability of the model.

[0108] In the federated learning framework, local model parameters on local nodes are directly transmitted to the central server starting from the second round of training. Based on the clustering results, the central server aggregates local model parameters with similar characteristics to form a global model. This global model integrates the data characteristics and patterns of each local node, improving the prediction accuracy of the entire power grid communication data flow.

[0109] The present invention deeply analyzes historical communication data and, combined with the Dlinear time prediction model, can accurately predict periodic and trend traffic changes and obtain data changes of the user's IoT devices. This analysis helps the system identify data traffic change trends; monitor and control the power grid status in real time, respond to power grid load changes and potential faults, improve the reliability and economy of the power grid, and ensure efficient and stable operation of the power grid.

[0110] (III) Combined application of federated learning algorithm and grey wolf optimization algorithm (meta-heuristic algorithm)

[0111] Combination Figure 2 As shown, the present invention will randomly generate the initial information of the gray wolf, and use the location of the gray wolf searching for prey to continuously and effectively aggregate the weight of the local model, so as to obtain the optimal parameters and optimize the federated learning model for power demand forecasting. A global shared model is constructed to search and identify the optimal solution of the local model weights, and the generated federated learning model is then transmitted to the local node to improve the quality of the local model.

[0112] When the gray wolf algorithm is running, it first divides the population individuals into four types of gray wolves, namely α, β, δ and ω, according to their hunting methods. Gray wolf α is responsible for formulating the hunting plan of the wolf pack and represents the optimal solution to the problem. Gray wolf β represents the suboptimal solution to the problem and manages the search plan of the subordinate individuals for prey while following the orders issued by gray wolf α. Gray wolf δ is responsible for assisting gray wolf α and gray wolf β to complete the capture of prey. The others belong to gray wolf ω and are the basis of the entire gray wolf population. They must obey gray wolf α, gray wolf β and gray wolf δ. The mathematical model of the gray wolf algorithm is shown in formula (1):

[0113]

[0114] t is the current iteration number; and is the synergy coefficient vector; represents the position vector of the prey; Represents the current position vector of the gray wolf; during the entire iteration Linearly decreases from 2 to 0; and is a random vector in [0, 1].

[0115] After finding the location of the prey, the gray wolf α leads the gray wolf β and gray wolf δ to command the wolf pack to encircle the prey. The location of the prey can be determined based on the positions of the three gray wolves α, β and δ. The formula (2) for updating the position of the gray wolf is as follows:

[0116]

[0117] Respectively represent the position vectors of α, β, and δ in the current population; represents the position vector of the gray wolf; They represent the distances between the current candidate gray wolf and the best three wolves respectively; When the wolves try to disperse in different areas and search for prey. When hunting, gray wolves will focus on searching for prey in one or more areas.

[0118] Based on the above-mentioned gray wolf optimization algorithm, the present invention continuously searches to obtain the optimal solution with the highest fitness:

[0119] The present invention is provided with a central node (central server) N C , in each cluster, it runs a meta-heuristic algorithm, the Grey Wolf Optimization algorithm, to determine the best weight vectors (i.e., model parameters) that will produce the best global model with the lowest global loss for that cluster.

[0120]

[0121] Find an optimal solution in a given search space that minimizes a set of (ω C ,L,Ω), where ω C is a set of candidate solutions, representing the vector parameters of the clustering model. L is the loss function or objective function to be minimized. Ω is a set of constraints that must be satisfied. The range of decision variables forms the search space of the optimization problem. The constraint set Ω, for the learned model parameters, is formally defined as:

[0122]

[0123] The weight aggregation process and clustering model construction are optimal in maintaining overall accuracy and performance. After performing federated training at each cluster level, if performance is found to be improved, the local model weights of the node are updated; and the updated local model parameters are sent down to the local nodes through the edge nodes.

[0124]

[0125] In the iteration phase: the algorithm updates the population of weight vectors by applying exploration and exploitation strategies to each weight vector in the population. After the first round of clustering, the model parameters returned by the edge node to the local node are labeled. After the first round, there is no need to cluster the local model again in each subsequent round. The device node only needs to pass the local model to the central server for aggregation by the gray wolf optimization algorithm according to the cluster of the corresponding label. At the end of each iteration, the algorithm identifies the best weight vector in the updated population by evaluating the global loss value of the weight vector and selecting the one with the smallest loss as the best weight vector.

[0126] At each cluster level, the model is optimized through a specific number of rounds of communication between local nodes and the central server. This process first involves the central server sending the initial model to the local node, and then the local node adjusts the model parameters after training and sends it back to the central server.

[0127] After receiving the weight data of all local models, the central server aggregates the weights based on the federated grey wolf algorithm and aggregation strategy to obtain a new initial model and broadcast it to the local model; after receiving the initial model sent by the central server, the local model performs a model convergence check; if the model has reached convergence, the participant exits the federated learning; if the model has not reached convergence, a new round of federated learning is started using the global model. The weights of local models need to have a unified evaluation standard (fitness) in the model aggregation stage to reduce data heterogeneity and improve the quality of the overall model.

[0128] The fitness value measures the quality of the solution returned by the Gray Wolf Optimization algorithm and is calculated using the loss function L defined for the local and global federated models. The convergence rate is used to quantify the rate of improvement of the fitness value during the algorithm iterations and is calculated as:

[0129]

[0130] Where L opt is the best fitness obtained by the algorithm in T iterations, L t is the fitness of the current iteration T, L Goalis the target fitness with an ideal value (i.e., no loss during the prediction process) in the embodiment of the present invention, and T is the number of iterations. Diversity is used to evaluate the ability of the gray wolf to explore the search space in order to determine the optimal parameter vector of the global federated model from the learned local model. The diversity of each iteration is calculated using the Euclidean distance:

[0131]

[0132] There is a convergence condition for the iteration setting: when the fitness value of the algorithm no longer changes significantly, the algorithm stops iterating. The present invention uses the fitness value to measure the performance of the model. When the change in the fitness value is less than a preset threshold, the algorithm stops iterating. This method can ensure that the algorithm stops iterating after reaching a certain accuracy, avoiding invalid calculations.

[0133] In the first iteration, the algorithm mainly explores the search space and the diversity increases, while in the final iteration, the algorithm focuses on the exploitation of the search space to converge to the optimal solution. Clustering occurs only in the first round of training, and in each subsequent round, the local model trained by the local node is directly uploaded to the central server for multiple iterations until full convergence. The fitness value increases from one iteration interval to the next. Similarly, there is no fluctuation in the convergence rate, only in the interval where it stagnates and then increases again and approaches the optimal value, which indicates that the algorithm is converging quickly to the optimal solution.

[0134] The Gray Wolf Optimization Algorithm includes the construction and optimization of local and global models. Specifically, the algorithm is used to optimize the global shared model in the federated learning model to improve the prediction quality of communication data traffic. By using the Gray Wolf Optimization Algorithm, the weights of local models can be aggregated more effectively, thereby improving prediction accuracy and training efficiency while protecting the user's personal sensitive information. Specific realizations include:

[0135] (1) The federated architecture consists of multiple local nodes distributed geographically. Each node uses IoT metering devices to obtain flow data such as voltage, current, and power in the form of time series and stores it locally.

[0136] (2) Each cluster groups a set of local nodes with homogeneous data and has a responsible node to coordinate federated model aggregation and model parameter updates, namely the edge node.

[0137] (3) Due to the large amount of time series data, the fast convergence performance of the Grey Wolf Optimization Algorithm is used to improve the computational efficiency of the model.

[0138] (IV) Performance test of the model

[0139] The present invention uses the mean square error (MSE) and mean absolute error (MAE) of training and testing for comparison. Mean square error (MSE) and mean absolute error (MAE) are commonly used indicators to evaluate the performance of regression models. MSE provides a view on the ability of the global model to significantly reduce large errors and prioritize accurate predictions, while MAE shows the robustness of the model to outliers and the overall accuracy of the predicted energy value. The obtained results have been compared with a popular state-of-the-art method, namely federated averaging, in which model parameters are aggregated by averaging model parameters over participating nodes. A consistent data distribution is maintained between the two evaluations to allow a fair comparison of the results. Compared with traditional federated averaging, the federated gray wolf optimization algorithm shows better performance in terms of mean square error (MSE) and mean absolute error (MAE), which is specifically reflected in lower error values. The present invention calculates the performance improvement ratio of the federated gray wolf optimization relative to the federated average in these two indicators.

[0140] The present invention achieves accurate prediction and timely monitoring of communication data flow anomalies on the basis of strictly protecting the confidentiality and security of user IoT node data. The model not only optimizes the prediction algorithm, but also significantly reduces the mean square error (MSE) and mean absolute error (MAE) through its advanced optimization strategy, providing more accurate flow prediction results, thus providing strong technical support for the stable operation of smart grids and data security management.

Claims

1. A method for monitoring and predicting abnormal traffic of smart grid communication data, characterized in that: The method is based on the deployment of local models and global models in geographically distributed local nodes in the smart grid. The local models and the overall models include training using a Dlinear time series prediction model, and the communication data traffic of the local nodes is monitored and predicted by the Dlinear time series prediction model. The method includes obtaining time series data on each local node in the smart grid and storing it on the local node based on a federated learning framework; then forming K clusters on the edge node by clustering, each cluster aggregates a group of local nodes with isomorphic time series data, and the edge node is used to coordinate global model aggregation and local model parameter update in training; The training and optimization of the local model and the global model include the following steps: First, the central server sends the initial random model parameters to the local nodes for initial local model training; the edge node sends each cluster after aggregation to the central server to apply the Gray Wolf Optimization Algorithm for aggregation, and then returns the aggregated model parameters to the edge node, which sends the model parameters to the corresponding local node for local model training to complete the initial training of the local model; at the same time, the Gray Wolf Optimization Algorithm is used in each cluster to aggregate the local model parameters trained on each local node to generate a global prediction model. In the training after the initial round, each round of local models trained by the local nodes is directly uploaded to the central server for multiple iterations until full convergence.

2. The method for monitoring and predicting abnormal traffic of communication data for smart grid according to claim 1 is characterized in that: This method adopts a federated learning framework to obtain time series data through IoT metering devices distributed at each node in the smart grid and store the data locally. The collected time series data includes data flow of power consumption, environmental parameters and user behavior patterns. Then, K clusters are formed on the edge nodes through clustering. Each cluster brings together a group of local nodes with homogeneous data, and the edge nodes coordinate the federated model aggregation and model parameter updates. The K-Means algorithm is used to cluster the non-independent and identically distributed data on different edge nodes, so as to cluster the data with similar data traffic scale values; the K-Means algorithm groups the IoT nodes with similar data traffic scales, and then groups the similar data into K clusters, and applies the Grey Wolf Optimization Algorithm in each cluster to achieve data aggregation.

3. The method for monitoring and predicting abnormal traffic of smart grid communication data according to claim 2 is characterized in that: The preprocessing of time series data includes: Normalization processing, scaling the time series data to the same range, and also includes calculating the correlation between various data features using the Pearson correlation coefficient; Data reconstruction is done to meet the model input format requirements. The corresponding time intervals are obtained according to the time series data and converted into an input sequence of corresponding time steps. Each time step contains data features including power consumption data flow, environmental parameters and user behavior patterns. The reconstructed time series data is converted into tensor format for passing into the local model for training and prediction.

4. The method for monitoring and predicting abnormal traffic of communication data for smart grid according to claim 1 is characterized in that: Set a central node as the central server N C , in each cluster, the central server N C Run the Gray Wolf Optimization algorithm to determine the optimal weight vector, i.e., the model parameter min heuristic , and then cluster to generate the best global model GL with the minimum global loss, expressed as: In the formula, NNC represents the neural network model of the local node, that is, the local model, and LNc(NNC) represents the loss function of the local model based on NNC; Based on the gray wolf optimization algorithm, we find an optimal solution (ω C ,L,Ω), where ω C is a set of candidate solutions, representing the vector parameters of the clustering model, and L is the loss function or objective function to be minimized; L NC is the loss function or objective function to be minimized corresponding to the global model, Ω represents the constraint condition; N represents the number of local nodes; Combined with the federated learning algorithm, the value range of the decision variables forms the search space of the optimization problem, which is represented as the constraint set Ω. The learned model parameters are formally defined as: Where W NNc represents the local model weight; After performing federated training at each cluster level, if the performance is found to be improved, the local model weights of the nodes are updated, thereby achieving the best weight aggregation process and clustering model construction in terms of maintaining overall accuracy and performance. The updated local model parameters are then sent down to the local nodes through the edge nodes, expressed as: Where W i Represents the weight vector of the i-th local model At each cluster level, local model optimization is achieved by performing a specific number of rounds of communication between local nodes and the central server; After receiving the weight data of all local models, the central server aggregates the weights based on the federal grey wolf algorithm and aggregation strategy to obtain a new initial model and broadcast it to the local models; after the local model receives the initial model sent by the central server, it performs a convergence check on the initial model; if the model has reached convergence, the participant exits federated learning; if the model has not reached convergence, a new round of federated learning is started using the global model.

5. The method for monitoring and predicting abnormal traffic of communication data for smart grid according to claim 1 or 4, characterized in that: The Gray Wolf Optimization Algorithm updates the population of weight vectors by applying exploration and development strategies to each weight vector in the population. After the first round of clustering, the model parameters returned by the edge node to the local node are labeled. After the first round, there is no need to cluster the local model again in each subsequent round. The corresponding local device node only needs to pass the local model to the central server for aggregation by the Gray Wolf Optimization Algorithm within the cluster according to the corresponding label; at the end of each iteration, the Gray Wolf Optimization Algorithm identifies the best weight vector in the updated population by evaluating the global loss value of the weight vector and selecting the one with the smallest loss as the best weight vector.

6. The method for monitoring and predicting abnormal traffic of communication data for smart grid according to claim 4 is characterized in that: The specific process of aggregating the weights of local models through the Gray Wolf Optimization Algorithm includes: When the gray wolf optimization algorithm is running, the population individuals are first divided into four types of gray wolves, namely α, β, δ and ω, according to their hunting methods. Gray wolf α is responsible for formulating the hunting plan of the wolf pack and represents the optimal solution to the problem. Gray wolf β represents the suboptimal solution to the problem and manages the search plan of the subordinate individuals for prey while following the orders issued by gray wolf α. Gray wolf δ is responsible for assisting gray wolf α and gray wolf β to complete the capture of prey. The others belong to gray wolf ω and are the basis of the entire gray wolf population. They must obey gray wolf α, gray wolf β and gray wolf δ. Among them, c represents the number of individual wolves, r represents the random factor when different gray wolves update their positions, which is usually generated by random numbers, and n represents the number of iterations in the gray wolf algorithm. The mathematical model of the Grey Wolf Algorithm is shown in formula (1): After finding the location of the prey, the gray wolf α leads the gray wolf β and gray wolf δ to command the wolf pack to encircle the prey. The location of the prey can be determined based on the positions of the three gray wolves α, β and δ. The formula (2) for updating the position of the gray wolf is as follows: Respectively represent the position vectors of α, β, and δ in the current population; represents the position vector of the gray wolf; They represent the distances between the current candidate gray wolf and the best three wolves respectively; When the gray wolves try to disperse in different areas and search for prey, When hunting, gray wolves will focus on searching for prey in one or more areas; Respectively represent the distance vectors between gray wolf α, gray wolf β, gray wolf δ and their prey; The three equations represent the direction and distance of other gray wolves moving toward gray wolf α, gray wolf β, and gray wolf δ; It refers to the remaining gray wolves updating their own positions to search for prey under the leadership of three types of optimal wolves including gray wolf α, gray wolf β, and gray wolf δ; The three equations represent the updated position information of the gray wolf ω. It represents the final location of the prey searched by the gray wolf population, which is the optimal solution to the problem to be solved.

7. The method for monitoring and predicting abnormal traffic of communication data for smart grid according to claim 1 or 4, characterized in that: The weights of local models need to establish a unified fitness-based evaluation standard in the global model aggregation stage to reduce data heterogeneity; The fitness value measures the quality of the solution returned by the Grey Wolf Algorithm and is calculated using the loss function L defined for the local and global federated models; The convergence rate is used to quantify the improvement rate of the fitness value during the algorithm iteration process. The expression is as follows: Where L opt is the best fitness obtained by the federal grey wolf optimization algorithm in T iterations, L t is the fitness of the current iteration T, L Goal represents the target fitness, T is the number of iterations; Diversity is used to evaluate the ability of the gray wolf to explore the search space and determine the optimal parameter vector of the global federated model from the learned local model. The diversity of each iteration is calculated using the Euclidean distance: When the fitness value of the algorithm changes less than a preset threshold, the algorithm stops iterating.

8. The method for monitoring and predicting abnormal traffic of communication data for smart grid according to claim 1 is characterized in that: The Dlinear time series prediction model takes into account the characteristics of time series data, including a trend layer and a seasonal layer to separate trend and seasonal components, and improve the accuracy of capturing the communication data flow and predicting the traffic pattern of the local model; The trend layer is used to identify and predict long-term data traffic trends, providing the local model with insights into long-term changes in the local node of the smart grid; The seasonality layer is used to identify and predict periodic data traffic fluctuations, including daily peaks and valleys, as well as seasonal effects.

9. The method for monitoring and predicting abnormal traffic of communication data for smart grid according to claim 8, characterized in that: The described Dlinear time series forecasting model includes the introduction of regularization methods to demonstrate the complexity of the model and avoid overfitting.

10. The method for monitoring and predicting abnormal traffic of communication data for smart grid according to claim 1, characterized in that: The method analyzes the abnormal communication flow value that exceeds the predicted normal threshold and can diagnose the cause of the abnormal value, including: 1) Abnormally increased traffic, which may be caused by DDoS attacks on the power grid, resulting in a large influx of junk traffic; or smart devices in the smart grid are infected with malware and send a large amount of data; 2) Abnormally reduced traffic, the reasons for which include failure of certain sensors or communication equipment, resulting in obstruction of data transmission; or network configuration errors or communication path problems leading to reduced data traffic; 3) Data suddenly becomes very regular: The reasons include that the communication traffic may be controlled by malware or attackers to hide attack behavior or conduct data leakage; 4) Temporary data distortion or service interruption: The reasons include temporary interruption due to system upgrade, maintenance or software update; also include service interruption due to hardware failure or power supply problem; 5) Instantaneous power consumption peak: The causes include a sudden increase in load in a certain part of the power grid, and also include the protection device in the smart grid causing an instantaneous consumption peak; 6) Sudden interruption of data flow: The reasons include problems due to failure or damage of communication equipment; 7) Communication delay or packet loss: The reasons include communication delay due to network congestion or insufficient bandwidth, as well as data packet loss due to damage to the physical medium; When the communication data on the local node is monitored to be abnormal, by analyzing the above reasons, the abnormal node can be isolated to prevent the impact and spread to other local nodes in the smart grid.

Citation Information

Cited By

  • Distributed meter identification method and system

    CN120434535A

  • A distributed meter identification method and system

    CN120434535B

  • Data intelligent optimization system and method based on artificial intelligence

    CN120880914A

  • An artificial intelligence-based data intelligent optimization system and method

    CN120880914B