An ultra-short-term photovoltaic power prediction method based on an improved whale optimization algorithm

CN117318036BActive Publication Date: 2026-09-25NANJING UNIV OF INFORMATION SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311259683.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-27
Publication Date
2026-09-25
Estimated Expiration
2043-09-27

AI Technical Summary

Technical Problem

[0003]问题一:光伏发电功率在不同天气条件下出力差异性较大,且由于其波动性和不稳定性导致预测效果不佳,尤其在阴雨天等波动较大的天气

Benefits of technology

[0081]1、针对Kmeans聚类算法处理非线性数据和对初始值敏感的缺陷,设计了一种E-P核函数,通过E-P核函数计算核距离代替传统Kmeans聚类中的欧氏距离并结合了谱聚类算法;其中,E-P核函数由指数核函数和多项式核函数组成,可以同时处理线性和非线性数据且对于高维的数据也更有优势,稳定性和泛化性更佳;通过谱-核Kmeans聚类的方法对历史数据进行不同天气划分,可以更精确地区分出晴天、阴天、雨天三类不同天气的数据集建立不同天气的训练模型分别进行训练提高预测精度;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117318036B_ABST
    Figure CN117318036B_ABST
Patent Text Reader

Abstract

The application discloses a kind of short-term photovoltaic power prediction method based on improved whale optimization algorithm, including steps: preprocessing historical data, and correlation analysis is carried out to meteorological factor and photovoltaic power generation;Similar day sample data of rainy day, cloudy day, sunny day is divided by clustering;The historical data is normalized;The time sequence characteristics of photovoltaic power are mined by prediction model;The hyperparameters of prediction model are optimized by improved whale optimization algorithm;The optimal hyperparameter is input into prediction model and is normalized, and preliminary photovoltaic power prediction result and prediction error sequence are obtained;The prediction error sequence is decomposed into multiple components and residual error;Each component and residual error is predicted by IWOA-BiGRU model, and error prediction result is obtained;The preliminary photovoltaic power prediction result and error prediction result are summed, and the photovoltaic power prediction result after error correction is obtained.The application establishes the training model of different weather to train, improves prediction accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of photovoltaic power generation, and in particular to an ultra-short-term photovoltaic power prediction method based on an improved whale optimization algorithm. Background Technology

[0002] Because photovoltaic (PV) power generation is intermittent and susceptible to weather and environmental influences, it exhibits significant volatility and randomness, posing challenges to large-scale grid integration of PV energy. Research on domestic and international power grid system fault events and PV power prediction reveals the following issues:

[0003] Problem 1: Photovoltaic power output varies significantly under different weather conditions, and its volatility and instability lead to poor prediction results, especially on cloudy or rainy days. Since the training set of a machine learning model has a significant impact on the test set, it is necessary to differentiate the training set under different weather conditions when inputting it into the model to improve prediction accuracy. While the traditional K-means clustering algorithm can perform unsupervised clustering of data samples under different weather conditions, it has limitations in handling nonlinear data and is sensitive to initial values. Therefore, it is necessary to improve the K-means clustering algorithm to enhance clustering performance and further improve prediction accuracy.

[0004] Question 2: For ultra-short-term photovoltaic power generation forecasting, while BiGRU neural networks can capture the correlation between time series data and weather characteristics, their prediction accuracy may be affected by the selection of hyperparameters. Traditional whale optimization algorithms are inefficient for searching large-scale parameter spaces and are prone to getting trapped in local optima, thus failing to fully utilize the predictive performance of BiGRU neural networks. Therefore, it is necessary to improve the whale optimization algorithm to enhance convergence and thus improve its optimization capabilities and prediction accuracy.

[0005] In the early stages of the whale optimization algorithm, the initialization of the population affects the position vector of each individual whale, which in turn affects the optimization process. The original whale optimization algorithm uses a random number generation method for population initialization. The initial population generated by this method is unevenly distributed in the solution space and is prone to clustering, resulting in poor optimization performance in the later stages.

[0006] Furthermore, the linear decreasing factor in the original whale optimization algorithm changes relatively uniformly during the iteration process, which fails to balance the relationship between global search and local optimization. This makes the algorithm prone to getting trapped in local optima and affects its final convergence.

[0007] Furthermore, the whale optimization algorithm simulates the whale's bubble hunting process, where the encirclement of prey is fast in the early stages but slows down in the later stages. This situation was not considered in the algorithm's mathematical model, resulting in the algorithm's local optimization performance still needing improvement.

[0008] Question 3: For ultra-short-term photovoltaic power forecasting, the optimized forecasting model can effectively extract information between weather changes and power output. However, due to the influence of complex factors such as some turning weather events, the preliminary forecast results may contain significant errors, leading to a need to improve the accuracy of the forecasts. Therefore, further processing of the preliminary forecast results is required to enhance the forecast accuracy. Summary of the Invention

[0009] Purpose of the invention: The purpose of this invention is to provide an ultra-short-term photovoltaic power prediction method based on an improved whale optimization algorithm, which can improve the accuracy of photovoltaic power generation prediction and enhance the stability and reliability of photovoltaic grid-connected power systems.

[0010] Technical solution: The ultra-short-term photovoltaic power prediction method of the present invention includes the following steps:

[0011] S1. Preprocess each piece of historical data collected, which includes photovoltaic power generation and meteorological factors; and use the Pearson correlation coefficient method to perform correlation analysis on all meteorological factors and photovoltaic power generation in the historical data.

[0012] S2, similar day sample data for rainy days, cloudy days and sunny days are divided by spectrum-kernel Kmeans clustering;

[0013] S3, normalizes historical data;

[0014] S4 uses the BiGRU prediction model to mine the time-series characteristics of photovoltaic power;

[0015] S5 optimizes the hyperparameters of the BiGRU prediction model by improving the whale optimization algorithm and outputs the optimal hyperparameters.

[0016] S6. The optimal hyperparameters are input into the BiGRU prediction model for prediction and then inversely normalized to obtain preliminary photovoltaic power prediction results; the preliminary photovoltaic power prediction results are then compared with the sample label values. By performing the subtraction, we obtain the prediction error sequence. ;

[0017] S7, for the prediction error sequence Variational mode decomposition is performed to obtain multiple components. and residuals ;

[0018] S8, for each component and residuals The prediction is performed using the IWOA-BiGRU model to obtain the predicted value of each component. The predicted values ​​of each component are then summed to obtain the error prediction result.

[0019] S9 sums the preliminary photovoltaic power prediction result with the error prediction result to obtain the final photovoltaic power prediction result after error correction.

[0020] Furthermore, in step S1, the meteorological factors include direct solar radiation, diffuse solar radiation, ambient temperature, wind speed, relative humidity, wind direction, and rainfall; and nighttime data are excluded, and a sampling period is set.

[0021] Historical data Represented as:

[0022] ,

[0023] In the formula, ; , , , They are respectively The values ​​of photovoltaic power generation, direct solar radiation, diffuse solar radiation, ambient temperature, wind speed, relative humidity, wind direction, and rainfall at any given time;

[0024] The expression for the correlation analysis between a certain meteorological factor and photovoltaic power generation is as follows:

[0025] ,

[0026] In the formula, The correlation coefficient between a certain meteorological factor and photovoltaic power generation. The length of the original input data. For the first At that moment; For the first The value of a meteorological factor that is correlated with the photovoltaic power generation power calculation at a given moment; This represents the average value corresponding to the meteorological factors; For the first Photovoltaic power generation value at any given moment; This represents the average value of photovoltaic power generation.

[0027] Furthermore, in step S2, the set C containing N historical data points is divided into groups using spectral-kernel K-means clustering. Cluster , The implementation steps are as follows:

[0028] S21, average the daily direct solar radiation values ​​from all sampling points, calculate the kernel distance of the daily average direct solar radiation using the EP kernel function, and then construct a similarity matrix of the daily average direct solar radiation. ;

[0029] Among them, the EP kernel function The expression is as follows:

[0030] ,

[0031] In the formula, This is the output of the exponential kernel function; This is the output of the polynomial kernel function; Let R and O be the average solar radiation values ​​on days R and O; R and O are any two days in the total number of days M. For bandwidth parameters; These are the polynomial coefficients; The offset is a constant. Let the order be the order of the polynomial. Indicates matrix transpose;

[0032] S22, using the similarity matrix as the adjacency matrix. And calculate the degree matrix. , yes Composition A diagonal matrix of dimension 1;

[0033] The calculation formula is as follows:

[0034] ,

[0035] in, For matrix No. Line 1 The element values ​​of the column;

[0036] S23, Construct the Laplace matrix And calculate the Laplace matrix. The eigenvalues, take the smallest of the following. Calculate the eigenvalues ​​and eigenvectors to construct the eigenvector matrix. ,in, for An identity matrix of dimension 1 As the initial cluster centers;

[0037] S24, calculate the kernel distance from each sample data point to each initial cluster center. Select the nearest cluster center to form Clusters, and based on minimizing the squared error renew The expression for minimizing the squared error for a cluster is as follows:

[0038] ,

[0039] in, For clusters The central sample; The average solar radiation value on day R;

[0040] S25, for the new Clusters through formula Recalculate cluster centers until the set termination condition is met or the preset number of iterations is reached, to obtain the clustered data sample. ;

[0041] The termination condition is: , Let be any given positive number.

[0042] Furthermore, in step S3, the min-max normalization method is used to normalize the historical data, and the calculation formula is as follows:

[0043] ,

[0044] in, The input values ​​are normalized and include photovoltaic power generation and meteorological factors; The value of the original input data; This represents the minimum value of the feature in the input data; This represents the maximum value of the feature in the input data.

[0045] Furthermore, in step S4, when making predictions, the BiGRU prediction model considers information from both past and future times to mine the time-series characteristics of photovoltaic power. The expression for the BiGRU prediction model is:

[0046] ,

[0047] ,

[0048] ,

[0049] In the formula, express The input to the GRU model at time step; This represents the sigmoid activation function; express The output of the forward GRU model at each time step; express The output of the forward GRU model at each time step; express The output of the GRU model at time step backward; express The output of the GRU model at time step backward; Indicates the output of the hidden layer; and Let the input weight matrix of the feedforward GRU model be denoted as and respectively. Output the weight matrix at each time step; and The input weight matrix and are respectively the weight matrix of the backward GRU model. Output the weight matrix at each time step; and Output weight matrices for the forward GRU model and the backward GRU model, respectively.

[0050] Furthermore, in step S5, the implementation steps for optimizing the hyperparameters of the BiGRU prediction model using the improved whale optimization algorithm are as follows:

[0051] S51, the mean squared error function of the BiGRU prediction model is used as the fitness function of the whale pod, and its expression is:

[0052] ,

[0053] in, The fitness function; This represents the number of neurons in the first hidden layer. This represents the number of neurons in the second hidden layer. The learning rate; Number of batches; This represents the total number of samples; This is the current sample number; For the first Predicted values ​​for each sample; For the first Each sample label value;

[0054] S52, the whale population is initialized by improving the Circle chaotic mapping. The expression for the improved chaotic mapping is:

[0055] ,

[0056] In the formula, It is the remainder function; The generated chaotic value; The dimension of the chaos value;

[0057] S53, Select A whale population consists of several whales, each of which is... dimensional vector And update the whale optimization algorithm. parameter:

[0058] ,

[0059] ,

[0060] In the formula, , It is a random vector whose values ​​are in the range [0,1]. The non-linear decreasing factor is expressed as:

[0061] ,

[0062] In the formula, Non-linear decreasing factor The maximum and minimum values; This represents the current iteration number; This represents the maximum number of iterations. Inverse incomplete function; Inverse incomplete Parameters in the function;

[0063] S54, iteratively update the individual whale positions; if and Then, update the current position of the individual whale using the following formula:

[0064] ,

[0065] like and Then update the current position of the individual whale using the following formula:

[0066] ,

[0067] like Then update the current position of the individual whale using the following formula:

[0068] ,

[0069] In the formula, This represents the distance between the current position of the individual whale and the current optimal solution. Inertial weights; A random number between [0, 1]; This represents the position vector of the individual whale after the next iteration. This is the position vector of the current optimal solution; The location vector of a randomly selected individual whale; It is a constant; It is the natural logarithm; A random number between [-1, 1]; The inertial weights proposed to simulate the feeding speed of whales ;

[0070] S55, determine whether the maximum number of iterations has been reached. If it has, stop the calculation and output the optimal position of the whale and the corresponding fitness value; otherwise, repeat steps S51 to S54.

[0071] Furthermore, in step S7, let the error sequence of the preliminary prediction result be... Let w(t) be the error value at time t. The decomposition formula for variational mode decomposition of the error value is:

[0072] ,

[0073] in, For the first One IMF component; Re is the residual component; This represents the number of IMFs.

[0074] Furthermore, in step S8, for each component... and residuals Prediction was performed using the IWOA-BiGRU model to obtain the predicted value for each component. And sum to obtain the error prediction result. Its formula is:

[0075] ,

[0076] in, For the first Predicted values ​​of each IMF component; This represents the predicted value of the residual component Re.

[0077] Furthermore, in step S9, the preliminary photovoltaic power prediction result is summed with the error prediction result to obtain the final photovoltaic power prediction result after error correction. The formula is as follows:

[0078] ,

[0079] in, for Preliminary photovoltaic power forecast results at the specified time; for Error prediction results at time points; for The final photovoltaic power prediction result at the specified time.

[0080] Compared with the prior art, the significant advantages of this invention are as follows:

[0081] 1. To address the shortcomings of the K-means clustering algorithm in handling nonlinear data and its sensitivity to initial values, an EP kernel function was designed. The EP kernel function calculates kernel distance instead of the Euclidean distance in traditional K-means clustering and incorporates a spectral clustering algorithm. The EP kernel function consists of exponential and polynomial kernel functions, which can handle both linear and nonlinear data simultaneously and is more advantageous for high-dimensional data, exhibiting better stability and generalization. By using the spectral-kernel K-means clustering method to classify historical data into different weather conditions, it can more accurately distinguish between sunny, cloudy, and rainy weather datasets. Training models for different weather conditions are then established and trained separately to improve prediction accuracy.

[0082] 2. For the preliminary prediction results, the error sequence is obtained by comparing with the true label values. The error sequence is decomposed into multiple sub-components by the variational mode decomposition method. Each sub-component is predicted by the prediction model and the arithmetic sum is obtained to get the error prediction result. The arithmetic sum is combined with the preliminary prediction results to obtain the final power prediction result after error correction.

[0083] 3. To address the problem that the whale optimization algorithm is prone to getting trapped in local optima and has low convergence accuracy, an improved whale optimization algorithm is proposed by introducing improved Circle chaotic mapping initialization, nonlinear convergence factor, and adding inertial weight. The improved whale optimization algorithm is used to optimize the hyperparameters of the BiGRU neural network and establish an IWOA-BiGRU prediction model to improve prediction accuracy. Attached Figure Description

[0084] Figure 1 This is an overall flowchart of the present invention;

[0085] Figure 2 Flowchart for improving the whale optimization algorithm. Detailed Implementation

[0086] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments.

[0087] To improve the convergence of the whale optimization algorithm and the accuracy of ultra-short-term photovoltaic power prediction, this invention proposes an ultra-short-term photovoltaic power prediction method based on an improved whale optimization algorithm. The method involves constructing similar days, optimizing BiGRU hyperparameters using the improved whale optimization algorithm, and employing an error correction method to predict ultra-short-term photovoltaic power.

[0088] like Figure 1 The diagram shown is an overall flowchart of the present invention. The implementation steps of the present invention are as follows:

[0089] Step 1: Preprocess and perform correlation analysis on historical data.

[0090] Data from a photovoltaic power station in Jurong City, Jiangsu Province, covering January, April, July, and October of 2015 (a total of M days), was selected. Each historical data point consists of photovoltaic power generation and seven types of meteorological data: direct solar radiation, diffuse solar radiation, ambient temperature, wind speed, relative humidity, wind direction, and rainfall. Nighttime data was excluded, retaining data from 07:35 to 18:25 daily. Data was sampled every 5 minutes, resulting in 131 sampling points and 16,113 data points per day. After data quality control, outliers and missing values ​​were removed, leaving 15,921 data points. The Pearson correlation coefficient method was used to analyze the correlation between all meteorological factors and photovoltaic power generation in the historical data.

[0091] Historical data It can be represented as:

[0092] (1)

[0093] In the formula, ; , , , They are respectively The values ​​of photovoltaic power generation, direct solar radiation, diffuse solar radiation, ambient temperature, wind speed, relative humidity, wind direction, and rainfall at any given time.

[0094] The correlation between various meteorological factors and photovoltaic power generation can be calculated using the Pearson correlation coefficient method, as shown in the following formula:

[0095] (2)

[0096] In the formula, The correlation coefficient between a certain meteorological factor and photovoltaic power generation. The length of the original input data. For the first At that moment; For the first The value of a meteorological factor that is correlated with the photovoltaic power generation power calculation at a given moment; This represents the average value corresponding to the meteorological factors; For the first Photovoltaic power generation value at any given moment; This represents the average value of photovoltaic power generation.

[0097] Step 2: Use spectral-kernel Kmeans clustering to segment similar day sample data for rainy days, cloudy days, and sunny days.

[0098] Clustering of historical data for different weather conditions using spectral-kernel K-means clustering, grouping data containing N historical data points... The set C is divided into Cluster , The main steps are as follows:

[0099] Step 21: Average the direct solar radiation values ​​from 131 sampling points each day, calculate the kernel distance of the daily average direct solar radiation using the newly constructed EP kernel function, and then construct a similarity matrix of the daily average direct solar radiation using this kernel distance as a similarity metric. .

[0100] Among them, the EP kernel function The specific formula is:

[0101] (3)

[0102] In the formula, This is the output of the exponential kernel function; This is the output of the polynomial kernel function; Let R and O be the average solar radiation values ​​on days R and O; R and O are any two days in the total number of days M. For bandwidth parameters; These are the polynomial coefficients; The offset is a constant. Let be the order of the polynomial. Transpose the matrix. Step 22: Use the similarity matrix as the adjacency matrix. And calculate the degree matrix. Calculate the degree matrix yes Composition A diagonal matrix of dimension 1;

[0103] The calculation formula is as follows:

[0104] (4)

[0105] in, For matrix No. Line 1 The element values ​​of the column.

[0106] Step 23, construct the Laplacian matrix And calculate the Laplace matrix. The eigenvalues, take the smallest of the following. Calculate the eigenvalues ​​and eigenvectors to construct the eigenvector matrix. ,in, for An identity matrix of dimension 1 These are the initial cluster centers.

[0107] Step 24: Calculate the kernel distance from each sample data point to each initial cluster center. Select the nearest cluster center to form Clusters, and based on minimizing the squared error renew The expression for minimizing the squared error for a cluster is as follows:

[0108] (5)

[0109] in, For clusters The central sample; Let R be the average solar radiation value on day R.

[0110] Step 25, for the new Clusters through formula Recalculate the cluster centers until the termination condition is met after a preset number of iterations, or the expression is satisfied. This means that it has converged, among which Let be any given positive number. This yields the clustered data samples. ,in, The value is 3.

[0111] Step 3: Normalize the historical data.

[0112] To reduce the complexity of model processing and improve accuracy, the input data, including photovoltaic power generation and data containing direct solar irradiance, diffuse solar irradiance, ambient temperature, wind speed, relative humidity, wind direction, and rainfall, are normalized using the min-max normalization method. The normalized data range is between [0,1], and the calculation formula is as follows:

[0113] (6)

[0114] in, The input values ​​are normalized and include photovoltaic power generation and direct solar irradiance, diffuse solar irradiance, ambient temperature, wind speed, relative humidity, wind direction, and rainfall. The value of the original input data; This is the minimum value of this feature in the input data; This represents the maximum value of this feature in the input data.

[0115] Step 4: Construct the BiGRU prediction model.

[0116] The Bidirectional Gated Recurrent Unit (BiGRU) is a special variant of the GRU structure, consisting of two layers of GRU models with the same output but opposite information transmission directions. During prediction, the BiGRU can simultaneously consider information from past and future times, fully exploiting the time-series characteristics of photovoltaic power and improving data utilization and model prediction accuracy. The specific calculation formula for BiGRU can be expressed as:

[0117] (7)

[0118] (8)

[0119] (9)

[0120] In the formula, express The input to the GRU model at time step; This represents the sigmoid activation function; express The output of the forward GRU model at each time step; express The output of the forward GRU model at each time step; express The output of the GRU model at time step backward; express The output of the GRU model at time step backward; Indicates the output of the hidden layer; and Let the input weight matrix of the feedforward GRU model be denoted as and respectively. Output the weight matrix at each time step; and The input weight matrix and are respectively the weight matrix of the backward GRU model. Output the weight matrix at each time step; and Output weight matrices for the forward GRU model and the backward GRU model, respectively.

[0121] Step 5: Construct the IWOA-optimized BiGRU model.

[0122] The normalized data was divided into training sets in an 8:2 ratio. With test set This data is then input into the IWOA-BiGRU model. The hyperparameters to be optimized in the BiGRU prediction model include... This paper proposes an improved whale optimization algorithm to address the issue of its convergence performance. The hyperparameters of the BiGRU model are optimized, and the optimal hyperparameters are finally output. .in, The input vector matrix of the training set; The output vector matrix of the training set; The input vector matrix for the test set; The output vector matrix of the test set; This represents the number of neurons in the first and second layers of the BiGRU prediction model. The learning rate; The number of batches.

[0123] The improved whale optimization algorithm is used for hyperparameter optimization as follows: Figure 2 As shown, the specific steps are as follows:

[0124] Step 51, define the objective function for the whale pod. The mean squared error function of the BiGRU prediction model is used as the fitness function for the whale pod, and its specific formula is:

[0125] (10)

[0126] in, The fitness function; This represents the number of neurons in the first hidden layer. This represents the number of neurons in the second hidden layer. The learning rate; Number of batches; This represents the total number of samples. This is the current sample number; For the first Predicted values ​​for each sample; For the first Each sample label value.

[0127] Step 52: Initialize the location of the whale population.

[0128] The whale optimization algorithm initializes the population using random generation. This method suffers from uneven spatial distribution of the initial population, leading to clustering of initial solutions. To address this, a Circle chaotic model is used for initial value mapping. However, the Circle chaotic mapping has a relatively dense value range ([0.2, 0.6]), which can result in uneven distribution of chaotic values. Therefore, the Circle chaotic mapping formula is improved to make the initial population distribution more uniform. The improved chaotic mapping formula modifies the formula structure, breaking the dense range of values ​​in the [0.2, 0.6] range, thus making the generated initial population more spatially evenly distributed.

[0129] Whale population initialization is achieved through an improved Circle chaotic mapping. The improved chaotic mapping formula modifies the original formula's structure, breaking the dense distribution of its results within the [0.2, 0.6] range. The specific formula is as follows:

[0130] (11)

[0131] In the formula, It is the remainder function; The generated chaotic value; The dimension of the chaos value.

[0132] Step 53, select A whale population consists of several whales, each of which is... dimensional vector And update the whale optimization algorithm. Parameters such as these.

[0133]

[0134]

[0135] In the formula, , It is a random vector whose values ​​are in the range [0,1]. The non-linear decreasing factor is calculated using the following formula:

[0136] (12)

[0137] In the formula, Non-linear decreasing factor The maximum and minimum values; This represents the current iteration number; This represents the maximum number of iterations. Inverse incomplete function; Inverse incomplete The parameter in the function takes a value of 0.01.

[0138] This embodiment utilizes a function based on inverse incomplete functions. Nonlinear decreasing factor substitution In the original whale optimization algorithm, due to The iterations decrease linearly from 2 to 0. However, the linear decrease factor changes relatively easily during the iteration process, making it difficult to balance the relationship between global and local optimization. Therefore, a method based on inverse incompleteness is used. Nonlinear decreasing factor substitution of a function By constructing a nonlinear decreasing factor that changes rapidly in the early stages to improve the global optimization effect and changes slowly in the later stages of iteration to facilitate local optimization, the algorithm achieves a better balance between global and local optimization.

[0139] Step 54: Iteratively update the location of individual whales.

[0140] Considering that whales move faster in the early stages of their feeding process than in the later stages, to better simulate this process algorithmically, a method based on an inverse incomplete function is added when updating the whale population position. An inertia weight update is set to improve the algorithm's optimization ability. When the inertia weight is greater than 1, the algorithm will gradually diverge, while when the weight is less than 0, the algorithm will enter a stagnant state. Furthermore, considering that the algorithm mainly focuses on global optimization in the early stage of iteration, the weight should be larger at this time, while the algorithm mainly focuses on local optimization in the later stage of iteration, the weight should be smaller at this time. Therefore, an inertia weight that decreases non-linearly from 1 to 0 is designed and added to the whale population position update formula.

[0141] Compare The size, while also randomly generating values Compare with 0.5 and update the formula at the appropriate location. If and Then, update the current position of the individual whale using the following formula:

[0142] (13)

[0143] like Then update the current position of the individual whale using the following formula:

[0144] (14)

[0145] like Then update the current position of the individual whale using the following formula:

[0146] (15)

[0147] In the formula, This represents the distance between the current position of the individual whale and the current optimal solution. Inertial weights; A random number between [0, 1]; This represents the position vector of the individual whale after the next iteration. This is the position vector of the current optimal solution; The location vector of a randomly selected individual whale; It is a constant; It is the natural logarithm; It is a random number between [-1, 1].

[0148] in, The inertial weight, proposed to simulate the feeding speed of whales, has the following specific formula:

[0149] (16)

[0150] In the formula, It is a non-linear decreasing factor.

[0151] Step 55: Determine if the maximum number of iterations has been reached. If it has, stop the calculation and output the optimal position of the whale and its corresponding fitness value. Otherwise, repeat steps 51 to 54.

[0152] Step 6: Optimize the BiGRU prediction model and make predictions.

[0153] The BiGRU prediction model is optimized based on the improved whale optimization algorithm in step five to obtain the IWOA-BiGRU prediction model and perform ultra-short-term photovoltaic power prediction.

[0154] The optimized hyperparameters are input into the BiGRU prediction model for prediction and then inversely normalized to obtain preliminary photovoltaic power prediction results. And the preliminary photovoltaic power prediction results With sample label values The difference is used to obtain the prediction error sequence. .in, For the first Predicted photovoltaic power at any given time; For the first The sample label value at each time point; For the first The error between the predicted data and the label value at each time point.

[0155] Step 7: Analyze the prediction error sequence. Variational mode decomposition is performed to obtain multiple components. and residuals Variational mode decomposition can adaptively transform the error sequence. If the error w(t) at time t is decomposed into multiple stationary IMFs components and residual components Re, then the decomposition formula is as follows:

[0156] (17)

[0157] in, For the first One IMF component; Re is the residual component; This represents the number of IMFs.

[0158] Step 8, for each component and residuals The prediction model IWOA-BiGRU is used to obtain the predicted value for each component. And sum to obtain the error prediction result. The formula is as follows:

[0159] (18)

[0160] in, For the first Predicted values ​​of each IMF component; This represents the predicted value of the residual component Re.

[0161] Step nine: Sum the preliminary photovoltaic power prediction results with the error prediction results to obtain the final photovoltaic power prediction results after error correction. The formula is as follows:

[0162] (19)

[0163] in, for Preliminary photovoltaic power forecast results at the specified time; for Error prediction results at time points; for The final photovoltaic power prediction result at the specified time.

Claims

1. A method for predicting ultra-short-term photovoltaic power based on an improved whale optimization algorithm, characterized in that, The steps include the following: S1. Preprocess each piece of historical data collected, which includes photovoltaic power generation and meteorological factors; and use the Pearson correlation coefficient method to perform correlation analysis on all meteorological factors and photovoltaic power generation in the historical data. S2, similar day sample data for rainy days, cloudy days and sunny days are divided by spectrum-kernel Kmeans clustering; S3, normalizes historical data; S4 uses the BiGRU prediction model to mine the time-series characteristics of photovoltaic power; S5 optimizes the hyperparameters of the BiGRU prediction model by improving the whale optimization algorithm and outputs the optimal hyperparameters. S6. The optimal hyperparameters are input into the BiGRU prediction model for prediction and then inversely normalized to obtain preliminary photovoltaic power prediction results; the preliminary photovoltaic power prediction results are then compared with the sample label values. By performing the subtraction, we obtain the prediction error sequence. ; S7, for the prediction error sequence Variational mode decomposition is performed to obtain multiple components. and residuals ; S8, for each component and residuals The prediction is performed using the IWOA-BiGRU model to obtain the predicted value of each component. The predicted values ​​of each component are then summed to obtain the error prediction result. S9 sums the preliminary photovoltaic power prediction result with the error prediction result to obtain the final photovoltaic power prediction result after error correction.

2. The ultra-short-term photovoltaic power prediction method based on the improved whale optimization algorithm according to claim 1, characterized in that, In step S1, the meteorological factors include direct solar radiation, diffuse solar radiation, ambient temperature, wind speed, relative humidity, wind direction, and rainfall; and nighttime data are excluded, and a sampling period is set. Historical data Represented as: , In the formula, ; , , , They are respectively The values ​​of photovoltaic power generation, direct solar radiation, diffuse solar radiation, ambient temperature, wind speed, relative humidity, wind direction, and rainfall at any given time; The expression for the correlation analysis between a certain meteorological factor and photovoltaic power generation is as follows: , In the formula, The correlation coefficient between a certain meteorological factor and photovoltaic power generation. The length of the original input data. For the first At that moment; For the first The value of a meteorological factor that is correlated with the photovoltaic power generation power calculation at a given moment; This represents the average value corresponding to the meteorological factors; For the first Photovoltaic power generation value at any given moment; This represents the average value of photovoltaic power generation.

3. The ultra-short-term photovoltaic power prediction method based on the improved whale optimization algorithm according to claim 1, characterized in that, In step S2, the set C containing N historical data points is divided into groups using spectral-kernel K-means clustering. Cluster , The implementation steps are as follows: S21, average the daily direct solar radiation values ​​from all sampling points, calculate the kernel distance of the daily average direct solar radiation using the EP kernel function, and then construct a similarity matrix of the daily average direct solar radiation. ; Among them, the EP kernel function The expression is as follows: , In the formula, This is the output of the exponential kernel function; This is the output of the polynomial kernel function; Let R and O be the average solar radiation values ​​on days R and O; R and O are any two days in the total number of days M. For bandwidth parameters; These are the polynomial coefficients; The offset is a constant. Let the order be the order of the polynomial. Indicates matrix transpose; S22, using the similarity matrix as the adjacency matrix. And calculate the degree matrix. , yes Composition A diagonal matrix of dimension 1; The calculation formula is as follows: , in, For matrix No. Line 1 The element values ​​of the column; S23, Construct the Laplace matrix And calculate the Laplace matrix. The eigenvalues, take the smallest of the following. Calculate the eigenvalues ​​and eigenvectors to construct the eigenvector matrix. ,in, for An identity matrix of dimension 1 As the initial cluster centers; S24, calculate the kernel distance from each sample data point to each initial cluster center. Select the nearest cluster center to form Clusters, and based on minimizing the squared error renew The expression for minimizing the squared error for a cluster is as follows: , in, For clusters The central sample; The average solar radiation value on day R; S25, for the new Clusters through formula Recalculate cluster centers until the set termination condition is met or the preset number of iterations is reached, to obtain the clustered data sample. ; The termination condition is: , Let be any given positive number.

4. The ultra-short-term photovoltaic power prediction method based on the improved whale optimization algorithm according to claim 1, characterized in that, In step S3, the min-max normalization method is used to normalize the historical data. The calculation formula is as follows: , in, The input values ​​are normalized and include photovoltaic power generation and meteorological factors; The value of the original input data; This represents the minimum value of the feature in the input data; This represents the maximum value of the feature in the input data.

5. The ultra-short-term photovoltaic power prediction method based on the improved whale optimization algorithm according to claim 1, characterized in that, In step S4, when making predictions, the BiGRU prediction model considers information from both past and future times to mine the time-series characteristics of photovoltaic power. The expression for the BiGRU prediction model is: , , , In the formula, express The input to the GRU model at time step; This represents the sigmoid activation function; express The output of the forward GRU model at each time step; express The output of the forward GRU model at each time step; express The output of the GRU model at time step backward; express The output of the GRU model at time step backward; Indicates the output of the hidden layer; and Let the input weight matrix of the feedforward GRU model be denoted as and respectively. Output the weight matrix at each time step; and The input weight matrix and are respectively the weight matrix of the backward GRU model. Output the weight matrix at each time step; and Output weight matrices for the forward GRU model and the backward GRU model, respectively.

6. The ultra-short-term photovoltaic power prediction method based on the improved whale optimization algorithm according to claim 1, characterized in that, In step S5, the implementation steps for optimizing the hyperparameters of the BiGRU prediction model using the improved whale optimization algorithm are as follows: S51, the mean squared error function of the BiGRU prediction model is used as the fitness function of the whale pod, and its expression is: , in, The fitness function; This represents the number of neurons in the first hidden layer. This represents the number of neurons in the second hidden layer. The learning rate; Number of batches; This represents the total number of samples; This is the current sample number; For the first Predicted values ​​for each sample; For the first Each sample label value; S52, the whale population is initialized by improving the Circle chaotic mapping. The expression for the improved chaotic mapping is: , In the formula, It is the remainder function; The generated chaotic value; The dimension of the chaos value; S53, Select A whale population consists of several whales, each of which is... dimensional vector And update the whale optimization algorithm. parameter: , , In the formula, , It is a random vector whose values ​​are in the range [0,1]. The non-linear decreasing factor is expressed as: , In the formula, Non-linear decreasing factor The maximum and minimum values; This represents the current iteration number; This represents the maximum number of iterations. Inverse incomplete function; Inverse incomplete Parameters in the function; S54, iteratively update the individual whale positions; if and Then, update the current position of the individual whale using the following formula: , like and Then update the current position of the individual whale using the following formula: , like Then update the current position of the individual whale using the following formula: , In the formula, This represents the distance between the current position of the individual whale and the current optimal solution. Inertial weights; A random number between [0, 1]; This represents the position vector of the individual whale after the next iteration. This is the position vector of the current optimal solution; The location vector of a randomly selected individual whale; It is a constant; It is the natural logarithm; A random number between [-1, 1]; The inertial weights proposed to simulate the feeding speed of whales ; S55, determine whether the maximum number of iterations has been reached. If it has, stop the calculation and output the optimal position of the whale and the corresponding fitness value; otherwise, repeat steps S51 to S54.

7. The ultra-short-term photovoltaic power prediction method based on the improved whale optimization algorithm according to claim 1, characterized in that, In step S7, let the error sequence of the preliminary prediction result be... Let w(t) be the error value at time t. The decomposition formula for variational mode decomposition of the error value is: , in, For the first One IMF component; Re is the residual component; The number of IMFs.

8. The ultra-short-term photovoltaic power prediction method based on the improved whale optimization algorithm according to claim 7, characterized in that, In step S8, for each component and residuals Prediction was performed using the IWOA-BiGRU model to obtain the predicted value for each component. And sum to obtain the error prediction result. Its formula is: , in, For the first Predicted values ​​of each IMF component; This represents the predicted value of the residual component Re.

9. The ultra-short-term photovoltaic power prediction method based on the improved whale optimization algorithm according to claim 1, characterized in that, In step S9, the preliminary photovoltaic power prediction result is summed with the error prediction result to obtain the final photovoltaic power prediction result after error correction. The formula is as follows: , in, for Preliminary photovoltaic power forecast results at the specified time; for Error prediction results at time points; for The final photovoltaic power prediction result at the specified time.