Photovoltaic power prediction method, system and equipment based on hybrid model

By constructing an RNN-Transformer-BiLSTM hybrid model and using a multi-strategy improved WOA algorithm training, the problems of short-term and long-term timing dependence in photovoltaic power forecasting are solved, the prediction accuracy of photovoltaic power fluctuation range and peak position is improved, and the economic benefits of photovoltaic power generation and the stability of the power system are enhanced.

CN120671883APending Publication Date: 2025-09-19ECONOMIC & TECH RES INST OF HUBEI ELECTRIC POWER COMPANY SGCC

Patent Information

Application Number
CN202510588911.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-08
Publication Date
2025-09-19

AI Technical Summary

Technical Problem

The existing single network model is difficult to effectively handle short-term and long-term timing dependencies in photovoltaic power forecasting, resulting in insufficient prediction accuracy of photovoltaic power fluctuation range and peak position.

Method used

A RNN-Transformer-BiLSTM hybrid model was constructed, combining the ADTC layer and the VTx layer for parallel feature extraction, and the hybrid model was trained by a multi-strategy improved WOA algorithm, including random jump search, dual-strategy prey encirclement and dynamic spiral update stages, to optimize the model parameters.

Benefits of technology

The prediction accuracy of photovoltaic power fluctuation range and peak position is improved, which enhances the economic benefits of photovoltaic power generation and the balance and safety of the power system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120671883A_ABST
    Figure CN120671883A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of photovoltaic power generation prediction, and particularly relates to a photovoltaic power prediction method, system and equipment based on a hybrid model, the method constructs an RNN-Transform-BiLSTM hybrid model, the hybrid model comprises an RNN layer, an ADTC layer, a VTx layer and a BiLSTM layer, a photovoltaic short-term sequence pattern is captured through the RNN layer, then a long-distance dependency relationship is efficiently learned through the VTx layer, and a photovoltaic power prediction result is obtained. An ADTC layer and a VTx layer are introduced to carry out parallel feature extraction, weighted fusion is carried out on features extracted by the ADTC layer and the VTx layer, so that a local and global dependency relationship is effectively captured and balanced, finally, fusion features obtained by weighted fusion are transmitted to a BiLSTM layer, and photovoltaic power generation power prediction is realized by using the BiLSTM layer. The hybrid model constructed by the invention can process short-term and long-term time sequence dependence, accurately simulate the variation trend of the photovoltaic power, and improve the fluctuation range of the photovoltaic power and the prediction precision of the peak position.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of photovoltaic power generation prediction, and in particular relates to a photovoltaic power prediction method, system and equipment based on a hybrid model. Background Art

[0002] With the rapid development of renewable energy, particularly solar energy, photovoltaic power generation has become a crucial component of the global energy transition. However, due to its impact on meteorological conditions, seasonal variations, and time-of-day fluctuations, photovoltaic power output is subject to significant uncertainty and volatility. Therefore, accurate photovoltaic power prediction has become a key technology for improving photovoltaic power generation efficiency, optimizing energy management, and promoting the development of smart grids.

[0003] In recent years, deep learning-based forecasting methods have gradually emerged, becoming a cutting-edge and hot research topic in photovoltaic power forecasting. The paper "Ultra-Short-Term Solar Irradiance Forecasting Based on CNN-Bi-LSTM" proposes a CNN-Bi-LSTM-based ultra-short-term solar irradiance forecasting method. This method constructs a one-dimensional convolutional neural network, performs data fusion and feature transformation on multiple key meteorological variables, and then constructs a bidirectional long-short-term memory network prediction model to achieve ultra-short-term forecasts of total solar irradiance for the next 15 minutes. The paper "Short-Term Photovoltaic Power Forecasting Based on LSTM Model" proposes a short-term photovoltaic power forecasting method based on an LSTM model. This method, validated on three different data inputs, ultimately demonstrates that using both photovoltaic power and meteorological forecasts minimizes the relative error in short-term power forecasts. However, the single network used in these existing papers has limited accuracy when predicting complex scenarios. Combining different machine learning models is one way to improve forecast accuracy. The invention patent with application number 202411347293.0 provides a wind power prediction method that integrates a multi-head attention mechanism. This method introduces a multi-head attention mechanism based on CNN-BiLSTM, and introduces a nonlinear convergence factor and a full-process Cauchy variation for optimization to obtain IGWO, thereby improving the prediction accuracy of wind power. Although the prediction accuracy of this method is significantly higher than that of traditional methods, it cannot capture short-term time series dependencies. At the same time, there are still certain errors in capturing long-term trends (such as the peak of photovoltaic power changes), resulting in certain deviations in the prediction of the fluctuation range and peak position of photovoltaic power. Summary of the Invention

[0004] The purpose of the present invention is to address the above-mentioned problems existing in the prior art and to provide a photovoltaic power prediction method, system and equipment based on a hybrid model that can handle short-term and long-term timing dependencies, accurately simulate photovoltaic power change trends, and improve the prediction accuracy of photovoltaic power fluctuation range and peak position.

[0005] To achieve the above objectives, the technical solutions of the present invention are as follows:

[0006] In a first aspect, the present invention provides a photovoltaic power prediction method based on a hybrid model, the photovoltaic power prediction method comprising:

[0007] S1. Construct an RNN-Transformer-BiLSTM hybrid model; the RNN-Transformer-BiLSTM hybrid model includes an RNN layer, an ADTC layer, a VTx layer, and a BiLSTM layer. First, the time series features extracted by the RNN layer are input to the ADTC layer and the VTx layer for parallel feature extraction. Then, the outputs of the ADTC layer and the VTx layer are weighted fused. The fused features obtained by the weighted fusion are then passed to the BiLSTM layer, and the BiLSTM layer outputs the prediction results.

[0008] S2. Training the RNN-Transformer-BiLSTM hybrid model using a photovoltaic power generation dataset, wherein the photovoltaic power generation dataset includes photovoltaic power generation and meteorological data, where the photovoltaic power generation is the model output and the meteorological data is the model input;

[0009] S3. Photovoltaic power generation prediction based on the trained RNN-Transformer-BiLSTM hybrid model.

[0010] The ADTC layer includes a dilated convolution structure with four branches, wherein the four branches are a small core branch, a medium core branch, a large core branch, and an adaptive core branch. First, each branch is used to perform local feature extraction on the temporal features extracted by the RNN layer, and the temporal features extracted by each branch are truncated according to the shortest temporal length and then spliced ​​along the channel dimension. The shortest temporal length refers to the minimum value of the temporal feature lengths extracted by the four branches. Then, the spliced ​​multi-scale features are activated by a two-way nonlinear function, and the two-way nonlinear function includes a Tanh function and a Sigmoid function. Finally, the output of the Tanh function is multiplied element-by-element by the output of the Sigmoid function, and the obtained product is the output of the ADTC layer.

[0011] The convolution kernel sizes of the small core branch, medium core branch, and large core branch are 2, 4, and 8 respectively. The calculation formulas for the dilation factors of the small core branch, medium core branch, and large core branch are all:

[0012]

[0013] In the above formula, d is the expansion factor of the corresponding branch; T is the input sequence length of the ADTC layer; k is the convolution kernel size of the corresponding branch;

[0014] The expansion factor of the adaptive kernel branch is 1, and the calculation formula of the convolution kernel size of the adaptive kernel branch is:

[0015] k=3 / 4×T.

[0016] In S2, the multi-strategy improved WOA algorithm is used to train the RNN-Transformer-BiLSTM hybrid model;

[0017] The multi-strategy improved WOA algorithm includes a random jump prey search stage, a dual-strategy prey encirclement stage, and a dynamic spiral update stage;

[0018] The random jump search prey stage uses the first dynamic probability factor m to select the long-distance jump update mode or the short-distance jump update mode for position update. If the random number rand is less than m, the long-distance jump update mode is selected for position update. If the random number rand is greater than or equal to m, the short-distance jump update mode is selected for position update. The position update formula of the random jump search prey stage is:

[0019]

[0020] m=(1-(t / T) 2 ) 1 / 2 -0.2;

[0021] u1=(c1-s1)·R1+s1;

[0022] l1=(c1-s1)·R2+s1;

[0023] D1=|C·X rand (t)-X(t)|;

[0024] In the above formula, X(t+1) is the current position of the individual whale at the t+1th iteration; X rand (t) is the random whale individual of the t-th iteration; X*(t) is the optimal whale individual position of the t-th iteration; t is the current iteration number; T is the maximum iteration number; β is a constant; A is the convergence factor; D1 is the difference between individual X(t) and individual X rand (t), individual X(t) is the current whale individual in the t-th iteration; C is the perturbation coefficient; m is the first dynamic probability factor; rand is a random number; u1 and l1 both represent the dynamic boundaries generated in the search space; c1 and s1 respectively represent the maximum and minimum values ​​of all whale individuals in different dimensions in the current iteration; ∈ is a very small constant used to avoid the denominator being zero; R1, R2, R3, and R4 are all random numbers in the interval [0, 1]; v~N(0,1), indicating that v obeys the standard normal distribution; u~N(0,σ 2), indicating that u has a mean of 0 and a variance of σ 2 Normal distribution; the calculation formula of σ is:

[0025]

[0026] In the above formula, Γ(·) represents the gamma function;

[0027] The dual-strategy prey encirclement stage uses the second dynamic probability factor q to select the average dimension guidance strategy or the shrinking encirclement strategy for position update. If the random number rand ≤ q, the average dimension guidance strategy is selected for position update. If the random number rand > q, the shrinking encirclement strategy is selected for position update. The position update formula of the dual-strategy prey encirclement stage is:

[0028]

[0029] D=|C·X * (t)-X(t)|;

[0030] In the above formula, q is the second dynamic probability factor; X mean (t) represents the average dimension value of all whale individuals in the whale population at the t-th iteration in each dimension; Xi(t) is the position of the i-th whale individual in the whale population at the t-th iteration; N is the number of all whale individuals in the whale population; D represents the difference between individual X(t) and individual X * (t) the difference between;

[0031] The dynamic spiral update stage uses the random triangular guidance vector obtained from the top three individuals in the whale population to replace the optimal whale individual for position update; the position update in the dynamic spiral update stage is:

[0032] X(t+1)=b1·|C·X n (t)-X(t)|·exp(l)·cos(2πl)+X n (t);

[0033] X n (t) = n·(r3·(X2(t)-X * (t))+r4·(X3(t)-X * (t)))+X * (t);

[0034]

[0035] n=-(1-((t / T)-1) 2 ) 1 / 2 +1;

[0036] In the above formula, b1 is the spiral step length control parameter; X n (t) is a random triangular guide vector; l is a random number in the interval [-1, 1]; r3 and r4 are both random numbers in the interval [0, 1]; X2(t) and X3(t) are the individuals with the second and third highest fitness values ​​in the whale population, respectively; n is a weight factor;

[0037] The training process of the multi-strategy improved WOA algorithm is as follows:

[0038] Step 1: Iteration starts:

[0039] Update global parameters including m, q, b1, c1, and s1;

[0040] Step 2: Traverse the population individuals:

[0041] Calculate the current individual control parameters including A, C, l, probability factor p, etc.;

[0042] Update individual position: first determine whether the probability factor P<0.5 is satisfied. If not, execute the dynamic spiral update phase. If so, determine whether |A|≥1 is satisfied. If not, execute the dual strategy prey encirclement phase. If so, execute the random jump prey search phase.

[0043] Step 3: Calculate individual fitness values ​​and update the global optimal solution;

[0044] Step 4: Determine whether the maximum number of iterations has been reached. If so, output the global optimal solution. Otherwise, return to step 1 to continue iterative calculation.

[0045] In the training process of the multi-strategy improved WOA algorithm, it is determined whether the execution conditions of the escape mechanism are met. If so, the escape mechanism is executed. If not, it is determined whether the execution conditions of any stage of the random jump search for prey stage, the dual strategy encirclement of prey stage, and the dynamic spiral update stage are met. If none of them are met, the escape mechanism is triggered.

[0046] The escape mechanism execution conditions are: And (L-count≥0), where L is the stagnation threshold; count represents the number of consecutive unimproved iterations;

[0047] The position update formula of the escape mechanism is:

[0048] X(t+1)=X(t)+t(iter)·|X * (t)-X(t)|·cos(2·π·rand);

[0049] In the above formula, t(iter) represents the t distribution whose degrees of freedom change with the current number of iterations.

[0050] In a second aspect, the present invention provides a photovoltaic power prediction system based on a hybrid model, the photovoltaic power prediction system comprising:

[0051] A hybrid model construction module is used to construct an RNN-Transformer-BiLSTM hybrid model; the RNN-Transformer-BiLSTM hybrid model includes an RNN layer, an ADTC layer, a VTx layer, and a BiLSTM layer. The RNN layer is used to extract time series features from the model input, and the extracted time series features are respectively input to the ADTC layer and the VTx layer for parallel feature extraction. The outputs of the ADTC layer and the VTx layer are weighted fused, and the fused features obtained by the weighted fusion are passed to the BiLSTM layer, which outputs the prediction results.

[0052] A model training module is used to train the RNN-Transformer-BiLSTM hybrid model using a photovoltaic power generation dataset, wherein the photovoltaic power generation dataset includes photovoltaic power generation and meteorological data, where the photovoltaic power generation is the model output and the meteorological data is the model input;

[0053] The photovoltaic power prediction module is used to predict photovoltaic power generation based on the trained RNN-Transformer-BiLSTM hybrid model.

[0054] The ADTC layer includes a dilated convolution structure with four branches, wherein the four branches are a small core branch, a medium core branch, a large core branch, and an adaptive core branch. First, each branch is used to perform local feature extraction on the temporal features extracted by the RNN layer, and the temporal features extracted by each branch are truncated according to the shortest temporal length and then spliced ​​along the channel dimension. The shortest temporal length refers to the minimum value of the temporal feature lengths extracted by the four branches. Then, the spliced ​​multi-scale features are activated by a two-way nonlinear function, and the two-way nonlinear function includes a Tanh function and a Sigmoid function. Finally, the output of the Tanh function is multiplied element-by-element by the output of the Sigmoid function, and the obtained product is the output of the ADTC layer.

[0055] The convolution kernel sizes of the small core branch, medium core branch, and large core branch are 2, 4, and 8 respectively. The calculation formulas for the dilation factors of the small core branch, medium core branch, and large core branch are all:

[0056]

[0057] In the above formula, d is the expansion factor of the corresponding branch; T is the input sequence length of the ADTC layer; k is the convolution kernel size of the corresponding branch;

[0058] The expansion factor of the adaptive kernel branch is 1, and the calculation formula of the convolution kernel size of the adaptive kernel branch is: k=3 / 4×T.

[0059] The model training module uses a multi-strategy improved WOA algorithm to train the RNN-Transformer-BiLSTM hybrid model; the multi-strategy improved WOA algorithm includes a random jump prey search stage, a dual-strategy prey encirclement stage, and a dynamic spiral update stage;

[0060] The random jump search prey stage uses the first dynamic probability factor m to select the long-distance jump update mode or the short-distance jump update mode for position update. If the random number rand is less than m, the long-distance jump update mode is selected for position update. If the random number rand is greater than or equal to m, the short-distance jump update mode is selected for position update. The position update formula of the random jump search prey stage is:

[0061]

[0062] m=(1-(t / T) 2 ) 1 / 2 -0.2;

[0063] u1=(c1-s1)·R1+s1;

[0064] l1=(c1-s1)·R2+s1;

[0065] D1=|C·X rand (t)-X(t)|;

[0066] In the above formula, X(t+1) is the current position of the individual whale at the t+1th iteration; X rand (t) is the random whale individual of the t-th iteration; X * (t) is the optimal whale individual position of the tth iteration; t is the current iteration number; T is the maximum iteration number; β is a constant; A is the convergence factor; D1 is the difference between individual X(t) and individual X rand (t), individual X(t) is the current whale individual in the t-th iteration; C is the perturbation coefficient; m is the first dynamic probability factor; rand is a random number; u1 and l1 both represent the dynamic boundaries generated in the search space; c1 and s1 respectively represent the maximum and minimum values ​​of all whale individuals in different dimensions in the current iteration; ∈ is a very small constant used to avoid the denominator being zero; R1, R2, R3, and R4 are all random numbers in the interval [0, 1]; v~N(0,1), indicating that v obeys the standard normal distribution; u~N(0,σ 2 ), indicating that u has a mean of 0 and a variance of σ 2 Normal distribution; the calculation formula of σ is:

[0067]

[0068] In the above formula, Γ(·) represents the gamma function;

[0069] The dual-strategy prey encirclement stage uses the second dynamic probability factor q to select the average dimension guidance strategy or the shrinking encirclement strategy for position update. If the random number rand ≤ q, the average dimension guidance strategy is selected for position update. If the random number rand > q, the shrinking encirclement strategy is selected for position update. The position update formula of the dual-strategy prey encirclement stage is:

[0070]

[0071] D=|C·X * (t)-X(t)|;

[0072] In the above formula, q is the second dynamic probability factor; X mean (t) represents the average dimension value of all whale individuals in the whale population in each dimension at the tth iteration; X i (t) is the position of the i-th whale individual in the whale population at the t-th iteration; N is the number of all whale individuals in the whale population; D represents the relationship between individual X(t) and individual X * (t) the difference between;

[0073] The dynamic spiral update stage uses the random triangular guidance vector obtained from the top three individuals in the whale population to replace the optimal whale individual for position update; the position update in the dynamic spiral update stage is:

[0074] X(t+1)=b1·|C·X n (t)-X(t)|·exp(l)·cos(2πl)+X n (t);

[0075] X n (t) = n·(r3·(X2(t)-X * (t))+r4·(X3(t)-X * (t)))+X * (t);

[0076]

[0077] n=-(1-((t / T)-1) 2 ) 1 / 2 +1;

[0078] In the above formula, b1 is the spiral step length control parameter; X n(t) is a random triangular guide vector; l is a random number in the interval [-1, 1]; r3 and r4 are both random numbers in the interval [0, 1]; X2(t) and X3(t) are the individuals with the second and third highest fitness values ​​in the whale population, respectively; n is a weight factor;

[0079] The training process of the multi-strategy improved WOA algorithm is as follows:

[0080] Step 1: Iteration starts:

[0081] Update global parameters including m, q, b1, c1, and s1;

[0082] Step 2: Traverse the population individuals:

[0083] Calculate the current individual control parameters including A, C, l, probability factor p, etc.;

[0084] Update individual position: first determine whether the probability factor P < 0.5 is satisfied. If not, execute the dynamic spiral update phase. If so, determine whether |A| ≥ 1 is satisfied. If not, execute the dual strategy prey encirclement phase. If so, execute the random jump prey search phase.

[0085] Step 3: Calculate individual fitness values ​​and update the global optimal solution;

[0086] Step 4: Determine whether the maximum number of iterations has been reached. If so, output the global optimal solution. Otherwise, return to step 1 to continue iterative calculation.

[0087] In the training process of the multi-strategy improved WOA algorithm, it is determined whether the execution conditions of the escape mechanism are met. If so, the escape mechanism is executed. If not, it is determined whether the execution conditions of any stage of the random jump search for prey stage, the dual strategy encirclement of prey stage, and the dynamic spiral update stage are met. If none of them are met, the escape mechanism is triggered.

[0088] The escape mechanism execution conditions are: And (L-count≥0), where L is the stagnation threshold; count represents the number of consecutive unimproved iterations;

[0089] The position update formula of the escape mechanism is:

[0090] X(t+1)=X(t)+t(iter)·|X * (t)-X(t)|·cos(2·π·rand);

[0091] In the above formula, t(iter) represents the t distribution whose degrees of freedom change with the current number of iterations.

[0092] In a third aspect, the present invention provides a photovoltaic power prediction device based on a hybrid model, the photovoltaic power prediction device comprising a memory and a processor; the memory is used to store computer program code and transmit the computer program code to the processor; the processor is used to execute the aforementioned photovoltaic power prediction method according to the instructions in the computer program code.

[0093] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the aforementioned photovoltaic power prediction method is implemented.

[0094] Compared with the prior art, the present invention has the following beneficial effects:

[0095] 1. In the photovoltaic power prediction method based on the hybrid model described in the present invention, an RNN-Transformer-BiLSTM hybrid model is constructed. The RNN-Transformer-BiLSTM hybrid model includes an RNN layer, an ADTC layer, a VTx layer, and a BiLSTM layer. The RNN layer is used to capture short-term photovoltaic sequence patterns, and the VTx layer can efficiently learn long-distance dependencies and highlight key features in the data through a multi-head self-attention mechanism. In addition, the ADTC layer and the VTx layer are introduced for parallel feature extraction. The features extracted by the ADTC layer and the VTx layer are weighted and fused to effectively capture and balance local and global dependencies. The fused features obtained by the weighted fusion are passed to the BiLSTM layer. The BiLSTM layer is used to further refine the prediction by maintaining memory over time, enabling the hybrid model to handle multi-scale dependencies. The hybrid model constructed by this method can handle short-term and long-term temporal dependencies, accurately simulate photovoltaic power variation trends, and improve the prediction accuracy of the fluctuation range and peak position of photovoltaic power, which helps to improve the economic benefits of photovoltaic power generation and ensure the balance and operational safety of the power system.

[0096] 2. In the photovoltaic power prediction method based on the hybrid model described in the present invention, the RNN-Transformer-BiLSTM hybrid model is trained using a multi-strategy improved WOA algorithm. The multi-strategy improved WOA algorithm includes a random jump search prey stage, a dual-strategy prey encirclement stage, and a dynamic spiral update stage. In the random jump search prey stage, the first dynamic probability factor m is used to select a long-distance jump update mode or a short-distance jump update mode for position update. In the dual-strategy prey encirclement stage, the second dynamic probability factor q is used to select an average dimension guidance strategy or a shrinking encirclement strategy for position update. In the dynamic spiral update stage, a random triangular guidance vector obtained from the top three individuals in the whale population in terms of fitness value is used to replace the optimal whale individual for position update. The multi-strategy improved WOA algorithm is used to optimize the hyperparameters of the hybrid model to maximize the model prediction accuracy.

[0097] 3. In the photovoltaic power prediction method based on the hybrid model described in the present invention, the multi-strategy improved WOA algorithm also includes an escape mechanism to enhance the randomness and exploration ability of the algorithm in the later stage and avoid falling into the local optimum. BRIEF DESCRIPTION OF THE DRAWINGS

[0098] Figure 1 The present invention is a flowchart of the method.

[0099] Figure 2 This is a training flowchart of the multi-strategy improved WOA algorithm described in the present invention.

[0100] Figure 3 The prediction results of the method described in the present invention under clear weather conditions are compared with those of the RNN-Transformer-BiLSTM hybrid model, the BiLSTM model, and the RNN-BiLSTM model trained with the WOA algorithm without multi-strategy improvement.

[0101] Figure 4 The prediction results of the method described in the present invention under cloudy weather conditions are compared with those of the RNN-Transformer-BiLSTM hybrid model, the BiLSTM model, and the RNN-BiLSTM model trained with the WOA algorithm without multi-strategy improvement.

[0102] Figure 5 This is a structural block diagram of the system of the present invention.

[0103] Figure 6 This is a structural block diagram of the device described in the present invention. DETAILED DESCRIPTION

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

[0105] Example 1:

[0106] See also Figure 1 ,A photovoltaic power prediction method based on a hybrid model,is carried out in the following steps:

[0107] S1. Construct an RNN-Transformer-BiLSTM hybrid model; the RNN-Transformer-BiLSTM hybrid model includes an RNN layer, an ADTC layer, a VTx layer, and a BiLSTM layer. First, the time series features extracted by the RNN layer are input to the ADTC layer and the VTx layer for parallel feature extraction. Then, the outputs of the ADTC layer and the VTx layer are weighted fused. The fused features obtained by the weighted fusion are then passed to the BiLSTM layer, and the BiLSTM layer outputs the prediction results.

[0108] The RNN (Recurrent Neural Network) layer is a recurrent connection structure that allows for the retention of memory of previous inputs. This recurrent architecture allows for the capture of dependencies and intrinsic connections in a sequence, making RNN very suitable for time series prediction tasks. In the RNN component, the hidden unit is represented by H t , used to specify the input order, RNN receives Y at each time step t And through a weight W hh The H from the previous time step t-1 The information is integrated into the current state through the following formula:

[0109] H t =tanh(W hh H t-1 +W hY Y t );

[0110] Z t =W hz H t ;

[0111] In the above formula, Y t Represents the input at time t, which is the feature vector of the t-time moment in the multidimensional time series data after cleaning and normalization; W hY Represents the weight of the current input state; tanh represents the activation function; Z t Indicates output status; W hz Represents the weight of the output state;

[0112] The VTx layer (Vanilla Transformer), as the second module in the hybrid model, is mainly used to further process the features extracted by the recurrent neural network (RNN). The VTx model uses the core element of the Transformer architecture, the self-attention mechanism, which can effectively capture long-term dependencies in sequence data. In order to enhance the ability to express key features, a multi-head attention mechanism is introduced. The calculation steps of the multi-head attention mechanism are as follows:

[0113] First, the data input to the VTx layer is split into multiple independent self-attention heads through linear transformation. Each self-attention head performs self-attention calculation independently and generates corresponding attention output. The self-attention calculation formula of each head is as follows:

[0114]

[0115] In the above formula, Head i is the attention output of the i-th self-attention head; Q i is the query matrix; is the bond matrix; V i is the value matrix; d k is the dimension of the input vector; softmaxsoftmax normalizes the attention scores to ensure that the sum of all weights is 1;

[0116] The attention outputs of all self-attention heads are transformed linearly to generate intermediate representations:

[0117] MultiHead(Q,K,V)=Concat(head1,...,head h )W O ;

[0118] In the above formula, h is the number of heads; MultiHead(Q,K,V) is the generated intermediate representation; W O is a linear transformation matrix used to concatenate the outputs of multiple heads into an intermediate representation;

[0119] The generated intermediate representation is then recorded as x and input into the feedforward neural network FFN for nonlinear transformation to obtain the final multi-head attention result:

[0120] FFN(x)=max(0,xW1+b1)W2+b2;

[0121] In the above formula, W1 and W2 are the first and second weight matrices respectively; b1 and b2 are the first and second bias terms respectively; max(0,·) is the ReLU activation function;

[0122] The ADTC layer includes a dilated convolution structure with four branches, wherein the four branches are a small core branch, a medium core branch, a large core branch, and an adaptive core branch. First, each branch is used to perform local feature extraction on the temporal features extracted by the RNN layer, and the temporal features extracted by each branch are truncated according to the shortest temporal length and then spliced ​​along the channel dimension, thereby achieving effective fusion and performance improvement of multi-branch features. The shortest temporal length refers to the minimum value of the temporal feature lengths extracted by the four branches. The spliced ​​multi-scale features are then activated by a two-way nonlinear function, which includes a Tanh function and a Sigmoid function activation. Finally, the output of the Tanh function is element-wise multiplied by the output of the Sigmoid function, and the obtained product is the output of the ADTC layer.

[0123] Dynamically adjustable convolution kernel sizes and dilation factors are introduced into different branches to form a nonlinear multi-scale receptive field, significantly enhancing the model's ability to extract local features. This further enables the module to flexibly adapt to feature modeling requirements of different time ranges according to the length of the input sequence. Specifically, the convolution kernel sizes of the small, medium, and large kernel branches are 2, 4, and 8, respectively. The small kernel branch is used to capture detailed features between local time steps and improve short-term dependency representation, while the large kernel branch is used to effectively capture long-term dependencies and model global trends. The calculation formulas for the dilation factors of the small, medium, and large kernel branches are:

[0124]

[0125] In the above formula, d is the expansion factor of the corresponding branch; T is the input sequence length of the ADTC layer; k is the convolution kernel size of the corresponding branch;

[0126] The expansion factor of the adaptive kernel branch is 1, and the calculation formula of the convolution kernel size of the adaptive kernel branch is: k=3 / 4×T,

[0127] To further enhance feature selection and representation capabilities, the concatenated multi-scale features are activated using a dual-path nonlinear function. One path uses the Tanh function (hyperbolic tangent activation function) as a feature filter to extract key information, while the other uses the Sigmoid function as a gating mechanism to dynamically control the amount of information passing through the filter. This mechanism combines the advantages of both the Tanh and Sigmoid functions, demonstrating strong flexibility and robustness in modeling complex temporal dependencies.

[0128] The ADTC layer of the present invention integrates a multi-branch structure, an adaptive expansion strategy, and a nonlinear activation mechanism, which can not only extract local features with high precision but also flexibly model global dependencies, significantly improving the feature representation capability of the module.

[0129] The outputs of the ADTC layer and the VTx layer are weighted fused according to the following formula:

[0130] Z=α ADTC ·Y ADTC +α VTx ·Y VTx ;

[0131] In the above formula, Z is the fusion feature obtained after weighted fusion; α ADTC , α VTx The output weights of ADTC layer and VTx layer respectively; Y ADTC 、Y VTx They are the outputs of ADTC layer and VTx layer respectively;

[0132] The BiLSTM layer implements bidirectional processing through the parallel operation of two LSTM networks: one LSTM network processes the sequence from the initial position to the final position, and the other LSTM network processes the sequence from the final position to the initial position. The outputs of the two LSTM networks are integrated to obtain a hidden state that contains both past and future information. The fused features obtained by weighted fusion of the outputs of the ADTC layer and the VTx layer are input into the BiLSTM layer, which then predicts photovoltaic power generation.

[0133] S2. Train the RNN-Transformer-BiLSTM hybrid model using a photovoltaic power generation dataset, where the photovoltaic power generation dataset includes photovoltaic power generation, meteorological data, and timestamps. The photovoltaic power generation is the model output, and the meteorological data is the model input. The meteorological data includes temperature, humidity, light intensity, and other data.

[0134] Specifically, a multi-strategy improved WOA algorithm (whale optimization algorithm) is used to train the RNN-Transformer-BiLSTM hybrid model to determine the optimal hyperparameter combination; the multi-strategy improved WOA algorithm includes a random jump prey search stage, a dual-strategy prey encirclement stage, a dynamic spiral update stage, and an escape mechanism, specifically:

[0135] (1) The traditional WOA algorithm uses spiral predation to assist random search to achieve global exploration. However, the fixed spiral search trajectory and the random individual update mechanism only in the first half of the prey search phase lead to insufficient and inefficient exploration of the population search space. To avoid the above problems, an indirect jump perturbation is introduced on the basis of the random search strategy. The first dynamic probability factor m is used to select the long-distance jump update mode or the short-distance jump update mode for position update, so as to realize the random jump of the whale group between long and short distances, enhance the random interaction between the whale groups, and significantly improve the global exploration performance of the algorithm.

[0136] In the random jump search prey stage, the first dynamic probability factor m is used to select the long-distance jump update mode or the short-distance jump update mode for position update, specifically: if the random number rand is less than m, the long-distance jump update mode is selected for position update; if the random number rand is greater than or equal to m, the short-distance jump update mode is selected for position update; the first dynamic probability factor m decreases nonlinearly with the increase of the number of iterations t, and by nonlinearly adjusting m, the global exploration (long-distance jump) and local development (short-distance jump) are dynamically balanced in different iteration stages; in the initial stage of the iteration (t is small), the m value is large, and it is more likely that the random number rand is less than m, and long-distance jump is selected. The search range is expanded by adaptive boundaries c1 and s1. By expanding the exploration range of the search space, the population is promoted to jump to farther positions, thereby enhancing the global exploration ability; in the later stage of the iteration (t is large), the m value is small, and it is more likely to select short-distance jump. By narrowing the search range, the local search is refined and the accuracy is improved;

[0137] The position update formula in the random jump search prey stage is:

[0138]

[0139] m=(1-(t / T) 2 ) 1 / 2 -0.2;

[0140] u1=(c1-s1)·R1+s1;

[0141] l1=(c1-s1)·R2+s1;

[0142] D1=|C·X rand (t)-X(t)|;

[0143] In the above formula, X(t+1) is the current position of the individual whale at the t+1th iteration; X rand (t) is the random whale individual of the t-th iteration; X * (t) is the optimal whale individual position of the tth iteration; t is the current iteration number; T is the maximum iteration number; β is a constant with a value of 1.5; A is the convergence factor; D1 is the difference between individual X(t) and individual X rand (t), individual X(t) is the current whale individual in the t-th iteration; C is the perturbation coefficient; m is the first dynamic probability factor; rand is a random number; u1 and l1 both represent the dynamic boundaries generated in the search space; c1 and s1 respectively represent the maximum and minimum values ​​of all whale individuals in different dimensions in the current iteration; ∈ is a very small constant used to avoid the denominator being zero; R1, R2, R3, and R4 are all random numbers in the interval [0, 1]; v~N(0,1), indicating that v obeys the standard normal distribution; u~N(0,σ 2), indicating that u has a mean of 0 and a variance of σ 2 Normal distribution; the calculation formula of σ is:

[0144]

[0145] In the above formula, Γ(·) represents the gamma function;

[0146] (2) In the traditional WOA algorithm, the encirclement mechanism and spiral predation mechanism run through the entire iterative process to achieve local search. However, both mechanisms update the position around the current optimal individual, resulting in a loss of population diversity and insufficient search accuracy in the later stages of the algorithm. To avoid the above problems, the present invention uses the average dimension value of the current individual, prompting some whales to no longer rely solely on the optimal individual, but to move towards the average dimension value;

[0147] The dual-strategy prey encirclement stage uses the second dynamic probability factor q to select the average dimension-oriented strategy or the shrinking encirclement strategy for position update. If the random number rand ≤ q, the average dimension-oriented strategy is selected for position update. Moving in the direction of the average dimension value can reduce excessive dependence on the current optimal individual, avoid premature aggregation of the population, and help explore potential areas not covered by the optimal individual, especially in high-dimensional complex problems. If the random number rand> q, the shrinking encirclement strategy is selected for position update, and a refined search is performed around the current optimal individual. The position update formula of the dual-strategy prey encirclement stage is:

[0148]

[0149] D=|C·X * (t)-X(t)|;

[0150] In the above formula, q is the second dynamic probability factor; X mean (t) represents the average dimension value of all whale individuals in the whale population in each dimension at the tth iteration; X i (t) is the position of the i-th whale individual in the whale population at the t-th iteration; N is the number of all whale individuals in the whale population; D represents the relationship between individual X(t) and individual X * (t) the difference between;

[0151] (3) The spiral predation mechanism in the traditional WOA algorithm can gather in the area near the current optimal individual, but it is easy to fall into premature convergence, thereby reducing the search accuracy; the present invention uses the random triangular guidance vector obtained from the top three individuals in the whale population to replace the optimal whale individual for position update; the setting of the weight factor n makes the change amplitude of the guidance center decrease with the number of iterations, thereby enhancing the algorithm's later development capabilities and avoiding premature convergence. In addition, an adaptive variable spiral mechanism is introduced to improve the original spiral mode with a single change trend: a larger spiral step size is used in the early iteration to expand the search space, and then the step size is gradually reduced to accelerate the group aggregation convergence;

[0152] The dynamic spiral update stage uses the random triangular guidance vector obtained from the top three individuals in the whale population to replace the optimal whale individual for position update; the position update in the dynamic spiral update stage is:

[0153] X(t+1)=b1·|C·X n (t)-X(t)|·exp(l)·cos(2πl)+X n (t);

[0154] X n (t) = n·(r3·(X2(t)-X * (t))+r4·(X3(t)-X * (t)))+X * (t);

[0155]

[0156] n=-(1-((t / T)-1) 2 ) 1 / 2 +1;

[0157] In the above formula, b1 is the spiral step length control parameter; X n (t) is a random triangular guide vector; l is a random number in the interval [-1, 1]; r3 and r4 are both random numbers in the interval [0, 1]; X2(t) and X3(t) are the individuals with the second and third highest fitness values ​​in the whale population, respectively; n is a weight factor;

[0158] (4) The position update formula of the escape mechanism is:

[0159] X(t+1)=X(t)+t(iter)·|X * (t)-X(t)|·cos(2·π·rand);

[0160] In the above formula, t(iter) represents the t distribution whose degrees of freedom change with the current number of iterations;

[0161] The escape mechanism determines the perturbation step size and direction through t-distribution and random angles on the circumference, enhancing the randomness and exploration ability of the algorithm in the later stage. The t-distribution combines the advantages of the strong exploration ability of Cauchy mutation and the strong development ability of Gaussian mutation. In the early stages of iteration, the population is relatively dispersed and the probability of executing the escape mechanism is small, thus avoiding excessive exploration of areas outside the search space. As the number of iterations and degrees of freedom increase, the probability of individuals choosing the escape mechanism increases.

[0162] The training process of the multi-strategy improved WOA algorithm is as follows:

[0163] Step 1: Iteration starts:

[0164] Update global parameters including m, q, b1, c1, and s1;

[0165] Step 2: Traverse the population individuals:

[0166] Calculate the current individual control parameters including A, C, l, probability factor p, etc.;

[0167] Update individual locations:

[0168] First, determine whether the escape mechanism execution conditions are met. If so, execute the escape mechanism. If not, determine whether the execution conditions of any of the random jump prey search phase, the dual strategy prey encirclement phase, and the dynamic spiral update phase are met. If none of them are met, trigger the escape mechanism.

[0169] The escape mechanism execution conditions are: And (L-count≥0), where L is the stagnation threshold; count represents the number of consecutive unimproved iterations obtained by the stagnation counter; the number of consecutive unimproved iterations means that the global optimal solution in a certain iteration is not better than the previous iteration. For example, if the fitness value of the global optimal solution in the tth iteration is f t * , and the global optimal solution fitness value of the t+1th iteration is Not better than f t * , it is considered as no improvement, that is, count = count + 1; if an improvement occurs in a global optimal solution before L-count ≥ 0, the stagnation counter is reset, that is, count = 0;

[0170] The specific conditions for determining whether the execution of any of the random jump search for prey, dual strategy encirclement of prey, and dynamic spiral update stages are met are as follows: first determine whether the probability factor P < 0.5 is met. If not, execute the dynamic spiral update stage. If so, determine whether |A| ≥ 1 is met. If not, execute the dual strategy encirclement of prey stage. If so, execute the random jump search for prey stage.

[0171] Step 3: Calculate the individual fitness value and update the global optimal solution and stagnation counter; the fitness function is set to:

[0172]

[0173] In the above formula, f is the fitness value of the individual whale; n S is the total number of samples; is the predicted value of the i-th sample; y i is the actual value of the i-th sample;

[0174] Step 4: Determine whether the maximum number of iterations has been reached. If so, output the global optimal solution. Otherwise, return to step 1 to continue iterative calculation.

[0175] S3. Photovoltaic power generation prediction based on the trained RNN-Transformer-BiLSTM hybrid model.

[0176] Performance Verification:

[0177] (1) The prediction results of the RNN-Transformer-BiLSTM hybrid model trained by the multi-strategy improved WOA algorithm (i.e., the method proposed in this invention) are compared with those of the RNN-Transformer-BiLSTM hybrid model, BiLSTM model, and RNN-BiLSTM model trained by the WOA algorithm without multi-strategy improvement in sunny weather. The comparison results are as follows: Figure 3 As shown. On sunny days, the photovoltaic power generation shows a typical relationship between sunshine intensity and time. The power rises rapidly during the daytime and reaches a peak before gradually decreasing. At this time, the actual photovoltaic power changes more obviously and smoothly, with a strong time sequence. Figure 3 It can be seen that the BiLSTM model can better capture the trend of photovoltaic power changes over time under sunny conditions, but when approaching the power peak, the predicted value of BiLSTM still has a certain deviation, and the predicted power is slightly lower than the actual value, especially near the peak, the error is large. The RNN-BiLSTM model performs better than the single BiLSTM model on sunny days. It can better capture short-term temporal dependencies, but there are still certain errors in capturing long-term trends (such as the peak of photovoltaic power changes). The predicted power curve fluctuates more significantly and is closer to the fluctuation trend of actual power, but the peak prediction is relatively rough. The method proposed in the present invention can more accurately capture the changes in photovoltaic power under sunny conditions. This is because the model combines the advantages of RNN and Transformer, can handle short-term and long-term temporal dependencies, and is particularly outstanding in predicting the fluctuation range and peak position of photovoltaic power. The predicted value is very close to the actual value, which better simulates the changing trend of photovoltaic power.

[0178] (2) The prediction results of the RNN-Transformer-BiLSTM hybrid model trained with the multi-strategy improved WOA algorithm are compared with those of the RNN-Transformer-BiLSTM hybrid model, BiLSTM model, and RNN-BiLSTM model trained with the WOA algorithm without multi-strategy improvement in cloudy weather. The comparison results are as follows: Figure 4 As shown. In cloudy weather, the photovoltaic power output is low and the fluctuation range is small. As the cloud changes, the photovoltaic power output is relatively stable and the change trend is relatively gentle. The photovoltaic power is less affected by sunlight, but it is still affected by weather changes. Figure 4 As can be seen from the figure, the prediction error of the BiLSTM model increases significantly. Due to the small fluctuations in photovoltaic power output on cloudy days, BiLSTM performs poorly in capturing small changes. In particular, during periods of low power, the model fails to capture small fluctuations in power, resulting in large deviations in the predicted values. Compared with BiLSTM, the RNN-BiLSTM model performs slightly better on cloudy days. It performs better in capturing short-term dependencies, but it still cannot fully capture small fluctuations in photovoltaic power under cloudy conditions. Especially in low light conditions, the gap between the RNN-BiLSTM prediction curve and the actual curve is large. The method proposed in this invention still exhibits relatively good prediction ability under cloudy conditions. This is because the Transformer part enhances the model's ability to learn long-term dependencies, enabling the model to stably capture small fluctuations in power under cloudy conditions. Despite the low photovoltaic power, the hybrid model can still accurately track the actual value, reducing errors in low light conditions and having better stability and accuracy.

[0179] (3) The error indicators of the prediction results of the RNN-Transformer-BiLSTM hybrid model trained with the multi-strategy improved WOA algorithm, the RNN-Transformer-BiLSTM hybrid model trained without the multi-strategy improved WOA algorithm, the BiLSTM model, and the RNN-BiLSTM model under sunny weather conditions are calculated and compared. The comparison results are shown in Table 1. As can be seen from Table 1, the method proposed in the present invention outperforms the BiLSTM, RNN-BiLSTM model, and RNN-Transformer-BiLSTM hybrid model in all error indicators. Compared with the hybrid model trained without the multi-strategy improved WOA algorithm, the MAE of the method proposed in the present invention is reduced by 32.61%, the RMSE is reduced by 28.63%, the MSE is reduced by 31.32%, and the MAPE is reduced by 33.45%. This indicates that the use of the multi-strategy improved WOA algorithm to train the hybrid model can further optimize the prediction performance of the hybrid model. The above results prove that the method proposed in the present invention can improve the accuracy of photovoltaic power prediction.

[0180] Table 1 Comparison of various error indicators of the method proposed in this invention and other models

[0181] Model MAE / kW RMSE / kW MSE / kW BiLSTM 2.8198 3.0103 2.6843 RNN-BiLSTM 2.1361 2.2451 1.9642 RNN-Transformer-BiLSTM 1.2381 1.3422 1.1285 The method proposed by the present invention 0.7132 0.7842 0.6812

[0182] Example 2:

[0183] See also Figure 5, a photovoltaic power prediction system based on a hybrid model, including a hybrid model construction module, a model training module, and a photovoltaic power prediction module; the hybrid model construction module is used to construct an RNN-Transformer-BiLSTM hybrid model; the RNN-Transformer-BiLSTM hybrid model includes an RNN layer, an ADTC layer, a VTx layer, and a BiLSTM layer, the RNN layer is used to extract time series features from the model input, the extracted time series features are respectively input to the ADTC layer and the VTx layer for parallel feature extraction, the outputs of the ADTC layer and the VTx layer are weighted fused, the fusion features obtained by weighted fusion are passed to the BiLSTM layer, and the BiLSTM layer outputs the prediction result; the ADTC layer is a dilated convolution structure with four branches, the four The branches are small core branch, medium core branch, large core branch, and adaptive core branch. First, each branch is used to extract local features of the time series features extracted by the RNN layer. The time series features extracted by each branch are truncated according to the shortest time series length and then spliced ​​along the channel dimension. The shortest time series length refers to the minimum value of the time series feature lengths extracted by the four branches. Then, the spliced ​​multi-scale features are activated by a two-way nonlinear function, which includes a Tanh function and a Sigmoid function activation. Finally, the output of the Tanh function is element-wise multiplied by the output of the Sigmoid function, and the product obtained is the output of the ADTC layer. The convolution kernel sizes of the small core branch, medium core branch, and large core branch are 2, 4, and 8, respectively. The calculation formulas for the dilation factors of the small core branch, medium core branch, and large core branch are:

[0184]

[0185] In the above formula, d is the expansion factor of the corresponding branch; T is the input sequence length of the ADTC layer; k is the convolution kernel size of the corresponding branch;

[0186] The expansion factor of the adaptive kernel branch is 1, and the calculation formula of the convolution kernel size of the adaptive kernel branch is: k=3 / 4×T;

[0187] The model training module is used to train the RNN-Transformer-BiLSTM hybrid model using a photovoltaic power generation dataset; the photovoltaic power generation dataset includes photovoltaic power generation and meteorological data, where the photovoltaic power generation is the model output and the meteorological data is the model input;

[0188] Specifically, the model training module uses a multi-strategy improved WOA algorithm to train the RNN-Transformer-BiLSTM hybrid model; the multi-strategy improved WOA algorithm includes a random jump search prey stage, a dual-strategy prey encirclement stage, a dynamic spiral update stage, and an escape mechanism; the random jump search prey stage uses the first dynamic probability factor m to select a long-distance jump update mode or a short-distance jump update mode for position update. If the random number rand < m, the long-distance jump update mode is selected for position update; if the random number rand ≥ m, the short-distance jump update mode is selected for position update; the position update formula of the random jump search prey stage is:

[0189]

[0190] m=(1-(t / T) 2 ) 1 / 2 -0.2;

[0191] u1=(c1-s1)·R1+s1;

[0192] l1=(c1-s1)·R2+s1;

[0193] D1=|C·X rand (t)-X(t)|;

[0194] In the above formula, X(t+1) is the current position of the individual whale at the t+1th iteration; X rand (t) is the random whale individual of the t-th iteration; X * (t) is the optimal whale individual position of the tth iteration; t is the current iteration number; T is the maximum iteration number; β is a constant; A is the convergence factor; D1 is the difference between individual X(t) and individual X rand (t), individual X(t) is the current whale individual in the t-th iteration; C is the perturbation coefficient; m is the first dynamic probability factor; rand is a random number; u1 and l1 both represent the dynamic boundaries generated in the search space; c1 and s1 respectively represent the maximum and minimum values ​​of all whale individuals in different dimensions in the current iteration; ∈ is a very small constant used to avoid the denominator being zero; R1, R2, R3, and R4 are all random numbers in the interval [0, 1]; v~N(0,1), indicating that v obeys the standard normal distribution; u~N(0,σ 2 ), indicating that u has a mean of 0 and a variance of σ 2 Normal distribution; the calculation formula of σ is:

[0195]

[0196] In the above formula, Γ(·) represents the gamma function;

[0197] The dual-strategy prey encirclement stage uses the second dynamic probability factor q to select the average dimension guidance strategy or the shrinking encirclement strategy for position update. If the random number rand ≤ q, the average dimension guidance strategy is selected for position update. If the random number rand > q, the shrinking encirclement strategy is selected for position update. The position update formula of the dual-strategy prey encirclement stage is:

[0198]

[0199] D=|C·X * (t)-X(t)|;

[0200] In the above formula, q is the second dynamic probability factor; X mean (t) represents the average dimension value of all whale individuals in the whale population in each dimension at the tth iteration; X i (t) is the position of the i-th whale individual in the whale population at the t-th iteration; N is the number of all whale individuals in the whale population; D represents the relationship between individual X(t) and individual X * (t) the difference between;

[0201] The dynamic spiral update stage uses the random triangular guidance vector obtained from the top three individuals in the whale population to replace the optimal whale individual for position update; the position update in the dynamic spiral update stage is:

[0202] X(t+1)=b1·|C·X n (t)-X(t)|·exp(l)·cos(2πl)+X n (t);

[0203] X n (t) = n·(r3·(X2(t)-X * (t))+r4·(X3(t)-X * (t)))+X * (t);

[0204]

[0205] n=-(1-((t / T)-1) 2 ) 1 / 2 +1;

[0206] In the above formula, b1 is the spiral step length control parameter; X n (t) is a random triangular guide vector; l is a random number in the interval [-1, 1]; r3 and r4 are both random numbers in the interval [0, 1]; X2(t) and X3(t) are the individuals with the second and third highest fitness values ​​in the whale population, respectively; n is a weight factor;

[0207] The position update formula of the escape mechanism is:

[0208] X(t+1)=X(t)+t(iter)·|X * (t)-X(t)|·cos(2·π·rand);

[0209] In the above formula, t(iter) represents the t distribution whose degrees of freedom change with the current number of iterations;

[0210] The training process of the multi-strategy improved WOA algorithm is as follows:

[0211] Step 1: Iteration starts:

[0212] Update global parameters including m, q, b1, c1, and s1;

[0213] Step 2: Traverse the population individuals:

[0214] Calculate the current individual control parameters including A, C, l, probability factor p, etc.;

[0215] Update individual locations:

[0216] First, determine whether the escape mechanism execution conditions are met. If so, execute the escape mechanism. If not, determine whether the execution conditions of any of the random jump prey search phase, the dual strategy prey encirclement phase, and the dynamic spiral update phase are met. If none of them are met, trigger the escape mechanism.

[0217] The escape mechanism execution conditions are: And (L-count≥0), where L is the stagnation threshold; count represents the number of consecutive unimproved iterations;

[0218] The specific conditions for determining whether the execution of any of the random jump prey search stage, the dual strategy prey encirclement stage, and the dynamic spiral update stage are met are as follows: first determine whether the probability factor P < 0.5 is met; if not, execute the dynamic spiral update stage; if so, determine whether |A| ≥ 1 is met; if not, execute the dual strategy prey encirclement stage; if so, execute the random jump prey search stage;

[0219] Step 3: Calculate individual fitness values ​​and update the global optimal solution;

[0220] Step 4: Determine whether the maximum number of iterations has been reached. If so, output the global optimal solution. Otherwise, return to step 1 to continue iterative calculation.

[0221] The photovoltaic power prediction module is used to predict photovoltaic power generation based on the trained RNN-Transformer-BiLSTM hybrid model.

[0222] Example 3:

[0223] See also Figure 6 , a photovoltaic power prediction device based on a hybrid model, the photovoltaic power prediction device comprising a memory and a processor; the memory is used to store computer program code and transmit the computer program code to the processor; the processor is used to execute the photovoltaic power prediction method described in Example 1 according to the instructions in the computer program code.

[0224] Example 4:

[0225] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the photovoltaic power prediction method described in Example 1 is implemented.

[0226] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment, or a combination of software and hardware embodiments. Furthermore, the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0227] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0228] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0229] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0230] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered by the scope of protection of the claims of the present invention.

Claims

1. A photovoltaic power prediction method based on a hybrid model, characterized by: The photovoltaic power prediction method comprises: S1. Construct an RNN-Transformer-BiLSTM hybrid model; the RNN-Transformer-BiLSTM hybrid model includes an RNN layer, an ADTC layer, a VTx layer, and a BiLSTM layer. First, the time series features extracted by the RNN layer are input to the ADTC layer and the VTx layer for parallel feature extraction. Then, the outputs of the ADTC layer and the VTx layer are weighted fused. The fused features obtained by the weighted fusion are then passed to the BiLSTM layer, and the BiLSTM layer outputs the prediction results. S2. Train the RNN-Transformer-BiLSTM hybrid model using a photovoltaic power generation dataset, wherein the photovoltaic power generation dataset includes photovoltaic power generation and meteorological data, where the photovoltaic power generation is the model output and the meteorological data is the model input; S3. Photovoltaic power generation prediction based on the trained RNN-Transformer-BiLSTM hybrid model.

2. The photovoltaic power prediction method based on a hybrid model according to claim 1, characterized in that: The ADTC layer includes a dilated convolution structure with four branches, wherein the four branches are a small core branch, a medium core branch, a large core branch, and an adaptive core branch. First, each branch is used to perform local feature extraction on the temporal features extracted by the RNN layer, and the temporal features extracted by each branch are truncated according to the shortest temporal length and then spliced ​​along the channel dimension. The shortest temporal length refers to the minimum value of the temporal feature lengths extracted by the four branches. Then, the spliced ​​multi-scale features are activated by a two-way nonlinear function, and the two-way nonlinear function includes a Tanh function and a Sigmoid function. Finally, the output of the Tanh function is multiplied element-by-element by the output of the Sigmoid function, and the obtained product is the output of the ADTC layer. The convolution kernel sizes of the small core branch, medium core branch, and large core branch are 2, 4, and 8 respectively. The calculation formulas for the dilation factors of the small core branch, medium core branch, and large core branch are all: In the above formula, d is the expansion factor of the corresponding branch; T is the input sequence length of the ADTC layer; k is the convolution kernel size of the corresponding branch; The expansion factor of the adaptive kernel branch is 1, and the calculation formula of the convolution kernel size of the adaptive kernel branch is: k=3 / 4×T.

3. The photovoltaic power prediction method based on a hybrid model according to claim 1, characterized in that: In S2, the multi-strategy improved WOA algorithm is used to train the RNN-Transformer-BiLSTM hybrid model; The multi-strategy improved WOA algorithm includes a random jump prey search stage, a dual-strategy prey encirclement stage, and a dynamic spiral update stage; The random jump search prey stage uses the first dynamic probability factor m to select the long-distance jump update mode or the short-distance jump update mode for position update. If the random number rand is less than m, the long-distance jump update mode is selected for position update. If the random number rand is greater than or equal to m, the short-distance jump update mode is selected for position update. The position update formula of the random jump search prey stage is: m=(1-(t / T) 2 ) 1 / 2 -0.2; u1=(c1-s1)·R1+s1; l1=(c1-s1)·R2+s1; D1=|C·X rand (t)-X(t)|; In the above formula, X(t+1) is the current position of the individual whale at the t+1th iteration; X rand (t) is the random whale individual of the t-th iteration; X * (t) is the optimal individual whale position at the tth iteration; t is the current iteration number; T is the maximum iteration number; β is a constant; A is the convergence factor; D1 is the difference between individual X(t) and individual X rand (t), individual X(t) is the current whale individual in the t-th iteration; C is the perturbation coefficient; m is the first dynamic probability factor; rand is a random number; u1 and l1 both represent the dynamic boundaries generated in the search space; c1 and s1 respectively represent the maximum and minimum values ​​of all whale individuals in different dimensions in the current iteration; ∈ is a very small constant used to avoid the denominator being zero; R1, R2, R3, and R4 are all random numbers in the interval [0, 1]; v~N(0,1), indicating that v obeys the standard normal distribution; u~N(0,σ 2 ), indicating that u has a mean of 0 and a variance of σ 2 Normal distribution; the calculation formula of σ is: In the above formula, Γ(·) represents the gamma function; The dual-strategy prey encirclement stage uses the second dynamic probability factor q to select the average dimension guidance strategy or the shrinking encirclement strategy for position update. If the random number rand ≤ q, the average dimension guidance strategy is selected for position update. If the random number rand > q, the shrinking encirclement strategy is selected for position update. The position update formula of the dual-strategy prey encirclement stage is: D=|C·X * (t)-X(t)|; In the above formula, q is the second dynamic probability factor; X mean (t) represents the average dimension value of all whale individuals in the whale population in each dimension at the tth iteration; X i (t) is the position of the i-th whale individual in the whale population at the t-th iteration; N is the number of all whale individuals in the whale population; D represents the relationship between individual X(t) and individual X * (t) the difference between; The dynamic spiral update stage uses the random triangular guidance vector obtained from the top three individuals in the whale population to replace the optimal whale individual for position update; the position update in the dynamic spiral update stage is: X(t+1)=b1·|C·X n (t)-X(t)|·exp(l)·cos(2πl)+X n (t); X n (t)=n·(r3·(X2(t)-X * (t))+r4·(X3(t)-X * (t)))+X * (t); n=-(1-((t / T)-1) 2 ) 1 / 2 +1; In the above formula, b1 is the spiral step length control parameter; X n (t) is a random triangular guide vector; l is a random number in the interval [-1, 1]; r3 and r4 are both random numbers in the interval [0, 1]; X2(t) and X3(t) are the individuals with the second and third highest fitness values ​​in the whale population, respectively; n is a weight factor; The training process of the multi-strategy improved WOA algorithm is as follows: Step 1: Iteration starts: Update global parameters including m, q, b1, c1, and s1; Step 2: Traverse the population individuals: Calculate the current individual control parameters including A, C, l, probability factor p, etc.; Update individual position: first determine whether the probability factor P < 0.5 is satisfied. If not, execute the dynamic spiral update phase. If so, determine whether |A| ≥ 1 is satisfied. If not, execute the dual strategy prey encirclement phase. If so, execute the random jump prey search phase. Step 3: Calculate individual fitness values ​​and update the global optimal solution; Step 4: Determine whether the maximum number of iterations has been reached. If so, output the global optimal solution. Otherwise, return to step 1 to continue iterative calculation.

4. The photovoltaic power prediction method based on a hybrid model according to claim 3, characterized in that: In the training process of the multi-strategy improved WOA algorithm, it is first determined whether the execution conditions of the escape mechanism are met. If so, the escape mechanism is executed. If not, it is determined whether the execution conditions of any stage of the random jump search for prey stage, the dual strategy encirclement of prey stage, and the dynamic spiral update stage are met. If none of them are met, the escape mechanism is triggered. The escape mechanism execution conditions are: And (L-count≥0), where L is the stagnation threshold; count represents the number of consecutive unimproved iterations; The position update formula of the escape mechanism is: X(t+1)=X(t)+t(iter)·|X * (t)-X(t)|·cos(2·π·rand); In the above formula, t(iter) represents the t distribution whose degrees of freedom change with the current number of iterations.

5. A photovoltaic power prediction system based on a hybrid model, characterized by: The photovoltaic power prediction system includes: A hybrid model construction module is used to construct an RNN-Transformer-BiLSTM hybrid model; the RNN-Transformer-BiLSTM hybrid model includes an RNN layer, an ADTC layer, a VTx layer, and a BiLSTM layer. The RNN layer is used to extract time series features from the model input, input the extracted time series features to the ADTC layer and the VTx layer for parallel feature extraction, perform weighted fusion on the outputs of the ADTC layer and the VTx layer, pass the fused features obtained by the weighted fusion to the BiLSTM layer, and the BiLSTM layer outputs the prediction results; A model training module is used to train the RNN-Transformer-BiLSTM hybrid model using a photovoltaic power generation dataset, wherein the photovoltaic power generation dataset includes photovoltaic power generation and meteorological data, where the photovoltaic power generation is the model output and the meteorological data is the model input; The photovoltaic power prediction module is used to predict photovoltaic power generation based on the trained RNN-Transformer-BiLSTM hybrid model.

6. The photovoltaic power prediction system based on the hybrid model according to claim 5, characterized in that: The ADTC layer includes a dilated convolution structure with four branches, wherein the four branches are a small core branch, a medium core branch, a large core branch, and an adaptive core branch. First, each branch is used to perform local feature extraction on the temporal features extracted by the RNN layer, and the temporal features extracted by each branch are truncated according to the shortest temporal length and then spliced ​​along the channel dimension. The shortest temporal length refers to the minimum value of the temporal feature lengths extracted by the four branches. Then, the spliced ​​multi-scale features are activated by a two-way nonlinear function, and the two-way nonlinear function includes a Tanh function and a Sigmoid function. Finally, the output of the Tanh function is multiplied element-by-element by the output of the Sigmoid function, and the obtained product is the output of the ADTC layer. The convolution kernel sizes of the small core branch, medium core branch, and large core branch are 2, 4, and 8 respectively. The calculation formulas for the dilation factors of the small core branch, medium core branch, and large core branch are all: In the above formula, d is the expansion factor of the corresponding branch; T is the input sequence length of the ADTC layer; k is the convolution kernel size of the corresponding branch; The expansion factor of the adaptive kernel branch is 1, and the calculation formula of the convolution kernel size of the adaptive kernel branch is: k=3 / 4×T.

7. The photovoltaic power prediction system based on the hybrid model according to claim 5, characterized in that: The model training module uses a multi-strategy improved WOA algorithm to train the RNN-Transformer-BiLSTM hybrid model; the multi-strategy improved WOA algorithm includes a random jump prey search stage, a dual-strategy prey encirclement stage, and a dynamic spiral update stage; The random jump search prey stage uses the first dynamic probability factor m to select the long-distance jump update mode or the short-distance jump update mode for position update. If the random number rand is less than m, the long-distance jump update mode is selected for position update. If the random number rand is greater than or equal to m, the short-distance jump update mode is selected for position update. The position update formula of the random jump search prey stage is: m=(1-(t / T) 2 ) 1 / 2 -0.2; u1=(c1-s1)·R1+s1; l1=(c1-s1)·R2+s1; D1=|C·X rand (t)-X(t)|; In the above formula, X(t+1) is the current position of the individual whale at the t+1th iteration; X rand (t) is the random whale individual of the t-th iteration; X * (t) is the optimal individual whale position at the tth iteration; t is the current iteration number; T is the maximum iteration number; β is a constant; A is the convergence factor; D1 is the difference between individual X(t) and individual X rand (t), individual X(t) is the current whale individual in the t-th iteration; C is the perturbation coefficient; m is the first dynamic probability factor; rand is a random number; u1 and l1 both represent the dynamic boundaries generated in the search space; c1 and s1 respectively represent the maximum and minimum values ​​of all whale individuals in different dimensions in the current iteration; ∈ is a very small constant used to avoid the denominator being zero; R1, R2, R3, and R4 are all random numbers in the interval [0, 1]; v~N(0,1), indicating that v obeys the standard normal distribution; u~N(0,σ 2 ), indicating that u has a mean of 0 and a variance of σ 2 Normal distribution; the calculation formula of σ is: In the above formula, Γ(·) represents the gamma function; The dual-strategy prey encirclement stage uses the second dynamic probability factor q to select the average dimension guidance strategy or the shrinking encirclement strategy for position update. If the random number rand ≤ q, the average dimension guidance strategy is selected for position update. If the random number rand > q, the shrinking encirclement strategy is selected for position update. The position update formula of the dual-strategy prey encirclement stage is: D=|C·X * (t)-X(t)|; In the above formula, q is the second dynamic probability factor; X mean (t) represents the average dimension value of all whale individuals in the whale population in each dimension at the tth iteration; X i (t) is the position of the i-th whale individual in the whale population at the t-th iteration; N is the number of all whale individuals in the whale population; D represents the relationship between individual X(t) and individual X * (t) the difference between; The dynamic spiral update stage uses the random triangular guidance vector obtained from the top three individuals in the whale population to replace the optimal whale individual for position update; the position update in the dynamic spiral update stage is: X(t+1)=b1·|C·X n (t)-X(t)|·exp(l)·cos(2πl)+X n (t); X n (t)=n·(r3·(X2(t)-X * (t))+r4·(X3(t)-X * (t)))+X * (t); n=-(1-((t / T)-1) 2 ) 1 / 2 +1; In the above formula, b1 is the spiral step size control parameter; Xn(t) is the random triangle guidance vector; l is a random number in the interval [-1, 1]; r3 and r4 are both random numbers in the interval [0, 1]; X2(t) and X3(t) are the individuals with the second and third highest fitness values ​​in the whale population, respectively; n is the weight factor; The training process of the multi-strategy improved WOA algorithm is as follows: Step 1: Iteration starts: Update global parameters including m, q, b1, c1, and s1; Step 2: Traverse the population individuals: Calculate the current individual control parameters including A, C, l, probability factor p, etc.; Update individual position: first determine whether the probability factor P < 0.5 is satisfied. If not, execute the dynamic spiral update phase. If so, determine whether |A| ≥ 1 is satisfied. If not, execute the dual strategy prey encirclement phase. If so, execute the random jump prey search phase. Step 3: Calculate individual fitness values ​​and update the global optimal solution; Step 4: Determine whether the maximum number of iterations has been reached. If so, output the global optimal solution. Otherwise, return to step 1 to continue iterative calculation.

8. The photovoltaic power prediction system based on the hybrid model according to claim 7, characterized in that: In the training process of the multi-strategy improved WOA algorithm, it is first determined whether the execution conditions of the escape mechanism are met. If so, the escape mechanism is executed. If not, it is determined whether the execution conditions of any stage of the random jump search for prey stage, the dual strategy encirclement of prey stage, and the dynamic spiral update stage are met. If none of them are met, the escape mechanism is triggered. The escape mechanism execution conditions are: And (L-count≥0), where L is the stagnation threshold; count represents the number of consecutive unimproved iterations; The position update formula of the escape mechanism is: X(t+1)=X(t)+t(iter)·|X * (t)-X(t)|·cos(2·π·rand); In the above formula, t(iter) represents the t distribution whose degrees of freedom change with the current number of iterations.

9. A photovoltaic power prediction device based on a hybrid model, characterized by: The photovoltaic power prediction device includes a memory and a processor; the memory is used to store computer program code and transmit the computer program code to the processor; the processor is used to execute the photovoltaic power prediction method according to any one of claims 1 to 4 according to the instructions in the computer program code.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the photovoltaic power prediction method according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Wind power prediction method fusing multiple attention mechanisms

    CN119398215A

Cited By

  • A wind power multi-step prediction model construction method, device and medium

    CN122347082A