A method and device for predicting and optimizing net load peak and valley values based on TCN
Through the TCN-based method, the net load peak and valley value of the power system is predicted, which solves the problem of low accuracy in the prior art, and achieves higher prediction accuracy and stable operation of the power system.
Patent Information
- Application Number
- CN202410744381.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-11
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2044-06-11
AI Technical Summary
The prior art has low accuracy in the prediction of net load peak-to-valley values, which affects the stable operation of the power system.
Using a TCN-based method, we obtain the total power consumption data of the power grid, controlled load consumption data and total power generation data of solar system, preprocess and reorganize, build a TCN model and set a peak-to-valve loss function, and train it using a two-way dynamic parameter adjustment strategy and attention mechanism to improve the accuracy of peak-to-valve prediction.
It significantly improves the accuracy of net load peak-to-trough prediction, can more accurately capture the long-term dependence and periodic characteristics in the time series, and improves the operating efficiency and stability of the power system.
Smart Images

Figure CN118783404B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of power system prediction, and in particular relates to a method and device for predicting and optimizing net load peak and valley values based on TCN. Background Art
[0002] The volatility and diversity of renewable energy generation, coupled with the growing dynamic loads such as energy storage systems and electric vehicles, make it more difficult to predict the net power load of the power system, increasing the uncertainty of the balance of power supply and demand. This uncertainty poses a challenge to the safe operation, economy and efficiency of the power system. Therefore, accurate and reliable net power load prediction is essential for the planning, operation, stability analysis and control of the power system, and it is the key to ensure the sustainable operation of the power system. However, the peak and valley value of the net load has not received enough attention, which may affect the stable operation of the power system.
[0003] At present, the commonly used net power load forecasting methods include physical methods, statistical methods, artificial intelligence methods and their hybrid methods.
[0004] The physical method constructs a physical model related to the net power load by analyzing and simulating the physical environment of the power system, such as wind speed, temperature, solar radiation, etc. Although this method can provide predictions based on actual physical data, it relies on high-quality and high-frequency environmental data inputs and has limited ability to handle complex environmental conditions.
[0005] Statistical methods use historical data to predict net power load and use historical power data and load data to build mathematical models, such as time series analysis and regression analysis. The disadvantage of this method is that they usually assume that historical patterns will recur in the future and are difficult to adapt to the rapid changes in power markets and environmental conditions.
[0006] Artificial intelligence methods, especially machine learning and deep learning techniques, are widely used in net power load forecasting due to their significant advantages in processing large amounts of data and identifying complex patterns. As a powerful machine learning method, deep learning can automatically extract useful information from raw data through its multi-level feature learning and representation learning, thereby improving the accuracy and robustness of forecasts. In addition, deep learning models are able to capture nonlinear relationships in data, which is essential for predicting complex dynamic behaviors in power systems. Although these techniques require a large amount of training data and the transparency and interpretability of the models are low, which may lead to problems with user acceptance and trust in practical applications, deep learning's ability to handle high-dimensional data and complex data relationships makes it a very promising method in the field of net power load forecasting.
[0007] Therefore, how to design and develop a deep learning method to optimize the prediction of net load peak and valley values has become an urgent problem to be solved. Summary of the invention
[0008] To this end, the present invention provides a TCN-based net load peak-valley value prediction optimization method and device, which adopts a deep learning method to optimize the prediction of net load peak-valley values, while improving the prediction performance, also providing support for the stable operation and efficient management of the power system.
[0009] In order to achieve the above object, the present invention provides the following technical solution: a method for predicting and optimizing net load peak and valley values based on TCN, comprising:
[0010] Obtaining total power consumption data of the power grid, controlled load consumption data and total power generation data of the solar energy system; obtaining net power load data according to the total power consumption data of the power grid, the controlled load consumption data and the total power generation data of the solar energy system; preprocessing the net power load data to obtain net load power time series data;
[0011] Constructing a data reorganization system, and reorganizing the net load power time series data through the data reorganization system to obtain reorganized net load power time series data;
[0012] Setting a peak-valley loss function, and adjusting the hyperparameters of the peak-valley loss function through a bidirectional dynamic parameter adjustment strategy so that the peak-valley loss function meets the training requirements of the set TCN model;
[0013] Construct a TCN model and train the TCN model through the peak-valley value loss function; input the reorganized net load power time series data into the trained TCN model, perform prediction processing on the reorganized net load power time series data through the TCN model, and output the prediction result of the peak-valley value of the net power load of the power system.
[0014] As a preferred solution of the net load peak-valley value prediction optimization method based on TCN, the formula for obtaining the net power load data according to the total power consumption data of the power grid, the controlled load consumption data and the total power generation data of the solar energy system is:
[0015] L(t)=GC+CL-GG
[0016] Where L(t) is the net power load data; GC is the total power consumption data of the power grid; CL is the controlled load consumption data; GG is the total power generation data of the solar energy system.
[0017] As a preferred solution of a net load peak-valley value prediction optimization method based on TCN, the step of reorganizing the net load power time series data by the data reorganization system includes:
[0018] Performing phase space reconstruction processing on the net load power time series data to obtain reconstructed net load power time series data;
[0019] Performing position coding processing on the reconstructed net load power time series data to obtain position-coded net load power time series data;
[0020] Performing Mask processing on the net load power time series data after the position encoding;
[0021] The Min-Max normalization strategy is adopted to perform data normalization processing on the net load power time series data after the position encoding after the Mask processing is completed, so as to obtain the reorganized net load power time series data.
[0022] As a preferred solution of the net load peak-valley value prediction optimization method based on TCN, the peak-valley value loss function expression is:
[0023] L=L RMSE *(1+α*pd+β*vd)
[0024] Where, L RMSE is the local root mean square error; pd is the peak horizontal coordinate difference; vd is the valley horizontal coordinate difference; α and β are weight coefficients, ranging from 0.1 to 1.0.
[0025] As a preferred solution of a net load peak-valley value prediction optimization method based on TCN, the TCN model includes a causal convolution layer, an expansion convolution layer, a residual block network structure and an attention mechanism network structure;
[0026] The attention mechanism network structure includes a weighted sum function, a Softmax activation function and a fully connected output layer;
[0027] The output expression of the attention mechanism network structure is:
[0028]
[0029] Where K is the key vector; V is the value vector; Q is the query vector; d k is the dimension of the key vector K; K T is the transpose of the key vector; the Softmax function is used to normalize the weights so that the sum of the weights is 1.
[0030] The present invention also provides a net load peak-valley value prediction and optimization device based on TCN, which adopts the above-mentioned net load peak-valley value prediction and optimization method based on TCN, comprising:
[0031] A net power load data acquisition and preprocessing module is used to acquire the total power consumption data of the power grid, the controlled load consumption data and the total power generation data of the solar energy system; obtain the net power load data according to the total power consumption data of the power grid, the controlled load consumption data and the total power generation data of the solar energy system; preprocess the net power load data to obtain the net load power time series data;
[0032] A data reorganization system construction and processing module is used to construct a data reorganization system, and to reorganize the net load power time series data through the data reorganization system to obtain reorganized net load power time series data;
[0033] A peak-valley value loss function setting and adjustment module is used to set the peak-valley value loss function and adjust the hyperparameters of the peak-valley value loss function through a bidirectional dynamic parameter adjustment strategy so that the peak-valley value loss function meets the training requirements of the set TCN model;
[0034] The TCN model construction and processing module is used to construct a TCN model and train the TCN model through the peak-valley value loss function; the reorganized net load power time series data is input into the trained TCN model, and the reorganized net load power time series data is predicted and processed through the TCN model, and the prediction result of the peak-valley value of the net power load of the power system is output.
[0035] As a preferred solution of a net load peak-valley value prediction and optimization device based on TCN, in the net power load data acquisition and preprocessing module, the formula for obtaining the net power load data according to the total power consumption data of the power grid, the controlled load consumption data and the total power generation data of the solar energy system is:
[0036] L(t)=GC+CL-GG
[0037] Where L(t) is the net power load data; GC is the total power consumption data of the power grid; CL is the controlled load consumption data; GG is the total power generation data of the solar energy system.
[0038] As a preferred solution of a net load peak-valley value prediction and optimization device based on TCN, in the data reorganization system construction and processing module, the submodule for reorganizing the net load power time series data through the data reorganization system includes:
[0039] A phase space reconstruction submodule is used to perform phase space reconstruction processing on the net load power time series data to obtain reconstructed net load power time series data;
[0040] A position coding submodule, used for performing position coding processing on the reconstructed net load power time series data to obtain the position-coded net load power time series data;
[0041] The Mask submodule is used to perform Mask processing on the net load power time series data after the position encoding;
[0042] The data normalization submodule is used to adopt the Min-Max normalization strategy to perform data normalization processing on the net load power time series data after the position encoding after the Mask processing is completed, so as to obtain the reorganized net load power time series data.
[0043] As a preferred solution of a net load peak-valley value prediction and optimization device based on TCN, in the peak-valley value loss function setting and adjustment module, the peak-valley value loss function expression is:
[0044] L=L RMSE *(1+α*pd+β*vd)
[0045] Where, L RMSE is the local root mean square error; pd is the peak horizontal coordinate difference; vd is the valley horizontal coordinate difference; α and β are weight coefficients, ranging from 0.1 to 1.0.
[0046] As a preferred solution of a net load peak-valley value prediction and optimization device based on TCN, in the TCN model construction and processing module, the TCN model includes a causal convolution layer, an expansion convolution layer, a residual block network structure and an attention mechanism network structure;
[0047] The attention mechanism network structure includes a weighted sum function, a Softmax activation function and a fully connected output layer;
[0048] The output expression of the attention mechanism network structure is:
[0049]
[0050] Where K is the key vector; V is the value vector; Q is the query vector; d k is the dimension of the key vector K; K T is the transpose of the key vector; the Softmax function is used to normalize the weights so that the sum of the weights is 1.
[0051] The present invention has the following advantages: obtaining total power consumption data of the power grid, controlled load consumption data and total power generation data of the solar energy system; obtaining net power load data according to the total power consumption data of the power grid, the controlled load consumption data and the total power generation data of the solar energy system; preprocessing the net power load data to obtain net load power time series data; constructing a data reorganization system, reorganizing the net load power time series data through the data reorganization system to obtain reorganized net load power time series data; setting a peak-valley value loss function, adjusting the hyperparameters of the peak-valley value loss function through a bidirectional dynamic parameter adjustment strategy, so that the peak-valley value loss function meets the training requirements of the set TCN model; constructing a TCN model, training the TCN model through the peak-valley value loss function; inputting the reorganized net load power time series data into the trained TCN model, predicting the reorganized net load power time series data through the TCN model, and outputting the prediction result of the peak-valley value of the net power load of the power system. Aiming at the problem of low prediction accuracy of peak and valley values in existing net load forecasting, the present invention adopts phase space reconstruction technology to combine historical and future data to better capture the long-term dependency problem of time series. Position encoding is added to mine the regular features between sequences and the correlation between features to better capture the periodic characteristics of peak and valley values. The Mask masking technology in the BERT model is used to add the left and right information of the masked part to the prediction to better capture the fluctuation of peak and valley values. The attention mechanism is introduced into the TCN model to give weighted attention to key time points and enhance the model's ability to capture peak and valley values and their fluctuations. A new peak and valley loss function is proposed. By introducing the horizontal coordinate difference of the peak and valley values into the loss function and using dynamic parameter adjustment, it is ensured that the model can accurately predict the mutation extreme value and the time point of occurrence in the sequence. The method of the present invention is of great significance for improving the operating efficiency of the power system and promoting the safe, economical and efficient operation of the new energy power system. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] In order to more clearly illustrate the implementation methods of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for the implementation methods or the description of the prior art. Obviously, the drawings in the following description are only exemplary, and for ordinary technicians in this field, other implementation drawings can be derived from the provided drawings without creative work.
[0053] Figure 1 A schematic diagram of a flow chart of a method for predicting and optimizing net load peak and valley values based on TCN provided in Example 1 of the present invention;
[0054] Figure 2A schematic diagram of a specific process for implementing a method for predicting and optimizing net load peak and valley values based on TCN provided in Example 1 of the present invention;
[0055] Figure 3 Schematic diagram of a Mask processing method in a TCN-based net load peak and valley value prediction optimization method provided in Example 1 of the present invention;
[0056] Figure 4 A schematic diagram of a TCN expansion convolution structure diagram in a TCN-based net load peak-valley value prediction optimization method provided in Example 1 of the present invention;
[0057] Figure 5 A schematic diagram of the structure of an attention mechanism in a TCN-based net load peak-valley value prediction optimization method provided in Example 1 of the present invention;
[0058] Figure 6 This is an architecture diagram of a TCN-based net load peak and valley value prediction and optimization device provided in Example 2 of the present invention. DETAILED DESCRIPTION
[0059] The following is a description of the implementation of the present invention by specific embodiments. People familiar with the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0060] Example 1
[0061] See also Figure 1 and Figure 2 Embodiment 1 of the present invention provides a method for optimizing the prediction of net load peak and valley values based on TCN, comprising the following steps:
[0062] S1. Obtaining total power consumption data of the power grid, controlled load consumption data and total power generation data of the solar energy system; obtaining net power load data according to the total power consumption data of the power grid, the controlled load consumption data and the total power generation data of the solar energy system; preprocessing the net power load data to obtain net load power time series data;
[0063] S2, constructing a data reorganization system, and reorganizing the net load power time series data through the data reorganization system to obtain reorganized net load power time series data;
[0064] S3. Set a peak-valley loss function, and adjust the hyperparameters of the peak-valley loss function through a bidirectional dynamic parameter adjustment strategy so that the peak-valley loss function meets the training requirements of the set TCN model;
[0065] S4. Construct a TCN model and train the TCN model through the peak-valley value loss function; input the reorganized net load power time series data into the trained TCN model, perform prediction processing on the reorganized net load power time series data through the TCN model, and output the prediction result of the peak-valley value of the net power load of the power system.
[0066] In this embodiment, in step S1, the formula for calculating the net power load data is:
[0067] L(t)=GC+CL-GG
[0068] Where L(t) is the net power load data; GC is the total power consumption data of the power grid; CL is the controlled load consumption data; GG is the total power generation data of the solar energy system.
[0069] in,
[0070] L(t)=D(t)-R(t)
[0071] GC+CL=D(t)
[0072] GG=R(r)
[0073] Where L(t) is the net load; D(t) is the total load demand; and R(t) is the renewable energy output.
[0074] In this embodiment, in step S2, the step of reorganizing the net load power time series data by the data reorganization system includes:
[0075] S21, performing phase space reconstruction processing on the net load power time series data to obtain reconstructed net load power time series data;
[0076] Specifically, phase space reconstruction is a method for analyzing time series data. It is based on the embedding theorem in chaos theory, proposed by Takens in 1981. The theorem states that the intrinsic structure and dynamic behavior of a dynamic system can be restored by reconstructing time series data into a high-dimensional phase space. In this phase space, each point represents a state of the time series, and the trajectory of the point reflects the evolution of the system.
[0077] In the phase space reconstruction of the net load power time series, the power value at any time point is determined by the power values of other time points that interact with it. This means that each data point in the time series is not isolated, but has an intrinsic connection with other points in the sequence. By mapping these data points into a high-dimensional space according to certain rules, the complex interactions and chaotic characteristics within the system can be revealed.
[0078] Assuming that the length of the original net load power time series p is n, as shown in formula (1), this one-dimensional time series can be converted into an m-dimensional phase space by embedding the dimension m and selecting a suitable time window with time delay τ. Each phase space point consists of m consecutive points in the time series, which reflect the evolution of the system state under m different time delays. Such phase space reconstruction allows us to analyze the nonlinear dynamic behavior of the system and use it for prediction and modeling.
[0079] p=(p1,p2,……p n ) T (1)
[0080] In the formula, p i =(i=1,2,……,n) is the net load power value at the i-th moment;
[0081]
[0082] After the embedding dimension m and time delay τ are determined, the data reconstructed in phase space is shown in formula (2).
[0083] S22, performing position coding processing on the reconstructed net load power time series data to obtain position-coded net load power time series data;
[0084] Specifically, the position code is a matrix whose dimension is the same as the dimension of the input sequence. Each position has a unique position code vector, which contains the position information about the position. By adding the position code to the input sequence at the element level, the position information can be integrated into the input sequence. The present invention uses trigonometric functions to encode the position. Specifically, each element of the position code matrix is shown in formula (3).
[0085]
[0086] In the formula, pos represents the position; i represents the index of the position encoding vector; d model Represents the dimension of the input features.
[0087] The 10000 in the formula is a hyperparameter used to scale the position encoding. By using sine and cosine functions of different frequencies, the position encoding can capture the relative distance between different positions. Position encoding can simultaneously consider the elements in the input sequence and their position information, thereby better capturing the dependencies between elements in the sequence.
[0088] S23, performing mask processing on the net load power time series data after the position encoding;
[0089] Specifically, in the BERT model, masking technology is a key mechanism used to avoid directly exposing the model to unknown tags during model training and inference. This technology uses a mask vector to indicate which words in the input sequence should be hidden and which words remain visible. The length of the mask vector matches the length of the input sequence, where each element represents a word with a value of 0 or 1, and an element with a value of 0 indicates that the corresponding word should be masked, while an element with a value of 1 indicates that the corresponding word should be retained. This masking mechanism is particularly important in tasks such as text classification because it allows the model to be exposed to unlabeled data during training, thereby enhancing the generalization ability of the model. By randomly masking a portion of the words in the input sequence, the model must learn how to infer the meaning of the masked words only through the remaining visible words. This approach helps the model better handle unknown words or tags during inference, thereby improving the performance and stability of the model.
[0090] Therefore, the present invention applies the masking concept in the BERT model to the time series. Specifically, the present invention simulates the introduction of future time series features by performing random masking on the input time series data, thereby improving the model's prediction accuracy for peak points. Figure 3 As shown in the figure, the input data is constructed through a sliding window, and the data is randomly masked in the training set. The masked values are used as the predicted labels, and the future features at the masked moment are introduced, so that these features are considered in the prediction; in addition, the same amount of data is used in the training set, and the last column is masked for regular prediction, and random future features are introduced into the regular prediction. In the test set, the last column is masked, and the label value is the masked value, and a regular prediction is performed, indicating that the prediction point of the test set is irrelevant to the future features, avoiding the prediction problem caused by not knowing the future features in the test stage.
[0091] S24, adopting the Min-Max normalization strategy, performing data normalization processing on the position-encoded net load power time series data after the Mask processing, to obtain the reorganized net load power time series data.
[0092] Specifically, the present invention adopts the Min-Max normalization strategy to scale the original data to the interval [0, 1] to retain the intrinsic relationship of the data, as shown in formula (4).
[0093]
[0094] In the formula, x is the data point in the data set, x min is the minimum value in the data set; x max is the maximum value in the data set;
[0095] This strategy calculates the difference between each data point and the minimum and maximum values in the data set and scales it to that range without changing the distribution characteristics of the data. This standardization process helps deep learning models better process time series data and improve prediction accuracy.
[0096] In this embodiment, in step S3, the peak-to-valley loss function expression is:
[0097] L=L RMSE *(1+α*pd+β*vd)
[0098] Where, L RMSE is the local root mean square error; pd is the peak horizontal coordinate difference; vd is the valley horizontal coordinate difference; α and β are weight coefficients, ranging from 0.1 to 1.0.
[0099] Specifically, the peak-to-valley loss function adds two additional penalty terms on the basis of the traditional root mean square error (RMSE) to measure the horizontal coordinate differences of the peak and valley values between the predicted sequence and the target sequence.
[0100] The peak-to-valley loss function consists of the following three parts: First, the local root mean square error L RMSE : Measures the error between ypredict and ytrue. The second is the peak horizontal coordinate difference pd: Measures the horizontal coordinate difference between the peak point in the predicted sequence and the corresponding point in the target sequence. The third is the valley horizontal coordinate difference vd: Measures the horizontal coordinate difference between the peak and valley points in the predicted sequence and the target sequence.
[0101] The calculation method of the peak horizontal coordinate difference pd and the valley horizontal coordinate difference vd is as follows: first determine the peak points and valley points in the target sequence, then calculate the absolute difference between the actual value of the corresponding point in the predicted sequence and the average value of the peak point or valley point of the target sequence, and finally sum up all the absolute differences and divide them by the total number of peak points or valley points to obtain the values of pd and vd.
[0102] The parameters α and β are weight coefficients, and their values are adjusted dynamically. During the training iteration, the values keep changing. They are used to adjust the relative importance of peaks and valleys to the loss. By introducing these two penalty terms, the peak-valley loss function can better guide the model to pay attention to the horizontal coordinate difference between peaks and valleys during training, so as to improve the model's perception of specific data patterns.
[0103] The weight coefficients α and β are used to adjust the relative importance of peaks and valleys to the loss, and optimize the model performance through dynamic adjustment. The value range of these parameters is limited to between 0.1 and 1.0 to maintain model stability and learning efficiency.
[0104] The present invention also proposes a method for dynamically adjusting hyperparameters α and β to optimize the performance and generalization ability of the model. Initially, α and β are set to 0.5 and dynamically adjusted during the training process according to the performance of the model on the validation set.
[0105] Specifically, when the validation loss is higher than the training loss, it indicates that the model may be overfitting, and the values of α and β will be reduced; conversely, when the validation loss is lower than the training loss, it indicates that the model is capable of learning more complex features, and the values of α and β will be increased.
[0106] In addition, the present invention adopts the ReduceLROnPlateau method to adaptively adjust the learning rate, and the ModelCheckpoint function to save the best model during the training process. At the same time, the values of α and β are monitored and adjusted through a custom callback function to ensure the efficiency and optimal performance of model training.
[0107] Through the above method, the present invention can flexibly adjust the model parameters during the training process, improve the learning efficiency and the generalization ability of the model, especially when facing complex data. In addition, this optimization strategy for peak and valley value prediction enables the model to more accurately capture the key features in the data, thereby significantly improving the prediction accuracy of peak and valley values in sequence data.
[0108] In this embodiment, in step S4, the TCN model includes a causal convolution layer, a dilated convolution layer, a residual block network structure and an attention mechanism network structure;
[0109] Specifically, the causal convolutional layer is used as the basic architecture of TCN to ensure that the network output depends only on the input of the current and historical moments, thereby avoiding the "leakage" of information from the future to the past. t , …, x T ), the output y at time t t Determined only by the current and previous inputs, x t , xt-1 , x t-2 , …thus achieving strict time constraints.
[0110] To solve the problem of limited receptive field of causal convolution layer, the present invention introduces dilated convolution layer. Dilated convolution applies dilation factor d to filter feature f, so that the network can scan the input sequence with a larger stride, thereby expanding the receptive field. Specifically, for one-dimensional time series input feature X = (x0, x1, ..., x t , …, x T ), the dilated convolution H(·) operation on the time series element T is defined as:
[0111]
[0112] Where n is the filter size; d is the expansion factor; X* d This is achieved by applying a dilation factor d to the input feature X; T-di represents the past direction.
[0113] By adjusting n and d, the present invention can increase the network receptive field range, receive a wider input range, and improve the model operation efficiency in a parallel manner. The structural diagram of the expanded convolution layer is shown in Figure 4 shown.
[0114] In order to solve the problem of gradient vanishing and training instability that occurs as the number of network layers increases, the present invention adopts a residual block network structure. Each residual block includes a main path that performs a transformation operation on the input value X(h-1) and a 1×1 convolution bypass to maintain the consistency of the number of features. The output X(h) of the hth residual block is calculated as:
[0115] X (h) =δ(F(X (h-1) )+X (h-1) )
[0116] In the formula, δ is the activation function, which is a function used to introduce nonlinear characteristics. In neural networks, the main function of the activation function is to convert the result of linear transformation into nonlinearity, so that the network can process more complex data and models. In this formula, δ activates the output of the residual block to ensure the nonlinear representation of the features. F(·) includes dilated convolutional layers, weight parameter layers, activation layers, and random dropout layers.
[0117] The dilated causal convolution layer combines causal convolution and dilated convolution to extract the features of the input sequence. The weight layer accelerates network training by limiting the convolution weights. The activation layer uses the ReLU activation function to achieve nonlinear mapping. The random dropout layer is used as a regularization technique to prevent overfitting and promote the propagation of gradients in the network.
[0118] The present invention utilizes a TCN structure that can effectively process long-term time series information. Through the design of causal convolution, dilated convolution and residual block network, deep learning of time series data is realized while ensuring the stability of the model and the training efficiency.
[0119] The present invention adopts an attention mechanism to enhance the features. The mechanism scores the importance of the input features by weighted summation and adjusts the weight of each feature accordingly.
[0120] The output expression of the attention mechanism network structure is:
[0121]
[0122] Where K is the key vector; V is the value vector; Q is the query vector; d k is the dimension K of the key vector K T is the transpose of the key vector; the Softmax function is used to normalize the weights so that the sum of the weights is 1.
[0123] Assume that the output features of the previous layer are {x1,x2,…x n}, after the attention mechanism assigns weights, the input features will be converted into weighted features {w1x1,w2x2,…w n x n}, where w i is feature x i The weight of .
[0124] See also Figure 5 , the attention mechanism network structure includes weighted summation, Softmax activation function and fully connected output layer; through the processing of these layers, the feature representation enhanced by the attention mechanism is finally obtained.
[0125] In summary, the present invention obtains the total power consumption data of the power grid, the controlled load consumption data and the total power generation data of the solar energy system; obtains the net power load data according to the total power consumption data of the power grid, the controlled load consumption data and the total power generation data of the solar energy system; pre-processes the net power load data to obtain the net load power time series data; constructs a data reorganization system, and reorganizes the net load power time series data through the data reorganization system to obtain the reorganized net load power time series data; sets a peak-valley value loss function, and adjusts the hyperparameters of the peak-valley value loss function through a bidirectional dynamic parameter adjustment strategy so that the peak-valley value loss function meets the training requirements of the set TCN model; constructs a TCN model, and trains the TCN model through the peak-valley value loss function; inputs the reorganized net load power time series data into the trained TCN model, and predicts the reorganized net load power time series data through the TCN model, and outputs the prediction result of the peak-valley value of the net power load of the power system. Aiming at the problem of low prediction accuracy of peak and valley values in existing net load forecasting, the present invention adopts phase space reconstruction technology to combine historical and future data to better capture the long-term dependency problem of time series. Position encoding is added to mine the regular features between sequences and the correlation between features to better capture the periodic characteristics of peak and valley values. The Mask masking technology in the BERT model is used to add the left and right information of the masked part to the prediction to better capture the fluctuation of peak and valley values. The attention mechanism is introduced into the TCN model to give weighted attention to key time points and enhance the model's ability to capture peak and valley values and their fluctuations. A new peak and valley loss function is proposed. By introducing the horizontal coordinate difference of the peak and valley values into the loss function and using dynamic parameter adjustment, it is ensured that the model can accurately predict the mutation extreme value and the time point of occurrence in the sequence. The method of the present invention is of great significance for improving the operating efficiency of the power system and promoting the safe, economical and efficient operation of the new energy power system.
[0126] It should be noted that the method of the embodiment of the present disclosure can be performed by a single device, such as a computer or a server. The method of the present embodiment can also be applied in a distributed scenario and completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices can only perform one or more steps in the method of the embodiment of the present disclosure, and the multiple devices will interact with each other to complete the described method.
[0127] It should be noted that the above describes some embodiments of the present disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the above embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0128] Example 2
[0129] See also Figure 6 Embodiment 2 of the present invention further provides a net load peak-valley value prediction and optimization device based on TCN, which adopts a net load peak-valley value prediction and optimization method based on TCN in the above embodiment 1, including:
[0130] The net power load data acquisition and preprocessing module 001 is used to acquire the total power consumption data of the power grid, the controlled load consumption data and the total power generation data of the solar energy system; obtain the net power load data according to the total power consumption data of the power grid, the controlled load consumption data and the total power generation data of the solar energy system; preprocess the net power load data to obtain the net load power time series data;
[0131] The data reorganization system construction and processing module 002 is used to construct a data reorganization system, and to reorganize the net load power time series data through the data reorganization system to obtain the reorganized net load power time series data;
[0132] The peak-valley value loss function setting and adjustment module 003 is used to set the peak-valley value loss function, and adjust the hyperparameters of the peak-valley value loss function through a bidirectional dynamic parameter adjustment strategy so that the peak-valley value loss function meets the training requirements of the set TCN model;
[0133] The TCN model construction and processing module 004 is used to construct a TCN model and train the TCN model through the peak-valley value loss function; input the reorganized net load power time series data into the trained TCN model, predict and process the reorganized net load power time series data through the TCN model, and output the prediction result of the peak-valley value of the net power load of the power system.
[0134] In this embodiment, in the net power load data acquisition and preprocessing module 001, the formula for obtaining the net power load data according to the total power consumption data of the power grid, the controlled load consumption data and the total power generation data of the solar energy system is:
[0135] L(t)=GC+CL-GG
[0136] Where L(t) is the net power load data; GC is the total power consumption data of the power grid; CL is the controlled load consumption data; GG is the total power generation data of the solar energy system.
[0137] In this embodiment, in the data reorganization system construction and processing module 002, the submodules for reorganizing the net load power time series data through the data reorganization system include:
[0138] The phase space reconstruction submodule 201 is used to perform phase space reconstruction processing on the net load power time series data to obtain reconstructed net load power time series data;
[0139] A position coding submodule 202 is used to perform position coding processing on the reconstructed net load power time series data to obtain the position-coded net load power time series data;
[0140] The Mask submodule 203 is used to perform Mask processing on the net load power time series data after the position encoding;
[0141] The data normalization submodule 204 is used to adopt a Min-Max normalization strategy to perform data normalization processing on the position-encoded net load power time series data after the Mask processing is completed, so as to obtain the reorganized net load power time series data.
[0142] In this embodiment, in the peak-to-valley value loss function setting and adjustment module 003, the peak-to-valley value loss function expression is:
[0143] L=L RMSE *(1+α*pd+β*vd)
[0144] Where, L RMSE is the local root mean square error; pd is the peak horizontal coordinate difference; vd is the valley horizontal coordinate difference; α and β are weight coefficients, ranging from 0.1 to 1.0.
[0145] In this embodiment, in the TCN model construction and processing module 004, the TCN model includes a causal convolution layer, a dilated convolution layer, a residual block network structure and an attention mechanism network structure;
[0146] The attention mechanism network structure includes a weighted sum function, a Softmax activation function and a fully connected output layer;
[0147] The output expression of the attention mechanism network structure is:
[0148]
[0149] Where K is the key vector; V is the value vector; Q is the query vector; d k is the dimension of the key vector K; K T is the transpose of the key vector; the Softmax function is used to normalize the weights so that the sum of the weights is 1.
[0150] It should be noted that the information interaction, execution process and other contents between the modules of the above-mentioned device are based on the same concept as the method embodiment in Example 1 of the present application, and the technical effects they bring are the same as those of the method embodiment of the present application. For specific contents, please refer to the description in the method embodiment shown in the previous part of the present application, and will not be repeated here.
[0151] Example 3
[0152] Embodiment 3 of the present invention provides a non-transitory computer-readable storage medium, in which a program code for a net load peak-valley value prediction and optimization method based on TCN is stored. The program code includes instructions for executing embodiment 1 or any possible implementation method of a net load peak-valley value prediction and optimization method based on TCN.
[0153] The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or a data center that includes one or more available media. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).
[0154] Example 4
[0155] Embodiment 4 of the present invention provides an electronic device, including: a memory and a processor;
[0156] The processor and the memory communicate with each other via a bus; the memory stores program instructions that can be executed by the processor, and the processor calls the program instructions to execute a net load peak and valley value prediction and optimization method based on TCN in Example 1 or any possible implementation thereof.
[0157] Specifically, the processor can be implemented by hardware or by software. When implemented by hardware, the processor can be a logic circuit, an integrated circuit, etc.; when implemented by software, the processor can be a general-purpose processor implemented by reading software codes stored in a memory. The memory can be integrated in the processor or can be located outside the processor and exist independently.
[0158] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center.
[0159] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0160] Although the present invention has been described in detail above by general description and specific embodiments, it is obvious to those skilled in the art that some modifications or improvements can be made to the present invention. Therefore, these modifications or improvements made without departing from the spirit of the present invention all belong to the scope of protection claimed by the present invention.
Claims
1. A method for predicting and optimizing net load peak and valley values based on TCN, characterized in that: include: Obtaining data on total power consumption of the power grid, controlled load consumption, and total power generation of the solar energy system; Obtaining net load power data according to the total power consumption data of the power grid, the controlled load consumption data and the total power generation data of the solar energy system; preprocessing the net load power data to obtain net load power time series data; Constructing a data reorganization system, and reorganizing the net load power time series data through the data reorganization system to obtain reorganized net load power time series data; Setting a peak-valley loss function, and adjusting the hyperparameters of the peak-valley loss function through a bidirectional dynamic parameter adjustment strategy so that the peak-valley loss function meets the training requirements of the set TCN model; Constructing a TCN model, and training the TCN model by using the peak-valley value loss function; inputting the reorganized net load power time series data into the trained TCN model, performing prediction processing on the reorganized net load power time series data by using the TCN model, and outputting the prediction result of the peak-valley value of the net load power of the power system; The step of reorganizing the net load power time series data by the data reorganization system comprises: Performing phase space reconstruction processing on the net load power time series data to obtain reconstructed net load power time series data; Performing position coding processing on the reconstructed net load power time series data to obtain position-coded net load power time series data; Performing Mask processing on the net load power time series data after the position encoding; A Min-Max normalization strategy is adopted to perform data normalization processing on the net load power time series data after the position encoding after the Mask processing is completed, so as to obtain the reorganized net load power time series data; The expression of the peak-to-valley loss function L is: L=L RMSE *(1+a*pd+b*vd) Where, L RMSE is the local root mean square error; pd is the peak horizontal coordinate difference; vd is the valley horizontal coordinate difference; α and β are weight coefficients, ranging from 0.1 to 1.
0.
2. A method for predicting and optimizing net load peak and valley values based on TCN according to claim 1, characterized in that: The formula for obtaining the net load power data according to the total power consumption data of the power grid, the controlled load consumption data and the total power generation data of the solar energy system is: L(t)=GC+CL-GG Where L(t) is the net load power data; GC is the total power consumption data of the power grid; CL is the controlled load consumption data; GG is the total power generation data of the solar energy system.
3. The method for predicting and optimizing net load peak and valley values based on TCN according to claim 1 is characterized in that: The TCN model includes a causal convolution layer, an expansion convolution layer, a residual block network structure and an attention mechanism network structure; The attention mechanism network structure includes a weighted sum function, a Softmax activation function and a fully connected output layer; The output expression of the attention mechanism network structure is: Where K is the key vector; V is the value vector; Q is the query vector; d k is the dimension of the key vector K; K T is the transpose of the key vector; the Softmax function is used to normalize the weights so that the sum of the weights is 1.
4. A net load peak-valley value prediction and optimization device based on TCN, adopting a net load peak-valley value prediction and optimization method based on TCN according to any one of claims 1 to 3, characterized in that: include: Net load power data acquisition and preprocessing module, used to acquire total power consumption data of the power grid, controlled load consumption data and total power generation data of the solar energy system; Obtaining net load power data according to the total power consumption data of the power grid, the controlled load consumption data and the total power generation data of the solar energy system; preprocessing the net load power data to obtain net load power time series data; A data reorganization system construction and processing module is used to construct a data reorganization system, and to reorganize the net load power time series data through the data reorganization system to obtain reorganized net load power time series data; A peak-valley value loss function setting and adjustment module is used to set the peak-valley value loss function and adjust the hyperparameters of the peak-valley value loss function through a bidirectional dynamic parameter adjustment strategy so that the peak-valley value loss function meets the training requirements of the set TCN model; The TCN model construction and processing module is used to construct a TCN model and train the TCN model through the peak-valley value loss function; the reorganized net load power time series data is input into the trained TCN model, and the reorganized net load power time series data is predicted and processed through the TCN model to output the prediction result of the peak-valley value of the net load power of the power system.
5. The device for predicting and optimizing net load peak and valley values based on TCN according to claim 4, characterized in that: In the net load power data acquisition and preprocessing module, the formula for obtaining the net load power data according to the total power consumption data of the power grid, the controlled load consumption data and the total power generation data of the solar energy system is: L(t)=GC+CL-GG Where L(t) is the net load power data; GC is the total power consumption data of the power grid; CL is the controlled load consumption data; GG is the total power generation data of the solar energy system.
6. A TCN-based net load peak-valley value prediction and optimization device according to claim 5, characterized in that: In the data reorganization system construction and processing module, the submodule for reorganizing the net load power time series data through the data reorganization system includes: A phase space reconstruction submodule is used to perform phase space reconstruction processing on the net load power time series data to obtain reconstructed net load power time series data; A position coding submodule, used for performing position coding processing on the reconstructed net load power time series data to obtain the position-coded net load power time series data; The Mask submodule is used to perform Mask processing on the net load power time series data after the position encoding; The data normalization submodule is used to adopt the Min-Max normalization strategy to perform data normalization processing on the net load power time series data after the position encoding after the Mask processing is completed, so as to obtain the reorganized net load power time series data.
7. The device for predicting and optimizing net load peak and valley values based on TCN according to claim 6, characterized in that: In the peak-to-valley value loss function setting and adjustment module, the expression of the peak-to-valley value loss function L is: L=L RMSE *(1+a*pd+b*vd) Where, L RMSE is the local root mean square error; pd is the peak horizontal coordinate difference; vd is the valley horizontal coordinate difference; α and β are weight coefficients, ranging from 0.1 to 1.
0.
8. The device for predicting and optimizing net load peak and valley values based on TCN according to claim 7, characterized in that: In the TCN model construction and processing module, the TCN model includes a causal convolution layer, an expansion convolution layer, a residual block network structure and an attention mechanism network structure; The attention mechanism network structure includes a weighted sum function, a Softmax activation function and a fully connected output layer; The output expression of the attention mechanism network structure is: Where K is the key vector; V is the value vector; Q is the query vector; d k is the dimension of the key vector K; K T is the transpose of the key vector; the Softmax function is used to normalize the weights so that the sum of the weights is 1.
Citation Information
Patent Citations
Ultra-short-term net load prediction method based on phase space reconstruction and deep neural network
CN110263984A
Power load prediction method and system based on modal decomposition and batch decomposition
CN118095529A