Short-term power load prediction system
By combining a Transformer encoder with a BiLSTM layer, a short-term power load forecasting system is developed, which solves the problem of insufficient capture of nonlinear characteristics and long-term dependencies in power load forecasting by traditional models. This system achieves high-precision and robust power load forecasting and enhances the intelligent management capabilities of the power system.
Patent Information
- Application Number
- CN202510878190.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-27
- Publication Date
- 2025-11-21
AI Technical Summary
Traditional short-term power load forecasting models are unable to effectively capture the nonlinear characteristics and long-term dependencies of power load, and are sensitive to data noise. Single deep learning models lack automated hyperparameter tuning mechanisms, resulting in low prediction accuracy and difficulty in adapting to complex application scenarios.
The model is constructed using a cascaded Transformer encoder and BiLSTM layers. It combines multi-dimensional feature fusion and an improved Grey Wolf optimization algorithm, captures long-term dependencies through a self-attention mechanism, performs bidirectional temporal modeling, optimizes hyperparameters using an adaptive step size and non-uniform mutation strategy, and handles noise and missing values with a data reconstruction module.
It achieves high-precision and robust short-term power load forecasting, improves the model's adaptability and prediction accuracy, solves the problem of low efficiency of traditional models in noisy environments, and realizes intelligent management and dispatching of power systems.
Smart Images

Figure CN120999568A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of power systems, in particular to a short-term power load prediction system. BACKGROUND
[0002] In the field of power system dispatching and energy management, short-term power load prediction is a key link to realize optimal dispatching of power grids and intelligent energy management. Traditional prediction models are difficult to effectively capture the nonlinear characteristics and long-term dependence of power load, and are sensitive to data noise, which has obvious shortcomings. Single deep learning model uses one-way time series modeling, resulting in missing future information, and the hyperparameter optimization is heavily dependent on human experience, making it difficult to adapt to complex practical application scenarios.
[0003] In addition, traditional parameter optimization algorithms are prone to fall into local optimal solutions when dealing with complex model structures, and cannot efficiently search for optimal parameter combinations. Power load data itself is dynamically affected by weather, holidays, user electricity consumption behavior and other factors. The prediction accuracy of existing methods is low in a high-noise environment, and the model training efficiency cannot meet the response demand of real-time fluctuations of load. The method and system for predicting distributed photovoltaic bus load based on multi-stage data optimization disclosed in the publication CN119921312A solve the technical problems of single model, poor noise resistance and insufficient dynamic adaptability, but lack an automatic hyperparameter optimization mechanism, which seriously restricts the intelligent management and dispatching of power systems. SUMMARY
[0004] The technical problem to be solved by the present application is to overcome the shortcomings of the prior art and provide a short-term power load prediction system.
[0005] The technical solution adopted by the present application to solve the technical problem is that the short-term power load prediction system comprises:
[0006] A data processing module for normalizing historical load data and performing multi-dimensional feature fusion to divide the data set;
[0007] A model construction module for constructing a model using a cascaded Transformer encoder and a BiLSTM layer;
[0008] An optimization module for model optimization based on an improved grey wolf optimization algorithm;
[0009] A prediction execution module for realizing power load prediction.
[0010] The data processing of the data processing module comprises:
[0011] Data normalization processing for normalizing historical load data;
[0012] Multi-dimensional feature fusion, load data and external influencing factors are fused to form a multi-dimensional input feature set;
[0013] Data reconstruction, noise suppression and missing value processing are performed to realize data reconstruction.
[0014] The external influencing factors include one or more of temperature, humidity, time and economy.
[0015] The data processing module divides the preprocessed data into a training set, a validation set and a test set;
[0016] The training set is used for model parameter learning;
[0017] The validation set is used for hyperparameter tuning of the model;
[0018] The test set is used to evaluate the final performance of the model.
[0019] The model construction module comprises:
[0020] The Transformer encoder adopts a multi-head self-attention mechanism to extract cross-period load dependency features, and the multi-head self-attention mechanism includes 8 parallel computing heads, a position encoding layer and a residual connection structure.
[0021] The BiLSTM unit is used for bidirectional time sequence modeling of the feature sequence output by the Transformer encoder.
[0022] The Transformer encoder comprises:
[0023] The input layer receives the preprocessed data and represents it as an input embedding vector, calculates a position encoding vector, adds the position encoding vector to the input embedding vector to generate an input feature matrix, and gives the model time sequence order sensing ability;
[0024] The multi-head self-attention layer includes 8 parallel computing heads, each head independently processes a feature subspace, the input feature vector is multiplied by a weight matrix, a single-head output is calculated based on attention weight, and the 8-head results are mapped back to the original dimension after splicing.
[0025] The feedforward neural network layer includes two layers of fully connected networks, and a ReLU activation function is used in the middle; the number of layers of the Transformer encoder is 2-6 layers, and the layers are connected through residual connection and layer normalization.
[0026] The BiLSTM unit comprises:
[0027] The bidirectional LSTM layer comprises a forward LSTM and a backward LSTM, the forward LSTM and the backward LSTM process the feature sequence output by the Transformer encoder in parallel, and a dropout rate parameter is introduced between the LSTM layers;
[0028] The output layer maps the BiLSTM output dimension to 1 based on a single-layer full connection network.
[0029] The optimization module optimizes model hyperparameters, including the number of Transformer layers, the learning rate and the dropout rate, by using the improved grey wolf optimization algorithm, and the optimization target is to minimize the mean absolute error of the validation set.
[0030] The improved grey wolf optimization algorithm optimization step comprises:
[0031] Initialization, setting the population size and the number of iterations, randomly generating an initial parameter combination, each combination representing the position of a wolf in the population, corresponding to a set of model hyperparameters;
[0032] Fitness calculation, each set of parameters is substituted into the model for training, and the fitness of each wolf is calculated according to the mean absolute error on the validation set; the smaller the mean absolute error, the higher the fitness, indicating that the prediction effect of the model under this set of parameters is better.
[0033] Position update, simulate the hierarchical structure of the population, adjust the search direction according to the adaptive step size, and at the same time, perform mutation operation on part of the individuals through the non-uniform mutation strategy, increase the diversity of the population, and avoid the algorithm falling into local optimum;
[0034] Iterative optimization, repeat the fitness calculation and position update steps until the maximum number of iterations is reached or the convergence condition is met, and finally output the optimal hyperparameter combination for model training and prediction.
[0035] The prediction execution module adopts a sliding window mechanism for dynamic prediction, realizing hourly prediction.
[0036] Compared with the prior art, the present application has the following beneficial effects:
[0037] The present application provides a short-term power load prediction system with high precision and high robustness, which optimizes the model parameters and structure, and solves the problems of noise sensitivity, insufficient long-term dependence modeling and low parameter tuning efficiency in the prior art.
[0038] The present application combines the self-attention mechanism of Transformer with the bidirectional time series modeling of BiLSTM to capture long-term dependence and bidirectional dynamic features respectively. Meanwhile, an improved grey wolf optimization algorithm is designed, adaptive step size and non-uniform mutation strategy are introduced, and the search efficiency of hyperparameters is improved.
[0039] The noise is inhibited through a gating attention mechanism, and the missing values are processed in combination with a data reconstruction module, thereby enhancing data robustness.
[0040] The transformer encoder utilizes a multi-head self-attention mechanism to capture long-term dependencies of power load data, retains time sequence information through position encoding, solves the problem of insufficient modeling capability of traditional models for long sequences, realizes long-distance dependency modeling and multi-dimensional feature decoupling of power load data, and provides more abundant input features for subsequent time sequence analysis of BiLSTM, thereby improving system prediction accuracy.
[0041] The application adopts bidirectional time sequence modeling, simultaneously utilizes historical data and future context information (achieved through a sliding window mechanism), and makes up for the defect of "missing future information" of unidirectional LSTM.
[0042] The application introduces an adaptive step and a non-uniform variation strategy, avoids the problem that the traditional grey wolf algorithm is prone to local optimum, and improves the search efficiency of hyperparameters. BRIEF DESCRIPTION OF DRAWINGS
[0043] Figure 1 The figure is a system framework diagram of the application;
[0044] Figure 2 The figure is a model construction structure schematic diagram of the application;
[0045] Figure 3 The figure is a real load curve and prediction curve fitting effect diagram of the application. DETAILED DESCRIPTION
[0046] The technical solutions in the embodiments of the application will be described clearly and completely below with reference to the drawings in the embodiments of the application. Obviously, the described embodiments are only part of the embodiments of the application, rather than all the embodiments of the application. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative labor fall within the protection scope of the application.
[0047] It should be noted that all directionality indications (such as up, down, left, right, front, back, etc.) in the embodiments of the application are only used to explain the relative position relationship, movement condition, etc. between components in a certain specific posture (as shown in the drawings), and if the specific posture changes, the directionality indications also change accordingly.
[0048] In the present application, unless otherwise explicitly specified and limited, the terms "connection", "fixation" and the like should be understood in a broad sense, for example, "fixation" can be fixed connection, or detachable connection, or integral; can be mechanical connection, or electrical connection; can be direct connection, or indirect connection through intermediate medium, can be internal connection of two elements or interaction relationship between two elements, unless otherwise explicitly limited. For those skilled in the art, the specific meaning of the above terms in the present application can be understood according to the specific circumstances.
[0049] With reference to Figures 1-3 The short-term power load forecasting system comprises a data processing module, a model construction module, an optimization module and a prediction execution module.
[0050] The data processing module is used for data processing, and the data processing of the data processing module comprises data normalization processing, multi-dimensional feature fusion and data reconstruction.
[0051] The data normalization processing is mainly normalization processing of historical load data, which eliminates the dimensional difference of different variables and ensures the stability of model training; in this way, the neural network is more easily converged, and the training deviation caused by the difference in the range of feature values is avoided.
[0052] The multi-dimensional feature fusion is to fuse the load data and external influencing factors to form a multi-dimensional input feature set, so as to improve the adaptability of the model to complex scenarios. The external influencing factors include temperature, humidity, time, economy and the like.
[0053] The temperature and humidity mainly reflect the influence of weather on the load, such as the increase of air conditioner load in high temperature weather and the like.
[0054] The time includes date types, such as holidays or weekdays, days of the week, time periods and the like, mainly capturing periodic load patterns.
[0055] The economic characteristics such as electricity price can also be fused, which reflects the adjustment effect of price signal on user electricity behavior, such as load transfer under time-of-use electricity price and the like.
[0056] The historical load data can be the electricity consumption in unit time, such as hourly electricity consumption and the like.
[0057] The above features and load data are aligned according to time steps to form a two-dimensional matrix containing load values and multi-dimensional features, such as each row corresponding to one hour, containing electricity consumption, temperature, whether it is a holiday and the like.
[0058] The application realizes data reconstruction by carrying out noise suppression and missing value processing. The embodiment introduces a gating structure in the model, which can be a self-attention mechanism of a Transformer or an independent gating layer, to suppress data interference in high-noise periods by dynamically allocating weights. Specifically, by allocating a lower attention weight to noise points, the influence of the noise points on the prediction result is reduced.
[0059] The application uses interpolation algorithms or deep learning models to process missing data, such as linear interpolation, time series interpolation, or autoencoders, to infer missing values based on adjacent time steps or feature correlations.
[0060] The data processing module divides the preprocessed data into three data sets: a training set, a validation set, and a test set. The training set is used for model parameter learning, the validation set is used for hyperparameter tuning of the model, and the test set is used to evaluate the final performance of the model.
[0061] Referring to Figure 2 The model construction module of the embodiment uses a cascaded Transformer encoder and BiLSTM layer to construct the model. Further, the model construction module includes a Transformer encoder and a BiLSTM unit.
[0062] The Transformer encoder uses a multi-head self-attention mechanism to extract cross-period load dependency features, which includes 8 parallel calculation heads, a position encoding layer, and a residual connection structure. The Transformer encoder is responsible for capturing the long-term dependency relationships and cross-period correlations of power load data.
[0063] The Transformer encoder includes an input layer, a multi-head self-attention layer, and a feedforward neural network layer.
[0064] The input layer receives preprocessed data and represents it as an input embedding vector. The position encoding vector is calculated and added to the input embedding vector to generate an input feature matrix, giving the model the ability to perceive the timing sequence. Specifically, the preprocessed multi-dimensional feature sequence is the embedding vector, which includes load values + external features, with a dimension of sequence length x feature dimension, such as 24 hours x N-dimensional features.
[0065] A position vector is generated for each time step using a sine or cosine function, with the formula:
[0066]
[0067] where PE is the position encoding, pos is the time step position, for example, the first hour, pos = 1, the 24th hour, pos = 24. i is the feature dimension index, usually starting from 0, d modelis the model feature dimension, which is consistent with the input feature dimension.
[0068] The even dimensions 2i use a sine function, and the odd dimensions 2i+1 use a cosine function, to ensure that the encoding vectors of different positions are unique. The frequency of the position encoding decreases exponentially with the increase of the dimension, and the even dimensions 2i use a sine function in the denominator, and the odd dimensions 2i+1 use a cosine function, to ensure that the encoding vectors of different positions are unique.
[0069] The present application does not need training and can directly calculate the position encoding of any length sequence, which is suitable for dynamic input under the sliding window mechanism. The frequency of the position encoding decreases exponentially with the increase of the dimension, so that the model can learn the dependence relationship of different time scales, such as short-term fluctuations and long-term cycles.
[0070] By adding the position encoding vector to the input embedding vector, the model is given the time sequence perception ability.
[0071] The multi-head self-attention layer includes 8 parallel computing heads, each of which independently processes a feature subspace. The input feature vector is multiplied by a weight matrix, and a single-head output is calculated based on the attention weight. The 8-head results are spliced and mapped back to the original dimension through a linear layer; specifically, the input feature matrix X is multiplied by 3 groups of weight matrices W Q , W K , and W V to obtain 3 groups of vectors, which are represented as:
[0072] Q=X·W Q ;
[0073] K=X·W K ;
[0074] V=X·W V ;
[0075] Among them, Q is Query, which represents the query vector, used to calculate the attention of the current element to other elements. K is Key, which represents the key vector as the queried "index", representing the features of other elements. V is Value, which represents the value vector, representing the actual feature value of the queried element, such as load data, temperature, etc.
[0076] The similarity between Q and all K is calculated by dot product, and the attention weight is obtained by Softmax normalization, and the weight matrix Attention is as follows:
[0077]
[0078] Among them, d k is the K vector dimension.
[0079] The weight matrix is multiplied with the V matrix to obtain a single-head output, and the 8-head results are spliced and mapped back to the original dimension through a linear layer.
[0080] The input layer is connected in residual connection with the multi-head self-attention layer to avoid gradient disappearance of the deep network; after layer normalization, the input is input to the feedforward neural network layer.
[0081] The feedforward neural network layer includes two fully connected networks, and ReLU activation function is used in the middle; it is used for nonlinear transformation of the features extracted by the self-attention layer, and enhances the model expression ability.
[0082] The number of layers of the Transformer encoder is 2-6 layers, each layer contains a "multi-head self-attention + feedforward neural network" structure, and the layers are connected through residual connection and layer normalization connection.
[0083] The BiLSTM unit is used for bidirectional time sequence modeling of the feature sequence output by the Transformer encoder, which makes up for the "future information missing" defect of the unidirectional LSTM.
[0084] The BiLSTM unit includes a bidirectional LSTM layer and an output layer.
[0085] The bidirectional LSTM layer includes a forward LSTM and a backward LSTM, which process the feature sequence output by the Transformer encoder in parallel, and the hidden layer dimension is 256, and the output is the splicing of the forward and backward hidden states. A dropout rate parameter is introduced between the LSTM layers to randomly drop some neuron connections to alleviate overfitting. The dropout rate parameter ranges from 0.1 to 0.5 and is optimized by the improved grey wolf optimization algorithm. The hidden layer dimension is set to 256, and the double-channel processing of the Transformer output enhances the ability to capture short-term dynamic features.
[0086] The output layer is based on a single-layer fully connected network, which maps the BiLSTM output dimension to 1.
[0087] The optimization module is used to optimize the model based on the improved grey wolf optimization algorithm. Specifically, the optimization module uses the improved grey wolf optimization algorithm to optimize the model hyperparameters, including the number of Transformer layers, which ranges from 2 to 6; the learning rate, which ranges from 10 -5 to 10 -3 ; the dropout rate, which ranges from 0.1 to 0.5; and the optimization goal is to minimize the average absolute error of the validation set.
[0088] The optimization steps of the improved grey wolf optimization algorithm include initialization, fitness calculation, position update, and iterative optimization.
[0089] Initialization, set the population size and the number of iterations, randomly generate initial parameter combinations, each combination represents the position of a wolf in the population, corresponding to a set of hyperparameters of the model. For example, the population size is 50 gray wolves, and the number of iterations is 100 times, then each combination represents one of the 50 gray wolves.
[0090] Fitness calculation, each set of parameters is substituted into the model for training, and the average absolute error on the validation set is calculated to calculate the fitness of each wolf; the smaller the average absolute error, the higher the fitness, indicating that the prediction effect of the model under this set of parameters is better. The calculation formula of Fitness is as follows:
[0091]
[0092] Where, MAE val is the average absolute error of the validation set.
[0093] Position update, simulate the hierarchical structure of the population, and adjust the search direction according to the adaptive step size. In the gray wolf algorithm, the hierarchical structure includes alpha wolf, which is the leader wolf, representing the optimal solution in the population; beta wolf, assisting alpha wolf, representing the suboptimal solution; delta wolf, subordinate to alpha wolf and beta wolf, representing the third optimal solution; omega wolf, representing the remaining candidate solution. In the search process, the position information of alpha, beta and delta wolves can be used to guide the population to approach the optimal solution. At the same time, through the non-uniform mutation strategy, part of the individuals are mutated to increase the diversity of the population and avoid the algorithm falling into local optimum.
[0094] The adaptive step size calculation formula is as follows:
[0095]
[0096] In the formula, b0 is the initial step size, b a is the step size of the a-th iteration, A is the maximum number of iterations, a is the current iteration number, is the scaling parameter, usually taking the value of 2, Fitness i is the fitness of the i-th wolf, Fitness avg is the population average fitness, which reflects the overall level of the current parameter search, Fitness max is the maximum fitness of the population, which corresponds to the current optimal parameter combination, Fitness min is the minimum fitness of the population, which is used for normalization.
[0097] For the non-uniform mutation strategy, the mutation amplitude function expression formula is as follows:
[0098]
[0099] In the formula, u represents the maximum possible variation range of the optimized hyperparameter, for example, if the optimized hyperparameter is the number of Transformer layers, u takes a value in the range of 2-6. q is a shape parameter, usually taking a value of 2, which controls the decay rate of the variation amplitude.
[0100] iteratively optimize, repeat the fitness calculation and position update steps until the maximum number of iterations is reached or the convergence condition is met, Figure 1 Miter in the formula represents the maximum number of iterations or the convergence condition is met, and finally outputs the optimal hyperparameter combination for model training and prediction. Iter is the number of iterations, which is a variable, and Iter = Iter + 1 means that the current value of the variable Iter is added by 1 and then re-assigned to Iter itself.
[0101] The prediction execution module is used to realize power load prediction. The prediction execution module adopts a sliding window mechanism for dynamic prediction. Further, a sliding window mechanism with a fixed window length of 24 hours and a step length of 1 hour is adopted to cut the data into overlapping sequence segments. Each sample is a multi-dimensional feature sequence of the past 24 hours, and the corresponding label is the load value of the future 1 hour. Hourly prediction is realized through a rolling window.
[0102] Referring to Figure 3 The embodiment is a fitting effect diagram of a certain real load curve and a predicted curve predicted based on the system of the present application. The y-axis represents the power load in kilowatts, and the x-axis represents the time in hours. It can be seen that the two curves are highly coincident, and the prediction accuracy is high.
[0103] The above description is only an optional embodiment of the present application, and does not limit the patent scope of the present application. Any equivalent structural transformation made according to the content of the present application, or direct / indirect application in other related technical fields is included in the patent protection scope of the present application.
Claims
1. A short-term electric power load forecasting system, characterized by, The application relates to a power load forecasting method based on a Transformer-BiLSTM model. The application comprises: a data processing module for normalizing historical load data and performing multi-dimensional feature fusion to divide data sets; a model construction module for constructing a model by using a cascaded Transformer encoder and a BiLSTM layer; an optimization module for optimizing the model based on an improved grey wolf optimization algorithm; 2. The short-term power load forecasting system of claim 1, wherein, and a prediction execution module for realizing power load forecasting. The data processing of the data processing module comprises: data normalization processing for normalizing historical load data; multi-dimensional feature fusion for fusing load data and external influencing factors to form a multi-dimensional input feature set; 3. The short-term electric power load forecasting system of claim 2, wherein, and data reconstruction for noise suppression and missing value processing to realize data reconstruction.
4. The short-term electric power load forecasting system according to claim 1 or 2, characterized by, The external influencing factors include one or more of temperature, humidity, time and economy. The data processing module divides the preprocessed data into a training set, a validation set and a test set; the training set is used for model parameter learning; the validation set is used for hyperparameter tuning of the model; 5. The short-term electric power load forecasting system of claim 4, wherein, and the test set is used for evaluating the final performance of the model. The model construction module comprises: a Transformer encoder for extracting cross-period load dependency features by using a multi-head self-attention mechanism, wherein the multi-head self-attention mechanism comprises eight parallel calculation heads, a position encoding layer and a residual connection structure; 6. The short-term electric power load forecasting system of claim 5, wherein, and a BiLSTM unit for bidirectional time sequence modeling of the feature sequence output by the Transformer encoder. The Transformer encoder comprises: an input layer for receiving preprocessed data and representing the data as an input embedding vector, calculating a position encoding vector, adding the position encoding vector to the input embedding vector to generate an input feature matrix and giving the model time sequence order sensing ability; a multi-head self-attention layer comprising eight parallel calculation heads, each head independently processing a feature subspace, the input feature vector being multiplied by a weight matrix, a single-head output being calculated based on attention weight, and the eight-head results being mapped back to the original dimension after splicing; 7. The short-term electric power load forecasting system of claim 6, wherein, and a feedforward neural network layer comprising two fully connected networks and using a ReLU activation function in the middle; the number of layers of the Transformer encoder is 2-6 layers, and the layers are connected through residual connection and layer normalization. The BiLSTM unit comprises: a bidirectional LSTM layer comprising a forward LSTM and a backward LSTM, the forward LSTM and the backward LSTM processing the feature sequence output by the Transformer encoder in parallel, and a dropout rate parameter being introduced between the LSTM layers; 8. The short-term electric power load forecasting system of claim 7, wherein, and an output layer for mapping the BiLSTM output dimension to 1 based on a single-layer fully connected network.
9. The short-term electric power load forecasting system of claim 8, wherein, The optimization module optimizes the model hyperparameters by using an improved grey wolf optimization algorithm, the hyperparameters include the number of Transformer layers, the learning rate and the dropout rate, and the optimization target is to minimize the average absolute error of the validation set. The optimization steps of the improved grey wolf optimization algorithm comprise: initialization for setting the population size and the number of iterations, randomly generating an initial parameter combination, each combination representing the position of a wolf in the population and corresponding to a group of model hyperparameters; fitness calculation for substituting each group of parameters into the model for training, and calculating the fitness of each wolf according to the average absolute error on the validation set; and outputting the optimal parameter combination corresponding to the wolf with the highest fitness. Position update, analog population hierarchy, search direction adjustment according to adaptive step size, and mutation operation on part of individuals through non-uniform mutation strategy; Iterative optimization, repeated fitness calculation and position update steps until the maximum number of iterations is reached or the convergence condition is met, and finally output the optimal hyperparameter combination for model training and prediction.
10. The short-term power load forecasting system of claim 1, wherein, The prediction execution module adopts a sliding window mechanism for dynamic prediction, achieving hourly prediction.
Citation Information
Patent Citations
Distributed photovoltaic bus load prediction method and system based on multi-stage data optimization
CN119921312A