Multi-scale power load prediction method and device, equipment and storage medium
Through variational modal decomposition and fast Fourier transform extraction significant periods, combined with Transformer model, power load prediction is solved, and the problem of insufficient prediction accuracy when the power load sequence changes and fluctuates on different time scales is achieved, and short-term and Effective capture and fusion of long-term characteristics.
Patent Information
- Application Number
- CN202411106409.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-13
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2044-08-13
AI Technical Summary
When the real-world power load sequences show changes and fluctuations on different time scales, fixed-size patches cannot capture short-term and long-term multi-scale characteristics simultaneously, resulting in insufficient accuracy in power load prediction.
Variational modal decomposition technology combined with fast Fourier transform to extract significant periods, use these periods as patch length to segment the time series, and predict the time series at different scales based on the Transformer model, and finally fuse multiple times by weighted summing. Characteristics of scale.
It significantly improves the accuracy of power load prediction, and can capture short-term and long-term load changes at the same time, solving the problem that fixed-size patch cannot capture multi-scale features.
Smart Images

Figure CN119066491A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of power load forecasting, and in particular to a multi-scale power load forecasting method, device, equipment and storage medium. Background Art
[0002] In recent years, with the acceleration of economic development and urbanization, electricity demand has changed frequently. Accurate forecasting can optimize grid operation, reasonably arrange power generation plans, ensure reliable and economical power supply, and promote the access of new energy and the operation of the power market. However, due to the non-stationary and nonlinear characteristics of power load sequences, load forecasting is extremely challenging.
[0003] Existing load forecasting methods based on deep learning, represented by the Transformer model, have been widely used. Its self-attention mechanism can capture long-term dependencies in time series and automatically learn the relationship between elements in the sequence. It has good processing capabilities and high prediction accuracy for nonlinear data. However, the information revealed by a single time step is limited, and the standard dot product attention may ignore local patterns and mistakenly emphasize the similarities of different time steps. PatchTST introduces the concept of patch (block) in image processing into time series prediction. By presetting the length of the patch, the time series is divided into multiple blocks, each of which contains information from multiple time steps. This method can effectively capture local time series features while inheriting the advantages of the Transformer model. However, the real-world power load series shows changes and fluctuations at different time scales, and a fixed-size patch may not be able to capture short-term and long-term multi-scale features at the same time.
[0004] In summary, when real-world power load series show changes and fluctuations at different time scales, fixed-size patches may not be able to capture both short-term and long-term multi-scale characteristics, which is a problem that this application needs to solve. Summary of the invention
[0005] The main purpose of the present invention is to provide a multi-scale power load forecasting method, device, equipment and storage medium to solve the problem that a fixed-size patch may not be able to capture short-term and long-term multi-scale features at the same time when the real-world power load sequence shows changes and fluctuations on different time scales, thereby achieving the effect that when the real-world power load sequence shows changes and fluctuations on different time scales, multiple groups of patches of different sizes can capture short-term and long-term multi-scale features at the same time.
[0006] In order to achieve the above objectives, the present invention provides a multi-scale power load forecasting method, thereby achieving the effect of significantly improving the accuracy of power load forecasting.
[0007] In a first aspect, the present invention provides a multi-scale power load forecasting method, which is applied to a power load forecasting system. The method comprises:
[0008] Using variational mode decomposition, the original power load data is decomposed into K eigenmode component sequences, where K>1;
[0009] Extracting the main frequency of each intrinsic mode component sequence by fast Fourier transform, calculating the corresponding period according to the main frequency, and screening out the significant period;
[0010] Using the significant period as the patch length, segmenting the input time series by the patch length to obtain time series of different scales;
[0011] The different scale time series are predicted based on the Transformer model, and the obtained results are weighted and summed to obtain the final prediction result.
[0012] Optionally, the method of using variational mode decomposition to decompose the original power load data into K eigenmode component sequences comprises the following steps:
[0013] Step A101: Initialize the center frequency, mode function, Lagrange multiplier and maximum number of iterations;
[0014] Step A102: decomposing the time series of different scales into k modal functions by Lagrangian function, so that each modal function has the minimum frequency bandwidth;
[0015] Step A103: solving the optimization problem by using an alternating direction multiplier method, and updating the modal function and the center frequency;
[0016] Step A104: updating the Lagrange multiplier so that the optimization problem gradually approaches the optimal solution;
[0017] Step A105: Repeat the updating process in steps A103 and A104 until a preset convergence condition or the maximum number of iterations is reached, and then output the final intrinsic mode component sequence.
[0018] Optionally, the extracting the main frequency of each of the intrinsic mode component sequences by fast Fourier transform, calculating the corresponding period according to the main frequency, and screening out significant periods, comprises:
[0019] Performing fast Fourier transform on the K intrinsic mode component sequences respectively to obtain frequency domain signals;
[0020] Calculate the frequency components corresponding to the frequency domain signal, and find the index of the frequency component with the largest amplitude in the spectrum;
[0021] The period can be obtained by calculating the length of each eigenmode component sequence and dividing it by the index, and the value whose period is greater than the length of the eigenmode component sequence or less than 2 is removed to obtain the significant period.
[0022] Optionally, using the significant period as the patch length and segmenting the input time series by the patch length to obtain time series of different scales includes:
[0023] The input time series is divided into interlaced patches of length P, and the length of the isolated region separating the continuous patches is S;
[0024] The last load value of the time series is copied S times and appended to the end of the time series, and divided into N patches, thereby forming the time series of different scales.
[0025] Optionally, the predicting process of the time series of different scales based on the Transformer model and weighted summing the obtained results to obtain the final prediction result includes:
[0026] Build a Transformer model consisting of an encoder block and a linear prediction head decoder block;
[0027] The feature vector sequences corresponding to the time series of different scales are independently input into the encoding block for feature encoding, and the hidden state features of the encoder block are obtained as output;
[0028] Inputting the hidden state features into the linear prediction head decoder block for feature decoding, and outputting prediction results of different scales;
[0029] The prediction results of different scales are weighted and summed to obtain the final prediction result.
[0030] Optionally, the step of independently inputting the feature vector sequences corresponding to the time series of different scales into an encoding block for feature encoding, and outputting hidden state features of the encoder block, comprises:
[0031] Performing position encoding on the input time series of different scales to obtain position encoding features;
[0032] The position encoding feature is processed to obtain the hidden state feature.
[0033] Optionally, performing weighted summation on the prediction results of different scales to obtain a final prediction result includes:
[0034] Determine the number of the significant cycles as the number of weights, and determine each weight according to the length of the significant cycle;
[0035] The number of the significant cycles is determined as the number of prediction results of the different scales, and the final prediction result is obtained according to the weight corresponding to each prediction result of the different scales.
[0036] In a second aspect, the present invention provides a multi-scale power load forecasting device, which is applied to a power load forecasting system, and the device comprises:
[0037] A processing module, for decomposing the original power load data into K intrinsic mode component sequences using variational mode decomposition, where K>1;
[0038] A screening module, for extracting the main frequency of each of the intrinsic mode component sequences by fast Fourier transform, calculating the corresponding period according to the main frequency, and screening out significant periods;
[0039] The processing module is further used to use the significant period as the patch length to segment the input time series according to the patch length to obtain time series of different scales;
[0040] The prediction module is used to perform prediction processing on the time series of different scales based on the Transformer model, and perform weighted summation of the obtained results to obtain the final prediction result.
[0041] Optionally, the device further includes: an updating module.
[0042] The processing module is specifically used for step A101: initializing the center frequency, the modal function, the Lagrange multiplier and the maximum number of iterations; step A102: decomposing the time series of different scales into K modal functions through the Lagrange function so that each modal function has the minimum bandwidth;
[0043] The update module is used for step A103: solving the optimization problem by the alternating direction multiplier method, and updating the modal function and the center frequency; step A104: updating the Lagrange multiplier so that the optimization problem gradually approaches the optimal solution; step A105: repeating the update process in steps A103 and A104 until the preset convergence condition or the maximum number of iterations is reached, and then outputting the final intrinsic mode component sequence.
[0044] Optionally, the processing module is specifically used to perform fast Fourier transform on the K intrinsic mode component sequences respectively to obtain frequency domain signals; calculate the frequency components corresponding to the frequency domain signals, and find the index of the frequency component with the largest amplitude in the spectrum; calculate the length of each intrinsic mode component sequence and divide it by the index to obtain the period;
[0045] The screening module is specifically used to remove the period that is greater than the length of the eigenmode component sequence or less than 2, to obtain a significant period.
[0046] Optionally, the processing module is specifically used to divide the input time series into interlaced patches of length P, and the length of the isolated area separating continuous patches is S; copy the last load value of the time series S times and append it to the end of the time series, dividing it into N patches, thereby forming the time series of different scales.
[0047] Optionally, the processing module is specifically used to construct a Transformer model including an encoder block and a linear prediction head decoder block; independently input the feature vector sequences corresponding to the time series of different scales into the encoding block for feature encoding, and output the hidden state features of the encoder block;
[0048] The prediction module is specifically used to input the hidden state feature into the linear prediction head decoder block for feature decoding, and output prediction results of different scales; and perform weighted summation on the prediction results of different scales to obtain a final prediction result.
[0049] Optionally, the processing module is specifically used to perform position encoding on the input time series of different scales to obtain position encoding features; and process the position encoding features to obtain the hidden state features.
[0050] Optionally, the processing module is specifically configured to determine the number of the significant periods as the number of weights, and determine each weight according to the length of the significant period;
[0051] The prediction module is specifically used to determine the number of the significant cycles as the number of prediction results of the different scales, and obtain the final prediction result according to the weight corresponding to each prediction result of the different scales.
[0052] In a third aspect, the present invention provides a multi-scale power load forecasting device, the device comprising:
[0053] Memory;
[0054] processor;
[0055] Wherein, the memory stores computer-executable instructions;
[0056] The processor executes the computer-executable instructions stored in the memory to implement the above first aspect and / or various possible implementations of the first aspect.
[0057] In a fourth aspect, the present application provides a computer storage medium, wherein the computer-readable storage medium stores computer execution instructions, and when the computer execution instructions are executed by a processor, they are used to implement the above first aspect and / or various possible implementations of the first aspect.
[0058] The multi-scale power load forecasting method, device, equipment and storage medium provided by the present application use variational mode decomposition technology combined with fast Fourier transform to extract significant cycles, ensure that the key cycle features in the data are captured, use the detected significant cycles as the patch length, and segment the input time series into different patch scales to simultaneously process short-term and long-term load changes. Based on the Transformer model, the time series of different scales are predicted and processed, and the contextual information in the time series is fully utilized. Finally, the features of multiple scales are fused by weighted summation to obtain the final power load forecasting result. Through this method, the problem that when the real-world power load series shows changes and fluctuations at different time scales, the fixed-size patch may not be able to capture short-term and long-term multi-scale features at the same time is solved, thereby achieving the effect of significantly improving the accuracy of power load forecasting. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] The drawings constituting a part of the present application are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0060] Figure 1 Schematic diagram of the process of multi-scale power load forecasting method provided in this application Figure 1 ;
[0061] Figure 2 Schematic diagram of the process of multi-scale power load forecasting method provided in this application Figure 2 ;
[0062] Figure 3 Schematic diagram of the process of multi-scale power load forecasting method provided in this application Figure 3 ;
[0063] Figure 4 Schematic diagram of the process of multi-scale power load forecasting method provided in this application Figure 4 ;
[0064] Figure 5 A schematic diagram of the structure of the multi-scale power load forecasting device provided in this application;
[0065] Figure 6 A schematic diagram of the structure of the multi-scale power load forecasting device provided in this application.
[0066] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0067] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0068] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in sequences other than those illustrated or described herein.
[0069] In the present invention, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in this application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0070] In recent years, with the acceleration of economic development and urbanization, electricity demand has changed frequently. Accurate prediction can optimize the operation of the power grid, reasonably arrange the power generation plan, ensure reliable and economical power supply, and promote the access of new energy and the operation of the power market. Therefore, the main goal of power load forecasting is to accurately estimate the load demand of the power system within a certain time range in the future. However, due to the non-stationary and nonlinear characteristics of the power load sequence, load forecasting is extremely challenging.
[0071] At present, most power load forecasting architectures such as recurrent neural networks and long short-term memory networks are not sufficient in capturing complex long-distance dependencies and contextual information. Existing load forecasting methods based on deep learning, represented by the Transformer model, have been widely used. Its self-attention mechanism can capture long-term dependencies in time series and automatically learn the relationship between elements in the sequence. It has good processing capabilities and high prediction accuracy for nonlinear data. However, the information revealed by a single time step is limited. The standard dot product attention may ignore local patterns and mistakenly emphasize the similarities of different time steps. PatchTST introduces the concept of patch (block) in image processing into time series prediction. By presetting the length of the patch, the time series is divided into multiple blocks, each of which contains information from multiple time steps. This method can effectively capture local time series features while inheriting the advantages of the Transformer model. However, the real-world power load series shows changes and fluctuations at different time scales, and a fixed-size patch may not be able to capture short-term and long-term multi-scale features at the same time.
[0072] In response to the above problems, when the real-world power load series shows changes and fluctuations at different time scales, fixed-size patches may not be able to capture both short-term and long-term multi-scale characteristics, which is a problem that this application needs to solve.
[0073] The multi-scale power load forecasting method provided by the present application uses variational mode decomposition technology combined with fast Fourier transform to extract significant cycles, ensures that key cycle features in the data are captured, uses the detected significant cycles as the patch length, and divides the input time series into different patch scales to simultaneously process short-term and long-term load changes. Based on the Transformer model, the time series of different scales are predicted and processed, and the contextual information in the time series is fully utilized. Finally, the features of multiple scales are fused by weighted summation to obtain the final power load forecasting result. Through this method, the problem that when the real-world power load series shows changes and fluctuations at different time scales, the fixed-size patch may not be able to capture short-term and long-term multi-scale features at the same time is solved, thereby achieving the effect of significantly improving the accuracy of power load forecasting.
[0074] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0075] Figure 1Schematic diagram of the process of multi-scale power load forecasting method provided in this application Figure 1 , the execution subject of this embodiment is the power load forecasting system, such as Figure 1 As shown, the multi-scale power load forecasting method provided in this embodiment includes:
[0076] S101: Using variational mode decomposition, decompose the original power load data into K eigenmode component sequences.
[0077] Among them, the decomposition process of variational mode decomposition is divided into the following six steps.
[0078] Step 1: Initialize the center frequency and each mode function u k , Lagrange multiplier λ and maximum number of iterations N;
[0079] Step 2: Construct a Lagrangian function to handle constrained optimization problems. The goal is to decompose the time series f(t) of different scales into K modal functions, so that each modal function has the minimum bandwidth;
[0080] Step 3: Solve the optimization problem by using the Alternating Direction Method of Multipliers (ADMM) and update the modal function and center frequency accordingly.
[0081] Step 4: Update the Lagrange multiplier λ to gradually approach the optimal solution;
[0082] Step 5: repeat step 3 and each updating process in step 3 until a preset convergence condition or a maximum number of iterations N is reached; Step 6: output the final intrinsic mode component sequence.
[0083] The purpose of this step is to use variational mode decomposition technology to prepare basic data for the next step of extracting significant cycles in combination with fast Fourier transform, where the basic data refers to K intrinsic mode component sequences.
[0084] S102: extracting the main frequency of each of the intrinsic mode component sequences by using fast Fourier transform, calculating the corresponding period according to the main frequency, and screening out significant periods.
[0085] Among them, the method of using fast Fourier transform to extract the main frequency of each of the intrinsic mode component sequences is: first, each of the intrinsic mode component sequences is subjected to fast Fourier transform to obtain a frequency domain signal, and then the corresponding frequency components are calculated, and the main frequency can be found by finding the index of the frequency component with the largest amplitude in the spectrum.
[0086] The method of screening out significant cycles is: first, the length of the intrinsic mode component sequence is calculated and divided by the index of the frequency to obtain the cycle, and the values of infinite or too small cycles are removed to obtain significant cycles.
[0087] The purpose of this step is to ensure that the key periodic features in the original power load data are captured.
[0088] S103: Using the significant period as a patch length, segmenting the input time series by the patch length to obtain time series of different scales.
[0089] The step of dividing the input time series into the patch length and obtaining time series of different scales is:
[0090] Step 1: Split the input time series into interlaced patches, where the patch length is P and the length of the isolated region separating continuous patches is S;
[0091] Step 2: Add a copy of the last value at the end of the time series S times to avoid missing data during segmentation, and segment to form N patches;
[0092] Step 3: Repeat steps 1 and 2 for each scale patch to form time series of different scales.
[0093] The purpose of this step is to simultaneously process short-term and long-term load changes by segmenting the input time series into the patch length.
[0094] S104: Predicting the time series of different scales based on the Transformer model, and weighted summing the obtained results to obtain a final prediction result.
[0095] The step of performing prediction processing on the time series of different scales based on the Transformer model is:
[0096] Step 1: Build a Transformer model including an encoder block and a linear prediction head decoder block;
[0097] Step 2: independently input the feature vector sequences corresponding to the time series data divided at different scales into the encoding block for feature encoding, and output the hidden state features of the encoder block;
[0098] Step 3: Input the hidden state features of the encoder block into the linear prediction head decoder block for feature decoding, and output prediction results of different scales;
[0099] Step 4: Perform weighted summation on the prediction results obtained by each decoder block to obtain the final prediction result.
[0100] This step finally predicts the time series of different scales based on the Transformer model, and weights and sums the obtained results to obtain the final prediction result. It not only solves the shortcomings of traditional methods in period extraction and multi-scale analysis, but also significantly improves the accuracy of power load forecasting.
[0101] The multi-scale power load forecasting method provided in the embodiment of the present application utilizes variational mode decomposition technology combined with fast Fourier transform to extract significant cycles, ensures that key cycle features in the data are captured, uses the detected significant cycles as the patch length, and divides the input time series into different patch scales to simultaneously process short-term and long-term load changes. Based on the Transformer model, the time series of different scales are predicted and processed, and the contextual information in the time series is fully utilized. Finally, the features of multiple scales are fused by weighted summation to obtain the final power load forecasting result. Through this method, the problem that when the real-world power load series shows changes and fluctuations on different time scales, a fixed-size patch may not be able to capture short-term and long-term multi-scale features at the same time is solved, thereby achieving the effect of significantly improving the accuracy of power load forecasting.
[0102] Figure 2 Schematic diagram of the process of multi-scale power load forecasting method provided in this application Figure 2 ,like Figure 2 As shown, in this embodiment Figure 1 Based on the embodiment, the multi-scale power load forecasting method is described in detail. Figure 2 As shown, the multi-scale power load forecasting method provided in this embodiment includes:
[0103] S201: Initialize the center frequency, mode function, Lagrange multiplier and maximum number of iterations.
[0104] The center frequency is represented by ω k Indicates that each modal function is represented by u k Denote the Lagrange multiplier as λ and the maximum number of iterations as N, initialize ω k 、u k , λ, and N can be initialized using an initialization tool, or a computer program can be used to complete the initialization process according to actual needs.
[0105] S202: Decomposing time series of different scales into K modal functions by Lagrangian functions, so that each modal function has a minimum frequency bandwidth.
[0106] The method of decomposing the time series of different scales into K modal functions by Lagrangian function is: constructing Lagrangian function to deal with constrained optimization problems. The goal is to decompose the time series of different scales f(t) into K modal functions so that each modal function has the minimum bandwidth; the optimization problem is expressed as the following formula:
[0107]
[0108] Among them, α is the smoothing parameter, represents the time derivative, j is the imaginary unit, δ(t) is the Dirac function, λ(t) is the Lagrange multiplier, ω k is the center frequency, u k is the mode function, λ is the Lagrange multiplier, N is the maximum number of iterations, and f(t) is the time series of different scales.
[0109] S203: Solve the optimization problem by using the alternating direction multiplier method, and update the modal function and the center frequency.
[0110] The process of solving the optimization problem by the alternating direction multiplier method and updating the modal function and the center frequency accordingly can be defined by the following formula:
[0111]
[0112]
[0113] Among them, ω k is the center frequency, u k is the mode function, λ is the Lagrange multiplier, and α is the smoothing parameter.
[0114] S204: Update the Lagrange multiplier to make the optimization problem gradually approach the optimal solution.
[0115] The method of updating the Lagrange multiplier so that the optimization problem gradually approaches the optimal solution can be defined by the following formula:
[0116]
[0117] Where τ is the step size parameter, λ(t) is the Lagrange multiplier, f(t) is the signal, and u k is a modal function.
[0118] S205: Repeat the updating process in steps S203 and S204 until a preset convergence condition or a maximum number of iterations is reached, and then output the final intrinsic mode component sequence.
[0119] The condition until a preset convergence condition or a maximum number of iterations is reached can be expressed by the following formula:
[0120]
[0121] Among them, ε is the given judgment accuracy, u k is a modal function.
[0122] S206: Perform fast Fourier transform on the K intrinsic mode component sequences respectively to obtain frequency domain signals.
[0123] Among them, each eigenmode component sequence is subjected to fast Fourier transform to obtain a frequency domain signal; its definition is as follows:
[0124] yf=fft(mode)
[0125] Among them, mode is the modal component of the input, fft is the fast Fourier transform function, and yf is the frequency domain signal.
[0126] S207: Calculate the frequency components corresponding to the frequency domain signal, and find the index of the frequency component with the largest amplitude in the frequency spectrum.
[0127] The step of calculating the frequency components corresponding to the frequency domain signal and finding the index of the frequency component with the largest amplitude in the spectrum can be expressed as:
[0128] xf=fftfreq(n)
[0129] Wherein, fftfreq represents the function used to generate the frequency value in the fast Fourier transform result, n is the length of the data, and xf is the index of the largest frequency component.
[0130] It can be understood that the present invention can obtain the characteristics of the signal at different scales by analyzing the frequency spectra of different modal components through the function of fast Fourier transform.
[0131] S208: Calculate the length of each eigenmode component sequence and divide it by the index to obtain a period, remove values whose periods are greater than the length of the eigenmode component sequence or less than 2, and obtain a significant period.
[0132] The period can be obtained by dividing the length of each intrinsic mode component sequence by the index, which can be expressed as:
[0133]
[0134] Where n is the length of the sequence, idx is the index of the main frequency component, and period is the period.
[0135] The method of removing the period that is greater than the length of the intrinsic mode component sequence or less than 2 to obtain the significant period can be: using a computer program to determine whether the value of period satisfies the condition of being greater than the length of the intrinsic mode component sequence or less than 2, and marking the period that meets the above condition as a significant period.
[0136] S209: Using the significant period as the patch length, segmenting the input time series by the patch length to obtain time series of different scales.
[0137] S210: Predict time series of different scales based on the Transformer model, and perform weighted summation on the obtained results to obtain the final prediction result.
[0138] Among them, steps S209-S210 are similar to steps S103-S104, so they are not repeated here.
[0139] The multi-scale power load forecasting method provided by the embodiment of the present application uses Lagrangian functions to decompose time series of different scales into K modal functions, then solves the optimization problem by the alternating direction multiplier method, and updates the modal function and the center frequency, updates the Lagrangian multiplier so that the optimization problem gradually approaches the optimal solution to obtain the final K intrinsic modal component sequences, and then extracts the significant cycles by fast Fourier transforming the intrinsic modal component sequences respectively, ensuring that the key periodic features in the data are captured, and using the detected significant cycles as the patch length, the input time series is segmented into different patch scales to simultaneously process short-term and long-term load changes, and predicts and processes time series of different scales based on the Transformer model, making full use of the context information in the time series, and finally merging the features of multiple scales by weighted summation to obtain the final power load forecasting result. Through this method, the problem that when the real-world power load series shows changes and fluctuations on different time scales, the fixed-size patch may not be able to capture the short-term and long-term multi-scale features at the same time is solved, thereby achieving the effect of significantly improving the accuracy of power load forecasting.
[0140] Figure 3 Schematic diagram of the process of multi-scale power load forecasting method provided in this application Figure 3 ,like Figure 3 As shown, in this embodiment Figure 1 Based on the embodiment, the multi-scale power load forecasting method is described in detail. Figure 3 As shown, the multi-scale power load forecasting method provided in this embodiment includes:
[0141] S301: Using variational mode decomposition, decompose the original power load data into K intrinsic mode component sequences.
[0142] S302: extracting the main frequency of each of the intrinsic mode component sequences by using fast Fourier transform, calculating the corresponding period according to the main frequency, and screening out significant periods.
[0143] Among them, steps S301-S302 are similar to steps S101-S102, so they are not repeated here.
[0144] S303: Divide the input time series into interlaced patches of length P, and separate the isolated regions of continuous patches with a length of S.
[0145] The segmentation method may be to segment the input time series into interlaced patches according to the length P actually required by a computer program, and the length of the isolated region separating the continuous patches is S.
[0146] S304: copy the last load value of the time series S times and append it to the end of the time series, split it into N patches, and thus form time series of different scales.
[0147] The method of appending S copies of the last value at the end of the time series to avoid missing data during segmentation can be to copy the last load value through a computer program, and splice the last load value at the end of the time series through a conventional splicing algorithm, and split into N patches; the number of patches is expressed as:
[0148]
[0149] Where L represents the length of the time series.
[0150] Repeat steps S303 and S304 for each scale patch to form time series of different scales.
[0151] It can be understood that by dividing the time series data into a set of multiple patches Each patch contains data within a period of time {p1,…,p N This approach helps capture local patterns in time series and reduces the computational complexity of the model to O(N 2 / S 2 ). The disadvantage of standard dot-product attention is that it may ignore local patterns and mistakenly emphasize the similarities of different time steps. By patching the time series at different scales, local patterns can be effectively captured and multi-scale features of short-term and long-term can be extracted.
[0152] S305: Construct a Transformer model including an encoder block and a linear prediction head decoder block.
[0153] Among them, the method of constructing the Transformer model including the encoder block and the linear prediction head decoder block can be to input the output data of the encoder block into the linear prediction head decoder block for processing, and the processing method can be to use a computer system program. It can be understood that this step is a routine operation of technicians in this field, and there are many methods to choose from, so it will not be described in detail here.
[0154] S306: independently inputting feature vector sequences corresponding to time series of different scales into the encoding block for feature encoding, and outputting hidden state features of the encoder block.
[0155] The method of independently inputting the feature vector sequences corresponding to the time series of different scales into the encoding block for feature encoding and outputting the hidden state features of the encoder block is completed by the following steps:
[0156] Step 1: Position encode the input time series of different scales to obtain position encoding features;
[0157] Specifically, the present invention performs position encoding on the input X corresponding to the time series of different scales with a length of l, which is specifically expressed as:
[0158]
[0159]
[0160] Among them, pos is the position, i is the position index, d is the dimension of the position encoding vector, and PE is the position encoding.
[0161] The input time series X = [x1, x2, ..., x l ] is added to the position code to form an input time series containing position information:
[0162] Z=X+PE
[0163] The input time series Z containing position information is transformed into a projection matrix W. proj Projecting to a high-dimensional space, we get the projected sequence H:
[0164] H=ZW proj
[0165] Step 2: Input the position encoding feature H into the multi-head attention layer, concatenate the output results of each attention head, and pass it through the projection matrix W o As a linear mapping, it can be expressed as:
[0166] MultiHead(Q,K,V)=Concat(head1,…,head h )WO
[0167] Among them, MultiHead represents the output features of the multi-head attention layer, Concat is the concatenation function, h represents the number of attention heads, and the calculation of each attention head is as follows:
[0168]
[0169] Where Q = W Q Z, K = W K Z, V = W V Z, W Q , W K , W V is the projection matrix, d k is the dimension of the attention head.
[0170] Step 3: Input the output features of the multi-head attention layer into the first addition and normalization layer to obtain the output features of the first addition and normalization layer, expressed as:
[0171] H′=LayerNorm(H+A)
[0172] Among them, A is the output of the multi-head attention mechanism, H is the sequence after projection, H′ is the output feature of the first addition and normalization layer, and LayerNorm represents layer normalization;
[0173] Step 4: Input the output features of the first addition and normalization layer into the feed-forward network, which contains two fully connected layers. It can be expressed as:
[0174] FFN(H′)=ReLU(H′W1+b1)W2+b2
[0175] Among them, W1, W2, b1, b2 are the parameters of the feedforward network, ReLU is the activation function, FFN is the feedforward network, and H′ is the output feature of the first addition and normalization layer.
[0176] Step 5: Input the output features of the feedforward network layer into the second addition and normalization layer to obtain the output features of the second addition and normalization layer;
[0177] Step 6: Use M independent encoders to process sequences of different scales, and apply steps 1 to 5 to time series of different scales. It can be expressed as:
[0178]
[0179] Among them, Enconder represents the encoder, h m is the hidden state feature, is the time series segmented using the mth patch size, P mis the mth patch size. After the above steps, the hidden state features of the encoder block are finally output.
[0180] S307: Input the hidden state features into the linear prediction head decoder block for feature decoding, and output prediction results of different scales.
[0181] Among them, the input of hidden state features into the linear prediction head decoder block for feature decoding and output to obtain prediction results of different scales is a routine operation of those skilled in the art, and the input and output process can be completed using the existing linear prediction head decoder block, so it is not described in detail here.
[0182] S308: Perform weighted summation on the prediction results of different scales to obtain the final prediction result.
[0183] The weighted summation of prediction results at different scales is accomplished by the following steps:
[0184] Step 1: Each weight is calculated as p i The reciprocal of j = 1 to M is the reciprocal of all p j The sum of the reciprocals of is normalized to ensure that the sum of the weights is 1; the weight of each scale is expressed as:
[0185]
[0186] Step 2: Multiply the prediction result of each scale by the corresponding weight, and add the results linearly to get the final prediction result.
[0187] The multi-scale power load forecasting method provided by the embodiment of the present application uses variational mode decomposition technology combined with fast Fourier transform to extract significant cycles, ensure that the key cycle features in the data are captured, use the detected significant cycles as the patch length, and divide the input time series into different patch scales to simultaneously process short-term and long-term load changes. The time series of different scales are predicted and processed based on the Transformer model, and the context information in the time series is fully utilized. The feature vector sequences corresponding to the time series of different scales are independently input into the encoding block for feature encoding, and the hidden state features of the encoder block are output, and the hidden state features are input into the linear prediction head decoder block for feature decoding, and the prediction results of different scales are output. Finally, the features of multiple scales are fused by weighted summation to obtain the final power load forecasting result. Through this method, the problem that when the power load series in the real world shows changes and fluctuations on different time scales, the fixed-size patch may not be able to capture short-term and long-term multi-scale features at the same time is solved, thereby achieving the effect of significantly improving the accuracy of power load forecasting.
[0188] Figure 4 Schematic diagram of the process of multi-scale power load forecasting method provided in this application Figure 4 ,like Figure 4 As shown, in this embodiment Figure 3 Based on the embodiment, the prediction processing of the time series of different scales based on the Transformer model and the weighted summation of the obtained results to obtain the final prediction result are described in detail, such as Figure 3 As shown, the multi-scale power load forecasting method provided in this embodiment includes:
[0189] S401: Construct a Transformer model including an encoder block and a linear prediction head decoder block.
[0190] Among them, the method of constructing the Transformer model including the encoder block and the linear prediction head decoder block can be to input the output data of the encoder block into the linear prediction head decoder block for processing, and the processing method can be to use a computer system program. It can be understood that this step is a routine operation of technicians in this field, and there are many methods to choose from, so it will not be described in detail here.
[0191] S402: Position encoding is performed on input time series of different scales to obtain position encoding features.
[0192] The specific method of performing position encoding on the input time series of different scales to obtain the position encoding features is as follows:
[0193] The position encoding of the input X corresponding to the time series of different scales with a length of l is specifically expressed as:
[0194]
[0195]
[0196] Where pos is the position, i is the position index, and d is the dimension of the position encoding vector.
[0197] The input sequence X=[x1,x2,…,x l ] is added to the position code to form an input sequence containing position information:
[0198] Z=X+PE
[0199] Among them, PE is the position code.
[0200] The input sequence Z containing position information is transformed into a projection matrix W. proj Projecting to a high-dimensional space, we get the projected sequence H:
[0201] H=ZW proj
[0202] S403: Process the position encoding feature to obtain a hidden state feature.
[0203] The method of processing the position coding feature to obtain the hidden state feature specifically includes the following steps.
[0204] Step 1: Input the position coding feature obtained in step S402 into the multi-head attention layer, and splice the output results of each attention head. The specific process can be expressed as follows: Input the position coding feature H into the multi-head attention layer, splice the output results of each attention head, and pass through the projection matrix W o As a linear mapping, it can be expressed as:
[0205] MultiHead(Q,K,V)=Concat(head1,…,head h )W O
[0206] Among them, MultiHead represents the output features of the multi-head attention layer, h represents the number of attention heads, and the calculation of each attention head is as follows:
[0207]
[0208] Where Q = W Q Z, K = W K Z, V = W V Z, W Q , W K , W V is the projection matrix, d k is the dimension of the attention head;
[0209] Step 2: Input the output features of the multi-head attention layer into the first addition and normalization layer to obtain the output features of the first addition and normalization layer. The specific process can be expressed as:
[0210] H′=LayerNorm(H+A)
[0211] Among them, H is the position encoding feature, A is the output of the multi-head attention mechanism, and LayerNorm represents layer normalization;
[0212] Step 3: Input the output features of the first addition and normalization layer into the feedforward network layer to obtain the output features of the feedforward network layer. The specific process can be expressed as:
[0213] FFN(H′)=ReLU(H′W1+b1)W2+b2
[0214] Among them, W1, W2, b1, b2 are the parameters of the feedforward network, and ReLU is the activation function;
[0215] Step 4: Input the output features of the feedforward network layer into the second addition and normalization layer to obtain the output features of the second addition and normalization layer;
[0216] Step 5: Use M independent encoders to process sequences of different scales, and apply steps 1 to 5 to time series of different scales. It can be expressed as:
[0217]
[0218] Among them, Enconder represents the encoder, h m is the hidden state feature, is the time series segmented using the mth patch size, P m is the mth patch size. After the above steps, the hidden state features of the encoder block are finally output.
[0219] S404: Input the hidden state features into the linear prediction head decoder block for feature decoding, and output prediction results of different scales.
[0220] Among them, the input of hidden state features into the linear prediction head decoder block for feature decoding and output to obtain prediction results of different scales is a routine operation of those skilled in the art, and the input and output process can be completed using the existing linear prediction head decoder block, so it is not described in detail here.
[0221] S405: Determine the number of significant periods as the number of weights, and determine each weight according to the length of the significant period.
[0222] where each weight is calculated as p i The reciprocal of j = 1 to M is the reciprocal of all p j The sum of the reciprocals of is normalized to ensure that the sum of the weights is 1; the weight of each scale is expressed as:
[0223]
[0224] S406: Determine the number of significant cycles as the number of prediction results of different scales, and obtain the final prediction result according to the weight corresponding to each prediction result of different scales.
[0225] The final prediction result is obtained by multiplying the prediction result of each scale obtained in step S405 by the corresponding weight, and linearly adding the results to obtain the final prediction result.
[0226] The multi-scale power load forecasting method provided in the embodiment of the present application utilizes variational mode decomposition technology combined with fast Fourier transform to extract significant cycles, ensures that key cycle features in the data are captured, uses the detected significant cycles as the patch length, and divides the input time series into different patch scales to simultaneously process short-term and long-term load changes. Based on the Transformer model, the time series of different scales are predicted and processed, making full use of the contextual information in the time series. Finally, each weight is determined according to the length of the significant cycle, and the weights corresponding to the prediction results of each different scale are linearly added to obtain the final power load forecasting result. Through this method, the problem that when the real-world power load series shows changes and fluctuations on different time scales, a fixed-size patch may not be able to capture short-term and long-term multi-scale features at the same time is solved, thereby achieving the effect of significantly improving the accuracy of power load forecasting.
[0227] Figure 5 The schematic diagram of the structure of the multi-scale power load forecasting device provided in this application is applied to the power load forecasting system, such as Figure 5 As shown, the multi-scale power load prediction device 500 provided in this embodiment includes:
[0228] The processing module 501 is used to decompose the original power load data into K intrinsic mode component sequences using variational mode decomposition, where K>1;
[0229] A screening module 502 is used to extract the main frequency of each of the intrinsic mode component sequences by using fast Fourier transform, calculate the corresponding period according to the main frequency, and screen out significant periods;
[0230] The processing module 501 is further configured to use the significant period as a patch length to segment the input time series by the patch length to obtain time series of different scales;
[0231] The prediction module 503 is used to perform prediction processing on the time series of different scales based on the Transformer model, and perform weighted summation of the obtained results to obtain the final prediction result.
[0232] Optionally, the device further includes: an updating module.
[0233] The processing module 501 is specifically used for step A101: initializing the center frequency, the modal function, the Lagrange multiplier and the maximum number of iterations; step A102: decomposing the time series of different scales into K modal functions through the Lagrange function so that each modal function has the minimum bandwidth;
[0234] The update module is used for step A103: solving the optimization problem by the alternating direction multiplier method, and updating the modal function and the center frequency; step A104: updating the Lagrange multiplier so that the optimization problem gradually approaches the optimal solution; step A105: repeating the update process in steps A103 and A104 until the preset convergence condition or the maximum number of iterations is reached, and then outputting the final intrinsic mode component sequence.
[0235] Optionally, the processing module 501 is specifically used to perform fast Fourier transform on the K intrinsic mode component sequences respectively to obtain frequency domain signals; calculate the frequency components corresponding to the frequency domain signals, and find the index of the frequency component with the largest amplitude in the spectrum; calculate the length of each intrinsic mode component sequence and divide it by the index to obtain the period;
[0236] The screening module 502 is specifically used to remove the period that is greater than the length of the eigenmode component sequence or less than 2, to obtain a significant period.
[0237] Optionally, the processing module 501 is specifically used to divide the input time series into interlaced patches of length P, and the length of the isolated area separating continuous patches is S; copy the last load value of the time series S times and append it to the end of the time series, dividing it into N patches, thereby forming the time series of different scales.
[0238] Optionally, the processing module 501 is specifically used to construct a Transformer model including an encoder block and a linear prediction head decoder block; independently input the feature vector sequences corresponding to the time series of different scales into the encoding block for feature encoding, and output the hidden state features of the encoder block;
[0239] The prediction module 503 is specifically used to input the hidden state feature into the linear prediction head decoder block for feature decoding, and output prediction results of different scales; and perform weighted summation on the prediction results of different scales to obtain a final prediction result.
[0240] Optionally, the processing module 501 is specifically configured to perform position encoding on the input time series of different scales to obtain position encoding features; and process the position encoding features to obtain the hidden state features.
[0241] Optionally, the processing module 501 is specifically configured to determine the number of the significant periods as the number of weights, and determine each weight according to the length of the significant period;
[0242] The prediction module 503 is specifically configured to determine the number of the significant cycles as the number of prediction results of the different scales, and obtain the final prediction result according to the weight corresponding to each prediction result of the different scales.
[0243] Figure 6 This is a schematic diagram of the structure of the multi-scale power load forecasting device provided in this application. Figure 6 As shown, the multi-scale power load prediction device 600 provided by the present application includes:
[0244] Memory 602;
[0245] Processor 601;
[0246] Wherein, the memory 602 stores computer-executable instructions;
[0247] The processor 601 executes the computer-executable instructions stored in the memory to implement the multi-scale power load forecasting method as shown in the above embodiment.
[0248] The present application also provides a computer storage medium, in which computer execution instructions are stored. When the computer execution instructions are executed by a processor, they are used to implement the multi-scale power load forecasting method shown in the above embodiment.
[0249] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those of ordinary skill in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0250] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0251] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A multi-scale power load forecasting method, characterized in that: Applied to a power load forecasting system, the method comprises: Using variational mode decomposition, the original power load data is decomposed into K eigenmode component sequences, where K>1; Extracting the main frequency of each intrinsic mode component sequence by fast Fourier transform, calculating the corresponding period according to the main frequency, and screening out the significant period; Using the significant period as the patch length, segmenting the input time series by the patch length to obtain time series of different scales; The different scale time series are predicted based on the Transformer model, and the obtained results are weighted and summed to obtain the final prediction result.
2. The method according to claim 1, characterized in that The method of using variational mode decomposition to decompose the original power load data into K intrinsic mode component sequences includes the following steps: Step A101: Initialize the center frequency, mode function, Lagrange multiplier and maximum number of iterations; Step A102: decomposing the time series of different scales into K modal functions by Lagrangian function, so that each modal function has a minimum frequency bandwidth; Step A103: solving the optimization problem by using an alternating direction multiplier method, and updating the modal function and the center frequency; Step A104: updating the Lagrange multiplier so that the optimization problem gradually approaches the optimal solution; Step A105: Repeat the updating process in steps A103 and A104 until a preset convergence condition or the maximum number of iterations is reached, and then output the final intrinsic mode component sequence.
3. The method according to claim 1, characterized in that The method of extracting the main frequency of each intrinsic mode component sequence by fast Fourier transform, calculating the corresponding period according to the main frequency, and screening out the significant period includes: Performing fast Fourier transform on the K intrinsic mode component sequences respectively to obtain frequency domain signals; Calculate the frequency components corresponding to the frequency domain signal, and find the index of the frequency component with the largest amplitude in the spectrum; The period can be obtained by calculating the length of each eigenmode component sequence and dividing it by the index, and the value whose period is greater than the length of the eigenmode component sequence or less than 2 is removed to obtain the significant period.
4. The method according to claim 1, characterized in that: The method uses the significant period as the patch length, and divides the input time series by the patch length to obtain time series of different scales, including: The input time series is divided into interlaced patches of length P, and the length of the isolated region separating the continuous patches is S; The last load value of the time series is copied S times and appended to the end of the time series, and divided into N patches, thereby forming the time series of different scales.
5. The method according to claim 4, characterized in that The prediction processing of the time series of different scales based on the Transformer model and weighted summing of the obtained results to obtain the final prediction result include: Build a Transformer model consisting of an encoder block and a linear prediction head decoder block; The feature vector sequences corresponding to the time series of different scales are independently input into the encoding block for feature encoding, and the hidden state features of the encoder block are obtained as output; Inputting the hidden state features into the linear prediction head decoder block for feature decoding, and outputting prediction results of different scales; The prediction results of different scales are weighted and summed to obtain the final prediction result.
6. The method according to claim 5, characterized in that The step of independently inputting the feature vector sequences corresponding to the time series of different scales into the encoding block for feature encoding, and outputting the hidden state features of the encoder block, comprises: Performing position encoding on the input time series of different scales to obtain position encoding features; The position encoding feature is processed to obtain the hidden state feature.
7. The method according to claim 5, characterized in that The weighted summing of the prediction results of different scales to obtain the final prediction result includes: Determine the number of the significant cycles as the number of weights, and determine each weight according to the length of the significant cycle; The number of the significant cycles is determined as the number of prediction results of the different scales, and the final prediction result is obtained according to the weight corresponding to each prediction result of the different scales.
8. A multi-scale power load forecasting device, characterized in that: The multi-scale power load forecasting method according to any one of claims 1 to 7, wherein the device comprises: A processing module, for decomposing the original power load data into K intrinsic mode component sequences using variational mode decomposition, where K>1; A screening module, for extracting the main frequency of each of the intrinsic mode component sequences by fast Fourier transform, calculating the corresponding period according to the main frequency, and screening out significant periods; The processing module is further used to use the significant period as the patch length to segment the input time series according to the patch length to obtain time series of different scales; The prediction module is used to perform prediction processing on the time series of different scales based on the Transformer model, and perform weighted summation of the obtained results to obtain the final prediction result.
9. A multi-scale power load forecasting device, characterized in that: include: Memory; processor; Wherein, the memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the multi-scale power load forecasting method according to any one of claims 1-7.
10. A computer storage medium, characterized in that: The computer storage medium stores computer execution instructions, which, when executed by a processor, are used to implement the multi-scale power load forecasting method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Wind turbine wind speed prediction optimization method based on multi-scale analysis
CN107203827A
Wind power station output ultra-short time prediction method based on least square support vector machine
CN111222680A
Power load prediction model and construction method, device and application thereof
CN117114056A
Long-term power load prediction method based on automatic variational mode decomposition and time-frequency domain feedforward neural network
CN117410985A
Cited By
Short-term power load prediction method based on modal Fourier decomposition and improved Autoformer
CN119994871A
A short-term power load prediction method based on modal fourier decomposition and improved Autoformer
CN119994871B
Multi-scale power load prediction method and system based on dynamic graph neural network
CN121076736A
