Comprehensive energy system load prediction method based on Transform model
Through the comprehensive energy system load forecasting method based on the Transformer model, combined with variational mode decomposition and improved model structure, the problem of the deep learning method's insufficient ability to extract inter-load correlation features in the integrated energy system is solved, and the load forecasting is significantly improved. accuracy and robustness.
Patent Information
- Application Number
- CN202410757479.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-13
- Publication Date
- 2024-09-03
AI Technical Summary
Existing deep learning methods are insufficient in extracting correlation features between multiple loads in integrated energy systems, resulting in poor prediction results.
An integrated energy system load forecasting method based on the Transformer model is used to process load data through variational modal decomposition, and the encoder and decoder structures of the Transformer model are improved, including a position encoding layer, a convolutional multi-head attention layer and a point-wise convolutional neural network. network, extracts the correlation features of the input data and performs load forecasting.
It improves the accuracy and robustness of load forecasting, reduces the difficulty of prediction, enhances the nonlinear processing capability of the model, and effectively improves the accuracy of load forecasting of the integrated energy system.
Smart Images

Figure CN118589488A
Abstract
Description
Technical Field
[0001] The present invention relates to artificial intelligence technology, and in particular to a comprehensive energy system load forecasting method based on a Transformer model. Background Art
[0002] Integrated energy systems can diversify energy supply, effectively improve the comprehensive utilization efficiency of various energy sources, and play a positive role in environmental protection. Therefore, countries around the world have successively invested in the research and engineering application of integrated energy systems. Load forecasting is the premise and basis for ensuring the reliable and economical operation of energy systems. There is a certain coupling relationship between the multiple loads in the integrated energy system, and the load changes are relatively frequent, which puts forward higher requirements for the forecasting of multiple loads in the integrated energy system.
[0003] At present, the commonly used integrated energy system load forecasting methods are mainly divided into three categories: statistical analysis method, machine learning method and deep learning method. Statistical analysis method uses statistical principles to determine the relationship between independent variables and dependent variables and establishes a regression equation with high correlation. The main advantages of this type of method are simplicity, speed and intuitiveness, but poor adaptability and nonlinear fitting ability. Machine learning methods are suitable for dealing with dynamic systems with uncertainty and nonlinear characteristics. They do not need to set parameters in advance, are portable, can provide high-precision predictions, and usually have good error distribution. They can effectively model nonlinear load data and capture more complex correlations. However, commonly used machine learning methods, such as support vector regression and Bayesian networks, have limited scalability for large data sets. With the development of deep learning, researchers have gradually applied deep learning to load forecasting. Deep learning methods can effectively extract features from load data, and have strong learning ability and good adaptability, which are suitable for complex integrated energy system load forecasting tasks. However, the existing deep learning methods are insufficient in extracting correlation features between multiple loads in integrated energy systems, and the original load fluctuations are highly random, resulting in poor prediction results. Summary of the invention
[0004] The technical problem to be solved by the present invention is to provide a comprehensive energy system load forecasting method based on the Transformer model in view of the defects in the prior art.
[0005] The technical solution adopted by the present invention to solve the technical problem is: a comprehensive energy system load forecasting method based on a Transformer model, comprising the following steps:
[0006] 1) Obtaining the original integrated energy system load data; the integrated energy system load data includes electric load, cooling load and heating load data;
[0007] 2) Process the outliers and missing values of the original integrated energy system load data;
[0008] 3) Decomposing the load data sequence processed in step 2) into multiple intrinsic mode functions (IMFs) using variational mode decomposition;
[0009] 4) Perform normalization operation on the decomposed load data;
[0010] 5) Use the Transformer model to establish a comprehensive energy system load forecasting model; the model includes a position encoding layer, an encoder, a decoder, and a fully connected layer for encoding the input data bit by bit;
[0011] The load forecasting model of the integrated energy system is based on the load decomposition data X of n historical moments before time t. n As input to predict the load component output at time t After the prediction is completed, all load components are added together to obtain the load prediction value;
[0012] 6) Denormalize the model output as the load forecast value;
[0013] 7) Use prediction models to forecast the load of integrated energy systems.
[0014] According to the above scheme, in step 2), the abnormal value and missing value data are processed to correct the abnormal values in the original load data and fill the missing values in the original load data.
[0015] According to the above scheme, in step 3), the load data sequence processed in step 2) is decomposed into multiple intrinsic mode functions (IMFs) using variational mode decomposition, as follows:
[0016] 3.1) The modal function u of the load data series f(t) k (t) performing Hilbert transform;
[0017]
[0018] Where δ(t) is the Dirac distribution, * represents the convolution operation;
[0019] 3.2) The modal function u k The spectrum of (t) is modulated to the baseband;
[0020]
[0021] In the formula, ω k for u k The center frequency of (t);
[0022] 3.3) Obtain the bandwidth of each mode, and obtain the optimization function and constraints through bandwidth estimation;
[0023]
[0024] In the formula, the set {u k}={u1,...,u K}, set {ω k}={ω1,...,ω K}, K is the number of intrinsic mode functions;
[0025] 3.4) Solve the optimization function and obtain the decomposition result.
[0026] According to the above scheme, in step 5), the position coding layer is used to encode the input data bit by bit in the following manner:
[0027]
[0028] Among them, pos is the position of the current input data, i is a natural number, d is the dimension of a single input sample, d=3.
[0029] According to the above scheme, in step 5), each encoder includes 4 encoding layers, and each decoder includes 4 decoding layers;
[0030] The structures of the encoding layer and decoding layer are as follows: Each encoding layer and decoding layer includes a convolutional multi-head attention layer, a point-by-point convolutional neural network, residual connections, and layer normalization;
[0031] The convolutional multi-head attention layer is used to extract the correlation features of the input data. The point-by-point convolutional neural network is used to further extract features while maintaining the spatial structure of the input data. The residual connection and layer normalization are used to prevent the model from degrading during training while increasing the training speed.
[0032] According to the above scheme, in step 5), the convolutional multi-head attention layer in the encoding layer and the decoding layer is composed of 8 sub-attention layers, and the specific steps of extracting the correlation features of the input data include:
[0033] 5.1) Divide the input data into three vectors: Q, K and V, where Q is the query vector, K is the key vector, and V is the numerical vector. The dimension of each vector is L×N×E, where L is the input sequence length, N is the batch size, and E is the embedding dimension. The calculation method is as follows:
[0034]
[0035] Among them, W q , W k , W v is the linear transformation matrix, X inis the input;
[0036] 5.2) Perform a one-dimensional convolution operation on Q and K along the L dimension. The calculation method is as follows:
[0037] Q'=1Dconv(Q(L))
[0038] K'=1Dconv(K(L))
[0039] Among them, Q', K' are Q and K after convolution, and 1Dconv is a one-dimensional convolution operation;
[0040] 5.3) Input Q', K', and V into the sub-attention layer to calculate the attention score:
[0041]
[0042] Among them, d k is the embedding dimension of K;
[0043] 5.4) Connect the outputs of all sub-attention layers:
[0044]
[0045] in,
[0046] According to the above scheme, in step 5), the point-by-point convolutional neural network in the encoding layer extracts input features, as follows:
[0047]
[0048] Among them, Ω i (k) is the kth subdomain of the convolution kernel centered at point i, p j is the coordinate of point j, w k is the weight of the kth subdomain, and l is the index of the input and output.
[0049] The beneficial effects produced by the present invention are:
[0050] 1) The present invention decomposes the original load sequence into multiple intrinsic mode functions through variational mode decomposition, thereby reducing the difficulty of load prediction;
[0051] 2) The present invention improves the robustness and nonlinear processing capability of the Transformer model by improving the model. The improved Transformer model in the present invention enhances the ability to extract correlation features of input data through a decoder, thereby further improving the accuracy of load forecasting of the integrated energy system. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] The present invention will be further described below with reference to the accompanying drawings and embodiments, in which:
[0053] Figure 1 is a method flow chart of an embodiment of the present invention;
[0054] Figure 2 is a historical load data sampling diagram of an embodiment of the present invention;
[0055] Figure 3 is a model structure diagram of an embodiment of the present invention;
[0056] Figure 4 is a model training flow chart of an embodiment of the present invention;
[0057] Figure 5 It is a schematic diagram comparing the load prediction value and the load actual value according to an embodiment of the present invention. DETAILED DESCRIPTION
[0058] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0059] like Figure 1 As shown, a load forecasting method for an integrated energy system based on a Transformer model includes the following steps:
[0060] 1) Obtaining the original integrated energy system load data; the integrated energy system load data includes electric load, cooling load and heating load data;
[0061] In this embodiment, the historical load data of a campus integrated energy system from June 2022 to August 2022 is used as an example for description. The sampling interval is 1 hour. The original load data is as follows: Figure 2 As shown;
[0062] 2) Process the outliers and missing values of the original integrated energy system load data;
[0063] The outlier and missing value data processing is to correct the outliers in the original load data and fill the missing values in the original load data.
[0064] The load value change rate of two points close to the load point is used as the standard for judging abnormal points, and is processed by the average value correction method, as shown in equations (1) to (3):
[0065] like
[0066]
[0067]
[0068]
[0069] In formula (1) to formula (3), x i is the load value at the i-th moment, is the set threshold, φ is the set threshold coefficient, φ = 5%; n is the number of load samples, n = 6576; when the absolute difference between the load value at the i-th moment and the load values at the two moments before and after exceeds the threshold, the load value at the i-th moment is determined to be an abnormal value; in formula (3), the average of the load values at the two moments before and after is used to correct or fill in the abnormal or missing value of the load at the i-th moment.
[0070] 3) Decomposing the load data sequence processed in step 2) into multiple intrinsic mode functions (IMFs) using variational mode decomposition;
[0071] 3.1) The modal function u of the load data series f(t) k (t) performing Hilbert transform;
[0072]
[0073] Where δ(t) is the Dirac distribution, * represents the convolution operation;
[0074] 3.2) The modal function u k The spectrum of (t) is modulated to the baseband;
[0075]
[0076] In the formula, ω k for u k The center frequency of (t);
[0077] 3.3) Obtain the bandwidth of each mode, and obtain the optimization function and constraints through bandwidth estimation;
[0078]
[0079] In the formula, the set {u k}={u1,...,u K}, set {ω k}={ω1,...,ω K}, K is the number of intrinsic mode functions, K = 5;
[0080] 3.4) Solve the optimization function and obtain the decomposition result;
[0081] 3.4.1) Introduce the quadratic equilibrium parameter α and the Lagrange multiplier λ, α = 2000, and transform the constrained variational problem into the following unconstrained variational problem:
[0082]
[0083] 3.4.2) Solve equation (7) by the alternating direction multiplication method, u k and ω k Update in 2 directions:
[0084]
[0085]
[0086] Where n is the number of iterations, They are Fourier transform of f(t), λ(t).
[0087] 3.4.3) The iteration continues until the following convergence conditions are met:
[0088]
[0089] Where γ is the convergence error, γ = 10 -6 .
[0090] 4) Perform normalization operation on the decomposed load data;
[0091] The decomposed load data is normalized, as shown in formula (11):
[0092]
[0093] In formula (11), x' is the normalized value, x is the original value, and x max 、x min are the maximum and minimum values of the data set.
[0094] 5) Use the Transformer model to establish a comprehensive energy system load forecasting model;
[0095] The load decomposition data X at n historical moments before time t n As input to predict the load component output at time t After the prediction is completed, all load components are added together to obtain the load prediction value;
[0096] As shown in formula (12)-formula (13):
[0097] X n ={x t-n ,x t-n+1 ,...,x t-1} (12)
[0098]
[0099] In formula (13), model represents the prediction model. The data set is divided into training set, validation set, and test set according to the ratio of 3:1:1. The model predicts the load value of the next hour based on the load data of the previous 6 hours. The model is trained for 100 rounds, the batch size is set to 24, and the learning rate is set to 0.001. The model structure is as follows Figure 3 The model training and testing process is as follows Figure 4 shown.
[0100] The model consists of a positional encoding layer, an encoder, a decoder, and a fully connected layer for bit-wise encoding of the input data;
[0101] Among them, the position encoding layer is used to encode the input data bit by bit in the following way:
[0102]
[0103] Where pos is the current input position, i is a natural number, d is the dimension of a single input sample, d = 3;
[0104] Each encoder contains 4 encoding layers, and each decoder contains 4 decoding layers;
[0105] The structure of the encoding layer and decoding layer is as follows: Each encoding layer and decoding layer includes a convolutional multi-head attention layer, a point-by-point convolutional neural network, residual connections and layer normalization. The convolutional multi-head attention layer is responsible for extracting the correlation features of the input data. The point-by-point convolutional neural network further extracts features while maintaining the spatiality of the input data structure. The residual connections and layer normalization are used to prevent the model from degrading during training and improve the training speed.
[0106] The convolutional multi-head attention layer in the encoding layer and the decoding layer consists of 8 sub-attention layers. The specific steps of extracting the correlation features of the input data include:
[0107] 1) Divide the input data into three vectors: Q, K and V, where Q is the query vector, K is the key vector, and V is the numerical vector; the dimension of each vector is L×N×E, where L is the input sequence length, L=6, N is the batch size, N=24, and E is the embedding dimension, E=64. The calculation method is shown in formula (15):
[0108]
[0109] In formula (15), W q , W k , W v is the linear transformation matrix, X in For input;
[0110] 2) Perform a one-dimensional convolution operation on Q and K along the L dimension. The calculation method is shown in equations (16) and (17):
[0111] Q'=1Dconv(Q(L))(16)
[0112] K'=1Dconv(K(L))(17)
[0113] Where Q', K' are Q and K after convolution, and 1Dconv is a one-dimensional convolution operation.
[0114] 3) Input Q', K', and V into the sub-attention layer to calculate the attention score, as shown in formula (18):
[0115]
[0116] In formula (18), d k is the embedding dimension of K, d k =64.
[0117] 4) Connect the outputs of all sub-attention layers. The calculation method is shown in formula (19):
[0118]
[0119] In formula (19),
[0120] The calculation method of extracting input features by point-by-point convolutional neural network in the encoding layer is shown in formula (20):
[0121]
[0122] In formula (20), Ω i (k) is the kth subdomain of the convolution kernel centered at point i, p j is the coordinate of point j, w k is the weight of the kth subdomain, and l is the index of the input and output.
[0123] The calculation method of residual connection and layer normalization in the encoding layer and decoding layer is shown in equations (21) to (22):
[0124] Res=ReLU(F(x)+x) (21)
[0125]
[0126] In equations (21) and (22), Res is the output after residual connection, ReLU is the activation function, F(x) is the residual, x is the input, x' is the value after layer normalization, and x max 、x min are the maximum and minimum values in the layer.
[0127] The fully connected layer in the improved Transformer model is responsible for transforming the output of the decoder and outputting the load prediction value, as shown in formula (23):
[0128]
[0129] In formula (23), W is the weight matrix, x is the decoder output, and b is the bias.
[0130] The improved Transformer model is trained using the back propagation algorithm. The training steps are as follows:
[0131] 1) Calculate all parameters s t Partial derivative δ based on the loss function L:
[0132]
[0133] 2) Calculate the last moment τ
[0134]
[0135] In formula (25), V is the weight matrix, x τ are the predicted value and actual value at time τ.
[0136] 3) By Derivation
[0137]
[0138] 4) Adjust the gradient during error back propagation using the Adam optimization algorithm:
[0139]
[0140]
[0141]
[0142]
[0143] In equations (27) to (30), p = 0.9, q = 0.999; W t is the weight matrix; c t is the first-order moment estimate of the gradient, d t is the second-order moment estimate of the gradient; α is the initial learning rate, α = 0.005; η t is the descent gradient at the current moment.
[0144] After the model training is completed, the validation set is used to screen out the best prediction model, and the test set is input into the best model for testing.
[0145] 6) Denormalize the model output as the load forecast value;
[0146] x"=x'(x max -x min )+x min (31)
[0147] In formula (31), x' is the value after denormalization, x' is the value before denormalization, and x max 、x min is the maximum and minimum value of the data set. The comparison between the load forecast value and the actual load value after denormalization is as follows: Figure 5 shown.
[0148] The mean absolute percentage error (MAPE) is selected as the model evaluation indicator, and the calculation method is shown in formula (32):
[0149]
[0150] In formula (32), n is the number of load data samples, x i is the actual load value of the ith sample, is the predicted load value of the ith sample. The calculation results are shown in Table 1.
[0151] Table 1 Model prediction error results
[0152] Load Type MAPE% Electrical load 2.635 Cooling Load 1.877 Heat load 3.204
[0153] 7) Use prediction models to forecast the load of integrated energy systems.
[0154] Compared with the existing models, the model established by the present invention has a more perfect data processing. On the basis of known original load data and influencing factors, the present invention adopts the mean value correction method to process outliers and missing values to eliminate the influence on load data to the maximum extent; the original load sequence is decomposed into multiple intrinsic mode functions by using variational mode decomposition, each mode function has lower randomness and retains most of the characteristic information of the original load data; and the decomposed load data and the quantified influencing factors are normalized; the convolutional multi-head attention layer is used to enhance the correlation feature extraction capability of the input data, and the point-by-point convolutional neural network is used to further extract the input features, which can effectively improve the accuracy of load prediction of the integrated energy system.
[0155] It should be understood that those skilled in the art can make improvements or changes based on the above description, and all these improvements and changes should fall within the scope of protection of the appended claims of the present invention.
Claims
1. A comprehensive energy system load forecasting method based on Transformer model, characterized in that: The following steps are involved: 1) Obtaining the original integrated energy system load data; the integrated energy system load data includes electric load, cooling load and heating load data; 2) Process the outliers and missing values of the original integrated energy system load data; 3) Decomposing the load data sequence processed in step 2) into multiple intrinsic mode functions (IMFs) using variational mode decomposition; 4) Perform normalization operation on the decomposed load data; 5) Use the Transformer model to establish a comprehensive energy system load forecasting model; the model includes a position encoding layer, an encoder, a decoder, and a fully connected layer for encoding the input data bit by bit; The load forecasting model of the integrated energy system is based on the load decomposition data X of n historical moments before time t. n As input to predict the load component output at time t After the prediction is completed, all load components are added together to obtain the load prediction value; 6) Denormalize the model output as the final load forecast value; 7) Use prediction models to forecast the load of integrated energy systems.
2. The integrated energy system load forecasting method based on the Transformer model according to claim 1 is characterized in that: In the step 2), the outlier and missing value data are processed to correct the outliers in the original load data and fill the missing values in the original load data.
3. The integrated energy system load forecasting method based on Transformer model according to claim 1 is characterized in that: In step 3), the load data sequence processed in step 2) is decomposed into multiple intrinsic mode functions using variational mode decomposition, as follows: 3.1) The modal function u of the load data series f(t) k (t) performing Hilbert transform; Where δ(t) is the Dirac distribution, * represents the convolution operation; 3.2) The modal function u k The spectrum of (t) is modulated to the baseband; In the formula, ω k for u k The center frequency of (t); 3.3) Obtain the bandwidth of each mode, and obtain the optimization function and constraints through bandwidth estimation; In the formula, the set {u k }={u1,...,u K }, set {ω k }={ω1,...,ω K }, K is the number of eigenmode functions; 3.4) Solve the optimization function and obtain the decomposition result.
4. The integrated energy system load forecasting method based on the Transformer model according to claim 1 is characterized in that: In step 5), the position encoding layer is used to encode the input data bit by bit in the following manner: Among them, pos is the position of the current input data, i is a natural number, d is the dimension of a single input sample, d=3.
5. The integrated energy system load forecasting method based on Transformer model according to claim 1 is characterized in that: In step 5), each encoder includes 4 encoding layers, and each decoder includes 4 decoding layers; The structures of the encoding layer and decoding layer are as follows: Each encoding layer and decoding layer includes a convolutional multi-head attention layer, a point-by-point convolutional neural network, residual connections, and layer normalization; The convolutional multi-head attention layer is used to extract the correlation features of the input data; the point-by-point convolutional neural network is used to further extract features while maintaining the spatial structure of the input data; the residual connection and layer normalization are used to prevent the model from degrading during training while increasing the training speed.
6. The integrated energy system load forecasting method based on the Transformer model according to claim 5 is characterized in that: In step 5), the convolutional multi-head attention layer in the encoding layer and the decoding layer is composed of 8 sub-attention layers, and the specific steps of extracting the correlation features of the input data include: 5.1) The input data is calculated into three vectors: Q, K and V. The dimension of each vector is L×N×E, where L is the input sequence length, N is the batch size, and E is the embedding dimension. The calculation method is as follows: Among them, W q , W k , W v is the linear transformation matrix, X in is the input; 5.2) Perform a one-dimensional convolution operation on Q and K along the L dimension. The calculation method is as follows: Q'=1Dconv(Q(L)) K'=1Dconv(K(L)) Among them, Q', K' are Q and K after convolution, and 1Dconv is a one-dimensional convolution operation; 5.3) Input Q', K', and V into the sub-attention layer to calculate the attention score: Among them, d k is the embedding dimension of K; 5.4) Connect the outputs of all sub-attention layers: in, 7. The integrated energy system load forecasting method based on Transformer model according to claim 5 is characterized in that: In step 5), the point-by-point convolutional neural network in the encoding layer extracts input features, as follows: Among them, Ω i (k) is the kth subdomain of the convolution kernel centered at point i, p j is the coordinate of point j, w k is the weight of the kth subdomain, and l is the index of the input and output.
8. An electronic device, characterized in that: include: one or more processors; as well as a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors are caused to execute the method according to any one of claims 1 to 7.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Comprehensive energy load prediction method and system based on modal decomposition and TCN-Transform fusion
CN120597194A
