A wind power prediction method based on IPSO-LSTM
By improving the particle swarm algorithm to optimize the parameters of the LSTM model, the problem of difficult to determine the number of hidden layers, time step and batch size in wind power prediction is solved, and the accuracy and robustness of wind power prediction is improved, and the future is achieved Accurate prediction of wind power change trends within four days provides effective data support for the power system.
Patent Information
- Application Number
- CN202011501946.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-18
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2040-12-18
AI Technical Summary
In the existing wind power prediction methods, the number of hidden layers, time step and batch size of neural networks are difficult to determine, resulting in insufficient randomness and accuracy of prediction results.
The improved particle swarm algorithm (IPSO) is used to optimize the parameters of the LSTM model, and the particle swarm algorithm is optimized through inertia weight and acceleration factor to determine the number of hidden layer units, time step and batch size of the LSTM network, thereby improving the accuracy of wind power prediction .
It improves the accuracy and robustness of wind power power prediction, can accurately predict the wind power power change trend in the next four days, and provides effective data support for power system scheduling.
Smart Images

Figure CN114648147B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of power system time series data prediction, and specifically is a wind power prediction method based on IPSO-LSTM. Background Art
[0002] As energy and environmental issues become increasingly prominent, wind energy, as one of the most important renewable energy sources among clean energy, has been highly valued by countries around the world. Domestic wind power generation has also maintained a steady growth, reaching 366 billion kW·h in 2018, accounting for 5.2% of total power generation. Large-scale wind power access has an impact on the stable operation and dispatch of the power system. If wind power can be reliably and accurately predicted, it will be conducive to the stable operation of the power grid.
[0003] Regarding the prediction methods of wind power, the prediction models of wind power mainly include time series models and prediction models based on numerical weather forecasts, the latter of which include physical models and statistical models. In the statistical model, there is a short-term wind power prediction model based on LSTM network. Some authors have proposed to optimize BP neural network based on principal component analysis and genetic algorithm to predict the short-term power of wind farms. There is also a network combining CNN and GRU for ultra-short-term wind power prediction. At the same time, there are some methods that combine artificial intelligence algorithms and deep learning neural networks. For example, a short-term wind power prediction based on an improved firefly algorithm and a short-term wind power prediction method using a genetic algorithm to improve LSTM are used.
[0004] The application of particle swarm algorithm is mainly used for single-objective or multi-objective optimization. Particle swarm algorithm can be used to optimize the parameters of deep learning network. LSTM, as an improved time recurrent neural network (RNN), can learn long-term and short-term information of time series, and can be used to process and predict interval and delay events in time series. At the same time, there are also some disadvantages, such as the number of hidden layers of neural network, time step, and batch size are difficult to determine. In practical applications, these parameters are determined by experience and have great randomness. IPSO can be used to optimize the parameters of LSTM to better predict wind power. Summary of the invention
[0005] In view of the shortcomings of the existing wind power prediction methods, the technical problem solved by the present invention is to predict the wind power in the future based on the historical wind power data. The LSTM model optimized by the improved particle swarm algorithm is used to predict the wind power, which improves the accuracy and robustness of the model.
[0006] The technical solution adopted by the present invention to achieve the above-mentioned purpose is: a wind power prediction method based on IPSO-LSTM, comprising the following steps:
[0007] 1) Collect wind power related data from power system monitoring stations;
[0008] 2) Clean the collected wind power data and divide the data into training set and test set;
[0009] 3) Normalize the training set and test set data respectively;
[0010] 4) Use the training set data to input the IPSO-LSTM model to optimize the network parameters, and use the test set data for testing to obtain the optimized IPSO-LSTM model;
[0011] 5) Collect the wind power related data sequence in the actual site within a period of time, and input it into the optimized IPSO-LSTM model to obtain the prediction results of wind power data;
[0012] 6) The prediction results of wind power data are denormalized again, and the predicted wind power data within a set future time is obtained by combining the time point and wind speed.
[0013] The wind power related data are data of time point, wind speed and wind power.
[0014] The data cleaning is specifically as follows: using the isolation forest algorithm to detect outliers, correcting outliers by using nearby normal values, and filling missing values in the data set by using the mean method.
[0015] The data normalization process is specifically as follows: using minimum-maximum standardization to perform linear transformation on the sample data and mapping the result value to between [0, 1];
[0016] Among them, the sample data is wind power data, and the conversion expression is:
[0017] x'=(xx min ) / (x max -x min )
[0018] In the above formula, x and x' are the actual value and normalized value of the sample data respectively, and x min 、x max are the minimum and maximum values in the sample data set, respectively.
[0019] The network parameters need to be pre-set in their ranges, including setting the number of particles in the particle swarm, the maximum number of iterations, the number of units in the hidden layer of the neural network in the range [a, b], the time step in the range [1, p], and the batch size in the range [1, d]; where a, b, d, and p are all natural numbers.
[0020] The above parameters are continuously updated through the improved particle swarm algorithm IPSO, and finally the optimal values of the number of hidden layer units, time step, and batch size of the LSTM network are determined, thereby obtaining the optimized IPSO-LSTM model.
[0021] The improved particle swarm algorithm is to solve the problem that particles are prone to fall into local optimal solutions and have slow convergence speed from two aspects: inertia weight and acceleration factor. The inertia weight expression and the self-adjusting acceleration factor expression are respectively expressed as:
[0022]
[0023]
[0024] Among them, ω max ,ω min are the maximum and minimum values of the inertia weight, c 1s and c 2s are the initial values of c1 and c2 respectively, c 1c and c 2c are the final values of c1 and c2 respectively, t is the number of current iterations, and T is the total number of iterations.
[0025] The LSTM network structure includes: a forget gate, an input gate, and an output gate; the LSTM network keeps the memory of the unit state at time t, and uses the forget gate f t and input gate i t The forget gate is used to make the cell remember or forget the previous state C t-1 The function of the input gate is to allow or prevent the incoming signal from updating the unit state; the function of the output gate is to control the unit state C output and transmission to the next unit; the normalized training set sample data is processed by the forget gate, input gate, and output gate in turn to output the predicted data of the current data.
[0026] The LSTM network model is composed of multiple unit structures, which can store information for a long time by updating the internal state. The function is as follows:
[0027] f t =σ(w f ·[h t-1 ,x t ]+b f )
[0028] i t =σ(w i ·[h t-1 ,x t ]+b i )
[0029]
[0030]
[0031] o t =σ(w o ·[h t-1 ,x t ]+b o )
[0032] h t =o t tanh(C t )
[0033] In the formula, x is the input vector of the LSTM unit; h is the output vector of the LSTM unit, f, i, o represent the forget gate, input gate and output gate respectively; C represents the unit state; subscript t represents the time; σ and tanh are sigmoid and tanh activation functions respectively; w and b represent the weight and bias matrices respectively.
[0034] The present invention has the following beneficial effects and advantages:
[0035] 1) The present invention provides a practical and effective method for wind power forecasting, which can more accurately predict the changing trend of wind power in the next four days and provide effective data support for the dispatching and maintenance of the power system.
[0036] 2) The present invention uses historical data of wind power as the input of the model, gives full play to the high efficiency of LSTM in predicting time series data, and uses particle swarm algorithm to optimize parameters, thereby improving the accuracy of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 This is a structural diagram of a wind power prediction method based on IPSO-LSTM in the present invention;
[0038] Figure 2 It is the LSTM unit structure;
[0039] Figure 3 Prediction results for different models; DETAILED DESCRIPTION
[0040] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific implementation method of the present invention is described in detail below in conjunction with the accompanying drawings. In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention can be implemented in many other ways different from those described herein, and those skilled in the art can make similar improvements without violating the connotation of the invention, so the present invention is not limited by the specific implementation disclosed below.
[0041] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the invention herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention.
[0042] The present invention proposes a wind power prediction model based on IPSO-LSTM. The LSTM model has strong prediction ability and can be used for time series data with good results. The particle swarm method is easy to implement and has a fast convergence speed. IPSO is used to optimize the selection of LSTM neural network parameters, thereby improving the prediction accuracy of the model.
[0043] like Figure 1 As shown, the wind power prediction method based on IPSO-LSTM includes the following steps:
[0044] Step 1: The power system monitoring station has a wind power monitoring device, which collects wind power data and corresponding time points, wind speed, and other related data from the monitoring station;
[0045] Step 2: Clean the collected wind power data, including processing missing values and outliers;
[0046] Step 3: Divide the data into training set and test set, and then use the normalized data as the input of the LSTM model.
[0047] Step 4: Continuously iterate and update the optimal parameters of LSTM according to the IPSO algorithm.
[0048] Step 5: Test and predict the trained model, and denormalize and output the model prediction results to obtain the predicted wind power value for a period of time in the future.
[0049] The data cleaning specifically includes: using the isolation forest algorithm to detect outliers, and using nearby normal values to correct outliers. For missing values in the data set, the mean method is used to fill them.
[0050] The data normalization process is specifically: using minimum-maximum standardization to perform linear transformation on the sample data, and mapping the result value to [0,1]. The sample data is wind power data, and the conversion expression is:
[0051] x'=(xx min ) / (x max -x min )
[0052] In the above formula, x and x' are the actual value and normalized value of the sample data processed in step 2, respectively. min 、x max are the minimum and maximum values in the data set, respectively.
[0053] Description of traditional particle swarm algorithm: In an n-dimensional search space, a population X is composed of m particles, X = {x1,...,x i ,...,x m}, where the position of the ith particle can be described as x i =(x i1 ,x i2 ,...,x in ) T , the velocity of the ith particle can be described as v i =(v i1 ,v i2 ,...,v in ) T The local optimal solution of the particle is p i =(p i1 ,p i2 ,...p in ) T , the global optimal solution of the population is p g =(p g1 ,p g2 ,...,p gn ) T In the iterative optimization process, each particle takes the solution at the best fitness value it has experienced as the local optimal solution, and the solution at the best fitness value experienced by all particles is taken as the global optimal solution, and the particle position is updated according to these two optimal solutions. and speed The expressions are:
[0054]
[0055]
[0056] Wherein, d = 1, 2, ... n; i = 1, 2, ... m; m is the population size; t is the current evolutionary generation; r1 and r2 are random numbers between 0 and 1, c1 and c2 are acceleration factors, generally taken as c1 = c2 = 2, and ω is the inertia weight.
[0057] The improved particle swarm algorithm (IPSO): Since the traditional particle swarm algorithm has the problem of long optimization time and easy to fall into the local optimum, this method mainly solves the problem that particles are easy to fall into the local optimal solution and slow convergence speed from two aspects: inertia weight and acceleration factor. The inertia weight expression and the self-adjusting acceleration factor expression are respectively expressed as:
[0058]
[0059]
[0060] Among them, ω max ,ω min are the maximum and minimum values of the inertia weight, c 1s and c 2s are the initial values of c1 and c2 respectively, c 1c and c 2c are the final values of c1 and c2 respectively, t is the number of current iterations, and T is the total number of iterations.
[0061] The LSTM network:
[0062] f t =σ(w f ·[h t-1 ,x t ]+b f )
[0063] i t =σ(w i ·[h t-1 ,x t ]+b i )
[0064]
[0065]
[0066] o t =σ(w o ·[h t-1 ,x t ]+b o )
[0067] h t =o t tanh(C t )
[0068] like Figure 2 As shown in the figure, LSTM is composed of multiple unit structures, which can store information for a long time by updating the internal state. In the formula, x is the input vector of the LSTM unit; h is the output vector of the LSTM unit, f, i, o represent the forget gate, input gate and output gate respectively; C represents the unit state; subscript t represents the time; σ and tanh are sigmoid and tanh activation functions respectively; w and b represent the weight and bias matrices respectively.
[0069] The key to LSTM is the cell state C, which keeps the memory of the cell state at time t through the forget gate f t and input gate i t The forget gate is used to make the cell remember or forget the previous state C t-1 The function of the input gate is to allow or prevent the incoming signal from updating the cell state. The function of the output gate is to control the cell state C output and transmission to the next cell.
[0070] Initialization of IPSO-LSTM model: Set the number of particles in the particle swarm to 40, the maximum number of iterations to 600, the number of hidden layer units in the neural network to the range of [10,50], the time step to the range of [1,40], and the batch size to the range of [1,50].
[0071] Through continuous iterative updates, it was finally determined that the number of hidden layer units in the LSTM network was 30, the time step was 5, and the batch size was 10.
[0072] Example Analysis 1:
[0073] Step 1: Data collection: Collect wind power data from the power system monitoring points in a certain area. Collect data once an hour for a total of 12 days, from March 1 to March 12, 2019, for a total of 288 hours.
[0074] Step 2: Data cleaning: Use the isolation forest algorithm to detect outliers. For outliers, use nearby normal values for correction. For missing values in the data set, use the mean method to fill. At the same time, normalization is performed, and the processed data is divided into training set and test set. The data from March 1, 2019 to March 8, 2019 is used as the training set of the model, and the data from March 9, 2019 to March 12, 2019 is used as the test set.
[0075] Step 3: Initialize the IPSO-LSTM model: Set the number of particles in the particle swarm to 40, the maximum number of iterations to 600, the number of hidden layer units in the neural network to the range of [10, 50], the time step to the range of [1, 40], and the batch size to the range of [1, 50].
[0076] Step 4 is updated through continuous iterations, and finally determines that the number of hidden layer units of the LSTM network is 30, the time step is 5, and the batch size is 10.
[0077] Step 5: Model prediction: Use the trained model to predict wind power for the next four days based on historical data.
[0078] like Figure 3 As shown in the figure, in order to fully demonstrate the improvement of the model prediction accuracy, this experiment uses LSTM model, PSO-LSTM model, GA-LSTM model and IPSO-LSTM model for training and prediction, and calculates the root mean square error (RMSE), mean absolute error (MAE) and mean absolute percentage error (MAPE) of the model prediction.
[0079] Table 1 Error comparison of different models
[0080]
[0081] As can be seen from Table 1, the IPSO-LSTM model of the method of the present invention has higher accuracy than the other three models. Taking the mean absolute percentage error as an example, the IPSO-LSTM model is 1.79% higher than the LSTM model, 1.51% higher than the PSO-LSTM model, and 0.79% higher than the GA-LSTM model.
[0082] The specific embodiments described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A wind power prediction method based on IPSO-LSTM, characterized in that: The following steps are involved: S1. Collect wind power related data from the power system monitoring station; S2. Clean the collected wind power data and divide the data into a training set and a test set; S3, normalize the training set and test set data respectively; S4. Use the training set data to input the IPSO-LSTM model to optimize the network parameters, and use the test set data for testing to obtain the optimized IPSO-LSTM model; specifically, it includes: Set network parameters, including the number of particles in the particle swarm, the maximum number of iterations, the value range of the number of hidden layer units in the neural network [a, b], the value range of the time step [1, p], and the value range of the batch size [1, d]; where a, b, d, and p are all natural numbers; The above parameters are continuously updated through the improved particle swarm algorithm IPSO, and the optimal values of the number of hidden layer units, time step, and batch size of the LSTM network are finally determined, thereby obtaining the optimized IPSO-LSTM model; The improved particle swarm algorithm is to solve the problem that particles are prone to fall into local optimal solutions and have slow convergence speed from two aspects: inertia weight and acceleration factor. The inertia weight expression and the self-adjusting acceleration factor expression are respectively expressed as: Among them, ω max ,ω min are the maximum and minimum values of the inertia weight, c 1s and c 2s are the initial values of c1 and c2 respectively, c 1c and c 2c are the final values of c1 and c2 respectively, t is the number of current iterations, and T is the total number of iterations; S5. Collect the wind power related data sequence in the actual site within a period of time, and input it into the optimized IPSO-LSTM model to obtain the prediction result of the wind power data; S6. Denormalize the prediction results of wind power data, and combine the time point and wind speed to obtain the predicted wind power data within a set future time.
2. The wind power prediction method based on IPSO-LSTM according to claim 1 is characterized in that: The wind power related data are data of time point, wind speed and wind power.
3. The wind power prediction method based on IPSO-LSTM according to claim 1 is characterized in that: The data cleaning is specifically as follows: using the isolation forest algorithm to detect outliers, using nearby normal values to correct outliers, and using the mean method to fill in missing values in the data set.
4. The wind power prediction method based on IPSO-LSTM according to claim 1 is characterized in that: The data normalization process is specifically as follows: using minimum-maximum standardization to perform linear transformation on the sample data and mapping the result value to between [0, 1]; Among them, the sample data is wind power data, and the conversion expression is: x'=(x-x min ) / (x max -x min ) In the above formula, x and x' are the actual value and normalized value of the sample data respectively, and x min 、x max are the minimum and maximum values in the sample data set, respectively.
5. The wind power prediction method based on IPSO-LSTM according to claim 1 is characterized in that: The LSTM network structure includes: a forget gate, an input gate, and an output gate; the LSTM network keeps the memory of the unit state at time t, and uses the forget gate f t and input gate i t The forget gate is used to make the cell remember or forget the previous state C t-1 The function of the input gate is to allow or prevent the incoming signal from updating the unit state; the function of the output gate is to control the unit state C output and transmission to the next unit; the normalized training set sample data is processed by the forget gate, input gate, and output gate in turn to output the predicted data of the current data.
6. The wind power prediction method based on IPSO-LSTM according to claim 5 is characterized in that: The LSTM network model is composed of multiple unit structures, which can store information for a long time by updating the internal state. The function is as follows: f t =σ(w f ·[h t-1 ,x t ]+b f ) i t =σ(w i ·[h t-1 ,x t ]+b i ) the t =σ(w o ·[h t-1 ,x t ]+b o ) h t =o t ·tanh(C t ) In the formula, x is the input vector of the LSTM unit; h is the output vector of the LSTM unit, f, i, o represent the forget gate, input gate and output gate respectively; C represents the unit state; subscript t represents the time; σ and tanh are sigmoid and tanh activation functions respectively; w and b represent the weight and bias matrices respectively.
