Ultra-short-term power load prediction method and system based on attention mechanism and long-short-term memory network, storage medium and electronic equipment

By introducing attention mechanism and adaptive particle swarm algorithm into ultra-short-term power load forecasting, the LSTM model is optimized, solving the problems of complex calculation and slow processing speed of existing methods, and achieving more efficient and accurate forecasting results.

CN119337121APending Publication Date: 2025-01-21NORTH CHINA UNIV OF WATER RESOURCES & ELECTRIC POWER

Patent Information

Application Number
CN202411426584.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-12
Publication Date
2025-01-21

AI Technical Summary

Technical Problem

The existing ultra-short-term power load prediction methods are complex in the calculation process, resulting in slow processing speed and difficult to meet the real-time needs of the power system.

Method used

An ultra-short-term power load forecasting method based on attention mechanism and long short-term memory network (LSTM) is used, combined with an improved particle swarm algorithm (APSO) to optimize the model to improve prediction accuracy and processing speed.

Benefits of technology

By introducing the attention mechanism and adaptive particle swarm algorithm, the prediction accuracy and robustness of the LSTM model are improved, the training time and model iteration are significantly accelerated, and more efficient ultra-short-term power load forecasting is achieved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119337121A_ABST
    Figure CN119337121A_ABST
Patent Text Reader

Abstract

The invention discloses an ultra-short-term power load prediction method and system based on an attention mechanism and a long short-term memory network, a storage medium and electronic equipment, and the method comprises the following steps: taking preprocessed power load data as an input vector, inputting the input vector into an LSTM input layer, and outputting a power load prediction result through an LSTM hidden layer; improving a particle swarm algorithm, and optimizing the LSTM model; secondly, the power load prediction result in the second step serves as input of an Attention layer, weight distribution is carried out in the Attention layer, and a new vector is obtained; and taking the new vector as the input of the full connection layer to obtain a final prediction value. According to the method, the attention mechanism with the distribution weight is introduced to be combined with the long short-term memory network model, the problem that the input sequence of the LSTM model is represented by a fixed vector regardless of the length is solved, the model is trained and subjected to parameter optimization by adopting the particle swarm optimization algorithm capable of adaptively adjusting the inertia weight, the performance can be improved, and the method is suitable for large-scale popularization and application. And the method has higher prediction precision and robustness.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of ultra-short-term load forecasting for power systems, and in particular to an ultra-short-term power load forecasting method, system, storage medium and electronic device based on an attention mechanism and a long short-term memory network. Background Art

[0002] In the current power market environment, with the development of new power systems towards intelligence and networking, new roles such as new energy vehicles are connected to the load side on a large scale, loads are diversified and load conversion is rapid, resulting in new characteristics of load forecasting such as wider forecast range, shorter time and higher quality. This requires more accurate ultra-short-term forecasts to ensure the safe and stable operation of the power system. Therefore, it is very necessary to forecast ultra-short-term loads.

[0003] There are two types of load forecasting methods for power systems: single forecasting method and hybrid forecasting method. Single forecasting methods include time series, random forest algorithm, support vector machine, extreme learning machine, long short-term memory neural network (LSTM), etc. These methods have problems in data correlation and processing speed; hybrid forecasting method combines several forecasting methods together and uses their respective advantages to improve the prediction accuracy. Neural network method is currently the most widely used forecasting method for hybrid forecasting.

[0004] The existing published patent CN107506868B, a method for short-term power load forecasting, discloses a hybrid prediction model established by integrating quantile regression and robust extreme learning machine and optimizing with hybrid particle swarm algorithm (PSOGSA) to predict power load. Quantile regression uses multiple quantiles of influencing factors of historical power data to obtain the corresponding quantile equation of the conditional distribution of power load forecast data at a certain moment in the future. The hybrid model formed by combining the above two methods and optimizing with PSOGSA can accurately predict power load. Although accurate prediction can be achieved, the calculation process is still relatively complicated, so how to improve the processing speed is a practical problem to be solved. Summary of the invention

[0005] The purpose of the present invention is to provide an ultra-short-term power load forecasting method, system, storage medium and electronic device based on attention mechanism and long short-term memory network, which can forecast the load of ultra-short-term power system in a combined manner.

[0006] The technical solution adopted by the present invention is:

[0007] An ultra-short-term power load forecasting method based on Attention-APSO-LSTM includes the following steps:

[0008] Step 1: input the preprocessed power load data as an input vector into the LSTM input layer, pass through the LSTM hidden layer, and output the power load forecast result, which includes the number of hidden layer neurons, time step, learning rate and number of iterations;

[0009] Step 2: Improve the particle swarm algorithm and optimize the LSTM model: find the optimal position and speed of particles; obtain the optimal parameter values ​​of the four parameters: the number of hidden layer neurons, time step, learning rate and number of iterations;

[0010] Step 3: The power load prediction result of the second step is used as the input of the Attention layer. In the Attention layer, weights are assigned to obtain a new vector. The new vector is used as the input of the fully connected layer, and after calculation, the final prediction value is obtained.

[0011] Furthermore, the LSTM neural unit in step 1 contains three gating structures:

[0012] Forget gate calculation:

[0013] f t =σ(W f h t-1 +U f x t +b f ) (1)

[0014] Where: W f , U f is the weight matrix; b f is the bias term; σ is the sigmoid activation function, x k is the input value; h k is the state value of the hidden layer input corresponding to the input value; f is the forget gate; t is the time; f t is the output of the forget gate; h t-1 The output of the previous moment.

[0015] (2) Input gate:

[0016] i t =σ(W i h t-1 +U i x t +b i ) (2)

[0017] c t =tanh(W c h t-1 +U c x t +b c ) (3)

[0018] Where: W i , U i , W c , U c is the weight matrix, b i , b c is the bias term; i is the input gate; i t is the output of the input gate: C t is the cell state at time t: tanh is the activation function.

[0019] (3) New cell unit:

[0020] c t =f t c t-1 +i t c t (4)

[0021] (4) Output gate:

[0022] o t =σ(W o h t-1 +U o x t +b o ) (5)

[0023] h t =o t tanh(c t ) (6)

[0024] Where: x t is the input at time t; h t is the output at time t;

[0025] i t is the output of the input gate; f t is the output of the forget gate; c t is the cell state at time t; o t is the output of the output gate; b is the parameter matrix.

[0026] Furthermore, in step 2, a particle swarm algorithm for adaptively adjusting the inertia weight is used.

[0027]

[0028] ω=ω max ,f>f avg (9)

[0029] Where: max ,ω min are the maximum and minimum values ​​of the inertia weight; f, fmin 、f avg They are respectively the fitness, minimum fitness and average fitness of all current particles.

[0030] In step 3, Attention compares the input and output of the LSTM model, and assigns different weight values ​​to the LSTM model according to the different degrees of influence of the input on the output, so as to increase the proportion of important factors, thereby optimizing the LSTM model and making the model more accurate.

[0031] The calculation formula of the Attention mechanism is as follows:

[0032]

[0033] s ki =vtanh(Wh k +Uh i +b) (11)

[0034]

[0035] a ki is the attention weight; s k represents the hidden state value of the node; v, W, U, b are all weights of the model; h k is the true value of the hidden layer corresponding to the input order; C is the output of the Attention mechanism; k is the number of nodes; m is the dimension of the input vector of the prediction model.

[0036] The ultra-short-term power load forecasting system based on Attention-APSO-LSTM includes a data acquisition module, an information transmission module, a data processing module and a forecasting module.

[0037] Data acquisition module, used to collect load status information of the region in multiple time periods;

[0038] An information transmission module is used to transmit the acquired original runoff data to a memory for storage;

[0039] A data processing module, used for preprocessing the stored raw runoff data;

[0040] The prediction module includes a weight optimization module, namely the Attention mechanism, a parameter optimization module, namely the particle swarm APSO, and a data prediction, namely the LSTM prediction; wherein the Attention-LSTM model: assigns different weights to influencing factors according to different input sequences, thereby improving the prediction accuracy; the APSO optimization model: improves the prediction accuracy, reduces the loss value, speeds up the training time, and reduces the model iteration. The optimization model is used to input the power load feature sequence into the load state prediction model to predict the state information of each power load in the power load feature sequence in multiple future time periods.

[0041] A computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the device where the computer-readable storage medium is located executes the multi-sensor resource allocation method based on bidirectional joint risk assessment.

[0042] An electronic device comprises: a memory and a processor, wherein the memory stores a program that can be run on the processor, and when the processor executes the program, the multi-sensor resource allocation method based on bidirectional joint risk assessment as described above is implemented.

[0043] The beneficial effects of the present invention are as follows:

[0044] The present invention combines an attention mechanism (Attention) with a weighted distribution with a long short-term memory network (LSTM) model to solve the problem that the LSTM model input sequence is represented by a fixed vector no matter how long it is. The particle swarm algorithm (APSO) with adaptive adjustment of inertia weight is used to train the model and optimize parameters to establish an Attention-APSO-LSTM model. The model is simulated and analyzed in combination with actual engineering data, and compared with the prediction models of the Attention-LSTM model and the PSO-LSTM neural network. Experimental results show that the Attention-APSO-LSTM model can improve the performance of the ordinary LSTM model and has higher prediction accuracy and robustness, which verifies the feasibility of the proposed method and provides a reference for engineering applications. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 This is a diagram of the long short-term memory network structure of the present invention;

[0046] Figure 2 This is the flow chart of the attention mechanism of the present invention;

[0047] Figure 3 This is the flow chart of the Attention-LSTM prediction model of the present invention;

[0048] Figure 4This is the flow chart of the Attention-APSO-LSTM prediction model of the present invention;

[0049] Figure 5 A comparison chart of the predicted value and the actual value of the method of the present invention;

[0050] Figure 6 A relative error diagram of the predicted values ​​of the method according to the embodiment of the present invention;

[0051] Figure 7 This is a principle block diagram of the present invention;

[0052] Figure 8 The schematic diagram of the electronic device of the present invention is shown in FIG. DETAILED DESCRIPTION

[0053] like Figure 1 , 2 As shown, the present invention comprises the following steps:

[0054] Step 1: Input the preprocessed data as the input vector into the input layer of the LSTM network model; pass through the LSTM hidden layer and output the result.

[0055] LSTM network model is a special recurrent neural network. In order to overcome the lack of long-term memory of RNN, a new method, long short-term memory network, was developed based on RNN. It was created to solve the problem of gradient disappearance and has made major breakthroughs in speech recognition and text generation. It is the earliest proposed RNN gating algorithm, and its structure is based on the improvement of RNN. Compared with RNN, LSTM adds a "processor" to the algorithm, which is used to determine whether the input information is useful. There are three gates in this processor, namely input gate, forget gate, and output gate. LSTM neural unit contains three gating structures such as Figure 1 shown.

[0056] (1) Forget gate calculation:

[0057] f t =σ(W f h t-1 +U f x t +b f ) (1)

[0058] Where: W f , U f is the weight matrix; b f is the bias term; σ is the sigmoid activation function, x k is the input value; h k is the state value of the hidden layer input corresponding to the input value; f is the forget gate; t is the time; ft is the output of the forget gate; h t-1 The output of the previous moment.

[0059] (2) Input gate:

[0060] i t =σ(W i h t-1 +U i x t +b i ) (2)

[0061] c t =tanh(W c h t-1 +U c x t +b c ) (3)

[0062] Where: W i , U i , W c , U c is the weight matrix, b i , b c is the bias term; i is the input gate; i t is the output of the input gate: C t is the cell state at time t: tanh is the activation function.

[0063] (3) New cell unit:

[0064] c t =f t c t-1 +i t c t (4)

[0065] (4) Output gate:

[0066] o t =σ(W o h t-1 +U o x t +b o ) (5)

[0067] h t =o t tanh(c t ) (6)

[0068] Where: x t is the input at time t; h t is the output at time t;

[0069] i tis the output of the input gate; f t is the output of the forget gate; c t is the cell state at time t; o t is the output of the output gate; b is the parameter matrix.

[0070] Step 2: Improve the particle swarm algorithm and optimize the model

[0071] As the research goes deeper, the problem of model or parameter optimization is what we need to consider, and there are many solutions. At present, there are many methods to solve the optimization problem, mainly ant colony algorithm, genetic algorithm, particle swarm algorithm, etc. Particle swarm optimization algorithm Dr. Eberhart and Dr. Kennedy proposed an optimization algorithm based on swarm intelligence based on the foraging behavior of simulated bird flocks; the particle swarm algorithm is widely used in target optimization and other problems due to its easy calculation, simple implementation, few optimization conditions, and fast convergence speed; based on the literature review and the experience of predecessors, this article also uses the particle swarm algorithm for parameter optimization. The essence of particle swarm optimization is to find the optimal position and optimal speed of particles; the position and speed update formula of the particle swarm is:

[0072]

[0073] Where: ω is the inertia weight; c1, c2 are learning factors; r1, r2 are random numbers between (0, 1); v t i,j , x t i,j , p t g,j , p t i,j is the speed, position, group optimal position and individual optimal position of the j-th dimension variable of particle i in the t-th iteration.

[0074] The inertia weight ω reflects the ability of particles to inherit the speed of the previous generation of particles before each generation of iteration, and controls the particles to find the optimal solution. Therefore, the value of the inertia weight ω affects the degree of attention of the model to the influencing factors, and thus affects the optimization problem of the model. Due to the difference between local optimization and global optimization in the particle swarm algorithm during the model running time, the global optimization is active in the early stage and has a strong optimization ability; the local optimization is active in the later stage and has a strong optimization ability. Therefore, it is easy to cause premature particle maturation in the early stage. Therefore, the particle swarm algorithm with adaptive adjustment of the inertia weight is selected in this paper to avoid premature maturation during the model operation process.

[0075]

[0076] ω=ω max ,f>f avg (9)

[0077] Where: max ,ω min are the maximum and minimum values ​​of the inertia weight; f, f min 、f avg They are respectively the fitness, minimum fitness and average fitness of all current particles.

[0078] After the particle swarm algorithm is improved, whether the training effect of the new particle swarm algorithm is better than that of the unimproved particle swarm algorithm needs to be tested. Therefore, we choose the test function to test the particle swarm algorithm and the improved particle swarm algorithm. The test function uses three representative functions: Rosenbrock function, Sphere function and Ristrigin, and compares the test results. The parameters are set as follows: population size is 50, number of iterations is 500, inertia weight ω=0.7298, maximum particle speed Vmax is 4, and learning factor C1=C2=1.5.

[0079] After calculating the three test functions and sorting out the calculation results, the performance comparison results of the Sphere function of the PSO algorithm and the APSO algorithm are shown in Table 1.

[0080] Table 1

[0081]

[0082] As can be seen from Table 1, the training calculation results of the function show that the optimal solution found by APSO in the three test functions is smaller than the optimal solution found by PSO, which shows that APSO has strong parameter training ability, short function training time, fast convergence speed, and avoids the phenomenon of premature examples; therefore, the improved particle swarm algorithm has obvious advantages in finding the optimal solution, and the prediction accuracy of the model is higher.

[0083] Step 3: Use the output result of the second step as the input of the Attention layer. In the Attention layer, weights are assigned to obtain a new vector. The new vector is used as the input of the fully connected layer and the final prediction value is obtained after calculation.

[0084] The Attention mechanism is an evolution of the traditional encoder-decoder model. It was developed to solve the problem of decreased functionality caused by an increase in the input sequence of the encoder-decoder model while the component weights remain unchanged. It is also a neural network model that, like other neural networks, imitates the human brain. It learns the ability of the human brain to focus on a particular thing or any change in anything, while reducing attention to unimportant information, in order to extract useful information and filter out unimportant information, thereby achieving the purpose of information screening.

[0085] Attention compares the input and output of the model, and assigns different weights to the model according to the different degrees of influence of the input on the output, so as to increase the proportion of important factors and optimize the model to make it more accurate. Figure 2 shown.

[0086] The calculation formula of the Attention mechanism is as follows:

[0087]

[0088] s ki =vtanh(Wh k +Uh i +b) (11)

[0089]

[0090] The final feature vector hk0 is the hidden vector of the last node:

[0091] h k0 =H(C,h k ,x k ) (13) a ki is the attention weight; s k represents the hidden state value of the node; v, W, U, b are all weights of the model; h k is the true value of the hidden layer corresponding to the input order; C is the output of the Attention mechanism; k is the number of nodes; m is the dimension of the input vector of the prediction model.

[0092] The following is a prediction device for power grid load provided by the embodiment of the present disclosure, such as Figure 7 and Figure 8 As shown, the device includes: a data acquisition module, an information transmission module, a data processing module and a prediction module.

[0093] The data acquisition module is used to collect load status information of the region in multiple time periods;

[0094] An information transmission module is used to transmit the acquired original runoff data to a memory for storage;

[0095] A data processing module, used for preprocessing the stored raw runoff data;

[0096] The prediction module includes a weight optimization module, namely the Attention mechanism, a parameter optimization module, namely the particle swarm APSO, and a data prediction, namely the LSTM prediction; wherein, the Attention-LSTM model: assigns different weights to influencing factors according to different input sequences, thereby improving the prediction accuracy; the APSO optimization model: improves the prediction accuracy, reduces the loss value, speeds up the training time, and reduces the model iteration. The optimization model is used to input the power load feature sequence into the load state prediction model to predict the state information of each power load in the power load feature sequence in multiple future time periods.

[0097] A computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the device where the computer-readable storage medium is located executes the ultra-short-term power load forecasting method based on Attention-APSO-LSTM as described above. The computer program includes computer program code, which may be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory and other memory.

[0098] An electronic device comprises: a memory and a processor, wherein the memory stores a program that can be run on the processor, and when the processor executes the program, the ultra-short-term power load forecasting method based on Attention-APSO-LSTM as described above is implemented.

[0099] If the module / unit integrated in the electronic device described in this application is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware devices through a computer program. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by the processor, the steps of each of the above-mentioned method embodiments can be implemented.

[0100] Furthermore, the computer-readable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the blockchain node, etc.

[0101] The computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions are executed by a processor in an electronic device to implement the ultra-short-term power load forecasting method based on Attention-APSO-LSTM described in any of the above embodiments.

[0102] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.

[0103] The readable storage medium provided by the present invention stores a program product capable of implementing the power grid load forecasting method of the present specification. In some possible implementations, various aspects of the present disclosure may also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary implementations of the present disclosure described in the above “Exemplary Method” section of the present specification.

[0104] In order to make the method of the present invention more clear, a specific example is given below for further explanation:

[0105] The present invention uses the prediction method of the present invention to predict 60 data collected at 5-minute intervals in a certain place, judges the validity and reliability of the model, and selects the mean absolute percentage error (MAPE) and the root mean square error (RMSE) as the basis for judging the prediction effect of various methods. The smaller the MAPE and RMSE are in the power load prediction, the more accurate the load prediction is. The selection of parameters is very important for the prediction accuracy of the model. The parameters of the adaptive particle swarm optimization are selected as follows: the number of hidden layers is 3 layers, the number of hidden neurons is 200, the time step is 60, the learning rate is 0.0001, and the number of iterations is 3000 times.

[0106] In terms of the rating criteria for prediction errors, three rating criteria, namely correlation coefficient (CC), root mean square error (RMSE) and mean absolute percentage error (MAPE), are selected for evaluation.

[0107] Table 2 shows the prediction results of the prediction method of the present invention.

[0108] Table 2

[0109]

[0110]

[0111] Table 3

[0112]

[0113] From Table 2, Table 3, Table 4, Figure 5 and Figure 6 It can be seen that:

[0114] The prediction results are shown in Table 2. The comparison between the load prediction fitting curve of the Attention-APSO-LSTM model and the actual value curve is shown in Table 2. Figure 5 shown.

[0115] Table 3 shows the evaluation index results obtained after the Attention-APSO-LSTM algorithm is used for prediction. We use two evaluation indicators of load prediction: MAPE and RMSE for analysis. The maximum, minimum, and average values ​​of MAPE and RMSE can be seen.

[0116] In order to improve the prediction accuracy and obtain more accurate prediction results, the prediction method of the Attention-APSO-LSTM model is compared with the prediction methods of the Attention-LSTM model and the PSO-LSTM model, and the accuracy of load prediction is quantitatively evaluated. Figure 6 The evaluation results of different models are shown in Table 4.

[0117] Depend on Figure 6 It can be seen that the relative error fluctuation range of the PSO-LSTM model is large, and the relative error fluctuation range of the other two models is smaller than that of the PSO-LSTM model. The extreme values ​​of the curve fluctuations of the Attention-LSTM model and the Attention-APSO-LSTM model are smaller than that of the PSO-LSTM model, and the fluctuation frequency of the Attention-LSTM model and the Attention-APSO-LSTM model is also smaller than that of the PSO-LSTM model. The fluctuation frequency and error of the Attention-LSTM model and the Attention-APSO-LSTM model are almost similar.

[0118] Table 4

[0119]

[0120] The MAPE and RMSE of the PSO-LSTM model, Attention-LSTM model, and Attention-APSO-LSTM model are shown in Table 4. The MAPE of the PSO-LSTM model, Attention-LSTM model, and Attention-APSO-LSTM model are 1.45%, 1.42%, and 1.38%, respectively; and the RMSE are 197.13MW, 188.39MW, and 185.6MW, respectively.

[0121] The MAPE of the model in this paper and the Attention-LSTM model differ by 0.04%, and the MAPE of the Attention-LSTM model and the PSO-LSTM model differ by 0.03%. The error of the PSO-LSTM model is reduced by 0.21%; this shows that the attention mechanism is introduced in this paper. Different weight values ​​are assigned to the model according to the different degrees of influence of the input on the output, so as to increase the proportion of important factors, and then optimize the model, so that the prediction accuracy of the model is significantly improved. The adaptive particle swarm algorithm is introduced to optimize the parameters and select the optimal parameters. The prediction effect is not as obvious as that of the attention mechanism, but it speeds up the training time and reduces the number of model iterations.

[0122] Therefore, the main purpose of the combined prediction method in this paper is to improve the prediction accuracy, and the adaptive particle swarm method is to optimize parameters and shorten the running time.

[0123] In summary, compared with other prediction methods, LSTM takes time factors into consideration and has memory capacity; the hybrid prediction method of CNN and LSTM is used to mine the original load data features to improve the prediction accuracy, and the empirical mode decomposition is introduced on the basis of the hybrid prediction method of CNN and LSTM to improve the stability of the data; the attention mechanism is introduced to screen the input sequence, and different weights are assigned according to different input sequences to improve the prediction accuracy. In the above model, the particle swarm algorithm is introduced to solve the optimal problem of the model and parameters to avoid falling into the local optimum.

[0124] Therefore, on the basis of the LSTM algorithm, the present invention improves the stability and accuracy of the data by introducing the attention mechanism (Attention), adopts the improved particle swarm algorithm (APSO) to improve the optimal problem of model parameters, and establishes the Attention-APSO-LSTM prediction method.

[0125] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0126] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be construed as limiting the scope of the patent application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent application shall be subject to the attached claims.

[0127] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

[0128] It should be noted that the terms "including" and "having" and any variations thereof in the specification and claims of the present application are intended to cover non-exclusive inclusions. For example, a process, method, system, product or apparatus comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or inherent to these processes, methods, products or apparatuses.

[0129] Note that the above are only preferred embodiments of the present invention and the principles of the application technology. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention is described in more detail through the above embodiments, the present invention is not limited to the specific embodiments described herein, and may include more other effective embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. An ultra-short-term power load forecasting method based on attention mechanism and long short-term memory network, characterized by: The steps include: Step 1: input the preprocessed power load data as an input vector into the LSTM input layer, pass through the LSTM hidden layer, and output the power load forecast result, which includes the number of hidden layer neurons, time step, learning rate and number of iterations; Step 2: Improve the particle swarm algorithm and optimize the LSTM model: find the optimal position and speed of particles; obtain the optimal parameter values ​​of the four parameters: the number of hidden layer neurons, time step, learning rate and number of iterations; Step 3: The power load prediction result of the second step is used as the input of the Attention layer. In the Attention layer, weights are assigned to obtain a new vector. The new vector is used as the input of the fully connected layer, and after calculation, the final prediction value is obtained.

2. The ultra-short-term power load forecasting method based on attention mechanism and long short-term memory network according to claim 1 is characterized in that: The LSTM neural unit in step 1 contains three gating structures. Forget gate calculation: f t =σ(W f h t-1 +U f x t +b f ) (1) Where: W f , U f is the weight matrix; b f is the bias term; σ is the sigmoid activation function, x k is the input value; h k is the state value of the hidden layer input corresponding to the input value; f is the forget gate; t is the time; f t is the output of the forget gate; h t-1 is the output of the previous moment; (2) Input gate: i t =σ(W i h t-1 +U i x t +b i ) (2) c t =tanh(W c h t-1 +U c x t +b c ) (3) Where: W i , U i , W c , U c is the weight matrix, b i , b c is the bias term; i is the input gate; i t is the output of the input gate: C t is the cell state at time t: tanh is the activation function; (3) New cell unit: c t =f t c t-1 +i t c t (4) (4) Output gate: the t =σ(W o h t-1 +U o x t +b o ) (5) h t =o t fishy t ) (6) Where: x t is the input at time t; h t is the output at time t; i t is the output of the input gate; f t is the output of the forget gate; c t is the cell state at time t; o t is the output of the output gate; b is the parameter matrix.

3. The ultra-short-term power load forecasting method based on attention mechanism and long short-term memory network according to claim 2 is characterized in that: In the step 2, a particle swarm algorithm for adaptively adjusting the inertia weight is used. oh = oh max ,f>f avg (9) Where: max ,ω min are the maximum and minimum values ​​of the inertia weight; f, f min 、f avg They are respectively the fitness, minimum fitness and average fitness of all current particles.

4. The ultra-short-term power load forecasting method based on attention mechanism and long short-term memory network according to claim 3 is characterized in that: In step 3, Attention compares the input and output of the LSTM model, and assigns different weight values ​​to the LSTM model according to the different degrees of influence of the input on the output, so as to increase the proportion of important factors, thereby optimizing the LSTM model and making the model more accurate. The calculation formula of the Attention mechanism is as follows: s ki =vtanh(Wh k +Uh i +b) (11) a ki is the attention weight; s k represents the hidden state value of the node; v, W, U, b are all weights of the model; h k is the true value of the hidden layer corresponding to the input order; C is the output of the Attention mechanism; k is the number of nodes; m is the dimension of the input vector of the prediction model.

5. An ultra-short-term power load forecasting system based on attention mechanism and long short-term memory network, characterized by: include Data collection module, information transmission module, data processing module and prediction module; Data acquisition module, used to collect load status information of the region in multiple time periods; An information transmission module is used to transmit the acquired original runoff data to a memory for storage; A data processing module, used for preprocessing the stored raw runoff data; The prediction module includes a weight optimization module, namely the Attention mechanism, a parameter optimization module, namely the particle swarm APSO, and a data prediction, namely the LSTM prediction; wherein the Attention-LSTM model: assigns different weights to influencing factors according to different input sequences, thereby improving the prediction accuracy; the APSO optimization model: improves the prediction accuracy, reduces the loss value, speeds up the training time, and reduces the model iteration. The optimization model is used to input the power load feature sequence into the load state prediction model to predict the state information of each power load in the power load feature sequence in multiple future time periods.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, the device where the computer-readable storage medium is located executes the ultra-short-term power load forecasting method based on the attention mechanism and long short-term memory network as described in any one of claims 1-4.

7. An electronic device, characterized in that: include: A memory and a processor, wherein the memory stores a program that can be run on the processor, and when the processor executes the program, an ultra-short-term power load forecasting method based on an attention mechanism and a long short-term memory network as described in any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • A method and apparatus for short-term power load forecasting

    CN107506868B

Cited By

  • Power load prediction method based on NIWPSO + CNN + LSTM + Attention

    CN119917842A

  • Hybrid LSTM power grid load prediction method

    CN120657744A

  • Industrial and commercial energy storage EMS scheduling system based on multi-objective optimization

    CN120824745A