Multi-step forecasting method for adjustable load power based on improved TCN to correct cumulative error
Through the improved time convolution network (TCN) method, combined with multi-scale convolution and self-attention mechanism, the problem of error accumulation in multi-step prediction of adjustable load power is solved, achieving higher prediction accuracy and stability.
Patent Information
- Application Number
- CN202111348852.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-15
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2041-11-15
AI Technical Summary
The prior art has error accumulation problems in multi-step prediction of adjustable load power, resulting in low prediction accuracy and stability.
Using a method based on improved TCN, the temporal and spatial characteristics of the adjustable load power sequence are extracted through multi-scale convolution and self-attention mechanisms, and a single-step and multi-step prediction model is constructed to reduce error accumulation.
It effectively reduces the accumulation of errors in multi-step prediction of adjustable load power, improves prediction accuracy and stability, and the smoothed noise sequence reduces the impact of noise on the prediction results.
Smart Images

Figure CN114066052B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of adjustable load prediction, and in particular relates to an adjustable load power multi-step prediction method based on improved TCN to correct cumulative errors. Background Art
[0002] With the continuous advancement of my country's energy development strategy, the in-depth promotion of electricity market-oriented reforms and the upgrading of the power industry, the active participation of adjustable load resources in source-grid-load interaction will have a significant positive effect on the power grid.
[0003] At present, various types of adjustable load resources such as industry, buildings, customer-side energy storage, and charging piles are gradually involved in power grid dispatching. Since the amount of individual resources is small and the location is relatively scattered, they are generally aggregated into a larger resource aggregate for dispatching and control. When aggregating resources, once the load inside the aggregate has a large deviation, it will cause a large power error for the entire aggregate, seriously affecting its participation in power grid dispatching and operation, causing large economic losses. Therefore, it is proposed to study the problem of accurate prediction of adjustable load resource power.
[0004] In the prior art, load forecasting methods have great difficulties in determining the order, solving and identifying some models. At the same time, the model's adaptability is not strong, which often leads to problems such as slow data calculation and low accuracy. In addition, the grey prediction method, expert system method, wavelet analysis method and neural network method not only need to consider factors such as load shape, but also involve many external factors, such as environment, weather, etc., which will affect the accuracy of load forecasting. There are three main types of relatively accurate prediction methods: statistical method, physical method and combined prediction method. The disadvantage of single-step prediction of adjustable load power based on physical method is that there is a large error between NWP data and real load environment data, and there is a spatial difference between NWP data and adjustable load scenarios, which makes the single-step prediction accuracy of adjustable load power by physical method generally low; statistical method is an adjustable load power prediction method that updates and adjusts model weights and parameters based on the error between predicted value and real value. This method is usually divided into probability statistical model, machine learning model and deep learning model. Probabilistic statistical model can better follow the changing trend of adjustable load power than physical method, but there is a large error in multi-step prediction; the single-step prediction accuracy of machine learning model is better than traditional probability model; The deep learning model can fully explore the temporal and spatial characteristics of the input sequence, and further improve the accuracy of the single-step prediction of the adjustable load power. Due to its single structure and high requirements on data quality, it is difficult to accurately and stably predict the adjustable load power sequence with strong randomness and obvious noise signals in multiple steps. The combined prediction method is a method of predicting adjustable load power with higher prediction accuracy and better stability formed by combining the advantages of each single prediction model. It is generally used in the multi-step prediction of adjustable load power. The combined prediction model performs better than other models on multiple time scales. Compared with the physical method and the statistical method, the combined prediction method has better prediction performance, but does not provide a corresponding solution to the problem of cumulative multi-step prediction errors. Therefore, how to correct the accumulated error to perform multi-step prediction of adjustable load power is a problem that needs to be solved urgently. Summary of the invention
[0005] In order to solve the deficiencies in the prior art, the purpose of the present invention is to provide a multi-step prediction method for adjustable load power based on improved TCN correction of cumulative error, reduce the error accumulation in the multi-step prediction of adjustable load power, and improve the prediction accuracy and stability.
[0006] The present invention adopts the following technical solution.
[0007] The adjustable load power multi-step prediction method based on improved TCN corrected cumulative error includes:
[0008] Step 1, collecting and preprocessing the historical data of adjustable load power to obtain an adjustable load power sequence;
[0009] Step 2, using variational mode decomposition method to decompose the adjustable load power sequence to obtain a principal component sequence and a noise sequence;
[0010] Step 3, using an adaptive moving smoothing method to smooth the noise sequence;
[0011] Step 4: construct a model based on the multi-scale convolution method and the self-attention method; take the smoothed noise sequence as the model input, use the multi-scale convolution method to obtain the temporal and spatial characteristics of the adjustable load power sequence, and use the self-attention method to obtain the mapping relationship between the adjustable load prediction value and the adjustable load power historical data;
[0012] Step 5, taking the time characteristics and spatial characteristics of the adjustable load power sequence as input, and establishing a single-step prediction model of the adjustable load power based on a single multi-input single-output temporal convolutional network;
[0013] Step 6: Based on the single-step prediction model, a multi-step prediction model for adjustable load power is established by using a trained multi-input and multi-output temporal convolutional network (TCN) as a decoding layer and a model based on a multi-scale convolution method and a self-attention method as an encoding layer;
[0014] Step 7, select a prediction model according to the number of prediction steps, that is, select a single-step prediction model for single-step prediction and select a multi-step prediction model for multi-step prediction, and use the selected prediction model to predict the adjustable load power.
[0015] Preferably, in step 1, every 15 minutes is a sampling moment, and historical data of the instantaneous active power of the adjustable load is collected.
[0016] Preferably, in step 1, preprocessing the historical data of the instantaneous active power of the adjustable load includes: outlier processing, vacancy filling and normalization processing;
[0017] Abnormal values include: negative values, power values exceeding full load, and garbled codes. Among them, negative values are processed by directly setting them to zero; power values exceeding full load and garbled codes are processed by using the adjustable load instantaneous active power at the two sampling moments before and after to correct the power values exceeding full load and garbled codes.
[0018] The method of filling the missing value is to use the instantaneous active power of the adjustable load at the two previous and subsequent sampling moments to fill the missing value.
[0019] Preferably, step 2 comprises:
[0020] Step 2.1: Use variational mode decomposition method to decompose the adjustable load power sequence P into the principal component sequence u m and noise sequence E; the constraint condition is that the sum of all modes is equal to the adjustable load power sequence P, and the constrained variation satisfies the following relationship:
[0021]
[0022] In the formula,
[0023] u m = {u i},u i is the i-th modal component obtained by variational mode decomposition, i = 1, 2, …, m,
[0024] ω m ={ω i},ω i is the i-th modal component u i The center frequency, i = 1, 2, ..., m,
[0025] m is the total number of modal components,
[0026] j is the imaginary part in the complex frequency domain,
[0027] is the square expression of the two-norm,
[0028] δ(t) is the impulse function at time t,
[0029] is the first-order partial derivative at time t,
[0030] u m (t) is the principal component sequence at time t;
[0031] Step 2.2, introduce Lagrange multipliers and quadratic penalty functions to convert constrained variation into unconstrained variation, satisfying the following relationship:
[0032]
[0033] In the formula,
[0034] λ(t) is the Lagrange multiplier at time t,
[0035] α is a quadratic penalty function,
[0036] P(t) is the historical data of adjustable load power at time t;
[0037] Step 2.3, based on unconstrained variation, the alternating direction multiplier method iterative algorithm is used in combination with Parseval theorem, Plancherel theorem and Fourier isometric transform to perform optimization iteration on each modal component, the center frequency of each modal component and the Lagrange multiplier; after alternating optimization iteration n+1 times, the principal component sequence u is obtained. m , satisfying the following relationship:
[0038]
[0039]
[0040]
[0041] In the formula,
[0042] is the modal component after the n+1th iteration The Fourier transform of , where ω corresponds to the time domain t,
[0043] is the modal component after the nth iteration The Fourier transform of
[0044] is the i-th modal component u at time t i The Fourier transform of (t),
[0045] is the Fourier transform of the adjustable load power historical data P(t),
[0046] is the Lagrange multiplier λ after the n+1th iteration n+1 The Fourier transform of (t),
[0047] is the Lagrange multiplier λ after the nth iteration n The Fourier transform of (t),
[0048] is the Fourier transform of the Lagrange multiplier λ(t),
[0049] τ is the noise tolerance;
[0050] Step 2.4, using the principal component sequence u m and the adjustable load power history data P(t), we get the noise sequence E = {e1, e2, e3, …, e T}, satisfying the following relationship:
[0051]
[0052] Wherein, t=1,2,…,T, T is the total number of noise components, that is, the length of the noise sequence.
[0053] Preferably, step 3 comprises:
[0054] Step 3.1, for the noise sequence E = {e1, e2, e3, …, e T}, the mean μ of the noise sequence in the moving window of length N e and variance σ e 2 Satisfies the following relationship:
[0055]
[0056]
[0057] In the formula, e k is the element of the noise sequence in the moving window at time t, k = t+1, t+2, … t+N;
[0058] Step 3.2, based on the adaptive moving smoothing method, using the mean μ e and variance σ e 2 The noise sequence E in the moving window at time t is smoothed to satisfy the following relationship:
[0059]
[0060] In the formula,
[0061] f(e k ,μ e ,σ e 2 ) is the sum of the error values of the points that conform to the 3σ principle in the moving window, satisfying the following relationship:
[0062]
[0063] flag(e k ,μ e ,σ e 2 ) is the sum of the number of points that conform to the 3σ principle in the moving window, satisfying the following relationship:
[0064]
[0065] is the noise sequence after smoothing.
[0066] Preferably, in step 4, a model based on a multi-scale convolution method and a self-attention method is used, and a multi-scale convolution method is used to extract the temporal and spatial characteristics of the adjustable load power sequence from the smoothed noise sequence; a self-attention method is used to obtain the correlation between the temporal and spatial characteristics; important features in the temporal and spatial features are extracted based on the correlation, and the correlation between the important features and the adjustable load power sequence is used as a mapping relationship between the adjustable load prediction value and the adjustable load power historical data.
[0067] Preferably, step 4 comprises:
[0068] Step 4.1: Use multi-scale convolution method to extract the smoothed noise sequence Extract the temporal and spatial characteristics of adjustable load power sequence;
[0069]
[0070] In the formula,
[0071] c m is the output of multi-scale convolution, that is, the temporal and spatial features of the principal component sequence,
[0072] is the noise sequence after smoothing,
[0073] * is the convolution operation,
[0074] K r is the scale of the r-th convolution kernel, r = 1, 2, ..., L,
[0075] is the jth temporal convolution kernel of the rth layer, with a size of 1×K r , where j = 1, 2, ..., n, n is the total number of temporal convolution kernels,
[0076] is the spatial convolution kernel of the rth layer, with a size of L×1,
[0077] L is the number of input features;
[0078] Step 4.2, using the self-attention method to extract the correlation between temporal features and spatial features, and generate the correlation coefficient and mapping relationship of temporal and spatial features;
[0079] Among them, the QKV model of the self-attention method satisfies the following relationship:
[0080]
[0081]
[0082]
[0083] In the formula,
[0084] I SA To utilize the output c of multi-scale convolution m The n×m matrix is composed of m, where m is the total number of modal components and n is the total number of time convolution kernels.
[0085] is the weight matrix of the QKV model, where * represents Q, K, and V, and the size of the weight matrix is n×n.
[0086] is the bias matrix of the QKV model, where * represents Q, K, and V, and the size of the bias matrix is n×m;
[0087] The correlation coefficients of spatiotemporal features are calculated using matrices Q and K, and matrix V represents the mapping relationship of spatiotemporal features;
[0088] Step 4.3, use S = softmax (QK) V function to calculate the weight matrix, extract the important features in the time features and spatial features according to the weight matrix, and use the correlation between the important features and the adjustable load power sequence as the mapping relationship between the adjustable load prediction value and the adjustable load power historical data.
[0089] Preferably, step 5 comprises:
[0090] Step 5.1, taking the time characteristics and spatial characteristics of the adjustable load power sequence as the input data set, and dividing the input data set into a training set and a test set;
[0091] Step 5.2, using a single multi-input single-output temporal convolutional network as a decoding layer and a model based on a multi-scale convolution method and a self-attention method as an encoding layer, a single-step prediction model for adjustable load power is established;
[0092] Step 5.3, using the training set to train the single-step prediction model;
[0093] In step 5.4, the trained model is used as the final single-step prediction model.
[0094] Preferably, step 6 comprises:
[0095] Step 6.1, taking the time characteristics and spatial characteristics of the adjustable load power sequence as the input data set, and dividing the input data set into a training set and a test set;
[0096] Step 6.2, based on the final single-step prediction model, multiple temporal convolutional networks are connected in parallel through a fully connected layer;
[0097] Step 6.3, under various prediction step sizes, multiple parallel temporal convolutional networks are trained with the training set, and the minimum deviation between the output value of the temporal convolutional network and the actual value is used as the iteration control index. After multiple iterative updates, a set of nonlinear mapping relationships between multiple inputs and multiple outputs under various prediction step sizes is obtained;
[0098] Step 6.4, according to the set of nonlinear mapping relationships, the final multi-input and multi-output temporal convolutional network is trained, where the output of any temporal convolutional network is F n is the number of filters in the temporal convolutional network;
[0099] In step 6.5, the final multi-input multi-output temporal convolutional network is used as the decoding layer, and the model based on the multi-scale convolution method and the self-attention method is used as the encoding layer. After linear transformation and the introduction of the ReLU function, a multi-step prediction model for adjustable load power is established to satisfy the following relationship:
[0100]
[0101] In the formula,
[0102] y d is the predicted value at step d,
[0103] is the weight of the predicted output at step d,
[0104] b d is the bias for predicting the output at step d.
[0105] Preferably, in step 7, the number of prediction steps in the prediction time period is determined according to the sampling step length, wherein every 15 minutes is one sampling moment, that is, the length of the sampling step length is 15 minutes.
[0106] Preferably, step 7 further includes evaluating the performance of the prediction model using mean absolute error and root mean square error, as follows:
[0107] 1) Mean absolute error MAE, satisfies the following relationship:
[0108]
[0109] 2) Root mean square error RMSE, which satisfies the following relationship:
[0110]
[0111] In the above two equations, y d and are the predicted value and true value of the dth step respectively, d = 1, 2, …, D, and D is the number of prediction steps.
[0112] Preferably, step 7 also includes calculating the first lift P of the prediction model using the mean absolute error MAE MAE , satisfying the following relationship:
[0113]
[0114] In the formula,
[0115] Model1 MAE is the mean absolute error MAE of the single-step prediction model or the multi-step prediction model,
[0116] Model2 MAE is the mean absolute error MAE of the single-step prediction model;
[0117] The second lift P of the prediction model is calculated using the root mean square error RMSE RMSE , satisfying the following relationship:
[0118]
[0119] In the formula,
[0120] Model1 RMSE is the root mean square error RMSE of the single-step prediction model or the multi-step prediction model,
[0121] Model2 RMSE is the root mean square error RMSE of the single-step prediction model.
[0122] Preferably, for the multi-step prediction model, step 7 further includes calculating the average absolute error cumulative value Adde from the prediction step length a to the prediction step length b using the mean absolute error MAE: MAE,ab , satisfying the following relationship:
[0123] Adde MAE,ab =MAE a -MAE b a>b
[0124] In the formula,
[0125] MAE a is the mean absolute error MAE when the prediction step length is a,
[0126] MAE b is the mean absolute error MAE when the prediction step length is b;
[0127] For the multi-step prediction model, step 7 also includes calculating the root mean square error cumulative value Adde from prediction step a to prediction step b using the root mean square error RMSE. RMSE,ab , satisfying the following relationship:
[0128] Add eRMSE,ab =RMSE a -RMSE b a>b
[0129] In the formula,
[0130] RMSE a is the root mean square error RMSE when the prediction step length is a,
[0131] RMSE b It is the root mean square error RMSEb when the prediction step size is b.
[0132] The beneficial effects of the present invention are as follows:
[0133] 1. The single-step prediction model based on multi-scale convolution method and self-attention method effectively repairs the ability of TCN's single-scale convolution kernel to extract input sequence features. Multi-scale convolution and self-attention are used to extract temporal and spatial features of different scales of the input sequence, which improves the prediction accuracy and stability of the model.
[0134] 2. The multi-step prediction model effectively restores the ability of a single TCN to mine the mapping relationship between multiple inputs and multiple outputs. It reduces the impact of the previous step prediction error on the prediction through multi-channel TCN technology, and effectively reduces the error accumulation of the multi-step prediction of the adjustable load power.
[0135] 3. The prediction model and method in the prior art use the result of the previous step prediction to predict the data of the next step when performing multi-step prediction. The prediction result itself will have errors, and the error accumulation will be formed in the process of performing multi-step prediction. In the present invention, multi-channel TCN and multi-output TCN are used to perform multi-step prediction on the same set of data, which avoids the error accumulation of the prediction result and makes full use of the same set of data for multi-step prediction, thereby effectively reducing the error accumulation in the multi-step prediction of adjustable load power.
[0136] 4. The smoothed noise sequence is used to reduce the impact of noise on the output prediction results. BRIEF DESCRIPTION OF THE DRAWINGS
[0137] Figure 1 It is a block diagram of the steps of the adjustable load power multi-step prediction method based on improved TCN correction of cumulative error of the present invention;
[0138] Figure 2 A flowchart of a method in one embodiment of the present invention;
[0139] Figure 3 A schematic diagram of the structure of a prediction model in one embodiment of the present invention;
[0140] Figure 4Schematic diagram of the structure of a multi-output temporal convolutional network in one embodiment of the present invention;
[0141] Figure 5 A comparison diagram of prediction results of different models of electric vehicles in one embodiment of the present invention;
[0142] Figure 6 This is a comparison chart of prediction results of different air conditioning load models in one embodiment of the present invention. DETAILED DESCRIPTION
[0143] The present application is further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and cannot be used to limit the protection scope of the present application.
[0144] Example 1.
[0145] like Figure 1 and Figure 2 , the adjustable load power multi-step prediction method based on improved TCN corrected cumulative error includes steps 1 to 7, as follows:
[0146] Step 1: collect and preprocess the historical data of adjustable load power to obtain an adjustable load power sequence.
[0147] Specifically, in step 1, every 15 minutes is a sampling moment, and historical data of the instantaneous active power of the adjustable load is collected.
[0148] Specifically, in step 1, preprocessing the historical data of the instantaneous active power of the adjustable load includes: outlier processing, vacancy filling and normalization processing;
[0149] Abnormal values include: negative values, power values exceeding full load, and garbled codes. Among them, negative values are processed by directly setting them to zero; power values exceeding full load and garbled codes are processed by using the adjustable load instantaneous active power at the two sampling moments before and after to correct the power values exceeding full load and garbled codes.
[0150] The method of filling the vacancy value is to use the instantaneous active power of the adjustable load at the two previous and next sampling moments to fill the vacancy value;
[0151] The historical data is normalized to satisfy the following relationship:
[0152]
[0153] Where P g ″ is the adjustable load power at sampling time g after normalization, P g ′ is the adjustable load power at sampling time g before normalization, and P′ is the adjustable load power sequence after outlier processing and missing value filling.
[0154] Step 2: Decompose the adjustable load power sequence using the variational mode decomposition method to obtain the principal component sequence and the noise sequence.
[0155] Specifically, step 2 includes:
[0156] Step 2.1: Use variational mode decomposition method to decompose the adjustable load power sequence P into the principal component sequence u m and noise sequence E; the constraint condition is that the sum of all modes is equal to the adjustable load power sequence P, and the constrained variation satisfies the following relationship:
[0157]
[0158] In the formula,
[0159] u m = {u i},u i is the i-th modal component obtained by variational mode decomposition, i = 1, 2, …, m,
[0160] ω m ={ω i},ω i is the i-th modal component u i The center frequency, i = 1, 2, ..., m,
[0161] m is the total number of modal components,
[0162] j is the imaginary part in the complex frequency domain,
[0163] is the square expression of the two-norm,
[0164] δ(t) is the impulse function at time t,
[0165] is the first-order partial derivative at time t,
[0166] u m (t) is the principal component sequence at time t;
[0167] Step 2.2, introduce Lagrange multipliers and quadratic penalty functions to convert constrained variation into unconstrained variation, satisfying the following relationship:
[0168]
[0169] In the formula,
[0170] λ(t) is the Lagrange multiplier at time t,
[0171] α is a quadratic penalty function,
[0172] P(t) is the historical data of adjustable load power at time t;
[0173] Step 2.3, based on unconstrained variation, the alternating direction multiplier method iterative algorithm is used in combination with Parseval theorem, Plancherel theorem and Fourier isometric transform to perform optimization iteration on each modal component, the center frequency of each modal component and the Lagrange multiplier; after alternating optimization iteration n+1 times, the principal component sequence u is obtained. m , satisfying the following relationship:
[0174]
[0175]
[0176]
[0177] In the formula,
[0178] is the modal component after the n+1th iteration The Fourier transform of , where ω corresponds to the time domain t,
[0179] is the modal component after the nth iteration The Fourier transform of
[0180] is the i-th modal component u at time t i The Fourier transform of (t),
[0181] is the Fourier transform of the adjustable load power historical data P(t),
[0182] is the Lagrange multiplier λ after the n+1th iteration n+1 The Fourier transform of (t),
[0183] is the Lagrange multiplier λ after the nth iteration n The Fourier transform of (t),
[0184] is the Fourier transform of the Lagrange multiplier λ(t),
[0185] τ is the noise tolerance;
[0186] Step 2.4, using the principal component sequence u m and the adjustable load power history data P(t), we get the noise sequence E = {e1, e2, e3, …, e T}, satisfying the following relationship:
[0187]
[0188] Wherein, t=1,2,…,T, T is the total number of noise components, that is, the length of the noise sequence.
[0189] Step 3: Adopt adaptive moving smoothing method to smooth the noise sequence.
[0190] Specifically, step 3 includes:
[0191] Step 3.1, for the noise sequence E = {e1, e2, e3, …, e T}, the mean μ of the noise sequence in the moving window of length N e and variance σ e 2 Satisfies the following relationship:
[0192]
[0193]
[0194] In the formula, e k is the element of the noise sequence in the moving window at time t, k = t+1, t+2, … t+N;
[0195] Step 3.2, based on the adaptive moving smoothing method, using the mean μ e and variance σ e 2 The noise sequence E in the moving window at time t is smoothed to satisfy the following relationship:
[0196]
[0197] In the formula,
[0198] f(e k ,μ e ,σ e 2 ) is the sum of the error values of the points that conform to the 3σ principle in the moving window, satisfying the following relationship:
[0199]
[0200] flag(e k ,μ e ,σ e 2 ) is the sum of the number of points that conform to the 3σ principle in the moving window, satisfying the following relationship:
[0201]
[0202] is the noise sequence after smoothing.
[0203] Step 4, construct a model based on the multi-scale convolution method and the self-attention method; use the smoothed noise sequence as the model input, use the multi-scale convolution method to obtain the temporal and spatial characteristics of the adjustable load power sequence, and use the self-attention method to obtain the mapping relationship between the adjustable load prediction value and the adjustable load power historical data.
[0204] Specifically, in step 4, a model based on a multi-scale convolution method and a self-attention method is used, and a multi-scale convolution method is used to extract the temporal and spatial features of the adjustable load power sequence from the smoothed noise sequence; a self-attention method is used to obtain the correlation between the temporal and spatial features; important features in the temporal and spatial features are extracted based on the correlation, and the correlation between the important features and the adjustable load power sequence is used as a mapping relationship between the adjustable load prediction value and the adjustable load power historical data.
[0205] Specifically, step 4 includes:
[0206] Step 4.1: Use multi-scale convolution method to extract the smoothed noise sequence Extract the temporal and spatial characteristics of adjustable load power sequence;
[0207]
[0208] In the formula,
[0209] c m is the output of multi-scale convolution, that is, the temporal and spatial features of the principal component sequence,
[0210] is the noise sequence after smoothing,
[0211] * is the convolution operation,
[0212] K r is the scale of the r-th convolution kernel, r = 1, 2, ..., L,
[0213] is the jth temporal convolution kernel of the rth layer, with a size of 1×K r , where j = 1, 2, ..., n, n is the total number of temporal convolution kernels,
[0214] is the spatial convolution kernel of the rth layer, with a size of L×1,
[0215] L is the number of input features;
[0216] Step 4.2, using the self-attention method to extract the correlation between temporal features and spatial features, and generate the correlation coefficient and mapping relationship of temporal and spatial features;
[0217] Among them, the QKV model of the self-attention method satisfies the following relationship:
[0218]
[0219]
[0220]
[0221] In the formula,
[0222] I SA To utilize the output c of multi-scale convolution m The n×m matrix is composed of m, where m is the total number of modal components and n is the total number of time convolution kernels.
[0223] is the weight matrix of the QKV model, where * represents Q, K, and V, and the size of the weight matrix is n×n.
[0224] is the bias matrix of the QKV model, where * represents Q, K, and V, and the size of the bias matrix is n×m;
[0225] The correlation coefficients of spatiotemporal features are calculated using matrices Q and K, and matrix V represents the mapping relationship of spatiotemporal features;
[0226] Step 4.3, use S = softmax (QK) V function to calculate the weight matrix, extract the important features in the time features and spatial features according to the weight matrix, and use the correlation between the important features and the adjustable load power sequence as the mapping relationship between the adjustable load prediction value and the adjustable load power historical data.
[0227] Step 5: Taking the time characteristics and spatial characteristics of the adjustable load power sequence as input, a single-step prediction model of the adjustable load power is established based on a single multi-input single-output temporal convolutional network. The structure of the single-step prediction model is as follows: Figure 3 shown.
[0228] Figure 3 The prediction model shown in the figure includes: input layer, multi-scale convolution layer, self-attention mechanism layer, prediction layer and output layer; the multi-scale convolution layer includes m convolution calculation units of spatiotemporal features. By changing the number of TCN networks in the prediction layer, the distinction between single-step prediction model and multi-step prediction model can be achieved. That is, when TCN S When s is 1, it is a single-step prediction model.
[0229] Figure 3 In, x m represents the mth historical data in the input layer; c m It represents the spatiotemporal features obtained by processing the convolution calculation unit of m spatiotemporal features in the multi-scale convolution layer; in the self-attention mechanism layer, linear is a linear layer, which is a linear mapping of the inputs input, softmax is a solution function, and the QKV model is solved by the softmax function to obtain the output of the single-step prediction model, y_s represents the s-th prediction result in the output layer, TCN s Represents the sth TCN network, and each TCN network outputs a result.
[0230] Specifically, step 5 includes:
[0231] Step 5.1, taking the time characteristics and spatial characteristics of the adjustable load power sequence as the input data set, and dividing the input data set into a training set and a test set;
[0232] Step 5.2, using a single multi-input single-output temporal convolutional network as a decoding layer and a model based on a multi-scale convolution method and a self-attention method as an encoding layer, a single-step prediction model for adjustable load power is established;
[0233] Step 5.3, using the training set to train the single-step prediction model;
[0234] In step 5.4, the trained model is used as the final single-step prediction model.
[0235] Step 6: Based on the single-step prediction model, the trained multi-input multi-output temporal convolutional network is used as the decoding layer, and the model based on the multi-scale convolution method and the self-attention method is used as the encoding layer to establish a multi-step prediction model for adjustable load power. Figure 4 shown.
[0236] Figure 4 In the above example, relu is the name of the solution function, S n S is obtained by the softmax solution of the multi-temporal convolutional network and the self-attention mechanism. After the TCN network and linear mapping, the relu function is used to solve the final prediction result.
[0237] The structure of the multi-step prediction model is as follows Figure 3 As shown, when TCN S When s is greater than 1, it is a multi-step prediction model, and a multi-channel time convolutional network is used to extract the nonlinear mapping relationship between input and output of different prediction steps to reduce the cumulative error in the multi-step prediction of adjustable load power.
[0238] Specifically, step 6 includes:
[0239] Step 6.1, taking the time characteristics and spatial characteristics of the adjustable load power sequence as the input data set, and dividing the input data set into a training set and a test set;
[0240] Step 6.2, based on the final single-step prediction model, multiple temporal convolutional networks are connected in parallel through a fully connected layer;
[0241] Step 6.3, under various prediction step sizes, multiple parallel temporal convolutional networks are trained with the training set, and the minimum deviation between the output value of the temporal convolutional network and the actual value is used as the iteration control index. After multiple iterative updates, a set of nonlinear mapping relationships between multiple inputs and multiple outputs under various prediction step sizes is obtained;
[0242] Step 6.4, according to the set of nonlinear mapping relationships, the final multi-input and multi-output temporal convolutional network is trained, where the output of any temporal convolutional network is F n is the number of filters in the temporal convolutional network;
[0243] In step 6.5, the final multi-input multi-output temporal convolutional network is used as the decoding layer, and the model based on the multi-scale convolution method and the self-attention method is used as the encoding layer. After linear transformation and the introduction of the ReLU function, a multi-step prediction model for adjustable load power is established to satisfy the following relationship:
[0244]
[0245] In the formula,
[0246] y d is the predicted value at step d,
[0247] is the weight of the predicted output at step d,
[0248] b d is the bias for predicting the output at step d.
[0249] Step 7, select a prediction model according to the number of prediction steps, that is, select a single-step prediction model for single-step prediction and select a multi-step prediction model for multi-step prediction, and use the selected prediction model to predict the adjustable load power.
[0250] Specifically, in step 7, the number of prediction steps in the prediction time period is determined according to the sampling step length, wherein every 15 minutes is one sampling moment, that is, the length of the sampling step length is 15 minutes.
[0251] Specifically, step 7 also includes evaluating the performance of the prediction model using mean absolute error and root mean square error, as follows:
[0252] 1) Mean absolute error MAE, satisfies the following relationship:
[0253]
[0254] 2) Root mean square error RMSE, which satisfies the following relationship:
[0255]
[0256] In the above two equations, y d and are the predicted value and true value of the dth step respectively, d = 1, 2, …, D, and D is the number of prediction steps.
[0257] Specifically, step 7 also includes calculating the first lift P of the prediction model using the mean absolute error MAE MAE , satisfying the following relationship:
[0258]
[0259] In the formula,
[0260] Model1 MAE is the mean absolute error MAE of the single-step prediction model or the multi-step prediction model,
[0261] Model2 MAE is the mean absolute error MAE of the single-step prediction model;
[0262] The second lift P of the prediction model is calculated using the root mean square error RMSE RMSE , satisfying the following relationship:
[0263]
[0264] In the formula,
[0265] Model1 RMSE is the root mean square error RMSE of the single-step prediction model or the multi-step prediction model,
[0266] Model2 RMSE is the root mean square error RMSE of the single-step prediction model.
[0267] Specifically, for the multi-step prediction model, step 7 also includes calculating the average absolute error cumulative value Adde from the prediction step length a to the prediction step length b using the mean absolute error MAE: MAE,ab , satisfying the following relationship:
[0268] Adde MAE,ab =MAE a -MAE b a>b
[0269] In the formula,
[0270] MAE a is the mean absolute error MAE when the prediction step length is a,
[0271] MAE b is the mean absolute error MAE when the prediction step length is b;
[0272] For the multi-step prediction model, step 7 also includes calculating the root mean square error cumulative value Adde from prediction step a to prediction step b using the root mean square error RMSE. RMSE,ab , satisfying the following relationship:
[0273] Adde RMSE,ab =RMSE a -RMSE b a>b
[0274] In the formula,
[0275] RMSE a is the root mean square error RMSE when the prediction step length is a,
[0276] RMSE b is the root mean square error RMSE when the prediction step size is b.
[0277] Example 2.
[0278] This embodiment adopts the adjustable load multi-step prediction method based on improved TCN corrected cumulative error proposed in the present invention, and predicts the adjustable load of a certain area according to the sample data of electric vehicles and air-conditioning loads in the area; wherein, there are about 10,000 electric vehicles and about 10,000 air-conditioners in the area, and the first 80% of the sample data is used as a training set, and the last 20% is used as a test set.
[0279] In order to verify the prediction effect of the proposed prediction method, a TCN single model and the MSC-SA-TCN (Multi-Scale Self-Attention Temporal Convolutional Network, single-step prediction based on multi-scale convolution and self-attention) model were set for comparative experimental analysis. The electric vehicle prediction power curve is shown in Figure 5 As shown in Figure 2, the air conditioning load forecast curve is as follows: Figure 6 shown.
[0280] By comparison, it is found that the electric vehicle charging power prediction curve obtained by the MSC-SA-TCN model is closer to the fitting curve than the TCN single model prediction curve, and the prediction accuracy of the MSC-SA-TCN model is higher. It can also be seen that the charging behavior of electric vehicles peaks between 9:00 and 11:00. This is due to the influence of disorderly charging by electric vehicle users, which will also cause the regional load to peak on peak. The air-conditioning load is constantly changing with the changes in indoor and outdoor temperatures, showing a fluctuating curve. Therefore, by predicting adjustable loads such as electric vehicles through effective prediction methods and adjusting the load curve by orderly charging and other methods, the effect of peak shaving and valley filling can be achieved and the load curve can be smoothed.
[0281] It should be appreciated that embodiments of the present invention may be implemented or enforced by computer hardware, a combination of hardware and software, or by computer instructions stored in a non-transitory computer-readable memory. The method may be implemented in a computer program using standard programming techniques - including a non-transitory computer-readable storage medium configured with a computer program, wherein the storage medium so configured causes the computer to operate in a specific and predefined manner - according to the methods and drawings described in the specific embodiments. Each program may be implemented in a high-level procedural or object-oriented programming language to communicate with a computer system. However, if desired, the program may be implemented in an assembly or machine language. In any case, the language may be a compiled or interpreted language. In addition, the program may be run on a programmed ASIC for this purpose.
[0282] Furthermore, the operations of the processes described herein may be performed in any suitable order unless otherwise indicated herein or otherwise clearly contradicted by context. The processes described herein (or variations and / or combinations thereof) may be performed under the control of one or more computer systems configured with executable instructions, and may be implemented as code (e.g., executable instructions, one or more computer programs, or one or more applications) that is executed collectively on one or more processors, by hardware, or a combination thereof. The computer program includes a plurality of instructions that may be executed by one or more processors.
[0283] Further, the method can be implemented in any type of computing platform that is operably connected to a suitable computer, including but not limited to a personal computer, a minicomputer, a mainframe, a workstation, a network or distributed computing environment, a separate or integrated computer platform, or in communication with a charged particle tool or other imaging device, etc. Aspects of the present invention can be implemented in machine-readable code stored on a non-transitory storage medium or device, whether removable or integrated into a computing platform, such as a hard disk, an optical read and / or write storage medium, a RAM, a ROM, etc., so that it can be read by a programmable computer, and when the storage medium or device is read by the computer, it can be used to configure and operate the computer to perform the process described herein. In addition, the machine-readable code, or part thereof, can be transmitted via a wired or wireless network. When such media includes instructions or programs that implement the steps described above in conjunction with a microprocessor or other data processor, the invention described herein includes these and other different types of non-transitory computer-readable storage media. When programmed according to the methods and techniques described in the present invention, the present invention also includes the computer itself. The computer program can be applied to input data to perform the functions described herein, thereby converting the input data to generate output data stored in a non-volatile memory. The output information can also be applied to one or more output devices such as a display. In a preferred embodiment of the present invention, the converted data represents a physical and tangible object, including a specific visual depiction of the physical and tangible object produced on a display.
[0284] As used in this application, the terms "component", "module", "system", etc. are intended to refer to a computer-related entity, which can be hardware, firmware, a combination of hardware and software, software, or software in operation. For example, a component can be, but is not limited to: a process running on a processor, a processor, an object, an executable file, a thread in execution, a program, and / or a computer. As an example, an application running on a computing device and the computing device can both be components. One or more components can exist in a process and / or thread in execution, and a component can be located in a computer and / or distributed between two or more computers. In addition, these components can be executed from various computer-readable media having various data structures thereon. These components can communicate in a local and / or remote process manner, such as according to a signal having one or more data packets (e.g., data from a component that interacts with another component in a local system, a distributed system, and / or interacts with other systems in a signal manner through a network such as the Internet).
[0285] The beneficial effects of the present invention are as follows:
[0286] 1. The MSC-SA-TCN model effectively restored the ability of TCN's single-scale convolution kernel to extract input sequence features. Multi-scale convolution and self-attention were used to extract temporal and spatial features of input sequences at different scales, improving the prediction accuracy and stability of the model.
[0287] 2. The MMED-TCN model effectively restores the ability of a single TCN to mine the mapping relationship between multiple inputs and multiple outputs. It reduces the impact of the previous step prediction error on the prediction through multi-channel TCN technology, and effectively reduces the error accumulation of multi-step prediction of adjustable load power.
[0288] 3. The prediction model and method in the prior art use the result of the previous step prediction to predict the data of the next step when performing multi-step prediction. The prediction result itself will have errors, and the error accumulation will be formed in the process of performing multi-step prediction. In the present invention, multi-channel TCN and multi-output TCN are used to perform multi-step prediction on the same set of data, which avoids the error accumulation of the prediction result and makes full use of the same set of data for multi-step prediction, thereby effectively reducing the error accumulation in the multi-step prediction of adjustable load power.
[0289] 4. The smoothed noise sequence is used to reduce the impact of noise on the output prediction results.
[0290] The applicant of the present invention has made a detailed explanation and description of the implementation examples of the present invention in conjunction with the drawings in the specification. However, those skilled in the art should understand that the above implementation examples are only preferred implementation schemes of the present invention, and the detailed description is only to help readers better understand the spirit of the present invention, but not to limit the scope of protection of the present invention. On the contrary, any improvements or modifications based on the inventive spirit of the present invention should fall within the scope of protection of the present invention.
Claims
1. A multi-step forecasting method for adjustable load power based on improved TCN to correct cumulative error, characterized in that: The method comprises: Step 1, collecting and preprocessing the historical data of adjustable load power to obtain an adjustable load power sequence; Step 2, using variational mode decomposition method to decompose the adjustable load power sequence to obtain a principal component sequence and a noise sequence; Step 3, using an adaptive moving smoothing method to smooth the noise sequence; Step 4: construct a model based on the multi-scale convolution method and the self-attention method; using the model based on the multi-scale convolution method and the self-attention method, the multi-scale convolution method is used to extract the time characteristics and spatial characteristics of the adjustable load power sequence from the smoothed noise sequence; the self-attention method is used to obtain the correlation between the time characteristics and the spatial characteristics; according to the correlation, the important features in the time characteristics and the spatial characteristics are extracted, and the correlation between the important features and the adjustable load power sequence is used as the mapping relationship between the adjustable load prediction value and the adjustable load power historical data; including: Step 4.1: Use multi-scale convolution method to extract the smoothed noise sequence Extract the temporal and spatial characteristics of adjustable load power sequence; In the formula, c m is the output of multi-scale convolution, that is, the temporal and spatial features of the principal component sequence, is the noise sequence after smoothing, * is the convolution operation, K r is the scale of the r-th convolution kernel, r = 1, 2, ..., L, is the jth temporal convolution kernel of the rth layer, with a size of 1×K r , where j = 1, 2, ..., n, n is the total number of temporal convolution kernels, is the spatial convolution kernel of the rth layer, with a size of L×1, where L is the number of input features; Step 4.2, using the self-attention method to extract the correlation between temporal features and spatial features, and generate the correlation coefficient and mapping relationship of temporal and spatial features; Among them, the QKV model of the self-attention method satisfies the following relationship: In the formula, I SA To utilize the output c of multi-scale convolution m The n×m matrix is composed of m, where m is the total number of modal components and n is the total number of time convolution kernels. is the weight matrix of the QKV model, where * represents Q, K, and V, and the size of the weight matrix is n×n. is the bias matrix of the QKV model, where * represents Q, K, and V, and the size of the bias matrix is n×m; The correlation coefficients of spatiotemporal features are calculated using matrices Q and K, and matrix V represents the mapping relationship of spatiotemporal features; Step 4.3, using S = softmax (QK) V function to calculate the weight matrix, extracting the important features in the time features and spatial features according to the weight matrix, and taking the correlation between the important features and the adjustable load power sequence as the mapping relationship between the adjustable load prediction value and the adjustable load power historical data; Step 5, taking the time characteristics and spatial characteristics of the adjustable load power sequence as input, and establishing a single-step prediction model of the adjustable load power based on a single multi-input single-output temporal convolutional network; including: Step 5.1, taking the time characteristics and spatial characteristics of the adjustable load power sequence as the input data set, and dividing the input data set into a training set and a test set; Step 5.2, using a single multi-input single-output temporal convolutional network as a decoding layer and a model based on a multi-scale convolution method and a self-attention method as an encoding layer, a single-step prediction model for adjustable load power is established; Step 5.3, using the training set to train the single-step prediction model; Step 5.4, use the trained model as the final single-step prediction model; Step 6: Based on the single-step prediction model, a multi-step prediction model for adjustable load power is established by using the trained multi-input multi-output temporal convolutional network as the decoding layer and the model based on the multi-scale convolution method and the self-attention method as the encoding layer; including: Step 6.1, taking the time characteristics and spatial characteristics of the adjustable load power sequence as the input data set, and dividing the input data set into a training set and a test set; Step 6.2, based on the final single-step prediction model, multiple temporal convolutional networks are connected in parallel through a fully connected layer; Step 6.3, under various prediction step sizes, multiple parallel temporal convolutional networks are trained with the training set, and the minimum deviation between the output value of the temporal convolutional network and the actual value is used as the iteration control index. After multiple iterative updates, a set of nonlinear mapping relationships between multiple inputs and multiple outputs under various prediction step sizes is obtained; Step 6.4, according to the set of nonlinear mapping relationships, the final multi-input and multi-output temporal convolutional network is trained, where the output of any temporal convolutional network is F n is the number of filters in the temporal convolutional network; In step 6.5, the final multi-input multi-output temporal convolutional network is used as the decoding layer, and the model based on the multi-scale convolution method and the self-attention method is used as the encoding layer. After linear transformation and the introduction of the ReLU function, a multi-step prediction model for adjustable load power is established to satisfy the following relationship: In the formula, y d is the predicted value at step d, is the weight of the predicted output in step d, b d is the bias of the predicted output in step d; Step 7, select a prediction model according to the number of prediction steps, that is, select a single-step prediction model for single-step prediction and select a multi-step prediction model for multi-step prediction, and use the selected prediction model to predict the adjustable load power.
2. The adjustable load power multi-step prediction method based on improved TCN correction cumulative error according to claim 1 is characterized in that: In step 1, every 15 minutes is a sampling moment, and the historical data of the instantaneous active power of the adjustable load is collected.
3. The adjustable load power multi-step prediction method based on improved TCN correction cumulative error according to claim 2 is characterized in that: In step 1, the historical data of the instantaneous active power of the adjustable load is preprocessed, including: outlier processing, vacancy filling and normalization processing; Abnormal values include: negative values, power values exceeding full load, and garbled codes. Among them, negative values are processed by directly setting them to zero; power values exceeding full load and garbled codes are processed by using the adjustable load instantaneous active power at the two sampling moments before and after to correct the power values exceeding full load and garbled codes. The method of filling the missing value is to use the instantaneous active power of the adjustable load at the two previous and subsequent sampling moments to fill the missing value.
4. The adjustable load power multi-step prediction method based on improved TCN correction cumulative error according to claim 3 is characterized in that: Step 2 includes: Step 2.1: Use variational mode decomposition method to decompose the adjustable load power sequence P into the principal component sequence u m and noise sequence E; the constraint condition is that the sum of all modes is equal to the adjustable load power sequence P, and the constrained variation satisfies the following relationship: In the formula, u m = {u i },u i is the i-th modal component obtained by variational mode decomposition, i = 1, 2, ..., m, ω m ={ω i },ω i is the i-th modal component u i The center frequency, i = 1, 2, ..., m, m is the total number of modal components, j is the imaginary part in the complex frequency domain, is the square expression of the two-norm, δ(t) is the impulse function at time t, is the first-order partial derivative at time t, u m (t) is the principal component sequence at time t; Step 2.2, introduce Lagrange multipliers and quadratic penalty functions to convert constrained variation into unconstrained variation, satisfying the following relationship: In the formula, λ(t) is the Lagrange multiplier at time t, α is the quadratic penalty factor, P(t) is the historical data of adjustable load power at time t; Step 2.3, based on unconstrained variation, the alternating direction multiplier method iterative algorithm is used in combination with Parseval theorem, Plancherel theorem and Fourier isometric transform to perform optimization iteration on each modal component, the center frequency of each modal component and the Lagrange multiplier; after alternating optimization iteration n+1 times, the principal component sequence u is obtained. m , satisfying the following relationship: In the formula, is the modal component after the n+1th iteration The Fourier transform of , where ω corresponds to the time domain t, is the modal component after the nth iteration The Fourier transform of is the i-th modal component u at time t i The Fourier transform of (t), is the Fourier transform of the adjustable load power historical data P(t), is the Lagrange multiplier λ after the n+1th iteration n+1 The Fourier transform of (t), is the Lagrange multiplier λ after the nth iteration n The Fourier transform of (t), is the Fourier transform of the Lagrange multiplier λ(t), τ is the noise tolerance; ω is the frequency corresponding to time domain t, ω m ={ω i },ω i is the i-th modal component u i The center frequency, i = 1, 2, ..., m, ω-ω m Represents the difference between the frequency corresponding to time domain t and the center frequency of each modal component; Step 2.4, using the principal component sequence u m and adjustable load power history data P(t), we get the noise sequence E={e1, e2, e3, ..., e T }, satisfying the following relationship: Wherein, t=1, 2, ..., T, T is the total number of noise components, that is, the length of the noise sequence.
5. The adjustable load power multi-step prediction method based on improved TCN correction cumulative error according to claim 4 is characterized in that: Step 3 includes: Step 3.1, for the noise sequence E = {e1, e2, e3, ..., e T }, the mean μ of the noise sequence in the moving window of length N e and variance σ e 2 Satisfies the following relationship: In the formula, e k is the element of the noise sequence in the moving window at time t, k = t+1, t+2, ... t+N; Step 3.2, based on the adaptive moving smoothing method, using the mean μ e and variance σ e 2 The noise sequence E in the moving window at time t is smoothed to satisfy the following relationship: In the formula, f(e k , μ e , σ e 2 ) is the sum of the error values of the points that conform to the 3σ principle in the moving window, satisfying the following relationship: flag(e k , μ e , σ e 2 ) is the sum of the number of points that conform to the 3σ principle in the moving window, satisfying the following relationship: is the noise sequence after smoothing.
6. The adjustable load power multi-step prediction method based on improved TCN correction cumulative error according to claim 1 is characterized in that: In step 7, the number of prediction steps in the prediction time period is determined according to the sampling step length, wherein every 15 minutes is one sampling moment, that is, the length of the sampling step length is 15 minutes.
7. The adjustable load power multi-step prediction method based on improved TCN correction cumulative error according to claim 1 is characterized in that: Step 7 also includes evaluating the performance of the prediction model using mean absolute error and root mean square error, as follows: 1) Mean absolute error MAE, satisfies the following relationship: 2) Root mean square error RMSE, which satisfies the following relationship: In the above two equations, y d and are the predicted value and true value of the dth step respectively, d = 1, 2, ..., D, D is the number of prediction steps.
8. The adjustable load power multi-step prediction method based on improved TCN correction cumulative error according to claim 7 is characterized in that: Step 7 also includes calculating the first lift P of the prediction model using the mean absolute error MAE MAE , satisfying the following relationship: In the formula, Model1 MAE is the mean absolute error MAE of the single-step prediction model or the multi-step prediction model, Model2 MAE is the mean absolute error MAE of the single-step prediction model; The second lift P of the prediction model is calculated using the root mean square error RMSE RMSE , satisfying the following relationship: In the formula, Model1 RMSE is the root mean square error RMSE of the single-step prediction model or the multi-step prediction model, Model2 RMSE is the root mean square error RMSE of the single-step prediction model.
9. The adjustable load power multi-step prediction method based on improved TCN correction cumulative error according to claim 7 is characterized in that: For the multi-step prediction model, step 7 also includes calculating the average absolute error cumulative value Adde from prediction step a to prediction step b using the mean absolute error MAE. MAE,ab , satisfying the following relationship: Adde MAE,ab =There is a - IT IS b a > b In the formula, MAE a is the mean absolute error MAE when the prediction step length is a, MAE b is the mean absolute error MAE when the prediction step length is b; For the multi-step prediction model, step 7 also includes calculating the root mean square error cumulative value Adde from prediction step a to prediction step b using the root mean square error RMSE. RMSE,ab , satisfying the following relationship: Adde RMSE,ab =RMSE a -RMSE b a>b In the formula, RMSE a is the root mean square error RMSE when the prediction step length is a, RMSE b is the root mean square error RMSE when the prediction step size is b.
Citation Information
Patent Citations
Method for filtering baseline drift of magnetocardiogram signal
CN111938627A
Load prediction method and system based on deep self-attention network
CN113379164A
Traffic prediction method and device based on dynamic space-time diagram convolution attention model
CN113487088A