A short-term electricity forecasting method and device
The power data is processed through variational modal decomposition and improved Transformer model, which solves the problems of space-time uncertainty and nonlinear time-variability in power prediction, improves the accuracy of power prediction, and promotes the stability of power scheduling and power system.
Patent Information
- Application Number
- CN202211448407.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-18
- Publication Date
- 2025-08-29
- Estimated Expiration
- 2042-11-18
AI Technical Summary
Traditional methods are difficult to cope with space-time uncertainty and nonlinear time-varying in power prediction, resulting in insufficient power prediction accuracy, affecting the power scheduling and stable operation of the power system.
Variable modal decomposition (VMD) is used to decompose the historical power data segments to generate overlapping slices and sub-signals. Combined with the improved Transformer model (M-Transformer) to learn the correlation between the sub-signal and historical power data, the inertia and time-varying characteristics of the power sequence are described through variable support segments to improve prediction accuracy.
Through the decomposition and improved Transformer model, the inertia and time-varying characteristics of the power sequence are effectively described, the accuracy of short-term power prediction is improved, and the stability of power scheduling and power system is improved.
Smart Images

Figure CN115907142B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electric power big data, and in particular to a short-term electricity quantity prediction method and device. Background Art
[0002] Short-term electricity forecasting involves predicting electricity consumption for the next week, day, or even hour based on historical electricity data, climate, seasonality, and other data. The accuracy of electricity forecasts is closely linked to decision-making processes such as power dispatch and planning. It can effectively improve the efficiency of power dispatch and contribute to the economic and social benefits of power generation groups. With the development of smart grids, the grid access rate of renewable energy and the penetration rate of distributed energy continue to increase. New load types continue to emerge, and AC / DC hybrid connections are becoming increasingly common. This leads to increased spatiotemporal uncertainty in electricity data and increasingly pronounced nonlinear and time-varying characteristics. Traditional methods are no longer able to cope with the electricity forecasting challenges faced in this new landscape. Therefore, improving the accuracy of electricity forecasts is crucial for balanced electricity dispatch and the stable operation of power systems. Summary of the Invention
[0003] The technical problem to be solved by the present invention is to provide a short-term electricity forecasting method and device to improve the forecasting accuracy of future short-term electricity.
[0004] In order to solve the above technical problems, the technical solution adopted by the present invention is:
[0005] A short-term electricity forecasting method comprises the following steps:
[0006] Build a power forecasting model;
[0007] Get the user's historical power sequence;
[0008] Segmenting the historical power sequence to obtain historical power data segments;
[0009] generating overlapping slices according to the historical power data segments;
[0010] Decomposing the historical power data segment using variational mode decomposition to obtain sub-signals;
[0011] Inputting the sub-signal and the overlapping slices into a transformation model to obtain a variable support segment;
[0012] The predicted power is obtained according to the variable support segment and the power prediction model.
[0013] In order to solve the above technical problems, another technical solution adopted by the present invention is:
[0014] A short-term electricity forecasting device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, each step in the above-mentioned short-term electricity forecasting method is implemented.
[0015] The beneficial effects of the present invention are as follows: after acquiring historical electricity data, the historical electricity sequence is segmented to obtain historical electricity data segments, and overlapping slices and sub-signals are further generated according to the historical electricity data segments. Then, the correlation between the sub-signals and the historical electricity data is learned according to the M-Transformer model to realize the prediction of future electricity. At the same time, by using variable support segments to effectively describe the influence of the inertial characteristics and time-varying characteristics of the electricity sequence on the prediction, the accuracy of the electricity prediction is further improved, thereby improving the accuracy of the short-term electricity prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 This is a flowchart of a short-term power forecasting method according to an embodiment of the present invention;
[0017] Figure 2 Schematic diagram of a variable support segment of a short-term power forecasting method according to an embodiment of the present invention;
[0018] Figure 3 Schematic diagram of input / output layers of a short-term power forecasting method according to an embodiment of the present invention;
[0019] Figure 4 A schematic diagram of overlapping slices of historical electricity consumption in a short-term electricity consumption prediction method according to an embodiment of the present invention;
[0020] Figure 5 1 is a diagram of a component attention mechanism module of a short-term power prediction method according to an embodiment of the present invention;
[0021] Figure 6 A weight calculation matrix diagram of a head in a short-term power forecasting method according to an embodiment of the present invention;
[0022] Figure 7 A model structure diagram of a short-term power forecasting method according to an embodiment of the present invention;
[0023] Figure 8 Statistical graphs of two data sets of a short-term power forecasting method according to an embodiment of the present invention;
[0024] Figure 9 A test error diagram displayed by a box-whiske diagram of a short-term power forecasting method according to an embodiment of the present invention;
[0025] Figure 10This is a diagram showing the improved effect of VMD-CAT in a short-term power forecasting method according to an embodiment of the present invention;
[0026] Figure 11 FIG. 4 is a schematic structural diagram of an electronic device in an embodiment of the present invention. DETAILED DESCRIPTION
[0027] To illustrate the technical content, achieved objectives and effects of the present invention in detail, the following description is given in conjunction with the embodiments and accompanying drawings.
[0028] Please refer to Figure 1 , a short-term power forecasting method, comprising the steps of:
[0029] Build a power forecasting model;
[0030] Get the user's historical power sequence;
[0031] Segmenting the historical power sequence to obtain historical power data segments;
[0032] generating overlapping slices according to the historical power data segments;
[0033] Decomposing the historical power data segment using variational mode decomposition to obtain sub-signals;
[0034] Inputting the sub-signal and the overlapping slices into a transformation model to obtain a variable support segment;
[0035] The predicted power is obtained according to the variable support segment and the power prediction model.
[0036] From the above description, it can be seen that the beneficial effects of the present invention are: after obtaining historical electricity data, the historical electricity sequence is segmented to obtain historical electricity data segments, and then overlapping slices and sub-signals are generated respectively according to the historical electricity data segments. Then, the correlation between the sub-signals and the historical electricity data is learned according to the M-Transformer model to realize the prediction of future electricity. At the same time, by using variable support segments to effectively describe the influence of the inertial characteristics and time-varying characteristics of the electricity sequence on the prediction, the accuracy of the electricity prediction is further improved, thereby improving the accuracy of the short-term electricity prediction.
[0037] Furthermore, generating overlapping slices according to the segmented data includes:
[0038] Decomposing the segmented data into a preset number of slices;
[0039] The slices include multiple groups of continuous power usage samples, and adjacent slices have a common historical power data segment.
[0040] As can be seen from the above description, by decomposing the segmented data into a preset number of slices, and adjacent slices containing common historical electricity data segments, the slices are correlated, which can improve the accuracy of electricity prediction.
[0041] Furthermore, the variational mode decomposition is used to decompose the historical power data segment to obtain sub-signals including:
[0042] Generate a variational mode decomposition model based on preset constraints;
[0043] The historical electricity data segment is input into the variational mode decomposition model, and the sub-signal is obtained by solving the model.
[0044] From the above description, it can be seen that a variational mode decomposition model is generated through preset constraints, and the historical electricity data segment is decomposed into a sub-signal according to the variational mode decomposition model, so that the historical electricity data segment can be decomposed into an effective number of sub-signals, thereby improving the accuracy of electricity prediction.
[0045] Furthermore, the construction of the power consumption prediction model includes:
[0046]
[0047] Among them, x f =[x i ,...,x i+L-1 ], represents the predicted power series; Indicates based on The predicted power part obtained; x h =[x i-P ,...,x i-1 ], represents the historical electricity series; Represents the sub-signals decomposed from the historical power data segment; for and The relationship function between them.
[0048] From the above description, it can be seen that by constructing a relationship function between the predicted power sequence and the historical power sequence, it is possible to predict future power based on the input historical power sequence.
[0049] Furthermore, the building of the power forecasting model further includes:
[0050]
[0051] in, is the variable support segment of the kth sub-signal, express with x f The functional relationship between τk is a delay-dependent non-negative integer; the non-negative integer pk represents the length of the variable support segment.
[0052] From the above description, it can be seen that by considering the influence of inertia and time-varying characteristics on sub-signals, the influence of inertia and time-varying characteristics of power series on power prediction can be effectively described by using variable support segments.
[0053] Furthermore, the step of inputting the sub-signal and the overlapping slice into a transformation model to obtain a variable support segment comprises:
[0054] Converting the overlapping slices into first-dimensional vectors through a first fully connected neural network, performing position encoding on the vectors, and then inputting the vectors into a front-end encoder;
[0055] The sub-signal is converted into a second-dimensional vector by a second fully connected neural network, and is position-encoded and then input into a front-end encoder;
[0056] The front-end encoder obtains the variable support segment according to the first dimensional vector and the second dimensional vector.
[0057] From the above description, it can be seen that the overlapping slices and sub-signals are processed separately through different input ends, and the overlapping signals are converted into first-dimensional vectors, and the sub-signals are converted into second-dimensional vectors and then input into the front-end encoder, so that the front-end encoder can obtain variable support segments according to different dimensions.
[0058] Furthermore, the front-end encoder obtains the variable support segment according to the first dimensional vector and the second dimensional vector, including:
[0059] The front-end encoder calculates a first matrix and a second matrix according to the first dimensional vector, and calculates a third matrix according to the second dimensional vector;
[0060] Performing linear transformation on the first matrix, the second matrix, and the third matrix to obtain multiple sets of attention matrices;
[0061] The variable support segment is obtained according to multiple groups of the attention matrices.
[0062] From the above description, it can be seen that the first matrix and the second matrix are calculated according to the first dimensional vector, and the third matrix is obtained according to the second dimensional vector, and the first matrix, the second matrix and the third matrix are linearly transformed to obtain multiple sets of attention matrices. Then, variable support segments are obtained according to the multiple sets of attention matrices. By introducing the attention mechanism, the correlation between each sub-signal and the historical power data is established, thereby improving the accuracy of power prediction.
[0063] Furthermore, performing linear transformation on the first matrix, the second matrix, and the third matrix to obtain multiple sets of attention matrices includes:
[0064]
[0065] Among them, K is the first matrix, is the change matrix corresponding to the first matrix; V is the second matrix, is the change matrix corresponding to the second matrix; Q is the third matrix, is the change matrix corresponding to the third matrix, d is the scale factor; H i is the attention matrix.
[0066] From the above description, it can be seen that by respectively transforming the first matrix, the second matrix and the third matrix through different change matrices, and obtaining the attention matrix based on the transformed first matrix, the second matrix and the third matrix, an effective attention matrix can be obtained.
[0067] Furthermore, obtaining a variable support segment according to the multiple groups of attention matrices includes:
[0068] Calculate the weight matrix in the attention mechanism according to the first matrix, the second matrix and the third matrix;
[0069] The variable support segment of the attention matrix is determined to be composed of the historical power data segment according to the weight matrix, thereby obtaining the variable support segment.
[0070] From the above description, it can be seen that the weight matrix in the attention mechanism is first calculated through the first matrix, the second matrix and the third matrix, and then the variable support segment is determined according to the weight matrix. The elements that constitute the attention matrix in the historical power data segment can be extracted, that is, the effective variable support segment is obtained.
[0071] Another embodiment of the present invention provides a short-term electricity forecasting device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements each step of a short-term electricity forecasting method as described above when executing the computer program.
[0072] The above-mentioned short-term power forecasting method and device of the present invention can be applied to forecast the short-term power situation of the power grid within the next week, day, or hour. The following is an explanation through specific implementation methods:
[0073] Example 1
[0074] Please refer to Figure 1 , a short-term power forecasting method, comprising the steps of:
[0075] S1. Constructing a power forecasting model. Specifically, the forecasting model for predicting future data based on historical power data can be described as follows:
[0076] x f =F(x h )
[0077] Where x f =[x i ,...,x i+L-1 ], represents the predicted power sequence; F: P → L is a function describing the mapping relationship between the historical power series and the predicted power series; x h =[x i-P ,...,x i-1 ], expressed as a historical electricity series;
[0078] Since electricity series generally exhibit unstable future trends, direct prediction is challenging. In the frequency domain, sequences with narrower bandwidths generally exhibit better future trend stability, while electricity series have larger bandwidths. Therefore, the electricity data is first decomposed into several sub-signals, then these sub-signals are predicted. Finally, the predicted sub-signals are summed to reconstruct the future electricity. The model is optimized based on the sub-signals decomposed from the historical electricity data segment, resulting in:
[0079]
[0080] In the formula, Indicates based on The predicted power portion obtained; Represents the sub-signals decomposed from the historical power data segment; for and The relationship function between
[0081] Considering the influence of inertia and time-varying characteristics on the sub-signal, we can further obtain:
[0082]
[0083] In the formula, is the variable support segment of the kth sub-signal, express with x f The functional relationship between τ k is a delay-dependent non-negative integer; a non-negative integer p k represents the length of the variable support segment; the inertia of the time series can be characterized by a time delay process; where τ k and p k They are all variable, which can effectively describe the time-varying characteristics of the power series;
[0084] Please refer to Figure 2, is a schematic diagram of the variable support segment, wherein the cubes arranged in chronological order represent the predicted future power data segments, and the circles represent the sub-signal segments decomposed from the historical power data segments; the circles connected to the cubes with arrows form the variable support segment; if the goal is set to solve the one-step-ahead power prediction problem, the length of the predicted future power data segment L is set to 1; from Figure 2 It can be seen that the parameters τ and p of the variable support segment may change with different future power measurements; the variable support segment allows the functional relationship to flexibly describe the inertial and time-varying characteristics of the sub-signal;
[0085] S2. Get the user's historical power sequence, that is, get x h ;
[0086] S3, segment the historical power sequence to obtain historical power data segments, such as x h =[x i-P ,...,x i-1 ];
[0087] S4. Generating overlapping slices according to the historical power data segments, including:
[0088] S41, please refer to Figure 4 , decompose the historical power data segment into a preset number of slices; wherein the slices contain multiple groups of continuous power consumption samples, and adjacent slices have the same historical power data segment; for example, taking wind power prediction as an example, the historical power sequence x h The length of is set to 12; decompose it into ten slices, each slice s j Contains three consecutive electricity usage samples, and adjacent slices contain two common samples;
[0089] S5. Decomposing the historical power data segment using variational mode decomposition to obtain sub-signals;
[0090] S51. Generate a variational modal decomposition model according to preset constraints, input the historical power data segment into the variational modal decomposition model, and solve to obtain the sub-signal. Specifically:
[0091] The real-valued signal is iteratively decomposed into a given number of intrinsic mode functions. The intrinsic mode function (i.e., the decomposed sub-signal) is defined as:
[0092] u k (t) = A k (t)cos(φ k (t));
[0093] Among them, A k (t) and φ k (t) are expressed as uk (t) The amplitude and phase of the function;
[0094] The modal function can be obtained by solving the constrained optimization problem:
[0095]
[0096] Where w k for u k (t), δ(t) represents the pulse signal, and x(t) is the original signal to be decomposed (i.e., x h ), and “*” are gradient operator and convolution operator respectively;
[0097] The modal function can be obtained by solving the constrained optimization problem:
[0098]
[0099] Where α is the weight factor and λ(t) is the Lagrange multiplier;
[0100] u k (t) and w k The Fourier transform formula is as follows:
[0101]
[0102]
[0103] in, and are x(t) and λ respectively. n Fourier transform of (t);
[0104] The iteration method is:
[0105]
[0106] Where β is a constant;
[0107] The iterative process in the formula terminates when the following conditions are met:
[0108]
[0109] Where ε is the termination threshold;
[0110] Please refer to Figure 7In the process of wind power series decomposition using VMD, high-frequency residuals are usually generated; such high-frequency residuals may be high-frequency components or noise of the wind power generation system; therefore, the permutation entropy of the residuals is used as a measure of randomness, and when the permutation entropy of the residuals reaches a given η threshold, the residuals are discarded; to avoid confusion, the model combining the VMD proposed in this embodiment with the Transformer based on the component attention mechanism is called VMD-CAT; specifically, the historical power data segment is decomposed into sub-signals before entering the M-Transformer model; the basic parameter K (i.e., the number of modes) needs to be set in advance because it cannot be set adaptively in the VMD method; the present invention sets K to ensure that the minimum deviation between adjacent center frequencies of sub-signals with relatively high frequencies is not less than a given threshold; the threshold is set to one-tenth of the input power segment bandwidth; in addition, the parameters in VMD are empirically set to 2000;
[0111] When a power data segment is decomposed, a residual component is always generated. For example, the decomposition results of the power series collected at site A in June are shown in Table 1. It can be seen that the central fluctuation of the mode does not change much, and the difference between the central fluctuations of adjacent low-frequency sub-signals is relatively small. The sub-signals fluctuate regularly, while the residual fluctuates randomly. Because the residual may carry high-frequency information, directly discarding it may have a negative impact on the accuracy of power prediction. Therefore, permutation entropy is used as a measure of signal randomness, and the residual is filtered using a threshold-based method. The order and delay time of the permutation entropy are set to 7 and 2, respectively, and the η threshold is adaptively estimated.
[0112] η=mean(e p )+3std(e p )
[0113] where e p Is a vector whose elements are the permutation entropy values between each sub-signal;
[0114] The permutation entropy values of the sub-signals and residuals are shown in Table 1. The threshold η is equal to 4.73, so the residual should be retained and treated as a sub-signal.
[0115] Table 1
[0116]
[0117] S6, inputting the sub-signal and the overlapping slices into the transformation model to obtain a variable support segment; that is, inputting the sub-signal and the overlapping slices obtained through the above processing into the transformation model to obtain a variable support segment Specific parameter values;
[0118] S7. Obtaining predicted power according to the variable support segment and the power prediction model;
[0119] The variable support segment to be obtained The power forecasting model is brought in and a forecast is performed based on the input historical power sequence to obtain the predicted power.
[0120] Example 2
[0121] This embodiment specifically defines how the variation model handles sub-signals and overlapping slices;
[0122] Please refer to Figure 3 and Figure 5 The modified model is an improved Transformer model, which is called M-Transformer. It consists of an input layer, an encoding layer, a decoding layer, and an output layer, specifically including:
[0123] The improved input layer includes two parallel input modules, each of which consists of a fully connected neural network submodule and a position encoding submodule. The left input module is used to receive the overlapping slices, and the right input module is used to receive the sub-signals. The encoder layer consists of an encoding stack, which contains six serially connected encoders. Each encoder consists of a component attention mechanism (multi-head attention mechanism) module and a feed-forward neural network (feed-forward neural network) module. The improved encoder uses the component attention mechanism module instead of the multi-head attention mechanism module in the original Transformer model.
[0124] The decoder layer consists of a decoding stack containing six serially connected decoders. Each decoder contains three serially connected modules, including a multi-head attention mechanism module, an encoder-decoder attention mechanism module, and a feedforward neural network module. There is a residual in each module, and the output of the module is normalized.
[0125] The output layer replaces the linear module and activation (softmax) module in the original Transformer model with a fully connected neural network to output the power prediction results. Specifically:
[0126] Please refer to Figure 5In the figure, Q, K, and V represent query, key, and value matrices, respectively. In the self-attention mechanism, Q, K, and V are calculated from the same input, while in the component attention mechanism, K and V are calculated based on overlapping slices, and Q is calculated based on sub-signals. Each row of V is calculated from a unique slice. That is, K is the first matrix, V is the second matrix, and Q is the third matrix.
[0127] Specifically, according to the structure of the multi-head attention module, the i-th head outputs a weighted matrix, which is expressed as:
[0128]
[0129] In the formula and is the matrix used for linear transformation, that is is the change matrix corresponding to the first matrix K; is the change matrix corresponding to the second matrix V; is the change matrix corresponding to the third matrix Q; d is the scale factor; H i is the attention matrix;
[0130] For ease of representation, a weight matrix is separated from the formula It is expressed as:
[0131]
[0132] This weight matrix indicates which slices contribute to H i Contribute; can be restated as:
[0133]
[0134] therefore, The jth row of is equal to the weighted sum of all rows of V, The jth row of is the weight vector;
[0135] The M-Transformer model obtained above is used to estimate the parameters of the variable support segment to predict future power consumption. The specific steps include:
[0136] S1. Convert the overlapping slices into a first-dimensional vector using a first fully connected neural network, perform position encoding on the vector, and then input it into a front-end encoder; convert the sub-signal into a second-dimensional vector using a second fully connected neural network, perform position encoding on the vector, and then input it into a front-end encoder;
[0137] S2, the front-end encoder calculates a first matrix and a second matrix according to the first dimensional vector, that is, calculates a key matrix K and a value matrix V according to the overlapping slices, and obtains a third matrix according to the second dimensional vector, that is, calculates a query matrix Q according to the sub-signal;
[0138] S3. Perform linear transformation on the first matrix, the second matrix, and the third matrix to obtain multiple sets of attention matrices, including:
[0139] Please refer to Figure 6 , S31, calculate the weight matrix in the attention mechanism according to the first matrix, the second matrix and the third matrix; that is, calculate the weight matrix of the i-th head in the multi-head attention mechanism according to Q, K, V
[0140] S32. Determine, based on the weight matrix, that the historical power data segment constitutes a variable support segment of the attention matrix, and obtain the variable support segment:
[0141] according to Determine the variable support segment parameters to determine x h H i Elements of (i) ,
[0142]
[0143] Where, express The jth column of The largest element in is s (i) It is H i Variable support segments;
[0144] S33, Collection x h All s that contribute at least one head output (i) You can get the variable support segment:
[0145]
[0146] S4. Calculate the attention matrix H of the i-th head i , and get the output of the i-th head; splice and linearly transform the outputs of multiple heads to get the encoder output;
[0147] S5. The encoder output is sent to the output layer through the decoder, and the fully connected neural network of the output layer is used to predict future power consumption.
[0148] Example 3
[0149] This embodiment verifies the hybrid model proposed in the prior art and the VMD-CAT model proposed in this embodiment through specific examples.
[0150] Please refer to Figure 8 The proposed hybrid model is verified using two electricity data sets from different wind farms in my country. The data series collected at sites A and B are formed into datasets I and II, respectively. Both datasets record data for the entire year on an hourly time scale, and the statistical data of each dataset varies with the seasons. Dataset I reaches its maximum and minimum values in summer and spring, respectively, while dataset II reaches its maximum and minimum values in winter and autumn, respectively. The fluctuations in dataset I are most dramatic in summer and smallest in autumn, and the same is true for dataset II. In each season, the kurtosis of dataset I is greater than that of dataset II, and the skewness deviations of the two datasets are obvious.
[0151] Please refer to Figure 9 The evaluation indicators used include mean absolute error (MAE), root mean square error (RMSE) and mean absolute percentage error (MAPE); the expressions are:
[0152]
[0153]
[0154]
[0155] Where N is the predicted power segment length; P t a is the actual power; P t f To predict power consumption;
[0156] To verify the performance of VMD-CAT, a comparative experiment was conducted. Single models such as ARIMA (integrated moving average autoregressive model), BP (neural network model), and LS-SVM, as well as hybrid models such as WEE, EAW, RWA, and FVAD, were used as comparison models. The electricity consumption series of the last week of February, May, August, and October in Dataset I were selected as test data, and the electricity consumption samples collected in the first four weeks of each test data were selected as the corresponding training data. Similarly, the electricity consumption segments of the last week of February, May, August, and October in Dataset II were randomly selected as test data, and the electricity consumption samples collected in the first four weeks of the test data were regarded as the corresponding training data. In addition, the test results evaluated by MAE, RMSE, and MAPE are shown in Tables 2 and 3.
[0157] Table 2 Test results of dataset I
[0158]
[0159] Table 3 Test results of Dataset II
[0160]
[0161] As can be seen from Tables 2 and 3, the performance of all models varies with the season. On Dataset I, all models perform best on the February data and perform similarly on the August and October data. On Dataset II, each model performs similarly across seasons. VMD-CAT performs best on the May electricity consumption series and performs similarly on the February, August, and October data. In addition, the hybrid model performs significantly better than a single model. This is because the modal decomposition process used in the hybrid model reduces the difficulty of describing the characteristics of the electricity consumption series. VMD-CAT achieves the best prediction results on both datasets.
[0162] Based on the evaluation index, the improvement index of the relative prediction achieved by VMD-CAT is shown in the following formula. The larger the IM value, the better the improvement effect of VMD-CAT;
[0163]
[0164] Please refer to Figure 10 , the improvement index calculated based on the MAE values in Table 2 and Table 3; on both datasets, VMD-CAT effectively reduced the MAE value; in order to verify the superiority of VMD-CAT, WT, EMD and EEMD were combined with M-Transformer respectively, and the combined models were called WT-CAT, EMD-CAT and EEMD-CAT respectively. The settings of the test and training data remained unchanged, and the test result evaluation indicators are shown in Table 4.
[0165] Table 4 Experimental results of different hybrid models
[0166]
[0167] Example 4
[0168] A short-term electricity forecasting device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, each step of a short-term electricity forecasting method as described in Embodiment 1 or 2 is implemented.
[0169] In summary, the present invention provides a short-term electricity forecasting method and device, which uses a hybrid model VMD-CAT to obtain historical electricity data, decomposes it into sub-signals through VMD, and generates overlapping slices of historical electricity data segments. Then, an improved Transformer model is used to learn the support of future electricity consumption measurements to achieve prediction of future electricity. At the same time, by effectively describing the influence of the inertial characteristics and time-varying characteristics of the electricity series on the prediction with variable support segments, and introducing a component attention mechanism, a correlation between each sub-signal and the historical electricity consumption data is established, thereby improving the prediction accuracy of the hybrid model VDM-CAT for future electricity from various different aspects, thereby improving the accuracy of short-term electricity forecasting.
[0170] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent transformations made using the contents of the present invention's description and drawings, or directly or indirectly applied in related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A short-term electricity forecasting method, characterized in that: Including steps: Build a power forecasting model; Get the user's historical power sequence; Segmenting the historical power sequence to obtain historical power data segments; generating overlapping slices according to the historical power data segments; Decomposing the historical power data segment using variational mode decomposition to obtain sub-signals; Inputting the sub-signal and the overlapping slices into a transformation model to obtain a variable support segment; Obtaining predicted power according to the variable support segment and the power prediction model; Inputting the sub-signal and the overlapping slices into a transformation model to obtain a variable support segment comprises: Converting the overlapping slices into first-dimensional vectors through a first fully connected neural network, performing position encoding on the vectors, and then inputting the vectors into a front-end encoder; The sub-signal is converted into a second-dimensional vector by a second fully connected neural network, and is position-encoded and then input into a front-end encoder; The front-end encoder obtains the variable support segment according to the first dimensional vector and the second dimensional vector; The front-end encoder obtains the variable support segment according to the first dimensional vector and the second dimensional vector, comprising: The front-end encoder calculates a first matrix and a second matrix according to the first-dimensional vector, and obtains a third matrix according to the second-dimensional vector; Performing linear transformation on the first matrix, the second matrix, and the third matrix to obtain multiple sets of attention matrices; Obtaining the variable support segment according to multiple groups of the attention matrices; The linear transformation of the first matrix, the second matrix and the third matrix to obtain multiple sets of attention matrices includes: ; Among them, K is the first matrix, is the change matrix corresponding to the first matrix; V is the second matrix, is the change matrix corresponding to the second matrix; Q is the third matrix, is the change matrix corresponding to the third matrix, d is the proportional factor; H i is the attention matrix; The obtaining of variable support segments according to the plurality of attention matrices comprises: Calculate the weight matrix in the attention mechanism according to the first matrix, the second matrix and the third matrix; The variable support segment of the attention matrix is determined to be composed of the historical power data segment according to the weight matrix, thereby obtaining the variable support segment.
2. A short-term electricity forecasting method according to claim 1, characterized in that: Generating overlapping slices according to the historical power data segments includes: Decomposing the historical electricity data segment into a preset number of slices; The slices include multiple groups of continuous power usage samples, and adjacent slices have a common historical power data segment.
3. A short-term electricity forecasting method according to claim 1, characterized in that: The variational mode decomposition is used to decompose the historical power data segment to obtain sub-signals including: Generate a variational mode decomposition model based on preset constraints; The historical electricity data segment is input into the variational mode decomposition model, and the sub-signal is obtained by solving the model.
4. A short-term electricity forecasting method according to claim 1, characterized in that: The constructing of the power prediction model includes: ; in, , represents the predicted power series; , indicating that according to The predicted power volume obtained; , represents the historical electricity series; , represents the sub-signal decomposed from the historical power data segment; for and The relationship function between them.
5. A short-term electricity forecasting method according to claim 4, characterized in that: The constructing of the power prediction model further includes: ; in, For the k The variable support segment of each sub-signal, express With X f The functional relationship between is a delay-related non-negative integer; a non-negative integer p K Indicates the length of the variable support segment.
6. A short-term electricity forecasting device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, each step of the short-term electricity forecasting method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Short-term load prediction method of variational mode decomposition and deep belief network
CN107392364A
Prediction method combining sequence local feature extraction and deep convolution prediction model
CN112016590A