A short-term load forecasting method for microgrid based on GRU neural network
By applying multiverse algorithm to optimize weight parameters in GRU neural network, the problem of low prediction accuracy in microgrid short-term load prediction is solved, and higher prediction accuracy and better model performance are achieved.
Patent Information
- Application Number
- CN202210403788.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-18
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2042-04-18
AI Technical Summary
The existing GRU neural networks are not high enough in the prediction accuracy of short-term microgrid load prediction, and the selection of weight parameters lacks theoretical basis, which affects the prediction performance of the model.
The multiverse algorithm is used to optimize the weight parameters of the GRU neural network. By creating the multiverse, calculating the expansion rate of the universe, performing matter exchange and element exchange, the weight parameters are optimized to improve the prediction accuracy.
By optimizing the weight parameters, the accuracy of short-term load prediction of microgrids is improved, and the actual scheduling prediction requirements are met.
Smart Images

Figure CN114897220B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of microgrid load technology, and in particular to a microgrid short-term load forecasting method based on a GRU neural network. Background Art
[0002] A microgrid is a group of micro systems consisting of distributed power sources, loads, energy storage systems and control devices. For a large power grid, it appears as a single controllable unit that can achieve highly reliable supply of loads in various forms of energy (electricity, heat, etc.). The power sources in a microgrid are mostly small-capacity distributed power sources, mainly photovoltaic cells, small wind turbines, micro gas turbines, fuel cells, batteries and other energy storage devices, which have the characteristics of low cost, low voltage and low pollution.
[0003] Load forecasting is an important part of the microgrid energy management system. It is the basis for optimizing the dispatch of distributed power sources, such as wind power, photovoltaics, micro gas turbines, diesel engines and energy storage. The forecast results will directly affect the microgrid operation strategy and power trading. Compared with the large power grid environment, it is more difficult for microgrids to conduct short-term load forecasting. This is mainly due to the strong randomness of the load, the low similarity of historical load curves, the limited user capacity, the small mutual smoothing effect of load characteristics between users, and the large overall load fluctuation.
[0004] In order to improve the accuracy of load forecasting, many scholars have conducted extensive research and proposed a series of forecasting methods, such as BP-NN forecasting method and conventional GRU neural network forecasting method. However, these methods still have the problem of insufficient forecasting accuracy. Among them, the weights of the GRU neural network are undetermined parameters, and there is no mature theoretical basis for the selection of these weight parameters. Moreover, the selection of these weight parameters has a great influence on the forecasting performance of the GRU neural network model. This is the difficulty in applying the GRU neural network to short-term load forecasting in microgrids. Summary of the invention
[0005] In order to solve the above technical problems, the present invention provides a microgrid short-term load forecasting method based on GRU neural network, and uses multiverse algorithm to optimize the weight parameters of GRU neural network to achieve the purpose of improving the accuracy of short-term load forecasting.
[0006] To achieve the above object, the technical solution of the present invention is as follows:
[0007] A microgrid short-term load forecasting method based on GRU neural network includes the following steps:
[0008] Step 1: Obtain historical load data and meteorological factor data of the microgrid, perform data preprocessing, and divide the preprocessed data into a training set and a prediction set;
[0009] Step 2: Use the data in the training set to train the GRU neural network. During the training process, use the multiverse algorithm to optimize the weight parameters of the GRU neural network and save the trained GRU neural network.
[0010] Step 3: Input the data in the prediction set into the trained GRU neural network and output the load value of the microgrid at the time to be predicted.
[0011] In the above scheme, the GRU neural network includes an input layer, a hidden layer and an output layer, the hidden layer is composed of GRU units, and the GRU unit includes two input variables, namely the input at the current moment and the output of the hidden layer at the previous moment.
[0012] In the above scheme, the calculation formula executed inside the GRU unit is as follows:
[0013] z t =σ(W z x t +U z h t-1 ) (1)
[0014] r t =σ(W r x t +U r h t-1 ) (2)
[0015]
[0016]
[0017] y=σ(h t W y ) (5)
[0018] Where: z t is the update gate, r t To reset the gate, is the activation state of the hidden layer at time t, h t is the output of the hidden layer at time t, h t-1 is the output of the hidden layer at time t-1, and y is the output of the output layer of the neural network;
[0019] W z , U z , W r , U r , W, U, W y is the weight parameter of the GRU neural network, where W z is the input to the update gate z t The weight, U zis the hidden layer to update gate z at time t-1 t The weight, W r is the input to the reset gate r t The weight, U r From the hidden layer to the reset gate r at time t-1 t The weight of the hidden layer, W is the weight from the input layer to the hidden layer, U is the weight of the hidden layer itself, and W y is the weight from the hidden layer to the output layer;
[0020] ⊙ represents the multiplication of corresponding elements in the matrix, σ is the sigmoid function, is the tanh activation function, 1- means the output after operation is 1-z t .
[0021] In the above scheme, in step 2, the steps of optimizing the weight parameters of the GRU neural network using the multiverse algorithm are as follows:
[0022] (1) Create a multiverse based on the weight parameters of the GRU neural network to be optimized, and set the initial values of the parameters TDR and WEP. TDR is the distance that the current universe travels near the optimal solution through the wormhole, and WEP is the probability of the wormhole existing.
[0023] (2) Calculate the expansion rate of each universe and sort them;
[0024] (3) Based on the expansion rate and roulette, the universe with a white hole is selected and exchanges matter with the black hole;
[0025] (4) Select a specified universe, connect it to the current optimal universe through a wormhole, and exchange elements;
[0026] (5) Update the values of WEP and TDR and calculate the expansion rate of the updated universe;
[0027] (6) Determine whether the end condition is met. If so, output the calculation result; otherwise, return to step (2).
[0028] In the above scheme, in step (1), all solutions of the weight parameters of the GRU neural network are assumed to be a set of multiverses, as shown in formula (6):
[0029]
[0030] In the formula, U represents the multiverse set; x n,d It represents the d-th material element in the n-th universe, that is, the d-th variable.
[0031] In the above scheme, the expansion rate of the universe in step (2) is proportional to the fitness value of the solution. The fitness function is expressed as: fitness = 1 / f, where f is the mean square error between the expected and actual outputs of the GRU neural network, which is used to control the error accuracy of the model. In the above scheme, in step (3), the material exchange process is as follows:
[0032]
[0033] In the formula, x i,j represents the jth variable of the i-th universe; x k,j represents the jth element of the kth universe with a white hole; r1 represents a random number in the range [0,1]; NI(U i ) represents the expansion rate of the ith universe.
[0034] In the above scheme, in step (4), the process of exchanging elements between the specified universe and the current optimal universe is as follows:
[0035]
[0036] Where, X j is the jth variable of the current optimal universe; lb j is the lower bound of the jth variable; ub j is the upper bound of the jth variable; r2, r3, r4 are random numbers between [0, 1]; WEP represents the probability of wormhole existence, and the calculation formula is as follows:
[0037]
[0038] Where, WEP min and WEP max They represent the minimum and maximum values of WEP respectively, l is the current number of iterations; L is the maximum number of iterations;
[0039] TDR determines the distance the current universe travels near the optimal solution through the wormhole. The calculation formula of TDR is as follows:
[0040]
[0041] In the formula, p represents the degree of mining. The size of the p value directly determines the size of the local detection speed. The local detection speed increases with the increase of the p value.
[0042] In the above scheme, in step (5), the updated expansion rate is proportional to the fitness value of the solution obtained after the update. The fitness function is expressed as: fitness = 1 / f, where f is the mean square error between the expected and actual outputs of the GRU neural network, which is used to control the error accuracy of the model.
[0043] In the above scheme, in step (6), the termination condition is a preset number of iterations.
[0044] Through the above technical solution, the microgrid short-term load forecasting method based on GRU neural network provided by the present invention has the following beneficial effects:
[0045] The present invention adopts a GRU neural network, the weights of which are undetermined parameters, and there is no mature theoretical basis for the selection of these weight parameters, and the selection of these weight parameters has a great influence on the prediction performance of the GRU neural network model, which is the difficulty in applying the GRU neural network to short-term load prediction of microgrids. The present invention uses a multiverse algorithm (MVOA) to optimize the weight parameters of the GRU neural network, and uses the multiverse algorithm (Multi-Verse OptimizerAlgorithm, MVOA) with strong search capabilities. Through the prediction simulation and testing of the actual microgrid load, a relatively satisfactory prediction effect is achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.
[0047] Figure 1 A schematic diagram of a process of a microgrid short-term load forecasting method based on a GRU neural network disclosed in an embodiment of the present invention;
[0048] Figure 2 Schematic diagram of the connection mode of the hidden layer GRU units of the neural network at different times;
[0049] Figure 3 This is the internal structure diagram of the GRU unit. DETAILED DESCRIPTION
[0050] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0051] The present invention provides a microgrid short-term load forecasting method based on GRU neural network, such as Figure 1 As shown, the following steps are included:
[0052] Step 1: Obtain the historical load data and meteorological factor data of the microgrid, and perform data preprocessing, dividing the preprocessed data into a training set and a prediction set; the training set is used to train the GRU neural network, and the prediction set is used to perform short-term load forecasting of the microgrid.
[0053] Data preprocessing includes patching missing data and standardizing data.
[0054] The GRU neural network used in the present invention includes an input layer, a hidden layer and an output layer. The input of the input layer is the preprocessed data, and the output of the output layer is the load value of the microgrid at the time to be predicted. The hidden layer is composed of GRU units. The connection mode of the GRU units in the hidden layer at different times is as follows: Figure 2 As shown. Figure 2 It can be seen that the hidden layer GRU unit of the neural network consists of two input variables, namely the input at the current moment and the output value of the hidden layer at the previous moment.
[0055] The GRU unit introduces a gating mechanism so that the GRU unit can retain and forget information. The update gate represents the degree of retention of the state information of the neural network at the previous moment. The closer the output value of the update gate is to 1, the more the state information of the previous moment is retained; the reset gate represents the degree of neglect of the state information of the neural network at the previous moment. The closer the output value of the reset gate is to 0, the more the state information of the previous moment is ignored.
[0056] The internal structure of the GRU neural network GRU unit is as follows Figure 3 shown.
[0057] The calculation formula performed inside the GRU unit is as follows:
[0058] z t =σ(W z x t +U z h t-1 ) (1)
[0059] r t =σ(W r x t +U r h t-1 ) (2)
[0060]
[0061]
[0062] y=σ(h t W y ) (5)
[0063] Where: z t is the update gate, r t To reset the gate, is the activation state of the hidden layer at time t, h t is the output of the hidden layer at time t, h t-1 is the output of the hidden layer at time t-1, and y is the output of the output layer of the neural network;
[0064] Wz , U z , W r , U r , W, U, W y is the weight parameter of the GRU neural network, where W z is the input to the update gate z t The weight, U z is the hidden layer to update gate z at time t-1 t The weight, W r is the input to the reset gate r t The weight, U r From the hidden layer to the reset gate r at time t-1 t The weight of the hidden layer, W is the weight from the input layer to the hidden layer, U is the weight of the hidden layer itself, and W y is the weight from the hidden layer to the output layer,
[0065] ⊙ represents the multiplication of corresponding elements in the matrix, σ is the sigmoid function, is the tanh activation function, Figure 3 In The + in the formula actually represents the matrix addition operation. The ⊙ in the formula represents the element-wise multiplication of matrices. The two matrices to be multiplied must be of the same type. 1- indicates that the output after the operation is 1-z. t .
[0066] Step 2: Use the data in the training set to train the GRU neural network. During the training process, use the multiverse algorithm to optimize the weight parameters of the GRU neural network and save the trained GRU neural network.
[0067] W z , U z , W r , U r , W, U, W y are the weight parameters of the GRU neural network. These parameters are undetermined parameters, and there is no mature theoretical basis for the selection of these weight parameters. Moreover, the selection of these weight parameters has a great influence on the prediction performance of the GRU neural network model, which is the difficulty of applying the GRU neural network to microgrid short-term load prediction. The present invention uses a multiverse algorithm (MVOA) to optimize the weight parameters of the GRU neural network and achieves a more satisfactory prediction effect.
[0068] The Multi-Verse Optimizer Algorithm (MVOA) originates from the multiverse theory. MVOA selects black holes, white holes, wormholes and the expansion rate of the universe in the Big Bang theory and the multiverse theory as the basis of the algorithm. In the MVOA setting, each universe is a solution to the optimization problem, and the variables contained in the solution are equivalent to the relevant matter in the universe. The fitness value of the solution is proportional to the expansion rate of the universe. The concepts of black holes and white holes are used to search the solution space, and wormholes, as space-time tunnels of each universe, are used to mine the search space.
[0069] The optimization steps are as follows:
[0070] (1) Create a multiverse based on the weight parameters of the GRU neural network to be optimized, and set the initial values of the parameters TDR and WEP. TDR is the distance that the current universe travels near the optimal solution through the wormhole, and WEP is the probability of the wormhole existing.
[0071] All solutions of the weight parameters of the GRU neural network are assumed to be a set of multiverses, as shown in formula (6):
[0072]
[0073] In the formula, U represents the multiverse set; x n,d It represents the d-th material element in the n-th universe, that is, the d-th variable.
[0074] (2) Calculate the expansion rate of each universe and sort them;
[0075] The calculated expansion rate of the universe is proportional to the fitness value of the solution. The fitness function can be expressed as: fitness = 1 / f, where f is the mean square error between the expected and actual outputs of the GRU neural network, which is mainly used to control the error accuracy of the model.
[0076] (3) Based on the expansion rate and roulette, the universe with a white hole is selected and exchanges matter with the black hole;
[0077] The material exchange process is as follows:
[0078]
[0079] In the formula, x i,j represents the jth variable of the i-th universe; x k,j represents the jth element of the kth universe with a white hole; r1 represents a random number in the range [0,1]; NI(U i ) represents the expansion rate of the ith universe.
[0080] (4) Select a specified universe, connect it to the current optimal universe through a wormhole, and exchange elements;
[0081] The universe can exchange matter not only through white hole / black hole tunnels, but also through wormhole tunnels, which can ensure the diversity of the universe and avoid the algorithm from converging to a local state too early. The wormhole tunnel is set to exist only between the current optimal universe and the selected universe. The process of exchanging elements between the specified universe and the current optimal universe is as follows:
[0082]
[0083] Where, X j is the jth variable of the current optimal universe; lb j is the lower bound of the jth variable; ub j is the upper bound of the jth variable; r2, r3, r4 are random numbers between [0, 1]; WEP represents the probability of wormhole existence, which determines the size of the probability of wormhole existence, and thus determines the degree of mining in the search space. Its calculation formula is as follows:
[0084]
[0085] Where, WEP min and WEP max They represent the minimum and maximum values of WEP respectively, l is the current number of iterations; L is the maximum number of iterations;
[0086] TDR determines the distance the current universe travels near the optimal solution through the wormhole. The calculation formula of TDR is as follows:
[0087]
[0088] In the formula, p represents the degree of mining. The size of the p value directly determines the size of the local detection speed. The local detection speed increases with the increase of the p value.
[0089] (5) Update the values of WEP and TDR and calculate the expansion rate of the updated universe;
[0090] The updated expansion rate is proportional to the fitness value of the solution obtained after the update. The fitness function can be expressed as: fitness = 1 / f, where f is the mean square error between the expected and actual outputs of the GRU neural network, which is mainly used to control the error accuracy of the model.
[0091] (6) Determine whether the preset number of iterations has been reached. If so, output the calculation result; otherwise, return to step (2).
[0092] Step 3: Input the data in the prediction set into the trained GRU neural network, and after calculation by formulas (1)-(5), output the load value of the microgrid at the time to be predicted.
[0093] In order to verify the effectiveness of the prediction method (method I) proposed in this invention, the BP-NN prediction method (method II) and the conventional GRU neural network prediction method (method III) are used to predict the load of the microgrid at 24 points on a certain day. The comparison of the prediction errors of the three methods is shown in Table 1.
[0094] Table 1 Comparison of prediction errors of three prediction methods
[0095]
[0096] As can be seen from Table 1, the average absolute error E MAPE The maximum relative error is 9.86%. MAX It is 19.27%. Using the conventional GRU prediction method, the average absolute error is reduced by 2.18% compared with the traditional BP-NN prediction method, and the maximum relative error is reduced by 1.73%. Using the prediction method proposed by the present invention, the average absolute error is reduced by 5.21% compared with the traditional BP-NN prediction method, and the maximum relative error is reduced by 6.67%; the average absolute error is reduced by 3.03% compared with the conventional GRU prediction method, and the maximum relative error is reduced by 4.94%, which is the most ideal among the three methods. This shows that the prediction method of the present invention has better prediction accuracy and can meet the actual scheduling prediction requirements.
[0097] 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.
Claims
1. A microgrid short-term load forecasting method based on GRU neural network, characterized in that: The steps include: Step 1: Obtain historical load data and meteorological factor data of the microgrid, perform data preprocessing, and divide the preprocessed data into a training set and a prediction set; Step 2: Use the data in the training set to train the GRU neural network. During the training process, use the multiverse algorithm to optimize the weight parameters of the GRU neural network and save the trained GRU neural network. Step 3: Input the data in the prediction set into the trained GRU neural network and output the load value of the microgrid at the time to be predicted; In step 2, the steps of optimizing the weight parameters of the GRU neural network using the multiverse algorithm are as follows: (1) Create a multiverse based on the weight parameters of the GRU neural network to be optimized, and set the initial values of the parameters TDR and WEP. TDR is the distance that the current universe travels near the optimal solution through the wormhole, and WEP is the probability of the wormhole existing. (2) Calculate the expansion rate of each universe and sort them; (3) Based on the expansion rate and roulette, the universe with a white hole is selected and exchanges matter with the black hole; (4) Select a specified universe, connect it to the current optimal universe through a wormhole, and exchange elements; (5) Update the values of WEP and TDR and calculate the expansion rate of the updated universe; (6) Determine whether the end condition is met. If so, output the calculation result; otherwise, return to step (2).
2. A microgrid short-term load forecasting method based on GRU neural network according to claim 1, characterized in that: The GRU neural network includes an input layer, a hidden layer and an output layer. The hidden layer is composed of GRU units. The GRU units include two input variables, namely the input at the current moment and the output of the hidden layer at the previous moment.
3. A microgrid short-term load forecasting method based on GRU neural network according to claim 2, characterized in that: The calculation formula executed inside the GRU unit is as follows: z t =σ(W z x t +U z h t-1 ) (1) r t =σ(W r x t +U r h t-1 ) (2) y=σ(h t W y ) (5) Where: z t is the update gate, r t To reset the gate, is the activation state of the hidden layer at time t, h t is the output of the hidden layer at time t, h t-1 is the output of the hidden layer at time t-1, and y is the output of the output layer of the neural network; W z , U z , W r , U r , W, U, W y is the weight parameter of the GRU neural network, where W z is the input to the update gate z t The weight, U z is the hidden layer to update gate z at time t-1 t The weight, W r is the input to the reset gate r t The weight, U r From the hidden layer to the reset gate r at time t-1 t The weight of the hidden layer, W is the weight from the input layer to the hidden layer, U is the weight of the hidden layer itself, and W y is the weight from the hidden layer to the output layer; ⊙ represents the multiplication of corresponding elements in the matrix, σ is the sigmoid function, is the tanh activation function, 1- means the output after operation is 1-z t .
4. A microgrid short-term load forecasting method based on GRU neural network according to claim 1, characterized in that: In step (1), all solutions of the weight parameters of the GRU neural network are assumed to be a set of multiverses, as shown in formula (6): Where U represents the multiverse set; x n,d It represents the d-th material element in the n-th universe, that is, the d-th variable.
5. A microgrid short-term load forecasting method based on GRU neural network according to claim 1, characterized in that: In step (2), the expansion rate of the universe is proportional to the fitness value of the solution. The fitness function is expressed as: fitness = 1 / f, where f is the mean square error between the expected and actual outputs of the GRU neural network, which is used to control the error accuracy of the model.
6. A microgrid short-term load forecasting method based on GRU neural network according to claim 1, characterized in that: In step (3), the material exchange process is as follows: In the formula, x i,j represents the jth variable of the i-th universe; x k,j represents the jth element of the kth universe with a white hole; r1 represents a random number in the range [0,1]; NI(U i ) represents the expansion rate of the ith universe.
7. A microgrid short-term load forecasting method based on GRU neural network according to claim 1, characterized in that: In step (4), the process of exchanging elements between the specified universe and the current optimal universe is as follows: Where, X j is the jth variable of the current optimal universe; lb j is the lower bound of the jth variable; ub j is the upper bound of the jth variable; r2, r3, r4 are random numbers between [0, 1]; WEP represents the probability of wormhole existence, and the calculation formula is as follows: Where, WEP min and WEP max They represent the minimum and maximum values of WEP respectively, l is the current number of iterations; L is the maximum number of iterations; TDR determines the distance the current universe travels near the optimal solution through the wormhole. The calculation formula of TDR is as follows: Where p represents the degree of mining. The value of p directly determines the local detection speed. The local detection speed increases with the increase of the value of p.
8. A microgrid short-term load forecasting method based on GRU neural network according to claim 1, characterized in that: In step (5), the updated expansion rate is proportional to the fitness value of the solution obtained after the update. The fitness function is expressed as: fitness = 1 / f, where f is the mean square error between the expected and actual outputs of the GRU neural network, which is used to control the error accuracy of the model.
9. A microgrid short-term load forecasting method based on GRU neural network according to claim 1, characterized in that: In step (6), the termination condition is a preset number of iterations.
Citation Information
Patent Citations
GRU parallel network flow anomaly detection method based on GA optimization
CN111726349A
Short-term power load prediction method based on CNN-IPSO-GRU hybrid model
CN111738512A