A method and device for predicting renewable energy grid load based on TCN-Transformer

By combining the TCN-Transformer model with local and global feature extraction, the problem of insufficient accuracy of traditional methods in renewable energy grid load forecasting is solved, high-precision load forecasting is achieved, and stable scheduling of the power grid is supported.

CN119994847BActive Publication Date: 2025-10-03ECONOMIC & TECH RES INST OF HUBEI ELECTRIC POWER COMPANY SGCC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411828547.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-12
Publication Date
2025-10-03
Estimated Expiration
2044-12-12

AI Technical Summary

Technical Problem

Traditional load forecasting methods have difficulty coping with the highly volatile and dynamic load characteristics when dealing with the complex time series characteristics of renewable energy power grids. Existing research has ignored the impact of dynamic factors such as renewable energy output and time-of-use electricity prices, resulting in insufficient forecasting accuracy.

Method used

A TCN-Transformer-based method is adopted to extract local features through a temporal convolutional network, and a Transformer network with a multi-head self-attention mechanism and a masked self-attention mechanism is combined to extract global features. A renewable energy grid load forecasting model is constructed, and a composite loss function is introduced to optimize the model performance.

Benefits of technology

It significantly improves the accuracy and reliability of renewable energy grid load forecasting and can effectively support grid dispatching and operation, especially in scenarios with a high proportion of renewable energy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119994847B_ABST
    Figure CN119994847B_ABST
Patent Text Reader

Abstract

A TCN-Transformer-based method and device for renewable energy grid load forecasting includes: constructing a dataset containing historical load data, meteorological data, renewable energy output data, and electricity price data for the renewable energy grid; inputting the dataset into a temporal convolutional network and extracting local features from the time series using a dilated convolutional layer; inputting the local features from the time series into a Transformer network and extracting global features from the time series using a multi-head self-attention mechanism; fusing the local features extracted by the temporal convolutional network with the global features extracted by the Transformer network to construct a renewable energy grid load forecasting model and generate load forecast values ​​for future time points. By extracting local and global time series features and combining them with dynamic features such as renewable energy output and electricity prices, the present invention improves the accuracy and reliability of load forecasting to meet the scheduling needs of power grids with a high proportion of renewable energy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of power systems, and in particular to a method and device for predicting renewable energy power grid load based on TCN-Transformer. Background Art

[0002] With the continuous growth of installed capacity of renewable energy, the impact of new energy such as photovoltaic and wind power on the load characteristics of the power grid is becoming increasingly significant. Accurate load forecasting is the basis for the dispatching and operation of the power grid, which can effectively ensure the safety and economy of the power grid. However, traditional load forecasting methods have certain limitations when dealing with complex time series characteristics: (1) Traditional statistical methods: such as regression analysis, Markov chain, etc. These methods are simple and easy to use, but have limited fitting capabilities when dealing with nonlinear problems and are difficult to cope with the fluctuating characteristics of renewable energy output. (2) Artificial intelligence methods: Models such as support vector machines (SVM) and artificial neural networks (ANN) have good prediction accuracy, but are sensitive to outliers in the input data and are difficult to adapt to the highly volatile and dynamic characteristics of new energy loads.

[0003] In recent years, attention mechanisms have been introduced into the field of load forecasting, significantly improving forecasting performance by capturing global time series dependencies. However, existing research has largely focused on traditional power grids, neglecting the impact of dynamic factors such as renewable energy output and time-of-use electricity prices on load characteristics. Therefore, for the short-term load forecasting needs of power grids with a high proportion of renewable energy, an efficient forecasting method that comprehensively considers multiple dynamic factors is urgently needed. Summary of the Invention

[0004] The purpose of the present invention is to overcome the above-mentioned defects and problems existing in the prior art and provide a renewable energy power grid load forecasting method and device based on TCN-Transformer. By extracting local and global time series features and combining dynamic characteristics such as renewable energy output and electricity price, the accuracy and reliability of load forecasting are improved to meet the scheduling needs of power grids with a high proportion of renewable energy.

[0005] To achieve the above objectives, the technical solution of the present invention is: a renewable energy grid load forecasting method based on TCN-Transformer, comprising:

[0006] Construct a dataset containing historical load data, meteorological data, renewable energy output data, and electricity price data for renewable energy grids;

[0007] The dataset is fed into a temporal convolutional network, and the dilated convolutional layer is used to extract local features in the time series.

[0008] Input the local features in the time series into the Transformer network, and use the multi-head self-attention mechanism to extract the global features in the time series;

[0009] The local features extracted by the temporal convolutional network and the global features extracted by the Transformer network are fused to build a renewable energy grid load forecasting model and generate load forecast values ​​at future time points.

[0010] The formula for the dilated convolutional layer is:

[0011]

[0012] Where y(t) is the output of the convolution operation; D is the size of the convolution kernel; w(i) is the weight of the i-th convolution kernel; x(td·i) is the sequence element input at time step t; and d is the dilation rate.

[0013] The mathematical representation of the multi-head attention mechanism is:

[0014]

[0015] Where Q, K, and V represent query, key, and value vectors respectively; d k is the dimension of the key vector; head i is the attention weight of the i-th single attention head; are the learnable weight matrices corresponding to Q, K, and V of the i-th single attention head; W o is the weight matrix.

[0016] The attention formula is modified by introducing the mask matrix:

[0017]

[0018] Where Q i , K i 、V i are the query, key, and value vectors of the i-th single attention head respectively; M is the mask matrix.

[0019] The renewable energy grid load forecasting model is optimized through the following loss function:

[0020]

[0021] Where L(θ) is the calculated value of the loss function; MSE is the difference between the predicted value and the true value; y i and are the true value and predicted value of the i-th sample respectively; γ is a hyperparameter; k is the total number of samples; D KL is the difference between the true distribution and the predicted distribution; Yi is the true distribution of the target; is the predicted distribution.

[0022] The hyperparameters of the renewable energy grid load forecasting model are obtained by the following method:

[0023] Set the number of channels, dilation factor, kernel size, learning rate, and dropout rate of the temporal convolutional network, as well as the hidden layer dimensions, number of encoder layers, and number of heads of the multi-head attention mechanism of the Transformer network;

[0024] The grid search method is used to obtain the optimal combination of all parameters: the number of channels of the temporal convolutional network is set to [32, 64], the dilation factor is set to 2, the convolution kernel size is set to 3, the learning rate is set to 0.0003, and the dropout rate is set to 0.2; the hidden layer dimension of the Transformer network is set to 128, the number of encoder layers is set to 2, and the number of heads of the multi-head attention mechanism is set to 2.

[0025] The mean absolute percentage error, root mean square error, coefficient of determination, and mean absolute error are used to determine the percentage error between the predicted value and the true value:

[0026]

[0027] Where MAPE is the mean absolute percentage error; k is the total number of predicted samples; yi is the true value of the i-th sample; is the predicted value of the i-th sample; RMSE is the root mean square error; R 2 is the coefficient of determination; is the average of the true values; MAE is the mean absolute error.

[0028] A renewable energy grid load forecasting device based on TCN-Transformer, which is applied to the above-mentioned method, comprises:

[0029] A dataset construction module is used to construct a dataset containing historical load data, meteorological data, renewable energy output data, and electricity price data of renewable energy power grids;

[0030] The local feature acquisition module is used to input the dataset into the temporal convolutional network and use the dilated convolutional layer to extract local features in the time series;

[0031] The global feature acquisition module is used to input local features in the time series into the Transformer network and use the multi-head self-attention mechanism to extract global features in the time series;

[0032] The load forecast value acquisition module is used to fuse the local features extracted by the temporal convolutional network and the global features extracted by the Transformer network to build a renewable energy power grid load forecasting model and generate load forecast values ​​at future time points.

[0033] A renewable energy grid load forecasting device based on TCN-Transformer, comprising a memory and a processor;

[0034] The memory is configured to store computer program code and transmit the computer program code to the processor;

[0035] The processor is configured to execute the method according to the instructions in the computer program code.

[0036] A computer-readable storage medium stores a computer program, which implements the above-mentioned method when executed by a processor.

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

[0038] The present invention provides a method and device for predicting the load of a renewable energy grid based on TCN-Transformer. The method first collects historical load, meteorological data, renewable energy output, and time-of-use electricity price information of the renewable energy grid; then uses a temporal convolutional network to extract local features and expands the receptive field through dilated convolution; then uses a Transformer network to extract global time series features through a multi-head self-attention mechanism, and introduces a masked self-attention mechanism to limit access to future time step data, ensuring that the prediction logic relies only on historical data; finally, the local features extracted by TCN are combined with the global features extracted by Transformer to generate load forecast values ​​for future time points; in addition, a composite loss function combining mean square error and KL divergence is used to optimize model performance, and grid search is used to optimize model hyperparameters to further improve the accuracy and efficiency of load forecasting. This method comprehensively considers dynamic characteristics such as renewable energy output and time-of-use electricity price. In scenarios with a high proportion of renewable energy, the prediction accuracy is significantly improved, which can effectively support grid scheduling and operation. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 This is a flow chart of a renewable energy grid load forecasting method based on TCN-Transformer of the present invention.

[0040] Figure 2 2 is a schematic diagram of a framework of a renewable energy grid load forecasting model in an embodiment of the present invention.

[0041] Figure 3Schematic diagram of the masked self-attention mechanism structure in an embodiment of the present invention.

[0042] Figure 4 3 is a comparison chart of prediction results for working days and holidays in an embodiment of the present invention.

[0043] Figure 5 3 is a comparison chart of prediction results for special holidays in an embodiment of the present invention.

[0044] Figure 6 This is a structural block diagram of a renewable energy power grid load forecasting device based on TCN-Transformer in the present invention.

[0045] Figure 7 This is a structural block diagram of a renewable energy power grid load forecasting device based on TCN-Transformer in the present invention. DETAILED DESCRIPTION

[0046] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0047] See also Figure 1 The present invention provides a renewable energy grid load forecasting method based on TCN-Transformer, comprising:

[0048] S1. Construct a dataset containing historical load data, meteorological data, renewable energy output data, and electricity price data of renewable energy power grids.

[0049] First, as the proportion of renewable energy increases and relevant policies support renewable energy generation technologies, the correlation between changes in load demand and renewable energy output is becoming increasingly significant. Therefore, it is particularly important to consider the impact of renewable energy output in load forecasting. Secondly, a correlation analysis of time-of-use electricity price curves and load curves shows that electricity price and load have a strong correlation. Therefore, adding these two factors here will help the forecasting model better capture the load characteristics of renewable energy power grids and improve forecast accuracy.

[0050] The dataset also includes day type data, which includes holidays, working days, and special holidays (such as Spring Festival, May Day, etc.).

[0051] The above data is normalized, outliers are filled, and a sliding window is used to generate training and test datasets to meet the input requirements of the time series model. Sliding windows are a common data processing method for time series forecasting. They divide time series data into multiple continuous time segments according to the window length, allowing forecasts based on historical data. A rolling window is used to move across the time axis, updating the window data with each fixed step. This method updates the combined data to generate a dataset, supporting the training and testing of short-term load forecasting models.

[0052] S2. Input the dataset into the Temporal Convolutional Network (TCN) and use the dilated convolutional layer to extract local features in the time series.

[0053] Temporal Convolutional Networks (TCNs) primarily consist of dilated convolutional layers and residual modules. Dilated convolutional layers are used to extract local features from a sequence, while residual modules help capture long-term dependencies in the sequence, addressing the vanishing gradient problem of traditional convolutional neural networks (CNNs) and improving training efficiency.

[0054] A single residual module consists of two parallel convolutional branches, each of which sequentially includes a dilated convolutional layer, layer normalization, a ReLU activation function, and a Dropout layer. ReLU makes the network nonlinear, while Dropout prevents overfitting by discarding some neurons. Furthermore, the module uses a residual connection to add the input element-by-element to the output of the convolutional branch using a 1×1 convolution kernel. This structure enhances the model's training efficiency and generalization capabilities.

[0055] S3. Input the local features in the time series into the Transformer network, and use the multi-head self-attention mechanism to extract the global features in the time series.

[0056] The Transformer is a neural network architecture based on the self-attention mechanism. Its design concept is based on the self-attention mechanism. This mechanism calculates the dependencies between each position in the input sequence and other positions. This allows the model to flexibly capture the relationships between different positions when processing long sequence tasks, without losing information relevance due to the length of the input features. The self-attention mechanism can be represented as a Transformer consisting of three parts: an encoder, a decoder, and a positional encoding. The encoder converts the input sequence into a latent representation, which the decoder uses to generate the target output. The positional encoding is used to add positional information to each vector in the input sequence, effectively modeling long-range dependencies. Through the multi-head self-attention mechanism, the model can focus on different features in different subspaces when processing sequences, enhancing its ability to capture sequence information.

[0057] S4. The local features extracted by the temporal convolutional network and the global features extracted by the Transformer network are integrated to build a renewable energy grid load forecasting model and generate load forecast values ​​at future time points.

[0058] In order to better extract local features and global features, the present invention proposes a TCN-Transformer load forecasting model composed of TCN and Transformer. First, the historical data set is input into the TCN layer. TCN uses dilated convolution to increase the receptive field of the network to obtain features of multiple time steps and perform convolution, which can effectively extract local features. The local features extracted by TCN are transmitted to Transformer to extract global features, and position encoding is added to ensure time order. Each layer consists of a self-attention mechanism and a feedback layer. The prediction model is as follows: Figure 2 shown.

[0059] Furthermore, TCN uses a dilated convolution layer, which is a form of convolution that inserts gaps between convolution kernels. This operation enables the model to have a larger receptive field and can efficiently handle long-term dependencies without increasing computational complexity. The formula for the dilated convolution layer is:

[0060]

[0061] Where y(t) is the output of the convolution operation; D is the size of the convolution kernel; w(i) is the weight of the i-th convolution kernel; x(td·i) is the sequence element input at time step t; d is the dilation rate, and the receptive field of the network is controlled by setting the dilation rate d.

[0062] Furthermore, the mathematical representation of the multi-head attention mechanism is:

[0063]

[0064] MH(Q,K,V)=Concat(head1,...,head h )W o ;

[0065] Where attention is calculated by the softmax normalization function; Q, K, V represent query, key, and value vectors respectively; d k is the dimension of the key vector; head i is the attention weight of the i-th single attention head; are the learnable weight matrices corresponding to Q, K, and B of the i-th single attention head; W o is the weight matrix.

[0066] Each attention head calculates the attention result independently, and then the results of all heads are spliced ​​and linearly transformed using the weight matrix W o Generate the final overall attention output.

[0067] Furthermore, the traditional self-attention mechanism can associate the features of each time step with the features of all time steps of the sequence data. Although this can capture long-term dependencies, it will be associated with the features of future time steps. Therefore, the present invention uses a masked self-attention mechanism to restrict access to future information and ensure the integrity of the prediction logic. The attention formula is modified by introducing a mask matrix:

[0068]

[0069] Where Q i , K i 、V i are the query, key, and value vectors of the i-th single attention head respectively; M is the mask matrix.

[0070] The mask matrix is ​​an upper triangular matrix, which means that the features of each time step are only associated with the data observed at the current time step, ensuring that the model only uses current and past data, which is consistent with the logic of the real prediction model. The structure of the mask self-attention mechanism is as follows Figure 3 shown.

[0071] Furthermore, KL divergence is used to measure the difference between the model's predicted distribution and the true distribution, thereby optimizing the capture of global characteristics by the renewable energy grid load forecasting model. This paper uses a supervised learning loss function based on KL divergence to help the TCN-Transformer model better explore the characteristics of time series and improve its ability to fit the changing trend. The loss function formula is:

[0072]

[0073] Where L(θ) is the calculated value of the loss function; MSE is the difference between the predicted value and the true value, which ensures the accuracy of the power load; y j and are the true value and predicted value of the i-th sample respectively; γ is a hyperparameter; k is the total number of samples; D KL The difference between the actual distribution and the predicted distribution helps the model better capture the load characteristics of the renewable energy grid; i is the true distribution of the target; is the predicted distribution.

[0074] The KL divergence can also measure the degree of fit between two random distributions. The greater the similarity between two random distributions, the smaller their KL divergence. The above loss function can help the model improve its ability to learn global dependencies, and the hyperparameter γ is used to control the impact of the divergence on the overall loss.

[0075] Furthermore, the hyperparameters of the renewable energy grid load forecasting model are obtained by the following method:

[0076] Set the number of channels, dilation factor, kernel size, learning rate, and dropout rate of the temporal convolutional network, as well as the hidden layer dimensions, number of encoder layers, and number of heads of the multi-head attention mechanism of the Transformer network;

[0077] The grid search method is used to obtain the optimal combination of all parameters: the number of channels of the temporal convolutional network is set to [32, 64], the dilation factor is set to 2, the convolution kernel size is set to 3, the learning rate is set to 0.0003, and the dropout rate is set to 0.2; the hidden layer dimension of the Transformer network is set to 128, the number of encoder layers is set to 2, and the number of heads of the multi-head attention mechanism is set to 2.

[0078] By controlling the learning rate to control the training speed, the loss rate can prevent the model from overfitting. Optimization is performed with a fixed number of iterations (100 in this invention), using a grid search method to obtain the optimal combination of all parameters, fully exploiting the performance of the model to further improve the accuracy and efficiency of load forecasting.

[0079] Furthermore, the mean absolute percentage error, root mean square error, coefficient of determination, and mean absolute error are used to determine the percentage error between the predicted value and the true value:

[0080]

[0081] Where, MAPE is the mean absolute percentage error; k is the total number of prediction samples; y i is the true value of the i-th sample; is the predicted value of the i-th sample; RMSE is the root mean square error; R 2 is the coefficient of determination; is the average of the true values; MAE is the mean absolute error.

[0082] Among them, RMSE is very sensitive to the outliers of the prediction results and can measure the overall accuracy of the model prediction; MAPE can reflect the overall level of the entire prediction model. Since it is a percentage indicator, it is not affected by the data unit; R 2 It is used to evaluate the degree of fit of the regression model to the data and measure the fitting ability of the overall trend; MAE represents the mean absolute error between the predicted value and the true value, reflecting the overall error level of the prediction. In short, the smaller the RMSE, MAPE, and MAE values ​​are, the better the R 2 The larger the value, the higher the prediction accuracy.

[0083] The data used covers the period from January 2022 to August 2024, with a sampling interval of 15 minutes. It includes daily data on load power, meteorological conditions, renewable energy output, and electricity prices at 96 sampling points. In the experiment, 80% of the data was used as a training set, and 20% was used as a test set. To ensure that the load forecasting model fully captures time series characteristics and accounts for the cyclical and temporal nature of power load, the past three days of sampling data were used as input, and the predicted load data for the next 24 hours was used as output.

[0084] Using the TCN and Transformer fusion model and setting up four control groups, the methods of the present invention are introduced into the model for training without considering the renewable energy price and output factors, only considering the renewable energy price factors, only considering the renewable energy output factors, and considering the renewable energy price and output factors. The load curve from May 19 to 21, 2024 (i.e., two working days and one holiday load curve) was selected for comparison of prediction results, with a total of 288 sampling points. The performance of the method of the present invention and other methods in load prediction on working days and holidays is compared, and the results show that Figure 4 And Table 1, Table 2.

[0085] Table 1 Errors of the model considering different influencing factors on weekdays

[0086]

[0087] Table 2 Errors of the model considering different influencing factors for holidays

[0088]

[0089] Comparative analysis shows that when only considering renewable energy output, the model's forecasting performance improves. The forecast error metrics for weekdays and holidays decrease, respectively: RMSE, MAPE, and MAE decrease by 6.9%, 1.6%, and 6.8% on weekdays, and by 2.4%, 7.2%, and 8.1% on holidays. Due to the large fluctuations in renewable energy output, relying solely on this feature to improve model performance is still limited. Further considering renewable energy electricity prices significantly improves the model's forecasting accuracy. Compared to considering only renewable energy output, the RMSE, MAPE, and MAE on weekdays decrease by approximately 6.1%, 2.2%, and 2.8%, respectively, and on holidays by approximately 9.1%, 5.7%, and 6.8%, respectively. This demonstrates that the inclusion of electricity prices significantly improves the model's fit. When both renewable energy output and electricity prices are considered, the model's forecasting accuracy improves further, demonstrating a significant improvement. The error indicators RMSE, MAPE, and MAE on weekdays decreased by approximately 7.8%, 17.8%, and 18.1%, respectively; the corresponding indicators on holidays decreased by approximately 5.8%, 17.8%, and 17.7%, respectively. Overall, compared with completely ignoring the renewable energy factor, the model's fit R 2 The prediction performance of the proposed method is significantly better than that of other methods, both on weekdays and holidays, which fully verifies the effectiveness of the selected features and methods.

[0090] In addition, in order to test the prediction effect of the method of the present invention under the special conditions of special holidays, the selected time period is from May 1 to May 3 (during the May Day holiday). Figure 5 Table 3 compares the performance of the method of the present invention and other methods in load forecasting on special holidays.

[0091] Table 3 Errors of the model considering different influencing factors for special holidays

[0092]

[0093] By considering renewable energy output or electricity price factors, RMSE, MAPE, and MAE are improved to 36.97, 1.21, and 29.00 and 29.73, 0.93, and 22.03, respectively, which has shown a higher accuracy. However, the method of the present invention is further optimized, and RMSE, MAPE, and MAE are reduced to 28.50, 0.82, and 19.79, which is higher than that when renewable energy factors are not considered.2 The improvement is about 3.2%, which shows that the method mentioned in the present invention performs better under special holiday data.

[0094] In summary, the TCN-Transformer model mentioned in the present invention that considers renewable energy output and electricity price factors is the best regardless of normal working days, holidays or special holidays.

[0095] See also Figure 6 The present invention further provides a renewable energy grid load forecasting device based on TCN-Transformer, which is applied to the above-mentioned renewable energy grid load forecasting method based on TCN-Transformer, and the device includes:

[0096] A dataset construction module is used to construct a dataset containing historical load data, meteorological data, renewable energy output data, and electricity price data of renewable energy power grids;

[0097] The local feature acquisition module is used to input the dataset into the temporal convolutional network and use the dilated convolutional layer to extract local features in the time series;

[0098] The global feature acquisition module is used to input local features in the time series into the Transformer network and use the multi-head self-attention mechanism to extract global features in the time series;

[0099] The load forecast value acquisition module is used to fuse the local features extracted by the temporal convolutional network and the global features extracted by the Transformer network to build a renewable energy power grid load forecasting model and generate load forecast values ​​at future time points.

[0100] See also Figure 7 ,The present invention also provides a renewable energy grid load forecasting device based on TCN-Transformer, including a memory and a processor;

[0101] The memory is configured to store computer program code and transmit the computer program code to the processor;

[0102] The processor is configured to execute the above-mentioned renewable energy grid load forecasting method based on TCN-Transformer according to the instructions in the computer program code.

[0103] The present invention also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the computer program implements the above-mentioned renewable energy grid load forecasting method based on TCN-Transformer.

[0104] Generally speaking, computer instructions for implementing the method of the present invention may be carried by any combination of one or more computer-readable storage media. Non-transitory computer-readable storage media may include any computer-readable media except for signals that are temporarily propagating.

[0105] Computer-readable storage media can be, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or components, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EKROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or device.

[0106] Computer program code for performing the operations of the present invention can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages, in particular, Python suitable for neural network computing and platform frameworks based on TensorFlow, PyTorch, etc. can be used. The program code can be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or to an external computer (for example, through the Internet using an Internet service provider).

[0107] The above-mentioned device and non-transitory computer-readable storage medium can be referred to the detailed description of a renewable energy grid load forecasting method based on TCN-Transformer and its beneficial effects, which will not be repeated here.

[0108] Although the embodiments of the present invention have been shown and described above, it should be understood that the above embodiments are exemplary and should not be construed as limiting the present invention. A person skilled in the art may change, modify, replace and modify the above embodiments within the scope of the present invention.

Claims

1. A renewable energy grid load forecasting method based on TCN-Transformer, characterized in that: include: Construct a dataset containing historical load data, meteorological data, renewable energy output data, and electricity price data for renewable energy grids; The dataset is fed into a temporal convolutional network, and the dilated convolutional layer is used to extract local features in the time series. Input the local features in the time series into the Transformer network, and use the multi-head self-attention mechanism to extract the global features in the time series; The local features extracted by the temporal convolutional network and the global features extracted by the Transformer network are integrated to build a renewable energy grid load forecasting model and generate load forecast values ​​at future time points. The renewable energy grid load forecasting model is optimized through the following loss function: ; ; ; Where, Calculate the value for the loss function; is the difference between the predicted value and the true value; and Respectively The true value and predicted value of the sample; is a hyperparameter; is the total number of samples; is the difference between the true distribution and the predicted distribution; is the true distribution of the target; is the predicted distribution.

2. A renewable energy grid load forecasting method based on TCN-Transformer according to claim 1, characterized in that: The formula for the dilated convolutional layer is: ; Where, Output of the convolution operation; is the size of the convolution kernel; For the The weight of the convolution kernel; is the time step The input sequence elements; is the expansion rate.

3. The renewable energy grid load forecasting method based on TCN-Transformer according to claim 1 is characterized in that: The mathematical representation of the multi-head attention mechanism is: ; ; ; Where, 、 、 denote query, key, and value vectors respectively; is the dimension of the key vector; For the The attention weights of a single attention head; 、 、 Respectively A single attention head 、 、 The corresponding learnable weight matrix; is the weight matrix.

4. A renewable energy grid load forecasting method based on TCN-Transformer according to claim 3, characterized in that: The attention formula is modified by introducing the mask matrix: ; Where, 、 、 Respectively query, key, and value vectors for a single attention head; is the mask matrix.

5. The renewable energy grid load forecasting method based on TCN-Transformer according to claim 1 is characterized in that: The hyperparameters of the renewable energy grid load forecasting model are obtained by the following method: Set the number of channels, dilation factor, kernel size, learning rate, and dropout rate of the temporal convolutional network, as well as the hidden layer dimensions, number of encoder layers, and number of heads of the multi-head attention mechanism of the Transformer network; The grid search method is used to obtain the optimal combination of all parameters: the number of channels of the temporal convolutional network is set to [32, 64], the expansion factor is set to 2, the convolution kernel size is set to 3, the learning rate is set to 0.0003, and the dropout rate is set to 0.2; the hidden layer dimension of the Transformer network is set to 128, the number of encoder layers is set to 2, and the number of heads of the multi-head attention mechanism is set to 2.

6. The renewable energy grid load forecasting method based on TCN-Transformer according to claim 1 is characterized in that: The mean absolute percentage error, root mean square error, coefficient of determination, and mean absolute error are used to determine the percentage error between the predicted value and the true value: ; ; ; ; Where, is the mean absolute percentage error; is the total number of prediction samples; For the The true value of the samples; For the The predicted value of samples; is the root mean square error; is the coefficient of determination; is the average of the true values; is the mean absolute error.

7. A renewable energy grid load forecasting device based on TCN-Transformer, characterized in that: The device is applied to the method according to any one of claims 1 to 6, and the device comprises: A dataset construction module is used to construct a dataset containing historical load data, meteorological data, renewable energy output data, and electricity price data of renewable energy power grids; The local feature acquisition module is used to input the dataset into the temporal convolutional network and use the dilated convolutional layer to extract local features in the time series; The global feature acquisition module is used to input local features in the time series into the Transformer network and use the multi-head self-attention mechanism to extract global features in the time series; The load forecast value acquisition module is used to fuse the local features extracted by the temporal convolutional network and the global features extracted by the Transformer network to build a renewable energy power grid load forecasting model and generate load forecast values ​​at future time points.

8. A renewable energy grid load forecasting device based on TCN-Transformer, characterized in that: including memory and processor; The memory is configured to store computer program code and transmit the computer program code to the processor; The processor is configured to execute the method according to any one of claims 1 to 6 according to instructions in the computer program code.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.