Federal learning-based intelligent power grid electrical load prediction system and method thereof

By introducing a hierarchical knowledge distillation mechanism and an extreme weather compensation module, the problems of inconsistent regional feature distribution and decreased accuracy under extreme weather conditions in power grid load forecasting are solved, achieving high-precision and robust power load forecasting.

CN121503587APending Publication Date: 2026-02-10CHINA THREE GORGES UNIV
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202511616563.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-06
Publication Date
2026-02-10

AI Technical Summary

Technical Problem

Existing technologies for power grid load forecasting suffer from problems such as decreased forecast accuracy due to inconsistent regional feature distribution during model aggregation, and a sharp decline in forecast accuracy under extreme weather conditions.

Method used

Employing a hierarchical knowledge distillation mechanism and an extreme weather compensation module, local model knowledge is extracted into high-dimensional knowledge representation vectors through a teacher-student network architecture. Knowledge graph fusion under the topology structure is then performed on the cloud server. Combined with extreme weather monitoring and compensation mechanisms, the model prediction weights are dynamically adjusted.

Benefits of technology

It improves the accuracy and robustness of power grid load forecasting, enhances forecast adaptability in different regions, significantly reduces forecasting errors under extreme weather conditions, and strengthens the real-time performance and scalability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121503587A_ABST
    Figure CN121503587A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of power load prediction, and discloses an intelligent power grid power load prediction system and method based on federated learning, the system comprises a plurality of user terminals, a plurality of edge nodes and a cloud server, the user terminals collect local power consumption data and train a local model; the edge nodes extract abstract knowledge representation vectors of a regional power consumption mode through knowledge distillation, the cloud server fuses knowledge of the edge nodes based on a topological knowledge graph and constructs a global prediction model, and the system further comprises an extreme weather compensation module which dynamically adjusts a prediction weight when extreme weather is detected. According to the method, cross-region fusion is carried out on a knowledge level instead of a parameter level, so that the problem of multi-region feature distribution difference is effectively solved, the prediction accuracy is improved by 8-12%, the communication overhead is reduced by about 60%, and the prediction error in extreme weather is reduced to be within 2%.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of power load forecasting technology, specifically to a smart grid power load forecasting system and method based on federated learning, and particularly to a power grid load forecasting system and method employing a hierarchical knowledge distillation mechanism and extreme weather compensation technology. Background Technology

[0002] With the rapid development of smart grids, accurate power load forecasting is of great significance for grid dispatching, energy management, and electricity market operation. Traditional load forecasting methods typically require centralized data collection and processing, but face challenges in practical applications regarding user privacy protection and data security.

[0003] Existing technology CN117077186A discloses a privacy-preserving power load forecasting method using federated learning. This method implements distributed model training through a three-layer architecture consisting of a cloud server, edge nodes, and user terminals. Specifically, the user terminal uses local data to train the load forecasting model from the previous round, extracts the gradient of the load forecasting model upon completion of training, encrypts the gradient using a first encryption algorithm, and transmits the encrypted gradient to the corresponding edge node. The edge node decrypts and aggregates the gradients received in the current round to obtain a first aggregated gradient, encrypts the first aggregated gradient using a second encryption algorithm, and transmits the encrypted first aggregated gradient to the cloud server. The cloud server aggregates the received first aggregated gradients to obtain a second aggregated gradient, and uses the second aggregated gradient to train the global load forecasting model from the previous round to obtain the global load forecasting model for the current round. This method employs an encryption method based on the Diffie-Hellman key exchange protocol at the user terminal and a differential privacy noise addition method at the edge nodes to protect privacy.

[0004] However, the existing technologies have the following shortcomings: During model aggregation, due to significant differences in the spatial distribution of local model parameters trained by each edge node, direct weighted average aggregation can lead to a decrease in the prediction accuracy of the aggregated global model in certain regions. Specifically, when the electricity consumption characteristics of different edge nodes exhibit multi-peak distribution characteristics, such as peak electricity consumption in industrial areas occurring during weekdays while peak electricity consumption in residential areas occurs in the evenings and weekends, the gradient directions of the local model parameters in the two regions may have a large angle. In this case, simple weighted average aggregation will produce an intermediate solution in the parameter space, which cannot accurately capture the electricity consumption patterns of either industrial or residential areas, resulting in an increase of more than 5% in the prediction error of the aggregated global model in both types of regions. Furthermore, existing technologies lack specialized handling mechanisms for sudden events such as extreme weather. When encountering extreme weather such as typhoons and rainstorms, the accuracy of traditional load forecasting models will drop sharply, with prediction errors potentially exceeding 20%, severely affecting the accuracy of power grid dispatching. Summary of the Invention

[0005] To address the issues of inconsistent feature distribution across multiple regions caused by model aggregation in existing technologies and the decline in prediction accuracy under extreme weather conditions, this invention provides a smart grid power load forecasting system and method based on federated learning. By introducing a hierarchical knowledge distillation mechanism and an extreme weather compensation module, it achieves high-precision and robust power load forecasting while protecting user privacy.

[0006] To achieve the above objectives, the present invention adopts the following technical solution:

[0007] The smart grid load forecasting system based on federated learning provided by this invention includes multiple user terminals, multiple edge nodes, and a cloud server. The user terminals are used to collect local electricity consumption data and train local prediction models. The edge nodes are used to aggregate the model parameters of user terminals in their respective regions and extract knowledge features. The cloud server is used to integrate the knowledge features of each edge node to construct a global prediction model.

[0008] Preferably, the system further includes a knowledge distillation layer, which is set between the edge nodes and the cloud server, and is used to abstract the local model knowledge of each edge node into a high-dimensional knowledge representation vector.

[0009] Preferably, the system further includes an extreme weather compensation module, which is used to dynamically adjust the model prediction weights and integrate compensation parameters from historical extreme weather scenarios when extreme weather conditions are detected.

[0010] Preferably, the user terminal includes a data acquisition unit, a local training unit, and an encrypted transmission unit, wherein the local training unit uses a temporal convolutional network to extract the temporal features of the power load.

[0011] Preferably, the edge node includes a gradient aggregation unit, a knowledge extraction unit, and a regional feature library. The knowledge extraction unit extracts abstract knowledge of regional electricity consumption patterns through a teacher-student network architecture.

[0012] Preferably, the cloud server includes a knowledge fusion unit, a global model update unit, and a prediction output unit. The knowledge fusion unit integrates abstract knowledge from various regions using a knowledge graph based on topology.

[0013] Preferably, the extreme weather compensation module includes a weather monitoring unit, a scene matching unit, and a compensation coefficient calculation unit. The scene matching unit uses a similarity measurement method based on Mahalanobis distance to match historical extreme weather scenes.

[0014] Preferably, the system further includes a communication efficiency optimization unit, which uses model pruning and quantization techniques to reduce the amount of model parameter transmission.

[0015] Preferably, the system further includes a privacy protection unit, which employs homomorphic encryption and differential privacy technology to protect data security at the user terminal and edge nodes, respectively.

[0016] This invention also provides a smart grid load forecasting method based on federated learning, applied to the aforementioned system, comprising the following steps: each user terminal collects local electricity consumption data, trains a local time-series forecasting model, extracts the model gradient, and encrypts and uploads it to the corresponding edge node; each edge node aggregates the model gradients of its user terminals, extracts abstract knowledge representations of regional electricity consumption patterns through knowledge distillation, and uploads them to the cloud server; the cloud server integrates the knowledge representations of each edge node, constructs a global forecasting model based on a topological knowledge graph, and distributes it to each edge node; each edge node uses the global model to provide load forecasting services to user terminals, and when extreme weather is detected, activates the extreme weather compensation module to dynamically adjust the forecast results.

[0017] Compared with the prior art, the present invention has the following beneficial effects:

[0018] First, by introducing a hierarchical knowledge distillation mechanism, the local model knowledge of each edge node is abstracted into high-dimensional knowledge representation vectors, which are then aggregated at the knowledge level rather than the parameter level. This effectively solves the aggregation conflict problem caused by differences in the distribution of electricity consumption characteristics in different regions. The knowledge representation vectors can capture the essential laws of regional electricity consumption patterns without being limited by specific parameter values. This allows the aggregated global model to adapt to different electricity consumption characteristics, such as those in industrial areas and residential areas, improving prediction accuracy by 8 to 12 percentage points compared to existing technologies.

[0019] Second, by constructing an extreme weather compensation module, the system can automatically match similar historical scenarios and dynamically adjust prediction weights when detecting extreme weather such as typhoons and rainstorms, reducing the prediction error under extreme weather conditions from more than 20% in existing technologies to less than 2%, significantly improving the robustness and practicality of the system in emergency situations.

[0020] Third, by integrating abstract knowledge of various regions using a knowledge graph based on topology, the system can automatically discover the electricity consumption correlation between different regions, such as the impact of industrial production activities on the electricity consumption of surrounding residential areas. This topological correlation is used to further improve the accuracy of predictions, so that medium- and long-term predictions of up to 7 days can still maintain high accuracy.

[0021] Fourth, by employing model compression technology in the knowledge distillation layer, the system's communication overhead is reduced by approximately 60% compared to existing technologies, significantly improving the system's real-time performance and scalability while maintaining prediction accuracy. Attached Figure Description

[0022] Figure 1 This is a schematic diagram of the overall architecture of the smart grid load prediction system based on federated learning according to the present invention.

[0023] Figure 2 This is a schematic diagram of the edge node structure in this invention.

[0024] Figure 3 This is a schematic diagram illustrating the working principle of the knowledge distillation layer in this invention.

[0025] Figure 4 This is a flowchart illustrating the smart grid load prediction method based on federated learning according to the present invention. Detailed Implementation

[0026] Please refer to Figures 1-4 To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the scope of protection of the invention.

[0027] like Figure 1 As shown, the smart grid load forecasting system based on federated learning provided by this invention includes multiple user terminals, multiple edge nodes, and a cloud server. In practical applications, the entire smart grid is divided into several regions, each corresponding to an edge node, and each edge node connects to several user terminals. User terminals can be smart meters, industrial power monitoring equipment, or energy management systems in commercial buildings. Edge nodes are typically deployed in regional substations or distribution centers, responsible for data aggregation and preliminary processing within their respective regions. The cloud server is deployed in the central computer room of the power grid company, responsible for training and coordinating the global model.

[0028] The overall workflow of the system is as follows: Each user terminal first collects local electricity consumption data, including time-series data such as voltage, current, power, and electricity consumption. This data is used to train a local load prediction model, extracting model gradient parameters, which are then encrypted and uploaded to the corresponding edge node. The edge node receives the encrypted gradients uploaded by all user terminals within its region, decrypts and aggregates them to obtain the regional aggregated gradient. Unlike existing technologies that directly upload aggregated gradients, this invention introduces a knowledge distillation layer at the edge node. Through a teacher-student network architecture, the local model knowledge corresponding to the aggregated gradient is extracted into a high-dimensional knowledge representation vector. This knowledge representation vector contains abstract patterns of regional electricity consumption, such as peak-valley distribution, load change trends, and periodic characteristics, rather than simple model parameter values. The edge node uploads the extracted knowledge representation vector to the cloud server. The cloud server collects the knowledge representation vectors from each edge node and integrates them through a knowledge fusion unit. Knowledge fusion is not a simple vector weighted average, but a deep semantic fusion based on a knowledge graph with a topological structure, capable of discovering electricity consumption correlation patterns between different regions. The merged knowledge is used to update the global load forecasting model, which is then distributed to each edge node to provide load forecasting services to user terminals.

[0029] The user terminal is the system's data source, responsible for collecting local electricity consumption data and performing preliminary model training. For example... Figure 1 As shown, the user terminal includes a data acquisition unit, a local training unit, and an encrypted transmission unit.

[0030] The data acquisition unit is responsible for collecting users' electricity consumption data in real time. In an embodiment of the invention, the data acquisition frequency is set to once every 15 minutes, and the collected data includes parameters such as instantaneous power, cumulative electricity consumption, RMS voltage, RMS current, and power factor. This raw data is organized into a time-series data sequence, forming a sequence of length [length missing]. The time window, preferably, The value was set to 96, corresponding to 24 hours of data (one sampling point every 15 minutes, for a total of 96 sampling points over 24 hours). The collected data underwent preliminary outlier detection and missing value imputation to ensure data quality. Outlier detection employed a statistically based method. The criterion is that when the value of a sampling point deviates from the mean by more than three times the standard deviation, it is judged as an outlier, and a linear interpolation method is used to correct it using the preceding and following sampling points. Missing value imputation uses a time-series smoothing method. For short-term missing values ​​(less than 3 consecutive sampling points), linear interpolation is used; for long-term missing values ​​(more than 3 consecutive sampling points), the mean of historical data from the same period is used for imputation.

[0031] The local training unit is responsible for training the load prediction model using the collected local data. The local prediction model employs a Temporal Convolutional Network (TCN) architecture, which is particularly suitable for handling data with significant temporal dependencies, such as electricity load. The TCN includes multiple causal convolutional layers and dilated convolutional layers. Causal convolution ensures that the prediction depends only on historical data and not on future data, while dilated convolution expands the receptive field to capture long-term dependencies. In an embodiment of this invention, the TCN contains four causal convolutional layers with dilation rates of 1, 2, 4, and 8, respectively. The kernel size of each layer is set to 3, and the number of channels is 32, 64, 128, and 256, respectively. The network input is a historical load sequence of length 96, and the output is the load prediction values ​​for the next 24 sampling points (corresponding to the next 6 hours).

[0032] The training process employs supervised learning, and the loss function is a weighted combination of mean squared error (MSE) and mean absolute percentage error (MAPE). The mathematical expression for the loss function is:

[0033] ,

[0034] in: This represents the total loss value. This represents the number of training samples; For the first The actual load value of each sample is in kilowatts (kW). For the first The predicted load value for each sample, in kilowatts (kW). This is the mean square error weighting coefficient, with a value of 0.6; The average absolute percentage error weighting coefficient is 0.4.

[0035] This loss function design combines both absolute and relative error dimensions, maintaining stable training performance across different training load levels. The mean squared error term penalizes larger prediction biases more severely, helping to avoid extreme prediction errors. The mean absolute percentage error term focuses on relative error, maintaining sufficient prediction accuracy even during periods of lower training load (such as late night / off-peak hours). Two weighting coefficients... and The settings have been verified through numerous experiments. , When the model's predictive performance is most balanced across different time periods, it achieves the best overall performance.

[0036] The optimization algorithm uses the Adam optimizer, and the learning rate is set to... A cosine annealing learning rate scheduling strategy is employed, gradually reducing the learning rate during training to improve the model's convergence stability. Specifically, the learning rate is adjusted according to the following formula:

[0037] ,

[0038] in: For the first The learning rate for each training cycle; To set the minimum learning rate, set it to... ; To set the maximum learning rate, set it to... ; This represents the current training cycle number. Set the learning rate adjustment period to 50.

[0039] This learning rate scheduling strategy maintains a large learning rate in the early stages of training for rapid convergence, and gradually decreases it in the later stages to fine-tune the parameters, avoiding oscillations around the optimal solution. The smoothing property of the cosine function ensures the continuity of learning rate changes, which is beneficial for stable model training.

[0040] After local training is complete, the local training unit extracts the model's gradient parameters. Gradient parameters represent the derivatives of the model parameters with respect to the loss function, reflecting the direction and magnitude of the model parameter updates. The extracted gradient parameters are organized into gradient vectors. ,in This represents the total number of parameters in the model. In temporal convolutional networks, The value of gradient vectors typically ranges from hundreds of thousands to millions, depending on the number of layers in the network and the number of channels per layer. For ease of transmission and subsequent processing, the gradient vector is normalized to ensure that the gradient vector... The norm is equal to 1.

[0041] The encrypted transmission unit is responsible for encrypting the extracted gradient parameters before uploading them to the edge nodes. The encryption algorithm employs homomorphic encryption technology, specifically the Paillier encryption scheme. Paillier encryption is an additive homomorphic encryption scheme that supports direct addition operations on ciphertext. The decrypted result is equal to the sum of the plaintext and the original data. This characteristic allows edge nodes to perform aggregation operations directly without decrypting the gradients of individual users.

[0042] The Paillier encryption process is as follows: First, select two large prime numbers. and ,calculate and ,in Represents the least common multiple. Select random numbers. ,make sure The order is Multiples of. Public key is The private key is .

[0043] For each element of the gradient vector The encryption process is as follows:

[0044] ,

[0045] in: For elements The encrypted text; Indicates the encryption function; This is the generator of the public key; For random numbers, from Select evenly from the middle; The modulus of the public key.

[0046] Encrypted gradient vector Uploaded to the corresponding edge node via a secure communication protocol (such as TLS 1.3). Due to the long length of Paillier encryption ciphertext, in order to reduce communication overhead, the gradient vector is encrypted in blocks, with each block containing 100 gradient elements. A batch transmission strategy is adopted, accumulating a certain number of training epochs locally before uploading them all at once.

[0047] like Figure 2 As shown, the edge node includes a gradient aggregation unit, a knowledge extraction unit, and a regional feature library. The edge node serves as an intermediate layer connecting the user terminal and the cloud server, responsible for data aggregation, preliminary processing, and knowledge extraction within its region.

[0048] The gradient aggregation unit is responsible for receiving encrypted gradients uploaded by all user terminals within its assigned region and performing aggregation operations. Because Paillier homomorphic encryption is used, the aggregation operation can be performed directly on the ciphertext. Specifically, for gradients from within the region... Encryption gradient of individual user terminals The aggregation operation is as follows:

[0049] ,

[0050] in: This is the aggregated ciphertext gradient vector; For the first The ciphertext gradient vector of each user terminal; For the first The aggregation weight of each user terminal is determined by the amount of data on that user terminal. This represents the multiplication operation of the ciphertext, which corresponds to the weighted summation of the plaintext.

[0051] Aggregate weight The calculation method is as follows:

[0052] ,

[0053] in: For the first Aggregate weight of individual user terminals; For the first The amount of local training data per user terminal, in terms of the number of samples; This represents the total number of user terminals within the region.

[0054] This weighting design gives user terminals with larger datasets a greater influence during the aggregation process, which is reasonable because models trained on user terminals with larger datasets typically have better generalization capabilities. The sum of the aggregation weights equals 1, ensuring the normalization characteristic of the aggregation operation.

[0055] After aggregation, the gradient aggregation unit uses the private key of the edge node. Decrypting the aggregated ciphertext yields the aggregated gradient of the plaintext:

[0056] ,

[0057] in: This is the decrypted aggregated gradient vector; Indicates the decryption function; This is an auxiliary function for Paillier decryption.

[0058] The knowledge extraction unit is one of the core innovations of this invention, responsible for extracting abstract knowledge of regional electricity consumption patterns from the aggregated gradient. Unlike existing technologies that directly upload the aggregated gradient, this invention uses knowledge distillation technology to transform the local model knowledge corresponding to the aggregated gradient into a high-dimensional knowledge representation vector, thereby enabling cross-regional information exchange and fusion at the knowledge level rather than the parameter level.

[0059] Knowledge distillation employs a teacher-student network architecture. The teacher network is a region-local model updated based on aggregated gradients, while the student network is a lightweight knowledge extraction network. The goal of knowledge distillation is for the student network to learn the output distribution of the teacher network, rather than directly learning the input-output mapping. Specifically, given a set of input samples... The output of the teacher network is The output of the student network is The knowledge distillation loss function is:

[0060] ,

[0061] in: This represents the knowledge distillation loss value. Set the batch sample size to 32; Kullback-Leibler divergence measures the difference between two probability distributions; It is the softmax function; The temperature parameter controls the smoothness of the output distribution; it is set to 4. For the teacher network to the first Output of each sample; For student network to the first The output of each sample.

[0062] The Kullback-Leibler divergence is defined as:

[0063] ,

[0064] in: and There are two probability distributions; and For the probability distribution at the th The probability values ​​for each category.

[0065] The softmax function is defined as follows:

[0066] ,

[0067] in: For the first The softmax value of each output; It is an exponential function; the denominator is the sum of all output exponential values, which serves as a normalization function.

[0068] Temperature parameters This has a significant impact on the effectiveness of knowledge distillation. When When the output distribution is sharper, the softmax function degenerates into its standard form, resulting in a more acute output distribution and greater differences between categories. At this time, the output distribution becomes smoother, the differences between categories decrease, and more dark knowledge can be transmitted, i.e., the relative relationships between different categories in the teacher network. In this invention, Setting it to 4, experimental results have shown that this value strikes a good balance between maintaining knowledge integrity and simplifying model complexity.

[0069] After training with knowledge distillation, the intermediate layer representations of the student network are extracted as knowledge representation vectors. Specifically, the student network consists of an encoder and a decoder. The encoder maps the input sequence to the latent space, and the decoder reconstructs the output sequence from the latent space. The last hidden state of the encoder is the knowledge representation vector. ,in The hidden layer dimension is set to 256. This knowledge representation vector contains abstract features of regional electricity consumption patterns, such as peak-to-valley ratio, load change slope, and periodic intensity, rather than specific model parameter values. Compared to the original gradient vector (which typically has hundreds of thousands of dimensions), the dimensionality of the knowledge representation vector is significantly reduced, substantially decreasing communication overhead.

[0070] The regional feature library stores extracted knowledge representation vectors and related metadata. Metadata includes information such as region ID, timestamp, weather conditions, and number of users. This information will be used on the cloud server for weight calculation and topological relationship analysis during knowledge fusion. The regional feature library is stored in a time-series database, supporting efficient time-range query and aggregation operations.

[0071] The knowledge representation vector extracted by the edge nodes After packaging the metadata, it is uploaded to the cloud server via a secure channel. Since the dimension of the knowledge representation vector is much smaller than the original gradient vector, the communication overhead is significantly reduced. In the embodiments of this invention, compared to directly uploading aggregated gradients in existing technologies, the amount of communication data is reduced by approximately 60%, significantly improving the system's real-time performance and scalability.

[0072] The cloud server comprises a knowledge fusion unit, a global model update unit, and a prediction output unit. The cloud server is the central hub of the system, responsible for integrating the knowledge from various edge nodes and building and maintaining the global prediction model.

[0073] The knowledge fusion unit is responsible for fusing knowledge representation vectors from various edge nodes. Unlike the simple weighted averaging of existing technologies, this invention employs a knowledge graph based on topology for deep semantic fusion. First, the knowledge fusion unit constructs a regional association graph, where nodes represent edge nodes (corresponding to different regions), and edges represent the relationships between regions. These relationships are determined by analyzing factors such as the geographical location of the regions, the power grid topology, and the similarity of electricity consumption characteristics. For example, two geographically adjacent regions, or regions with high similarity in electricity consumption characteristics, have a strong association.

[0074] Adjacency matrix of region association graph Defined as:

[0075] ,

[0076] in: It is an adjacency matrix; This represents the total number of edge nodes. For edge nodes and edge nodes The strength of the correlation between them; For edge nodes and edge nodes Feature distance between them; The bandwidth parameter for the Gaussian kernel function is set to 1.5; The correlation threshold is set to 3.0; It is an exponential function.

[0077] Feature distance Taking into account both geographical distance and Euclidean distance of knowledge representation vectors:

[0078] ,

[0079] in: For comprehensive feature distance; For edge nodes and edge nodes The geographical distance between them, in kilometers, is normalized to a range of 0 to 10; The geographical distance weighting coefficient is set to 0.3. The distance weighting coefficient for knowledge representation is set to 0.7; and They are edge nodes and edge nodes The knowledge representation vector; for Norm, also known as Euclidean distance.

[0080] This feature distance design comprehensively considers both geographical proximity and the similarity of electricity consumption patterns. Geographically proximate areas often share similar climates and economic development levels, thus their electricity consumption patterns are likely similar. However, relying solely on geographical distance is insufficient, as electricity consumption patterns can differ significantly between industrial and residential areas, even when geographically close. Therefore, the Euclidean distance of knowledge representation vectors is introduced to directly measure the similarity of electricity consumption patterns. Two weighting coefficients are used. and The settings make electricity consumption pattern similarity the dominant factor, but geographic location information still plays a certain auxiliary role.

[0081] Based on adjacency matrix The knowledge fusion unit employs Graph Convolutional Networks (GCNs) for knowledge fusion. GCNs leverage the topological structure of graphs for information propagation and aggregation, ensuring that each node's representation not only includes its own information but also incorporates information from its neighbors. The mathematical expression for graph convolution operations is:

[0082] ,

[0083] in: For the first The node representation matrix of the layer has dimensions of ; For the first The node representation matrix of the layer has dimensions of ; To add self-connected adjacency matrices; It is the identity matrix; for The degree matrix is ​​a diagonal matrix, and the diagonal elements are... ; For the first The weight matrix of the layer has dimensions of ; This is the ReLU activation function.

[0084] The graph convolutional network consists of two layers. The first layer has an input dimension of... Equal to the knowledge representation vector dimension of 256, output dimension Set to 128; Input dimension of the second layer The output dimension is 128. Set to 64. After two layers of graph convolution, the representation vector of each node not only contains its own knowledge, but also incorporates the knowledge of its two-hop neighbors, enabling it to capture a wider range of regional association patterns.

[0085] Finally, the knowledge representation vectors of each edge node, after being fused by graph convolution, are subjected to global average pooling to obtain the global knowledge vector:

[0086] ,

[0087] in: This is a global knowledge vector with a dimension of 64; This represents the total number of edge nodes. For edge nodes The knowledge representation vector after two layers of graph convolution.

[0088] The global model update unit is responsible for updating the global prediction model based on the fused global knowledge vector. The structure of the global prediction model is similar to the local model on the user terminal, employing a temporal convolutional network architecture, but on a larger scale, containing six causal convolutional layers with channel numbers of 64, 128, 256, 512, 256, and 128 respectively, enabling it to handle more complex cross-regional electricity consumption patterns. Global knowledge vector The embedding layer is used to initialize the global model, enabling the global model to quickly adapt to the power consumption characteristics of each edge node.

[0089] The global model is updated using a meta-learning approach. Specifically, instead of directly updating parameters based on the aggregated gradients of each edge node, the global model learns an update strategy that dynamically generates the update direction and step size of the model parameters based on the global knowledge vector. This meta-learning method enables the global model to quickly adapt to the electricity consumption characteristics of different regions while maintaining strong generalization ability.

[0090] The objective function of meta-learning is:

[0091] ,

[0092] in: These are the optimized global model parameters; These are the current global model parameters; For edge nodes The loss function; For edge nodes The training set loss; Set the learning rate for the inner loop to [value]. ; Indicates the parameter The gradient; This represents the parameter value that minimizes the objective function.

[0093] The objective function represents: global model parameters. First, a gradient descent update is performed based on the training set loss of each edge node to obtain temporary parameters adapted to that edge node. Then, the validation set loss of the edge nodes is calculated on this temporary parameter. Finally, the average loss of the validation set across all edge nodes is used as the optimization objective for the global model. This two-layer optimization structure enables the global model to not only perform well at each edge node but also to quickly adapt to new regions.

[0094] After the global model is updated, the prediction output unit sends the updated global model parameters to each edge node. Each edge node receives the global model and uses it as the initial model for a new round of local training, continuing iterative optimization. This cyclical training process continuously improves both the global and local models, ultimately achieving high prediction accuracy.

[0095] like Figure 3As shown, the knowledge distillation layer, positioned between the edge nodes and the cloud server, is a key technology for achieving cross-regional knowledge fusion in this invention. The core idea of ​​the knowledge distillation layer is to extract the knowledge from the local models trained at each edge node into high-dimensional knowledge representation vectors through a teacher-student network architecture. These knowledge representation vectors contain abstract patterns of regional electricity consumption, such as load peak-to-valley ratios, trends, and periodic characteristics, rather than specific model parameter values. On the cloud server side, semantic fusion of the knowledge representation vectors from each edge node effectively solves the aggregation conflict problem caused by differences in the distribution of electricity consumption characteristics across different regions. Compared to the simple weighted averaging at the parameter level in existing technologies, this invention's knowledge-level fusion has stronger generalization and adaptability, enabling the global model to simultaneously adapt to different types of areas such as industrial zones, residential areas, and commercial zones, significantly improving prediction accuracy.

[0096] The extreme weather compensation module is another core innovation of this invention. It is used to dynamically adjust the model prediction weights and integrate compensation parameters from historical extreme weather scenarios when extreme weather conditions are detected, thereby significantly improving the robustness of the system in sudden situations.

[0097] The extreme weather compensation module includes a weather monitoring unit, a scene matching unit, and a compensation coefficient calculation unit.

[0098] The weather monitoring unit is responsible for real-time monitoring of current weather conditions and determining whether extreme weather conditions are occurring. Weather data is sourced from public APIs provided by meteorological departments and includes parameters such as temperature, humidity, wind speed, rainfall, and visibility. The weather monitoring unit defines criteria for extreme weather: extreme weather is defined as follows: temperature below -10℃ or above 40℃; wind speed greater than 17 m / s (equivalent to a gale-force wind of level 8); hourly rainfall greater than 16 mm (equivalent to a heavy rain); or visibility less than 200 meters. When extreme weather is detected, the weather monitoring unit sends an extreme weather event notification to the scene matching unit, and simultaneously sends the current weather parameter vectors... Passed to the scene matching unit, where The weather characteristic dimension includes temperature, humidity, wind speed, rainfall, visibility, etc., and is set to 5.

[0099] The scenario matching unit is responsible for matching the most similar historical scenario to the current weather conditions within the historical extreme weather database. The historical extreme weather database stores all extreme weather events that have occurred over the past few years and their corresponding load data. For each historical scenario... The database stores the weather parameter vectors for this scenario. and the load compensation coefficient in this scenario Compensation coefficient Defined as the ratio of actual load under extreme weather conditions to predicted load under normal weather conditions, it reflects the degree of impact of extreme weather on the load.

[0100] Scene matching employs a similarity metric based on Mahalanobis distance. Mahalanobis distance considers the covariance relationship between features and, compared to Euclidean distance, can more accurately measure the similarity of multi-dimensional features. Current weather parameter vector. With historical scenes Weather parameter vector The Mahalanobis distance between them is defined as:

[0101] ,

[0102] in: For current weather and historical scenarios Mahalanobis distance between them; This is a vector of current weather parameters, with dimensions of [dimensional value missing]. ; For historical scenes The weather parameter vector, with dimension ; Let be the covariance matrix of the weather parameters, with dimension . This data was obtained from historical statistics. It is the inverse of the covariance matrix; This indicates the matrix transpose.

[0103] covariance matrix The calculation method is as follows:

[0104] ,

[0105] in: It is the covariance matrix; This represents the total number of historical extreme weather scenarios. For the first A vector of weather parameters for a historical scene; This is the mean vector of weather parameters for all historical scenarios, calculated as follows: .

[0106] The scene matching unit calculates the Mahalanobis distance between the current weather and all historical scenes, and selects the scene with the smallest distance. Each scenario is used as a matching result. In an embodiment of the present invention, Set to 5. Match results include this Weather parameters, compensation coefficients, and similarity scores for each historical scene. The similarity score is calculated based on Mahalanobis distance.

[0107] ,

[0108] in: For current weather and historical scenarios The similarity score ranges from 0 to 1; The Mahalanobis distance; The similarity bandwidth parameter is set to 2.0; It is an exponential function.

[0109] The compensation coefficient calculation unit is responsible for calculating the load compensation coefficient under the current extreme weather conditions based on the matched historical scenarios. The compensation coefficient is calculated using a weighted average method based on the matched scenarios.

[0110] ,

[0111] in: This is the compensation coefficient for the current extreme weather. Set the number of historical scenes to match to 5; For the current weather and the Similarity score for each matching scenario; For the first The compensation coefficient for each matching scenario.

[0112] This weighted averaging method gives greater weight to historical scenarios more similar to the current weather in the compensation coefficient calculation, resulting in a more accurate compensation effect. After the compensation coefficient is calculated, the compensation coefficient calculation unit applies it to the prediction results of the global model to obtain the compensated load forecast value:

[0113] ,

[0114] in: The load forecast is after compensation, and the unit is kilowatts; This is the compensation coefficient for the current extreme weather. These are the original predicted values ​​from the global model, expressed in kilowatts.

[0115] By introducing an extreme weather compensation module, this invention can automatically adjust load forecast results under sudden events such as typhoons, rainstorms, and extreme high or low temperatures, significantly improving forecast accuracy. In practical applications, the extreme weather compensation module reduces forecast errors from over 20% in existing technologies to less than 2%, effectively ensuring the accuracy and reliability of power grid dispatching.

[0116] The user terminal includes a data acquisition unit, a local training unit, and an encrypted transmission unit. These three units work together to achieve local data acquisition, model training, and secure transmission.

[0117] The data acquisition unit is responsible for collecting users' electricity consumption data in real time. Data is collected every 15 minutes, and the collected data includes parameters such as instantaneous power, cumulative electricity consumption, RMS voltage, RMS current, and power factor. The collected data undergoes preliminary data quality checks, including outlier detection and missing value imputation, to ensure the reliability of the data used in subsequent training processes.

[0118] The local training unit employs a Temporal Convolutional Network (TCN) architecture to extract the temporal features of electricity load. TCNs are particularly well-suited for processing data such as electricity load, which exhibits clear temporal dependencies and periodic characteristics. Compared to traditional Recurrent Neural Networks (RNNs) or Long Short-Term Memory (LSTM) networks, TCNs offer advantages such as strong parallel computing capabilities, fast training speed, and strong long-term dependency capture capabilities. TCNs achieve efficient temporal modeling through two core mechanisms: causal convolution and dilated convolution. Causal convolution ensures that the prediction at the current moment depends only on data from historical moments, not on data from future moments, meeting the requirements of real-world prediction scenarios. Dilated convolution significantly expands the receptive field without increasing the number of parameters by inserting holes (i.e., zero values) into the convolution kernel, enabling the network to capture long-term temporal dependencies.

[0119] In an embodiment of the present invention, the temporal convolutional network comprises four causal convolutional layers with dilation rates of 1, 2, 4, and 8, respectively. The first layer has a dilation rate of 1, equivalent to a standard convolution, with a receptive field of 3 time steps; the second layer has a dilation rate of 2, expanding the receptive field to 7 time steps; the third layer has a dilation rate of 4, expanding the receptive field to 15 time steps; and the fourth layer has a dilation rate of 8, expanding the receptive field to 31 time steps. Through this exponentially increasing dilation rate design, the temporal convolutional network can capture temporal dependencies spanning up to 31 time steps (corresponding to 7.75 hours) using only four convolutional layers, effectively extracting the patterns of intraday load changes.

[0120] The number of channels in each convolutional layer is set to 32, 64, 128, and 256, showing a trend of increasing with each layer. Shallow networks have fewer channels and mainly extract local temporal features; deep networks have more channels and can learn more complex feature combinations and high-level semantic information. Each convolutional layer is followed by batch normalization and the ReLU activation function. Batch normalization can accelerate training convergence, and the ReLU activation function introduces non-linearity to enhance the network's expressive power.

[0121] The temporal convolutional network takes a 96-bit historical load sequence as input, corresponding to 24 hours of data (one sampling point every 15 minutes, for a total of 96 sampling points). The output is the load forecast for the next 24 sampling points (corresponding to the next 6 hours). This multi-step forecasting design enables the system to provide short-term load forecasts, meeting the real-time requirements of power grid dispatching.

[0122] The local training process employs supervised learning, with training data including historical load sequences and corresponding future load values. The training set is divided chronologically, with the first 80% of the data used for training and the last 20% for validation. The training run consists of 100 epochs, iterating through all training data in each epoch. To prevent overfitting, Dropout regularization is used, with a Dropout ratio of 0.2, meaning 20% ​​of neurons are randomly dropped during each training run. Furthermore, an early stopping strategy is employed: training stops when the validation set loss does not decrease for 10 consecutive epochs, preventing the model from overfitting to the training set and losing generalization ability.

[0123] The encrypted transmission unit is responsible for encrypting the gradients of the trained model. The encryption algorithm employs the Paillier homomorphic encryption scheme, which supports direct addition operations on the ciphertext, allowing edge nodes to perform aggregation operations without decrypting the gradients of individual users, thus protecting user privacy. The encryption process includes three steps: key generation, gradient encryption, and ciphertext transmission. In the key generation phase, two large prime numbers are selected. and Typically 1024 or 2048 bits, the public and private keys are calculated. In the gradient encryption phase, each element of the gradient vector is encrypted to obtain the ciphertext vector. In the ciphertext transmission phase, the ciphertext vector is uploaded to the edge node via a TLS 1.3 secure channel.

[0124] Edge nodes consist of gradient aggregation units, knowledge extraction units, and regional feature libraries. These three components work together to aggregate user gradients, extract knowledge, and store features within the region.

[0125] The gradient aggregation unit is responsible for receiving encrypted gradients uploaded by all user terminals within its assigned region and performing aggregation operations. Since the gradients uploaded by users are encrypted using Paillier homomorphic encryption, the aggregation operation can be performed directly on the ciphertext without prior decryption, thus protecting the privacy of each user's gradient. The aggregation operation uses a weighted summation method, with the weights determined by the amount of data from each user; users with larger data volumes have greater influence in the aggregation. After aggregation, the gradient aggregation unit uses the private key of the edge nodes to decrypt the aggregated ciphertext, obtaining the plaintext aggregated gradient.

[0126] The knowledge extraction unit is a core innovative component of the edge nodes, extracting abstract knowledge of regional electricity consumption patterns through a teacher-student network architecture. The teacher network is a local model of the region updated based on aggregated gradients, which contains electricity consumption feature information of all users within the region. The student network is a lightweight knowledge extraction network whose goal is to learn the output distribution of the teacher network, rather than directly learning the mapping relationship between input and output. This knowledge distillation method can extract the hidden knowledge (i.e., the relative relationships between different output categories) in the teacher network, forming an abstract knowledge representation.

[0127] The training process of the teacher-student network architecture is as follows: First, prepare a set of input samples, which can be historical load data within the region or synthetic load curves. Input these samples into the teacher network and student network respectively, obtaining the outputs of the teacher network and student network. The output of the teacher network is then processed through a temperature... The softmax transformation of the network yields a smooth probability distribution; the student network's output also undergoes the same softmax transformation. The Kullback-Leibler divergence between the two probability distributions is calculated as the knowledge distillation loss. By minimizing the knowledge distillation loss, the student network gradually learns to mimic the output distribution of the teacher network.

[0128] Temperature parameters It plays a crucial role in knowledge distillation. When When the output distribution is sharp, the softmax function degenerates into its standard form, with the main information concentrated on the class with the highest probability. At this time, the output distribution of the softmax function becomes smoother, and the categories with lower probabilities also obtain relatively higher probability values. The relative relationships of these secondary categories contain the hidden knowledge of the teacher network. In this invention, the temperature parameter Setting it to 4 gives the output distribution moderate smoothness, which can convey dark knowledge without being too smooth and causing information loss.

[0129] After training with knowledge distillation, the encoder part of the student network is retained, and its hidden states in the last layer are used as the knowledge representation vector. This knowledge representation vector has a dimension of 256, significantly lower than the original aggregated gradient (which may have hundreds of thousands or millions of dimensions), but it contains core features of regional electricity consumption patterns, such as peak-to-valley ratio, load change rate, periodicity intensity, and fluctuation amplitude. This highly abstract knowledge representation allows subsequent knowledge fusion to be performed at the semantic level, rather than through simple parameter averaging, thus effectively addressing the problem of differences in feature distribution across different regions.

[0130] The regional feature library stores extracted knowledge representation vectors and related metadata. This metadata includes information such as region ID, timestamp, weather conditions, number of users, and average load level. This metadata plays a crucial role in knowledge fusion on the cloud server side. For example, region ID and knowledge representation vectors are needed when calculating the adjacency matrix of a regional association graph; timestamps are needed for time-series analysis; and weather conditions are needed for extreme weather compensation. The regional feature library is stored in a time-series database, supporting efficient time-range query and aggregation operations, facilitating backtracking analysis of historical data and the mining of long-term trends.

[0131] The cloud server comprises a knowledge fusion unit, a global model update unit, and a prediction output unit. These three units work together to build, update, and provide prediction services for the global model.

[0132] The knowledge fusion unit integrates abstract knowledge from various regions using a topology-based knowledge graph. A knowledge graph is a structured knowledge representation method that explicitly expresses the relationships between entities (here referring to edge nodes or regions). In this invention, nodes in the knowledge graph represent edge nodes, and edges represent the relationships between edge nodes. These relationships are determined by analyzing factors such as the geographical location of the regions, the power grid topology, and the similarity of electricity consumption characteristics.

[0133] The first step in building a knowledge graph is to determine the strength of associations between nodes, forming an adjacency matrix. The elements of the adjacency matrix... Represents edge nodes and edge nodes The correlation strength between them is obtained by transforming the feature distance using a Gaussian kernel function. The feature distance comprehensively considers geographical distance and the Euclidean distance of the knowledge representation vector. The former reflects the spatial proximity of the region, while the latter reflects the similarity of electricity consumption patterns. The two are combined through a weighted average to form a comprehensive distance, with the weighting coefficients adjusted according to the actual application scenario. When the comprehensive distance is less than a threshold... When the total distance is greater than or equal to the threshold, the association strength is set to 0, indicating that there is no direct association between the two nodes.

[0134] The second step in constructing a knowledge graph is to perform graph convolution operations based on the adjacency matrix to update and fuse node representations. Graph convolution can utilize the topological structure of the graph to propagate information, ensuring that each node's representation not only includes its own information but also incorporates information from its neighbors. Through multi-layer graph convolution, information can propagate multiple hops across the graph, allowing each node to perceive a wider range of neighborhood information. In this invention, a two-layer graph convolutional network is used. The first layer maps the 256-dimensional knowledge representation vector to 128 dimensions, and the second layer further maps it to 64 dimensions. This gradual reduction in dimensionality helps extract more abstract and essential features while removing redundant information.

[0135] The specific computation process of graph convolution includes adjacency matrix normalization, matrix multiplication, and activation function application. Adjacency matrix normalization employs a symmetric normalization method, i.e. ,in It is the adjacency matrix after adding self-connections. yes The degree matrix is ​​used. Symmetric normalization balances the degree differences between nodes, preventing nodes with high degrees from dominating aggregation. Matrix multiplication includes multiplying the normalized adjacency matrix and the node representation matrix, as well as multiplying the result and the weight matrix, achieving a linear transformation of features. The activation function is ReLU, introducing nonlinearity and enhancing the network's expressive power.

[0136] After two layers of graph convolution, the knowledge representation vectors of each edge node are updated to new representations that incorporate neighbor information. These new representations are then aggregated into a single global knowledge vector through a global average pooling operation. The global knowledge vector contains the electricity consumption pattern characteristics of all areas of the entire power grid and is an important input for subsequent global model updates.

[0137] The global model update unit updates the global prediction model based on the fused global knowledge vector. The global prediction model adopts a temporal convolutional network architecture similar to that of the user terminal but on a larger scale, containing 6 layers of causal convolutions with channel numbers of 64, 128, 256, 512, 256, and 128, respectively. The larger network scale enables the global model to handle more complex cross-regional electricity consumption patterns and capture the mutual influence and coupling relationships between different regions.

[0138] The role of global knowledge vectors in global model updates is to initialize the model's embedding layer. The embedding layer, located at the input of the temporal convolutional network, is responsible for mapping the original load sequence to a high-dimensional feature space. By initializing the embedding layer using global knowledge vectors, the global model can quickly adapt to the electricity consumption characteristics of each edge node, reducing training time and improving convergence speed.

[0139] The global model is trained using a meta-learning approach, aiming to learn an update strategy that can quickly adapt to different regions. The core idea of ​​meta-learning is learning to learn, that is, not only learning model parameters but also learning how to quickly adjust parameters to adapt to new tasks. In this invention, each edge node is treated as a task, and the goal of meta-learning is to find a set of global model parameters that, after a few steps of gradient descent at each edge node, achieve a low loss value. This two-layer optimization structure enables the global model to perform well at each edge node while also possessing the ability to quickly adapt to new regions, significantly improving generalization performance compared to traditional federated averaging methods.

[0140] The forecast output unit is responsible for distributing the updated global model to each edge node and providing forecast services. The global model is distributed as a model parameter file, which each edge node receives and loads locally, replacing the original model. The distribution process uses an incremental update strategy, transmitting only the changed parameters rather than the complete model file, thereby reducing communication overhead. The forecast service provides load forecasts at different time scales based on the edge node's request, including short-term forecasts (next 6 hours), medium-term forecasts (next 1-3 days), and long-term forecasts (next 7 days). Different time scales use different model configurations and input window lengths; short-term forecasts focus on capturing details of intraday load changes, while long-term forecasts focus on capturing weekly and seasonal periodic patterns.

[0141] The extreme weather compensation module comprises a weather monitoring unit, a scene matching unit, and a compensation coefficient calculation unit. These three units work together to achieve dynamic compensation for load forecasting under extreme weather conditions.

[0142] The weather monitoring unit is responsible for monitoring current weather conditions in real time and determining whether extreme weather conditions are likely. Weather data is obtained through the meteorological department's API interface and is updated hourly. Weather data includes parameters across multiple dimensions, such as temperature, humidity, wind speed, rainfall, visibility, air pressure, and UV index. These parameters are organized into a weather parameter vector, which serves as input for subsequent scene matching.

[0143] The criteria for determining extreme weather are based on meteorological disaster warning signals issued by the national meteorological department. Extreme weather is defined as follows: temperatures below -10℃ or above 40℃, corresponding to a cold wave or high temperature warning; wind speeds greater than 17 m / s (equivalent to a gale-force wind of level 8), corresponding to a gale warning; hourly rainfall greater than 16 mm (equivalent to a rainstorm), corresponding to a rainstorm warning; and visibility less than 200 meters, corresponding to a dense fog warning. When extreme weather is detected, the weather monitoring unit immediately triggers the extreme weather compensation process, sending an extreme weather event notification to the scene matching unit and transmitting the current weather parameter vector.

[0144] The scene matching unit uses a Mahalanobis distance-based similarity metric to match historical extreme weather scenes. Mahalanobis distance is a distance metric that considers the covariance relationship between features, and compared to Euclidean distance, it can more accurately measure the similarity of multi-dimensional features. The calculation of Mahalanobis distance requires a covariance matrix, which is statistically obtained from historical extreme weather data and reflects the correlation between different weather parameters. For example, temperature and humidity are usually negatively correlated, with higher temperatures and lower humidity; wind speed and rainfall are positively correlated during typhoons, with higher wind speeds usually accompanied by higher rainfall. By introducing the covariance matrix, Mahalanobis distance can automatically consider these correlations, making the similarity measurement more reasonable.

[0145] The specific process for scene matching is as follows: First, calculate the Mahalanobis distance between the current weather parameter vector and each extreme weather scenario in the historical database. The historical database stores all extreme weather events that have occurred over the past few years, typically containing hundreds to thousands of scenarios. For each scenario, the database records the weather parameters, occurrence time, duration, and corresponding load compensation coefficient. The compensation coefficient is defined as the ratio of the actual load under extreme weather to the predicted load under normal weather; this ratio reflects the degree of impact of extreme weather on the load. For example, under high temperatures, the compensation coefficient is usually greater than 1 due to increased air conditioning load; under cold weather, although heating load increases, industrial production may be affected, and the compensation coefficient may be greater than or less than 1, depending on the region's electricity consumption structure.

[0146] After calculating the Mahalanobis distance for all scenes, sort them in ascending order of distance and select the scenes with the smallest distance. Each scenario is used as the matching result. The value is set to 5, which ensures the diversity of matching scenarios while avoiding the introduction of too many irrelevant scenarios. For each matching scenario, a similarity score is calculated based on its Mahalanobis distance. The similarity score uses a Gaussian kernel function, which makes the similarity higher when the distance is smaller and lower when the distance is larger. The similarity score ranges from 0 to 1, with a similarity of 1 when the distance is 0 and a similarity approaching 0 when the distance approaches infinity.

[0147] The compensation coefficient calculation unit calculates the load compensation coefficient under the current extreme weather based on the matched historical scenarios. The calculation method is a weighted average of the compensation coefficients for the matched scenarios, with the weights being the similarity scores of each scenario. This weighted averaging design gives greater weight to historical scenarios more similar to the current weather in the compensation coefficient calculation, resulting in a more accurate compensation effect. If a historical scenario is very similar to the current weather, with a similarity score close to 1, the compensation coefficient is mainly determined by that scenario; if multiple historical scenarios have high similarity to the current weather, the compensation coefficient integrates information from these scenarios, exhibiting better robustness.

[0148] After calculating the compensation coefficient, the compensation coefficient calculation unit applies it to the prediction results of the global model. The application method is direct multiplication, meaning the compensated prediction value equals the original prediction value multiplied by the compensation coefficient. This simple linear compensation method achieves good results in most cases. For extreme cases, such as when the confidence level of the compensation coefficient is low (the similarity scores for all matching scenarios are low), the compensation coefficient calculation unit sets a default compensation coefficient, typically 1.0, meaning no compensation is performed to avoid erroneous compensation leading to increased prediction errors.

[0149] By introducing an extreme weather compensation module, the system can automatically adjust forecast results under sudden extreme weather conditions, significantly improving forecast accuracy. In practical applications, this module reduces forecast errors for typhoons, rainstorms, and extreme high or low temperatures from over 20% to less than 2%, providing reliable decision support for power grid dispatch.

[0150] The system also includes a communication efficiency optimization unit, which uses model pruning and quantization techniques to reduce the amount of model parameters transmitted. Communication efficiency is a crucial performance indicator for federated learning systems, directly impacting their real-time performance and scalability. In this invention, by introducing communication efficiency optimization units at edge nodes and cloud servers, the amount of model parameters transmitted is significantly reduced, improving the overall performance of the system.

[0151] Model pruning is a technique that reduces model size by removing unimportant connections or neurons from a neural network. In this invention, model pruning is primarily applied to the processing of the global model before it is distributed to edge nodes. The goal of pruning is to minimize the number of model parameters while maintaining relatively constant prediction accuracy, thereby reducing the amount of data transmitted and the computational burden on edge nodes.

[0152] The pruning method employs structured pruning based on weight magnitude. First, for each convolutional layer of the global model, the weight magnitude of each convolutional kernel is calculated. The norm reflects the importance of the convolution kernel. Convolutional kernels with smaller norms contribute less to the model output and can be safely removed. Then, according to... Sort by norm from smallest to largest, remove The front with the smallest norm The convolution kernel, where The pruning rate is set to 30% in this invention. Removing the convolution kernel also removes the corresponding batch normalization parameters and the connections associated with that kernel in subsequent layers, thereby achieving an actual reduction in model size.

[0153] The pruned model requires fine-tuning to recover the accuracy loss caused by pruning. Fine-tuning is performed on the cloud server using validation datasets provided by each edge node. Training typically takes 10 to 20 epochs, with the learning rate set to one-tenth of the original training learning rate. The fine-tuned pruned model maintains prediction accuracy no more than 1% different from the original model, but with approximately 30% fewer parameters and a corresponding 30% reduction in transmitted data.

[0154] Model quantization is a technique that reduces model storage space and data transfer by decreasing the numerical precision of model parameters. In this invention, model quantization converts 32-bit floating-point parameters into 8-bit integer parameters. The quantization process includes determining the quantization range and quantization mapping. The quantization range is determined by statistically analyzing the minimum and maximum values ​​of the model parameters, denoted as […]. Quantization mapping will convert floating-point parameters... Mapping to integer parameters The mapping formula is:

[0155] ,

[0156] in: This is the quantized integer parameter, with a value range of 0 to 255; These are the floating-point parameters before quantization; This represents the minimum value within the quantization range. This represents the maximum value within the quantization range. This is a rounding function; 255 is the maximum value of an 8-digit integer.

[0157] The dequantization process converts integer parameters Restore to floating-point parameters The mapping formula is:

[0158] ,

[0159] in: These are the dequantized floating-point parameters; These are quantized integer parameters; and These represent the minimum and maximum values ​​of the quantization range.

[0160] By quantization, the storage space for each parameter is reduced from 32 bits (4 bytes) to 8 bits (1 byte), and the model file size is reduced by 75%. Although quantization introduces numerical errors, due to the fault tolerance of neural networks, the accuracy loss caused by quantization is usually within 1%, which is acceptable in practical applications.

[0161] By combining model pruning and quantization techniques, the communication efficiency optimization unit reduces the amount of model parameter transmission by approximately 80% (pruning 30%, requantization 75%, resulting in a combined reduction of approximately...). (i.e., 82.5%). This significant reduction in transmission volume allows the system to support more edge nodes and user terminals, greatly improving scalability. Simultaneously, the shorter transmission time allows for more frequent model updates, improving the system's real-time performance.

[0162] The system also includes a privacy protection unit, employing homomorphic encryption and differential privacy technologies at user terminals and edge nodes respectively to protect data security. Privacy protection is one of the core requirements of federated learning systems, directly affecting users' trust and acceptance of the system.

[0163] On the user terminal, the privacy protection unit uses Paillier homomorphic encryption to encrypt the model gradient. Paillier encryption is an additive homomorphic encryption scheme with the following important properties: for two plaintexts... and The encrypted ciphertext is as follows: and ,but and product After decryption, it equals This homomorphic property allows edge nodes to directly perform weighted summation on the ciphertext to obtain aggregated ciphertext, which, after decryption, equals the weighted sum of the gradients of each user. Throughout the aggregation process, edge nodes cannot know the specific gradient values ​​of each user, thus protecting user privacy.

[0164] Paillier encryption typically uses 1024-bit or 2048-bit keys. Longer keys offer higher security but also greater computational overhead. In this invention, considering the balance between computational efficiency and security, a 1024-bit key length is chosen. This key length makes it extremely difficult to crack with current computing power, meeting the security requirements of practical applications. User terminals generate their own public and private keys. The public key is shared with edge nodes for aggregation operations; the private key is stored locally and never uploaded, used for decrypting other information (if necessary).

[0165] The encrypted gradient vector is quite long, with each ciphertext element being several times the length of the plaintext. To reduce communication overhead, the privacy protection unit performs block encryption and compressed transmission of the gradient vector. Specifically, the gradient vector is divided into several blocks, each containing 100 gradient elements, and each block is encrypted independently. The encrypted ciphertext blocks are compressed using a lossless compression algorithm (such as gzip) and then uploaded to the edge nodes through a secure channel. Upon receiving the blocks, the edge nodes first decompress them and then perform the aggregation operation. This block encryption and compressed transmission strategy significantly reduces communication overhead while protecting privacy.

[0166] At edge nodes, the privacy protection unit employs differential privacy technology to add noise to the aggregated gradient, further protecting user privacy. Differential privacy is a strict definition of privacy protection that adds carefully designed random noise to data query results, making it impossible for attackers to infer any individual's information from the query results. The core parameter of differential privacy is the privacy budget. This parameter controls the strength of privacy protection. The smaller the size, the stronger the privacy protection, but the lower the data utility; The larger the value, the higher the data utility, but the weaker the privacy protection. In this invention, the privacy budget... Setting it to 1.0 strikes a good balance between privacy protection and data utility.

[0167] Differential privacy noise employs a Gaussian noise mechanism. For each element of the aggregated gradient vector, a Gaussian noise distribution is added. The noise, where the noise standard deviation With privacy budget Dataset sensitivity Relevant. Dataset sensitivity is defined as the maximum difference in query results between two adjacent datasets (differences of only one sample), reflecting the degree of influence of a single sample on the query result. In federated learning scenarios, the query operation is gradient aggregation, and sensitivity can be controlled through gradient pruning techniques. Gradient pruning will reduce the gradient of each user's gradient... Norm constraint at a threshold Within, thus making the sensitivity .

[0168] The formula for calculating the standard deviation of noise is:

[0169] ,

[0170] in: The standard deviation of noise; The gradient clipping threshold is set to 1.0; Set as relaxation term ; Set the privacy budget to 1.0; It is the natural logarithm function.

[0171] The calculated noise standard deviation is substituted into a Gaussian distribution to add noise to each element of the aggregated gradient. The noise-added aggregated gradient is then extracted as a knowledge representation vector and uploaded to a cloud server. Due to the presence of noise, even if an attacker obtains the aggregated gradient, they cannot accurately infer the gradient information of any individual user, thus effectively protecting user privacy.

[0172] By employing homomorphic encryption at the user terminal and differential privacy at the edge node, this invention constructs a dual privacy protection mechanism, providing strict security for user data and meeting the high privacy protection requirements of the smart grid.

[0173] Please refer to Figure 4 This invention also provides a smart grid load forecasting method based on federated learning, applied to the above-mentioned system, specifically including the following steps:

[0174] Step 1, Local Data Acquisition and Model Training:

[0175] Each user terminal collects local electricity consumption data, including time-series data such as instantaneous power, cumulative power consumption, voltage, current, and power factor. Data is collected every 15 minutes, forming a continuous time-series data stream. The collected data undergoes preprocessing, including outlier detection, missing value imputation, and normalization, to ensure data quality.

[0176] The user terminal trains a local time-series forecasting model using preprocessed data. The local model employs a Temporal Convolutional Network (TCN) architecture, containing four causal convolutional layers with dilation rates of 1, 2, 4, and 8, and channel numbers of 32, 64, 128, and 256, respectively. The model's input is a historical load sequence of length 96 (corresponding to 24 hours of data), and the output is the load forecast values ​​for the next 24 sampling points (corresponding to the next 6 hours).

[0177] The training process employs supervised learning, with the loss function being a weighted combination of mean squared error and mean absolute percentage error. The optimization algorithm uses the Adam optimizer, with an initial learning rate of... A cosine annealing learning rate scheduling strategy was adopted. The training epochs were set to 100 epochs, and Dropout regularization (ratio 0.2) and early stopping strategy were used to prevent overfitting.

[0178] After training, the user terminal extracts the model gradient. The gradient represents the derivative of the model parameters with respect to the loss function, reflecting the direction and magnitude of the model parameter updates. The gradient vector is normalized to make it... The norm is equal to 1, which facilitates subsequent encryption and aggregation operations.

[0179] Step 2, Gradient Encryption and Upload:

[0180] The user terminal uses the Paillier homomorphic encryption algorithm to encrypt the extracted gradient vector. The encryption process includes public key generation, gradient encryption, and ciphertext upload. The public key is generated from two large prime numbers and is 1024 bits long. Each element of the gradient vector is encrypted independently to obtain the ciphertext vector. The ciphertext vector is then uploaded to the corresponding edge node via a TLS 1.3 secure channel.

[0181] To reduce communication overhead, gradient vectors employ a block encryption and compression transmission strategy. The gradient vectors are divided into several blocks, each containing 100 elements. Each block is independently encrypted and then losslessly compressed before being uploaded in batches.

[0182] Step 3, Edge Node Gradient Aggregation:

[0183] Edge nodes receive encrypted gradients uploaded by all user terminals within their assigned area. Due to the use of homomorphic encryption, edge nodes can directly perform aggregation operations on the ciphertext without decrypting the gradients of each user. The aggregation operation employs a weighted summation method, with the weights determined by the amount of data from each user. After aggregation, the edge node uses its private key to decrypt the aggregated ciphertext, obtaining the aggregated gradient in plaintext.

[0184] The aggregated gradient was used to update the local model of the region. The update method employed gradient descent, and the updated local model incorporated the electricity consumption characteristics of all users within the region.

[0185] Step 4, Knowledge Distillation and Characterization Extraction:

[0186] Edge nodes extract abstract knowledge of regional electricity consumption patterns from the updated local model using knowledge distillation technology. Knowledge distillation adopts a teacher-student network architecture, where the teacher network is the local model and the student network is a lightweight knowledge extraction network.

[0187] The training objective of knowledge distillation is to enable the student network to learn the output distribution of the teacher network. For a set of input samples, the outputs of the teacher and student networks are calculated separately, using a temperature of... The softmax transformation yields a smooth probability distribution. The Kullback-Leibler divergence between the two distributions is calculated as the loss function. Minimizing this loss completes the knowledge distillation training.

[0188] After training, the last hidden state of the student network encoder is extracted as a knowledge representation vector. This vector has a dimension of 256 and contains abstract features of regional electricity consumption patterns, such as peak-to-valley ratio, load change rate, and periodicity intensity. Compared to the original aggregated gradient, the dimension of the knowledge representation vector is significantly reduced (from hundreds of thousands to 256), resulting in a significant reduction in communication overhead.

[0189] Step 5, Knowledge Representation Upload and Differential Privacy Protection:

[0190] Differential privacy noise is added to the extracted knowledge representation vector at edge nodes to further protect user privacy. The noise adopts a Gaussian distribution, and the standard deviation is determined according to the privacy budget. Gradient clipping threshold and relaxation term Calculated.

[0191] The knowledge representation vector with added noise, along with related metadata (region ID, timestamp, weather conditions, etc.), is packaged and uploaded to the cloud server. Because the dimension of the knowledge representation vector is much smaller than that of the original gradient, the amount of data uploaded is reduced by approximately 60% compared to existing technologies.

[0192] Step 6: Knowledge fusion based on topological knowledge graph:

[0193] After receiving the knowledge representation vectors uploaded by each edge node, the cloud server constructs a regional association graph. Nodes in the graph represent edge nodes, and edges represent the relationships between nodes. These relationships are represented by an adjacency matrix, the elements of which are calculated based on the feature distances between regions. The feature distances are formed by a weighted combination of geographical distance and the Euclidean distance of the knowledge representation vectors.

[0194] Based on the adjacency matrix, the cloud server employs a Graph Convolutional Network (GCN) for knowledge fusion. The GCN consists of two layers: the first layer maps a 256-dimensional knowledge representation to 128 dimensions, and the second layer maps it to 64 dimensions. Through GCN, the representation of each node incorporates information from its neighboring nodes, enabling the capture of electricity consumption patterns between regions.

[0195] The representation vectors of each node, after being fused through graph convolution, are aggregated into a 64-dimensional global knowledge vector through global average pooling. This global knowledge vector contains the electricity consumption pattern characteristics of all regions of the entire power grid.

[0196] Step 7, Global Model Update and Deployment:

[0197] The cloud server updates the global prediction model based on the fused global knowledge vectors. The global model adopts a temporal convolutional network architecture and is larger than the local model on the user terminal. It contains 6 layers of causal convolutions with 64, 128, 256, 512, 256, and 128 channels respectively. The global knowledge vectors are used to initialize the model's embedding layer, enabling the model to quickly adapt to the electricity consumption characteristics of different regions.

[0198] The global model is updated using a meta-learning method, with the objective function being the average loss of the validation set at each edge node. Meta-learning enables the global model to not only perform well at each edge node but also to quickly adapt to new regions.

[0199] After the update is complete, the cloud server distributes the global model parameters to each edge node. Before distribution, the model is pruned and quantized, with a pruning rate of 30% and quantization precision of 8 bits, reducing the amount of data transmitted by approximately 80%. The distribution process uses an incremental update strategy, transmitting only the parameters that have changed.

[0200] Step 8, Edge Node Deployment and Predictive Services:

[0201] After receiving the global model, each edge node loads it locally, replacing the original model. The edge nodes then use the updated global model to provide load forecasting services to user terminals. Based on user requests, the forecasting service provides forecast results at different time scales, including short-term forecasts (next 6 hours), medium-term forecasts (next 1-3 days), and long-term forecasts (next 7 days).

[0202] The user terminal uses the received global model as the initial model for a new round of local training, repeating steps one through eight to form an iterative training process that continuously improves the model's prediction accuracy.

[0203] Step Nine, Extreme Weather Detection and Compensation:

[0204] Throughout the forecasting process, the system continuously monitors weather conditions. When extreme weather conditions are detected (temperature below -10℃ or above 40℃, wind speed greater than 17 m / s, hourly rainfall greater than 16 mm, or visibility less than 200 meters), the extreme weather compensation module is activated.

[0205] The extreme weather compensation module first matches the current weather parameter vector with scenarios in the historical extreme weather database, using a similarity metric based on Mahalanobis distance. It then selects the top five historical scenarios with the highest similarity and calculates the compensation coefficient for the current extreme weather based on the similarity score and compensation coefficient for each scenario.

[0206] The calculated compensation coefficient is applied to the prediction results of the global model to obtain the compensated load forecast. The compensation operation uses direct multiplication, that is, the compensated forecast value is equal to the original forecast value multiplied by the compensation coefficient. Through extreme weather compensation, the prediction error of the system under sudden events such as typhoons, rainstorms, and extreme high or low temperatures is reduced from more than 20% to less than 2%.

[0207] Through the above-described methods and steps, this invention achieves high-precision power load forecasting based on federated learning and knowledge distillation techniques while protecting user privacy. The system can handle differences in electricity consumption characteristics across multiple regions and adapt to emergencies such as extreme weather. Compared to existing technologies, it improves forecast accuracy by 8 to 12 percentage points and reduces communication overhead by approximately 60%, demonstrating significant technical advantages and practical value.

[0208] The embodiments described above are merely illustrative of specific implementations of the present invention, and while the descriptions are detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention.

Claims

1. A smart grid load forecasting system based on federated learning, characterized in that, include: Multiple user terminals are used to collect local electricity consumption data and train local load prediction models; Multiple edge nodes are connected to one or more user terminals to aggregate user terminal model parameters in their respective regions; and a cloud server is connected to each edge node to integrate model information from each edge node to construct a global load prediction model. The edge node includes a knowledge extraction unit, which is used to extract the aggregated local model knowledge into a knowledge representation vector through knowledge distillation. The cloud server includes a knowledge fusion unit, which is used to integrate the knowledge representation vectors of each edge node based on the knowledge graph of the topology structure, and update the global load prediction model.

2. The smart grid load forecasting system based on federated learning according to claim 1, characterized in that, The system also includes a knowledge distillation layer, which is set between the edge nodes and the cloud server, and is used to abstract the local model knowledge of each edge node into a high-dimensional knowledge representation vector.

3. The smart grid load forecasting system based on federated learning according to claim 1, characterized in that, The system also includes an extreme weather compensation module, which is used to dynamically adjust the model prediction weights and integrate compensation parameters from historical extreme weather scenarios when extreme weather conditions are detected.

4. The smart grid load forecasting system based on federated learning according to claim 1, characterized in that, The user terminal includes: The data acquisition unit is used to collect local electricity consumption data; The local training unit is used to extract the temporal features of electricity load using a temporal convolutional network and train a local prediction model; and the encrypted transmission unit is used to encrypt the gradient of the trained model and upload it to the corresponding edge node.

5. The smart grid load forecasting system based on federated learning according to claim 1, characterized in that, The edge nodes include: The gradient aggregation unit is used to aggregate encrypted gradients uploaded by user terminals within its jurisdiction. The knowledge extraction unit is used to extract abstract knowledge representation vectors of regional electricity consumption patterns from the aggregated local model through a teacher-student network architecture; and the regional feature library is used to store the extracted knowledge representation vectors and related metadata.

6. The smart grid load forecasting system based on federated learning according to claim 1, characterized in that, The cloud server includes: The knowledge fusion unit is used to integrate the knowledge representation vectors of each edge node using a topology-based knowledge graph, and to perform knowledge fusion by constructing a regional association graph and using a graph convolutional network. The global model update unit is used to update the global load prediction model based on the fused global knowledge vector; and the prediction output unit is used to distribute the updated global model to each edge node and provide prediction services.

7. The smart grid load forecasting system based on federated learning according to claim 3, characterized in that, The extreme weather compensation module includes: The weather monitoring unit is used to monitor weather conditions in real time and determine whether extreme weather conditions will occur. The scene matching unit is used to match the most similar historical scene to the current weather conditions in the historical extreme weather database using a similarity metric method based on Mahalanobis distance; and the compensation coefficient calculation unit is used to calculate the load compensation coefficient of the current extreme weather based on the matched historical scene and apply the compensation coefficient to the prediction results of the global model.

8. The smart grid load forecasting system based on federated learning according to claim 1, characterized in that, The system also includes a communication efficiency optimization unit, which uses model pruning and quantization techniques to reduce the amount of model parameter transmission. The model pruning adopts a structured pruning method based on weight magnitude, and the model quantization quantizes 32-bit floating-point parameters into 8-bit integer parameters.

9. The smart grid load forecasting system based on federated learning according to claim 1, characterized in that, The system also includes a privacy protection unit, which uses Paillier homomorphic encryption technology to encrypt the model gradient at the user terminal and adds Gaussian noise to the aggregated gradient at the edge nodes using differential privacy technology, thereby achieving a dual privacy protection mechanism.

10. A smart grid load forecasting method based on federated learning, applied to the system described in any one of claims 1 to 9, characterized in that, Includes the following steps: Each user terminal collects local electricity consumption data, trains a local time-series prediction model, extracts the model gradient, and encrypts and uploads it to the corresponding edge node. Each edge node aggregates the model gradient of its respective user terminal, extracts the abstract knowledge representation vector of regional electricity consumption pattern through knowledge distillation, adds differential privacy noise to the knowledge representation vector and then uploads it to the cloud server. The cloud server constructs a regional association graph, uses a graph convolutional network to fuse the knowledge representation vectors of each edge node to obtain a global knowledge vector, updates the global load prediction model based on the global knowledge vector, and then distributes the global model to each edge node after pruning and quantization. Each edge node uses the received global model to provide load forecasting services to user terminals; When extreme weather is detected, the extreme weather compensation module is activated. A scene matching method based on Mahalanobis distance is used to match similar scenes in the historical database, calculate the compensation coefficient, and apply it to the prediction results to obtain the compensated load prediction value.

Citation Information

Patent Citations

  • Power load prediction method for realizing privacy protection through federal learning

    CN117077186A