Bidirectional LSTM photovoltaic power generation prediction method based on wavelet decomposition and double attention
By employing a bidirectional LSTM photovoltaic power generation prediction method based on wavelet decomposition and dual attention, the problem of decreased prediction accuracy of photovoltaic power generation under cloudy weather conditions is solved, achieving high-precision and stable prediction of photovoltaic power generation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-27
- Publication Date
- 2026-03-13
AI Technical Summary
Traditional photovoltaic power generation forecasting methods struggle to effectively separate the fluctuation characteristics of different frequency components under cloudy weather conditions, leading to a decrease in forecast accuracy when photovoltaic power generation suddenly changes.
A bidirectional LSTM photovoltaic power generation prediction method based on wavelet decomposition and dual attention is adopted. By using adaptive noise complete set empirical mode decomposition and dual-path time attention structure, the trend and high-frequency signals of photovoltaic power signals are separated. When a sudden change in power or irradiance is detected, a sparse attention weight fast reconstruction mechanism is triggered to achieve high-precision prediction.
It significantly improves the accuracy and robustness of photovoltaic power generation prediction under cloudy weather conditions, can quickly respond to power fluctuations, and enhances the adaptability and anti-interference ability of the prediction model.
Smart Images

Figure CN121663469A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of power generation prediction technology, and specifically relates to a bidirectional LSTM photovoltaic power generation prediction method based on wavelet decomposition and dual attention. Background Technology
[0002] Photovoltaic power generation forecasting is a key technology for the stable operation of new energy power systems. Traditional forecasting methods mainly employ physical modeling and statistical learning methods to achieve short-term power prediction. Physical modeling methods establish prediction models based on the solar radiation transfer equation and photovoltaic module characteristic curves, while statistical learning methods utilize machine learning algorithms such as support vector machines and neural networks to mine mapping relationships in historical data. However, traditional methods often use single-scale analysis when processing photovoltaic power series, making it difficult to effectively separate the fluctuation characteristics of different frequency components, resulting in insufficient adaptability of the models to changes in meteorological conditions. Under cloudy weather conditions, cloud movement causes drastic fluctuations in irradiance, and photovoltaic output power exhibits a complex pattern of superimposed high-frequency random characteristics and low-frequency trend characteristics. Traditional forecasting models cannot accurately capture the temporal dependencies during power surges. In other words, existing technologies suffer from a technical problem of decreased prediction accuracy when photovoltaic power generation surges under cloudy weather conditions. Summary of the Invention
[0003] In view of this, the present invention provides a bidirectional LSTM photovoltaic power generation prediction method based on wavelet decomposition and dual attention, which can solve the technical problem of decreased prediction accuracy when photovoltaic power generation changes suddenly under cloudy weather conditions in the prior art.
[0004] This invention is implemented as follows: It provides a bidirectional LSTM photovoltaic power generation prediction method based on wavelet decomposition and dual attention. This method collects historical photovoltaic output power data, total irradiance data, normal irradiance data, horizontal diffuse irradiance data, temperature data, atmospheric pressure data, and humidity data from a photovoltaic power generation system and performs preprocessing. Then, it uses a particle swarm optimization algorithm to search for the optimal wavelet basis function and performs adaptive noise-complete ensemble empirical mode decomposition on the historical photovoltaic output power data to obtain multi-layer intrinsic mode function components. Adaptive denoising and reconstruction of the intrinsic mode function components yields photovoltaic power trend signals and effective high-frequency photovoltaic power signals. Key input feature variables are extracted using the maximum information coefficient and unsupervised pre-training is performed using a deep belief network. A bidirectional long short-term memory network prediction framework is established, and a feature attention mechanism is introduced at the input layer. A dual-path temporal attention structure is constructed at the output end. When the power change rate or irradiance change rate exceeds a threshold, a sparse attention weight fast reconstruction mechanism is triggered. Finally, photovoltaic power generation prediction is completed by weighted fusion of the forward hidden state and the backward hidden state.
[0005] The preprocessing process includes using the interquartile range method to detect and remove outliers, using multiple interpolation to complete missing data, and normalizing the data.
[0006] The interquartile range method determines the normal data range by calculating the first quartile and the third quartile, and data points that exceed the normal data range are considered outliers and are removed.
[0007] The multiple imputation method generates multiple complete datasets through multiple random samplings, and calculates the average estimated value of missing values in the multiple complete datasets as the imputation result.
[0008] Before searching for the optimal wavelet basis function, the particle swarm optimization algorithm first calculates the Shannon entropy and energy entropy values of the normalized historical photovoltaic output power data.
[0009] The adaptive noise-complete ensemble empirical mode decomposition adds adaptive white noise at each decomposition stage, eliminates mode aliasing through ensemble averaging, and decomposes historical photovoltaic output power data into a finite number of intrinsic mode function components and residual components.
[0010] The adaptive denoising method calculates the multi-scale permutation entropy and signal complexity for each intrinsic mode function component, determines the adaptive denoising threshold based on the Bayesian risk minimization criterion, and combines meteorological data to determine the current meteorological conditions and perform filtering and reconstruction.
[0011] The multi-scale permutation entropy value is used to quantitatively assess the complexity and regularity of the intrinsic mode function components by calculating the distribution entropy value of the permutation pattern of the time series at different time scales.
[0012] The maximum information coefficient is used to measure the strength of the nonlinear correlation between two variables. It is obtained by calculating the mutual information coefficient under different grid partitioning methods and normalizing it.
[0013] The deep belief network is composed of multiple layers of restricted Boltzmann machines stacked together, and abstract feature representation vectors are extracted layer by layer through unsupervised pre-training using a contrastive divergence algorithm.
[0014] The feature attention mechanism assigns dynamic weight coefficients to different key input feature variables by calculating the correlation weight between key input feature variables and the predicted value of photovoltaic power generation.
[0015] The dual-path time attention structure includes a fast detection path and a stable learning path. The fast detection path uses a sliding window to detect the power change rate of the photovoltaic power trend signal, while the stable learning path learns the long-term time-series pattern of the photovoltaic power trend signal.
[0016] The sparse attention weight fast reconstruction mechanism is triggered when the power change rate exceeds the power mutation threshold or the irradiance change rate exceeds the irradiance mutation threshold, and the sparse temporal attention weight coefficients are calculated using the Sparsemax function.
[0017] The bidirectional long short-term memory network prediction framework includes a forward long short-term memory layer and a reverse long short-term memory layer. The forward long short-term memory layer processes the input sequence in forward chronological order, while the reverse long short-term memory layer processes the input sequence in reverse chronological order.
[0018] The weighted fusion method involves weighting the forward hidden state of the forward long short-term memory layer and the reverse hidden state of the reverse long short-term memory layer according to the sparse temporal attention weight coefficient to obtain a fused feature vector.
[0019] Specifically, the Adam adaptive optimization algorithm is used to train the bidirectional long short-term memory network prediction framework, and the network weight parameters and bias parameters are updated by minimizing the mean squared error loss function.
[0020] This invention employs a multi-scale signal processing technique combining wavelet decomposition and adaptive noise-complete ensemble empirical mode decomposition to decompose the photovoltaic power sequence into multi-layer intrinsic mode function components. High-frequency components are adaptively selected for retention or filtering based on meteorological conditions, effectively separating power surge signals from measurement noise. By introducing a dual-path temporal attention structure into a bidirectional long short-term memory network, the system rapidly detects paths to monitor power change rates in real time and stably learns paths to extract long-term time-series patterns. When a power surge or irradiance surge is detected, a rapid reconstruction mechanism of sparse attention weights is triggered. The Sparsemax function is used to dynamically adjust the distribution of temporal attention weights, enabling the prediction model to quickly respond to power fluctuations under cloudy weather conditions. In summary, this invention solves the technical problem mentioned in the background art of decreased prediction accuracy when photovoltaic power generation surges under cloudy weather conditions. Attached Figure Description
[0021] Figure 1 This is a schematic diagram of the wavelet decomposition eigenmode function components in the embodiment.
[0022] Figure 2 This is a structural diagram of the bidirectional long short-term memory network prediction framework in the embodiment.
[0023] Figure 3 This is a schematic diagram illustrating the working process of the dual attention mechanism in the embodiment. Detailed Implementation
[0024] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below.
[0025] The invention provides a bidirectional LSTM photovoltaic power generation prediction method based on wavelet decomposition and dual attention, comprising: S01. Collect historical photovoltaic output power data, total irradiance data, normal irradiance data, horizontal diffuse irradiance data, temperature data, atmospheric pressure data, and humidity data of the photovoltaic power generation system. Use the interquartile range method to detect and remove outliers, use multiple interpolation method to complete the missing data, and normalize the historical photovoltaic output power data, total irradiance data, normal irradiance data, horizontal diffuse irradiance data, temperature data, atmospheric pressure data, and humidity data. S02. Calculate the Shannon entropy and energy entropy values of the normalized historical photovoltaic output power data, use the particle swarm optimization algorithm to search for the optimal wavelet basis function, and perform adaptive noise complete set empirical mode decomposition on the normalized historical photovoltaic output power data to obtain multi-layer intrinsic mode function components. S03. Calculate the multi-scale permutation entropy and signal complexity value for each intrinsic mode function component in the multi-layer intrinsic mode function components. Determine the adaptive denoising threshold based on the Bayesian risk minimization criterion. Combine the normalized total irradiance data, normal irradiance data, horizontal scattered irradiance data, temperature data, atmospheric pressure data, and humidity data to determine the current meteorological conditions. Filter out high-frequency intrinsic mode function components under stable weather conditions and retain high-frequency intrinsic mode function components under cloudy weather conditions to reconstruct the photovoltaic power trend signal and the effective high-frequency photovoltaic power signal. S04. Calculate the maximum information coefficient for the photovoltaic power trend signal, the effective high-frequency photovoltaic power signal, and the normalized total irradiance data, normal irradiance data, horizontal scattered irradiance data, temperature data, atmospheric pressure data, and humidity data respectively. Extract key input feature variables based on the magnitude of the maximum information coefficient, construct a deep belief network to perform unsupervised pre-training on the multi-layer intrinsic mode function components, and extract abstract feature representation vectors layer by layer through a restricted Boltzmann machine. S05. Establish a bidirectional long short-term memory network prediction framework. Input the key input feature variables and abstract feature representation vector into the input layer of the bidirectional long short-term memory network prediction framework. Introduce a feature attention mechanism in the input layer to dynamically assign weights to the key input feature variables to obtain feature attention weight coefficients. Construct a dual-path temporal attention structure at the output end of the bidirectional long short-term memory network prediction framework. The dual-path temporal attention structure includes a fast detection path and a stable learning path. The fast detection path uses a sliding window to detect the power change rate of the photovoltaic power trend signal. The stable learning path learns the long-term temporal pattern of the photovoltaic power trend signal. S06. Determine whether the power change rate exceeds the power mutation threshold, and whether the irradiance change rate of the normalized total irradiance data exceeds the irradiance mutation threshold. When the power change rate exceeds the power mutation threshold or the irradiance change rate exceeds the irradiance mutation threshold, trigger the sparse attention weight fast reconstruction mechanism, use the Sparsemax function to calculate the sparse temporal attention weight coefficient, and weight and fuse the forward hidden state of the forward long short-term memory layer and the reverse hidden state of the reverse long short-term memory layer in the bidirectional long short-term memory network prediction framework according to the sparse temporal attention weight coefficient to obtain the fused feature vector. Input the fused feature vector into the fully connected layer to complete the output of the photovoltaic power generation prediction value. S07. The bidirectional long short-term memory network prediction framework is trained using the Adam adaptive optimization algorithm. The network weight parameters and bias parameters of the bidirectional long short-term memory network prediction framework are updated by minimizing the mean square error loss function. The trained bidirectional long short-term memory network prediction framework is applied to real-time meteorological data input to output the photovoltaic power generation prediction value for the next 15 minutes to 1 hour.
[0026] The outlier detection method of the interquartile range is achieved by calculating the first and third quartiles of the historical photovoltaic output power data, total irradiance data, normal irradiance data, horizontal diffuse irradiance data, temperature data, atmospheric pressure data, and humidity data to determine the normal data range. The lower limit of the normal data value is the first quartile minus 1.5 times the interquartile range, and the upper limit of the normal data value is the third quartile plus 1.5 times the interquartile range. Data points that exceed the normal data range are considered outliers and are removed.
[0027] The multiple imputation method generates multiple complete datasets through multiple random samplings, calculates the average estimated value of missing values in the multiple complete datasets as the imputation result, and the average estimated value of missing values is the arithmetic mean of the estimated values at the corresponding positions in the multiple complete datasets. The standard error of the interpolation estimation is related to the proportion of missing data.
[0028] The Shannon entropy value is used to quantify the degree of information uncertainty of the normalized historical photovoltaic output power data, the energy entropy value is used to describe the degree of energy distribution concentration of the normalized historical photovoltaic output power data, and the particle swarm optimization algorithm searches in the wavelet basis function family space by initializing the particle population, updating the particle velocity and particle position according to the particle fitness value, and iteratively finding the optimal wavelet basis function that minimizes the reconstruction error.
[0029] In this process, the adaptive noise-complete ensemble empirical mode decomposition adds adaptive white noise at each decomposition stage, eliminates mode aliasing through ensemble averaging, and decomposes the normalized historical photovoltaic output power data into a finite number of intrinsic mode function components and residual components. The multi-layer intrinsic mode function components are arranged from high to low frequency, and each intrinsic mode function component represents the fluctuation characteristics at different time scales.
[0030] The multi-scale permutation entropy value is used to quantitatively evaluate the complexity and regularity of the intrinsic mode function components by calculating the permutation pattern distribution entropy value of the time series at different time scales. The signal complexity value comprehensively considers the spectral width and time-domain fluctuation characteristics of the intrinsic mode function components. The multi-scale permutation entropy value and the signal complexity value are combined to distinguish between real high-frequency fluctuation information and measurement noise information.
[0031] The Bayesian risk minimization criterion calculates the expected risk value under different thresholds by constructing a prior probability distribution and a loss function, selects the threshold that minimizes the expected risk value as the adaptive denoising threshold, increases the denoising intensity under stable weather conditions, and decreases the denoising intensity under cloudy weather conditions to retain effective high-frequency intrinsic mode function components.
[0032] The maximum information coefficient is used to measure the strength of the nonlinear correlation between two variables. The maximum information coefficient ranges from 0 to 1 and is obtained by calculating and normalizing the mutual information coefficient under different grid partitioning methods. When the value of the maximum information coefficient is close to 1, it indicates that the correlation between the variables is strong, and when it is close to 0, it indicates that the correlation between the variables is weak.
[0033] The deep belief network is composed of multiple layers of restricted Boltzmann machines stacked together. Each restricted Boltzmann machine includes a visible layer and a hidden layer. Unsupervised pre-training is performed using a contrastive divergence algorithm to extract abstract feature representation vectors from the input data layer by layer. The network weight parameters after pre-training are used to initialize the supervised learning network.
[0034] The feature attention mechanism calculates the correlation weight between the key input feature variables and the predicted photovoltaic power generation value, and assigns dynamic weight coefficients to different key input feature variables. This allows the bidirectional long short-term memory network prediction framework to highlight key input feature variables that have a significant impact on photovoltaic power generation. The feature attention weight coefficients are learned through neural network layers and are adaptively adjusted with the input data.
[0035] In the dual-path temporal attention structure, the fast detection path uses a short time window to slide and calculate the power change rate of adjacent time steps. When the absolute value of the power change rate exceeds a set threshold, it is marked as an abnormal moment. The stable learning path uses a long time window to learn a periodic temporal pattern. The output of the fast detection path and the output of the stable learning path are weighted and fused to form the final temporal attention weight.
[0036] The power mutation threshold is determined based on the statistical characteristics of the historical photovoltaic output power data, the irradiance mutation threshold is determined based on the statistical characteristics of the total irradiance data, and the sparse attention weight fast reconstruction mechanism quickly adjusts the temporal attention weight distribution to adapt to mutation events by recalculating the attention scores of each time step within the current time window.
[0037] The Sparsemax function is a sparsified alternative to the Softmax function. It achieves a sparse probability distribution by projecting onto a probability simplex, making the temporal attention weights of some time steps zero and the other time steps higher, thereby highlighting key moments and suppressing the influence of irrelevant time steps.
[0038] The bidirectional long short-term memory network prediction framework includes a forward long short-term memory layer and a reverse long short-term memory layer. The forward long short-term memory layer processes the input sequence in forward chronological order, while the reverse long short-term memory layer processes the input sequence in reverse chronological order. The forward hidden state of the forward long short-term memory layer and the reverse hidden state of the reverse long short-term memory layer are concatenated at each time step to form a bidirectional feature representation, thereby capturing both the historical dependencies and future associations of the time series.
[0039] The Adam adaptive optimization algorithm adaptively adjusts the learning rate of each parameter by calculating the first and second moment estimates of the gradient. The mean squared error loss function calculates the sum of squares of the difference between the predicted photovoltaic power generation value and the actual photovoltaic power generation value. The network weight parameters and bias parameters of the bidirectional long short-term memory network prediction framework are updated through the backpropagation algorithm.
[0040] Alternatively, the present invention also provides a computer-based approach to form a bidirectional LSTM photovoltaic power generation prediction system based on wavelet decomposition and dual attention. The computer is equipped with a readable storage medium that stores program instructions, which execute the above-described method when the computer is run.
[0041] The specific implementation methods of the above steps are described in detail below.
[0042] The specific implementation of step S01 involves first extracting historical operating data from the photovoltaic power generation system's data acquisition and monitoring system. This data includes photovoltaic output power data, total irradiance data, normal irradiance data, horizontal diffuse irradiance data, temperature data, atmospheric pressure data, and humidity data. This data covers the main meteorological factors affecting photovoltaic power generation and power output information. For the collected raw data, the interquartile range method is used for outlier detection, specifically calculating the first quartile of each data type. and the third and fourth quartiles Determine the interquartile range as minus The difference sets the lower limit of the normal data range to . Subtracting 1.5 times the interquartile range, the upper limit is set to... By adding a 1.5-times interquartile range, any data points outside this range are identified as outliers and removed. This method, based on the statistical characteristics of data distribution, can effectively identify abnormal data caused by measurement errors, sensor malfunctions, or communication interruptions. For missing values encountered during data acquisition, multiple imputation is used to complete them. This method generates several complete datasets through multiple random samplings, and the estimated values at the missing locations in each complete dataset are arithmetically averaged to obtain the final imputation result. Compared to simple interpolation methods, multiple imputation can more accurately reflect the uncertainty of the data and reduce prediction bias caused by missing data. After outlier removal and missing value completion, all data are normalized to map various data types to the interval between 0 and 1, eliminating differences in units and numerical ranges between different physical quantities. This provides standardized input data for subsequent feature extraction and model training. The normalization process uses a minimum-maximum normalization method, which is achieved by calculating the difference between each data point and the minimum value, divided by the difference between the maximum and minimum values.
[0043] The specific implementation of step S02 involves performing information entropy analysis and wavelet decomposition preprocessing on the normalized historical photovoltaic output power data. First, the Shannon entropy value of the power sequence is calculated to quantify the degree of uncertainty in power fluctuations. A larger Shannon entropy value indicates more irregular power fluctuations and higher prediction difficulty. Simultaneously, the energy entropy value is calculated to describe the concentration of energy distribution along the time axis of the power signal. A smaller energy entropy value indicates that energy is concentrated in a few time periods, while a larger energy entropy value indicates a relatively uniform energy distribution. To perform effective time-frequency decomposition of the power signal, a particle swarm optimization algorithm is used to search for the optimal wavelet basis function in the wavelet basis function family space. The particle swarm optimization algorithm first initializes the particle population, with each particle representing a candidate wavelet basis function. The reconstruction error of each particle's corresponding wavelet basis function is calculated as the fitness value. The particle's velocity and position are updated based on its own historical best position and global best position. The iterative search process continues until the optimal wavelet basis function that minimizes the reconstruction error is found. This adaptive selection process ensures the best match between the wavelet basis function and the characteristics of the photovoltaic power signal. After selecting the optimal wavelet basis function, adaptive noise-complete ensemble empirical mode decomposition is performed on the normalized historical photovoltaic output power data. This decomposition method, based on traditional empirical mode decomposition, adds an adaptively adjusted white noise auxiliary signal at each decomposition stage. Through multiple ensemble averaging operations, the mode aliasing phenomenon is effectively eliminated, and the original power sequence is decomposed into several intrinsic mode function components arranged from high to low frequency and a residual component. Each intrinsic mode function component represents the power fluctuation characteristics at different time scales. High-frequency components reflect short-term rapid fluctuations, while low-frequency components reflect long-term trend changes. This multi-scale decomposition provides a foundation for subsequent hierarchical prediction.
[0044] The specific implementation of step S03 involves performing complexity analysis and adaptive denoising on the multi-layer intrinsic mode function (IMF) components obtained from the decomposition. For each IMF component, its multi-scale permutation entropy value is calculated. This index quantitatively assesses the signal's complexity and regularity by statistically analyzing the permutation pattern distribution of the time series at different time scales. A larger multi-scale permutation entropy value indicates high signal complexity and weak regularity, while a smaller value indicates strong deterministic regularity. Simultaneously, the signal complexity value is calculated, which comprehensively considers the spectral width and temporal fluctuation amplitude of the IMF components, characterizing the signal's features from both frequency and time domain perspectives. Based on the multi-scale permutation entropy value and the signal complexity value, a Bayesian risk minimization criterion is used to determine the adaptive denoising threshold. This criterion constructs a prior probability distribution of the signal and noise, defines a loss function reflecting the denoising effect, calculates the expected risk value under different thresholds, and selects the threshold that minimizes the expected risk value as the denoising threshold. Compared to the fixed threshold method, this adaptive method can dynamically adjust the denoising intensity according to the signal characteristics. By combining normalized total irradiance data, normal irradiance data, horizontal diffuse irradiance data, temperature data, atmospheric pressure data, and humidity data, the fluctuation characteristics of these meteorological parameters are analyzed to determine the current meteorological conditions. When the meteorological parameters change gradually and the total irradiance fluctuation amplitude is less than 50 W / m², the current meteorological conditions are assessed. When the temperature reaches 50W / min, it is determined to be a stable weather condition. At this time, high-frequency intrinsic mode function components are filtered out to reduce noise interference. When meteorological parameters change rapidly and the total irradiance fluctuation exceeds 50W / min, the weather conditions are stabilized. When irradiance changes rapidly (e.g., / min) or frequently, it is determined to be cloudy weather. In this case, the high-frequency intrinsic mode function (IMF) components are retained to capture rapid power fluctuation information. Based on the denoising results, the retained low-frequency IMF components are reconstructed to obtain the photovoltaic power trend signal, and the retained effective high-frequency IMF components are reconstructed to obtain the effective high-frequency photovoltaic power signal. This hierarchical processing strategy decouples trend prediction and fluctuation prediction.
[0045] The specific implementation of step S04 involves feature selection and deep feature extraction. First, the maximum information coefficient between the photovoltaic power trend signal and each meteorological parameter is calculated. Simultaneously, the maximum information coefficient between the effective high-frequency photovoltaic power signal and each meteorological parameter is also calculated. The maximum information coefficient is obtained by calculating and normalizing the mutual information under different grid partitioning methods, with a value ranging from 0 to 1. This value can capture both linear and nonlinear correlations between variables. When the maximum information coefficient is close to 1, it indicates a strong correlation between the two variables; when the maximum information coefficient is close to 0, it indicates a weak or no correlation between the two variables. Based on the magnitude of the maximum information coefficient, meteorological parameters strongly correlated with the photovoltaic power signal are selected as key input feature variables. Generally, meteorological parameters with a maximum information coefficient greater than 0.3 are selected. This threshold can be adjusted according to specific application scenarios. The feature selection process reduces the model input dimension, lowers computational complexity, and avoids the negative impact of irrelevant features on prediction accuracy. To extract deep abstract features from the input data, a deep belief network is constructed and unsupervised pre-trained on multiple intrinsic mode function components. The deep belief network is composed of multiple stacked restricted Boltzmann machines. Each restricted Boltzmann machine contains a visible layer and a hidden layer. The visible layer receives the input data, and the hidden layer learns the feature representation of the input data. Unsupervised pre-training is performed using a contrastive divergence algorithm to extract abstract feature representation vectors layer by layer from the bottom to the top. The bottom feature representation vectors capture local detail information, while the top feature representation vectors capture global structural information. The network weight parameters after pre-training provide a good initialization for the subsequent supervised learning network, avoiding the training difficulties and local optima problems caused by random initialization.
[0046] The specific implementation of step S05 involves establishing a bidirectional long short-term memory (LSTM) network prediction framework and introducing a dual attention mechanism. The bidirectional LSTM network prediction framework includes an input layer, a forward LSTM layer, a backward LSTM layer, an attention layer, and an output layer. The input layer receives key input feature variables and abstract feature representation vectors extracted by a deep belief network. A feature attention mechanism is introduced at the input layer. This mechanism learns the importance weights of each key input feature variable for the predicted photovoltaic power generation value through neural network layers. Specifically, it calculates the similarity between the feature vector and the query vector, and obtains the feature attention weight coefficients after normalization. These coefficients adaptively adjust with the input data, enabling the network to dynamically highlight key input feature variables that significantly affect photovoltaic power generation while weakening less influential feature variables, thus improving the model's efficiency in utilizing key information. The forward long short-term memory layer processes the input sequence in forward chronological order, controlling the flow of information through forget gates, input gates, and output gates to capture the influence of historical time steps on the current time step. The backward long short-term memory layer processes the input sequence in reverse chronological order, capturing the correlation between future time steps and the current time step. The forward hidden state and the backward hidden state are concatenated at each time step to form a bidirectional feature representation, which contains both forward dependency and backward correlation information of the time sequence. A dual-path temporal attention structure is constructed at the output of a bidirectional long short-term memory network prediction framework. This structure includes two parallel branches: a fast detection path and a stable learning path. The fast detection path uses a sliding window of 5 to 10 time steps to calculate the power change rate between adjacent time steps. When the absolute value of the power change rate exceeds the power mutation threshold, it is marked as an abnormal moment. The power mutation threshold is determined based on the statistical characteristics of historical photovoltaic output power data, and is generally set to 2 to 3 times the standard deviation of the historical power change rate, with a reference value of approximately 5% to 10% of the rated power per minute. The stable learning path uses a long window of 30 to 60 time steps to learn the periodic temporal patterns and intraday variation laws of photovoltaic power generation. The outputs of the fast detection path and the stable learning path are weighted and fused through learnable weight coefficients to form the final temporal attention weights. This dual-path structure takes into account both short-term mutation detection and long-term pattern learning, enhancing the model's adaptability to complex temporal patterns.
[0047] The specific implementation of step S06 is to achieve rapid reconstruction of sparse attention weights based on mutation detection. During the prediction process, the power change rate and irradiance change rate are continuously monitored. The power change rate is obtained by calculating the difference between the power value at the current time step and the power value at the previous time step, divided by the time interval. The irradiance change rate is obtained by calculating the difference between the total irradiance at the current time step and the total irradiance at the previous time step, divided by the time interval. It is determined whether the power change rate exceeds a power mutation threshold, and simultaneously, whether the irradiance change rate exceeds an irradiance mutation threshold. The irradiance mutation threshold is determined based on the statistical characteristics of the total irradiance data, with a reference value of approximately 100 to 200 W / m². / min. When the rate of change of power exceeds the power mutation threshold or the rate of change of irradiance exceeds the irradiance mutation threshold, it indicates that the photovoltaic system has encountered abnormal events such as cloud cover or sudden weather changes. At this time, the sparse attention weight fast reconstruction mechanism is triggered. This mechanism recalculates the attention score of each time step within the current time window and uses the Sparsemax function instead of the traditional Softmax function for normalization. The Sparsemax function generates a sparse probability distribution by projecting the attention score onto the probability simplex, making the attention weight of some time steps exactly zero, while the other time steps receive higher attention weights, thereby highlighting the impact of key moments on the prediction results and suppressing the interference of irrelevant time steps. The forward hidden state of the forward long short-term memory layer and the reverse hidden state of the reverse long short-term memory layer in the bidirectional long short-term memory network prediction framework are weighted and fused according to the sparse temporal attention weight coefficient to obtain a fused feature vector. This fused feature vector contains key temporal information filtered by the attention mechanism. The fused feature vector is input into the fully connected layer, and processed by linear transformation and activation function to output the photovoltaic power generation prediction value. The output dimension of the fully connected layer corresponds to the time step of the prediction period, realizing multi-step prediction for the next 15 minutes to 1 hour.
[0048] The specific implementation of step S07 involves training a bidirectional long short-term memory (LSTM) network prediction framework and applying it to real-time prediction. The network is trained using the Adam adaptive optimization algorithm, which combines the advantages of momentum and adaptive learning rate adjustment. By calculating the first and second moment estimates of the gradient, the learning rate is adaptively adjusted for each network parameter. The initial learning rate is set to 0.001 to 0.01, the momentum decay coefficient is set to 0.9, and the second moment decay coefficient is set to 0.999. A mean squared error loss function is defined, and the sum of squares of the differences between the predicted and actual photovoltaic power generation is calculated. The gradient of the loss function with respect to each network parameter is calculated using the backpropagation algorithm. The network weight and bias parameters of the bidirectional LSM prediction framework are updated using the Adam optimization algorithm. The training process employs a mini-batch gradient descent method, with a batch size set to 32 to 128. The number of training epochs is determined based on the convergence of the validation set loss function, typically ranging from 100 to 500 epochs. Training is stopped early when the validation set loss function no longer decreases after several consecutive epochs to prevent overfitting. After training, the trained bidirectional long short-term memory network prediction framework is deployed to the real-time prediction system. It receives real-time meteorological data as input, and after data preprocessing, feature extraction, attention weighting and sequence prediction, it outputs the photovoltaic power generation prediction value for the next 15 minutes to 1 hour. The prediction results are used in application scenarios such as grid dispatch, energy storage management and power trading to improve the controllability of photovoltaic power generation system and grid stability.
[0049] It should be noted that the first key technical idea of this invention is a hierarchical signal processing method based on adaptive noise complete set empirical mode decomposition and meteorological condition judgment. This method decomposes the photovoltaic power signal into intrinsic mode function components at different frequency scales and dynamically adjusts the retention strategy for high-frequency components according to meteorological conditions. It filters out high-frequency noise under stable weather conditions and retains high-frequency fluctuation information under cloudy weather conditions, solving the problem of poor adaptability of traditional single denoising methods under different weather conditions. Compared with fixed threshold wavelet denoising or simple low-pass filtering methods, this technique can adaptively adjust the signal processing strategy according to meteorological conditions, ensuring prediction smoothness under stable weather conditions while capturing rapid power fluctuations under cloudy weather conditions, significantly improving the accuracy and robustness of predictions under different weather conditions.
[0050] The second key technical concept of this invention is the combination of a dual-path temporal attention structure and a sparse attention weight fast reconstruction mechanism. The dual-path temporal attention structure captures short-term power spikes through rapid path detection and learns long-term temporal patterns through stable path learning; the two work in parallel to achieve attention allocation across multiple time scales. When a power spike or irradiance spike is detected, the sparse attention weight fast reconstruction mechanism immediately adjusts the attention distribution, focusing the network on critical moments related to the spike event. Compared to traditional single-scale attention mechanisms or fixed attention weight methods, this technology can smoothly learn periodic patterns under normal conditions and quickly respond to spike events under abnormal conditions, solving the problem of accurately capturing spike events in photovoltaic power generation prediction and significantly improving the prediction capability for complex scenarios such as cloud cover and sudden weather changes.
[0051] The synergistic effect of the two key technological approaches mentioned above is reflected in the deep integration of the signal processing layer and the decision-making layer. The hierarchical signal processing method effectively separates trend signals and high-frequency signals during the data preprocessing stage, providing clear input features for subsequent networks. The dual-path temporal attention structure and the rapid reconstruction mechanism of sparse attention weights enable precise focusing and dynamic adjustment of information at different time scales in the prediction layer. The combination of these two approaches forms a complete technological chain from data to decision-making. The former ensures high-quality input data, while the latter ensures efficient utilization of time-series information, jointly solving the challenges of high data noise, variable weather conditions, and frequent power fluctuations in photovoltaic power generation prediction. Compared to traditional end-to-end deep learning methods or methods that solely rely on signal processing, this collaborative technology significantly improves the generalization ability and anti-interference capability of the prediction model, achieving stable and high-precision predictions under various complex weather conditions.
[0052] Specifically, the detailed structure of the bidirectional long short-term memory (LSTM) network prediction framework includes an input layer, a feature attention layer, a forward LSM layer, a backward LSM layer, a dual-path temporal attention layer, a feature fusion layer, and an output layer. The input layer receives preprocessed key input feature variables and abstract feature representation vectors extracted by a deep belief network. The dimension of the input data is the number of time steps multiplied by the number of features. The number of time steps is set according to the prediction task, generally historical data from the past 60 to 120 time steps. The number of features includes meteorological parameters, power trend signals, high-frequency power signals, and abstract features, totaling 10 to 20 feature dimensions. The feature attention layer adopts a multilayer perceptron structure, containing two fully connected neural network layers. The first layer maps the input features to an attention hidden space with a dimension half that of the input features. The second layer outputs a feature attention score, which is normalized using the Softmax function to obtain the feature attention weight coefficient. This coefficient is dynamically weighted by multiplying the input features element-wise, highlighting important features and suppressing secondary features.
[0053] Both the forward Long Short-Term Memory (LSTM) layer and the backward Long Short-Term Memory (RSM) layer contain 2 to 3 stacked LSM units. The hidden state dimension of each LSM unit ranges from 64 to 256, with the specific value determined based on the data scale and computational resources. The forward LSM layer processes the input sequence sequentially from the first time step. Each LSM unit at each time step receives the weighted features of the current time step and the hidden state from the previous time step. A forget gate determines how much of the previous time step's memory to retain, an input gate determines how much of the current time step's information to add, and an output gate determines how much of the current time step's hidden state to output. This gating mechanism allows the network to selectively remember long-term dependencies, avoiding the gradient vanishing problem. The backward LSM layer processes the input sequence in reverse chronological order from the last time step. Its internal structure is the same as the forward LSM layer, but the information flow direction is reversed, capturing the influence of future time steps on the current time step. At each time step, the forward hidden state and the backward hidden state are concatenated to form a bidirectional feature representation. This bidirectional feature representation contains both past and future information, and its dimension is the sum of the dimensions of the forward hidden state and the backward hidden state.
[0054] The dual-path temporal attention layer comprises two parallel branches: a fast detection path and a stable learning path. The fast detection path employs a one-dimensional convolutional neural network with kernel sizes of 5 to 10 and a stride of 1. It performs convolution operations on the bidirectional feature representation to extract local temporal patterns, obtains locally salient features through max pooling, and then outputs a fast detection attention score after passing through a fully connected layer. The stable learning path uses a multi-head self-attention mechanism, dividing the bidirectional feature representation into multiple heads. Each head independently calculates the query vector, key vector, and value vector. The attention score is calculated by the dot product of the query vector and key vector, normalized by Softmax, and then weighted and summed with the value vector. The outputs of the multiple heads are concatenated and subjected to a linear transformation to obtain the stable learning attention score. The fast detection attention score and the stable learning attention score are weighted and fused using learnable weight parameters to form the final temporal attention weights. When a power or irradiance mutation is detected, the temporal attention weights are recalculated using the Sparsemax function to achieve a sparse attention distribution.
[0055] The feature fusion layer multiplies the bidirectional feature representations element-wise with temporal attention weights to obtain weighted temporal features. Then, through a weighted summation operation along the time dimension, the sequence information is compressed into a fixed-dimensional fused feature vector. The output layer contains two fully connected neural networks. The first layer maps the fused feature vector to the hidden space, with dimensions ranging from 128 to 512, and uses the ReLU activation function to introduce non-linearity. The second layer maps the hidden states to the output space, with dimensions corresponding to the time steps of the prediction period, representing the power prediction value for the next 15 minutes to 1 hour. No activation function is used to support arbitrary real-valued outputs.
[0056] The steps for building the training dataset are as follows: First, continuous time windows are extracted from historical data. Each time window contains an input sequence and a corresponding prediction target. The input sequence consists of meteorological parameters and power data from the past 60 to 120 time steps, and the prediction target is the power value for the next 3 to 12 time steps. The data is divided into training, validation, and test sets according to time order. The training set accounts for 70% of the total data, the validation set for 15%, and the test set for 15%, ensuring that the time range of the test set is after the training set to avoid data leakage. Data augmentation is performed on the training set by adding small-amplitude random noise, random time offsets, and random feature scaling to increase the diversity of training samples and improve the model's generalization ability. When constructing training samples, a sliding window strategy is used, with a window sliding step size of 1 to 5 time steps, generating a large number of overlapping training samples to fully utilize historical data information. For data from periods of sudden weather changes, sampling weights are increased to allow the model to learn more about the prediction patterns under sudden weather scenarios, compensating for the relatively small number of sudden weather samples. During training, the order of samples is randomly shuffled in each training batch to prevent the model from learning false patterns in the sample arrangement. At the same time, Dropout regularization is used to randomly discard the output of some neurons during training to prevent the model from overfitting the training data.
[0057] The bidirectional long short-term memory (LSTM) network prediction framework is suitable for solving photovoltaic (PV) power generation prediction problems because of its unique bidirectional temporal modeling capabilities and LTM mechanism. PV power generation is cumulatively influenced by past weather conditions and is also closely related to short-term weather trends. Unidirectional recurrent neural networks can only capture the impact of historical information on the present and cannot utilize future information for auxiliary prediction. However, bidirectional LTM networks, through information flow in both forward and backward directions, can utilize complete sequence information from the past and future during the training phase, learning a more comprehensive temporal dependency. While real future data cannot be obtained during the prediction phase, the network has already learned the correlation between historical patterns and future trends during training, enabling it to infer possible future evolution directions based on current and historical information. The LTM mechanism, through gating units, selectively retains and forgets information, solving the gradient vanishing and gradient exploding problems of traditional recurrent neural networks when processing long sequences. This allows the network to effectively capture long-term periodic patterns in PV power generation, such as the periodic changes in sunrise and sunset, seasonal differences in irradiance, and the periodic evolution of weather patterns. It can also capture short-term rapid changes, such as sudden power drops caused by cloud cover and rapid power recovery after cloud dissipation.
[0058] Compared with existing technologies, the advantages and effects of the bidirectional long short-term memory (LSTM) network prediction framework are reflected in the following aspects. First, compared with traditional static models such as feedforward neural networks or support vector machines, bidirectional LSM networks can explicitly model the temporal dependencies of time series data. They do not require manual design of lag features or time window features; the network automatically learns complex correlation patterns between different time steps, reducing the workload of feature engineering and improving the model's efficiency in utilizing temporal information. Second, compared with unidirectional LSM networks or gated recurrent unit (GRU) networks, bidirectional LSM networks enhance their understanding of temporal context through bidirectional information flow. In photovoltaic power generation prediction tasks, the current power generation depends not only on past meteorological conditions and power changes but also on the short-term meteorological evolution trend. The bidirectional structure can more accurately capture this bidirectional dependency, improving the accuracy and stability of the prediction. Third, compared with spatial feature extraction models such as convolutional neural networks, the recurrent structure of bidirectional LSM networks is naturally suitable for processing time series data of variable length, flexibly responding to the needs of different prediction durations. Simultaneously, the recurrent connections allow the network to maintain a memory of the entire historical sequence when processing each time step, avoiding the problem of limited receptive fields in convolutional neural networks. Fourth, compared to pure attention mechanism models such as Transformer, the recurrent structure of bidirectional long short-term memory networks has a stronger inductive bias, that is, it has a priori assumptions about the sequentiality and local continuity of time series. This inductive bias can accelerate model convergence in tasks with obvious time-series dependencies, such as photovoltaic power generation, and reduce the need for large-scale training data. At the same time, the gating mechanism of long short-term memory units provides interpretable information flow paths, which facilitates the analysis of the model's decision-making basis.
[0059] This invention enhances the expressive power and prediction accuracy of the model by introducing a dual attention mechanism into the bidirectional long short-term memory network prediction framework. The feature attention mechanism addresses the problem of traditional models treating all input features equally. By dynamically adjusting the weights of different features, the model can automatically identify and highlight the most important meteorological parameters and power features according to the needs of the current prediction task, while suppressing the interference of noise and redundant features. This adaptive feature selection capability is particularly important in photovoltaic power generation scenarios with complex and variable weather conditions, because the dominant factors differ under different weather conditions. Total irradiance is the key factor on sunny days, while irradiance fluctuations and cloud movement speed become the dominant factors on cloudy days. The feature attention mechanism can flexibly adapt to these changes. The dual-path temporal attention structure solves the temporal scale conflict problem faced by traditional attention mechanisms when dealing with photovoltaic power generation prediction tasks. The fast detection path focuses on capturing short-term abrupt events, while the stable learning path focuses on learning long-term periodic patterns. The two work in parallel and are dynamically integrated to achieve collaborative modeling of information at multiple time scales. When the system detects a power or irradiance abrupt change, the sparse attention weight fast reconstruction mechanism immediately adjusts the temporal attention distribution, enabling the network to quickly focus on the key moments related to the abrupt event. This rapid response capability significantly improves the model's prediction accuracy for sudden events such as cloud cover, gusts, and local shadows. Compared with traditional fixed attention weights or global average pooling methods, this mechanism can significantly improve the prediction ability for abnormal periods while maintaining stable predictions for normal periods, achieving a dual improvement in prediction accuracy and robustness.
[0060] It should be noted that this invention also solves the following technical problem: the difficulty in accurately distinguishing between measurement noise and real high-frequency fluctuations in photovoltaic power sequences, leading to overfitting or underfitting of prediction models. Traditional denoising methods use fixed threshold filtering, which may retain too much noise to interfere with model training under stable weather conditions, and may mistakenly delete real high-frequency components containing power change information under cloudy weather conditions. This invention calculates the multi-scale permutation entropy value and signal complexity value of each intrinsic mode function component to quantitatively evaluate the complexity and regularity characteristics of the components. It determines the adaptive denoising threshold by combining the Bayesian risk minimization criterion, and judges whether the weather is stable or cloudy based on the current meteorological conditions. Under stable weather conditions, the denoising intensity is increased to filter out high-frequency noise components, and under cloudy weather conditions, the denoising intensity is decreased to retain effective high-frequency components. This achieves adaptive denoising processing for different meteorological conditions and signal characteristics, effectively distinguishing between measurement noise and real fluctuation information, and avoiding the problem of insufficient adaptability of fixed threshold methods under different operating conditions.
[0061] Specifically, the principle of this invention is as follows: The key to solving the problem of decreased prediction accuracy when photovoltaic power generation undergoes sudden changes under cloudy weather conditions lies in establishing a collaborative prediction framework of multi-scale signal decomposition and adaptive attention mechanism. First, the power sequence is decomposed into intrinsic mode function components of different frequencies through adaptive noise complete set empirical mode decomposition. Multi-scale permutation entropy and signal complexity indices are used to identify real high-frequency fluctuations and noise. Noise components are filtered out to reduce interference under stable weather conditions, while high-frequency components are retained to capture sudden change information under cloudy weather conditions, achieving adaptive signal preprocessing for meteorological conditions. Second, the dual-path temporal attention structure calculates the power change rate in real time through a sliding window mechanism for fast path detection. When the change rate exceeds a threshold, sparse attention weights are immediately triggered for rapid reconstruction, enabling the model to quickly focus on key feature information when power changes occur. This avoids the lagging response of traditional fixed attention weights under sudden change conditions, thereby improving the prediction accuracy for power sudden changes under cloudy weather conditions.
[0062] The following provides a specific embodiment 1 of the present invention, and the specific implementation of each step in this embodiment 1 is described in detail below.
[0063] The specific implementation of step S01 is as follows: First, collect historical photovoltaic output power data, total irradiance data, normal irradiance data, horizontal diffuse irradiance data, temperature data, atmospheric pressure data, and humidity data of the photovoltaic power generation system. Use the interquartile range method to detect outliers and calculate the first quartile of each data sequence. With the third quartile Interquartile range is The lower limit of normal data values is The upper limit of normal data values is Data points outside this range are considered outliers and are removed. This represents the value at the 25th percentile after arranging the data in ascending order. This indicates a value located at the 75% position. Interquartile range, This is the lower limit of normal data. The above figures represent the upper limit of normal data, and the units of all quantities are consistent with the units of the original data. For missing data, multiple imputation is used to complete the data. Multiple complete datasets are generated through multiple random samplings. The formula for calculating the average estimate of missing values is as follows: ; In the formula, This is the average estimate of the missing values; An empirical value for the number of complete datasets generated is 5 to 10; For the first The estimated values for the corresponding locations in the complete dataset are kept in the same units as the original data. The dataset is numbered, with values ranging from 1 to... The normalization process uses the minimum-maximum normalization method, and the normalization formula is expressed as follows: ; In the formula, The normalized data value ranges from 0 to 1. The original data value; The minimum value of the data sequence; For the maximum value of the data sequence, the above , , The units are consistent.
[0064] The specific implementation of step S02 is as follows: First, calculate the Shannon entropy value and energy entropy value of the normalized historical photovoltaic output power data. The formula for calculating the Shannon entropy value is as follows: ; In the formula, This is the Shannon entropy value; This is the number of data groups after discretization, typically ranging from 20 to 50. For the first The probability of a set of data appearing satisfies ; The data is grouped and numbered, with values ranging from 1 to... The formula for calculating energy entropy is as follows: ; In the formula, This is the energy entropy value; This represents the number of energy distribution intervals, with an empirical value of 10–30. For the first The normalized energy values for each interval satisfy... ; The energy range is numbered, with values ranging from 1 to... The particle swarm optimization algorithm searches for the optimal wavelet basis function, and the particle velocity update formula is expressed as follows: ; In the formula, For the first The particle in the first The velocity vector of the next iteration; This is the inertia weighting coefficient, with a default value of 0.7 to 0.9; For the first The particle in the first The velocity vector of the next iteration; and This is the learning factor, typically ranging from 1.5 to 2.5. and A random number between 0 and 1; For the first The historical optimal position vector of each particle; For the first The particle in the first The position vector of the next iteration; This is the globally optimal position vector for all particles; Number the particles; Let be the number of iterations. The particle position update formula is expressed as follows: ; In the formula, For the first The particle in the first The position vector of the next iteration. The fitness function adopts the criterion of minimizing reconstruction error, and the formula for calculating reconstruction error is as follows: ; In the formula, This is for normalized reconstruction error; The length of the data sequence; For the first part of the original data One sampling point; For the first time to reconstruct the data One sampling point; The sampling point number ranges from 1 to... .
[0065] The specific implementation of step S03 is as follows: Calculate the multi-scale permutation entropy value for each intrinsic mode function component. The formula for calculating the multi-scale permutation entropy value is as follows: ; In the formula, Time scale The entropy value of multi-scale arrangement under the following conditions; For the embedding dimension, the empirical value is 3 to 7; In order to be on a time scale Next The probability of a certain permutation pattern occurring; The total number of all possible permutations; For time scale parameters; The permutation pattern number has a value range of 1 to 1. The numerical formula for signal complexity is expressed as follows: ; In the formula, This represents the signal complexity value. and Let be the weighting coefficient, satisfying The default values are 0.6 and 0.4; The bandwidth is expressed in Hz. This represents the maximum bandwidth of the frequency spectrum, expressed in Hz. The standard deviation in the time domain; The maximum value of the time-domain standard deviation, in units of 1 and 2. Consistent. The formula for calculating the expected risk value of the Bayesian risk minimization criterion is as follows: ; In the formula, Threshold The corresponding expected risk value; Let be the loss function, representing the threshold. Below the actual signal state The extent of the loss; Based on observation data The posterior probability distribution; This represents the actual signal state; For the observation dataset. Adaptive denoising threshold selection makes Reaching the minimum value As the optimal threshold Threshold adjustment coefficient under stable weather conditions The threshold adjustment coefficient is set to 1.2 to 1.5 under cloudy weather conditions. The threshold value is set to 0.5 to 0.8, and the adjusted threshold is... In the formula The adjusted noise reduction threshold. This is the threshold adjustment coefficient, taken under stable weather conditions. Value, taken under cloudy weather conditions value.
[0066] The specific implementation of step S04 is as follows: Calculate the maximum information coefficient of each variable with respect to the photovoltaic power trend signal and the effective high-frequency signal of photovoltaic power. The formula for calculating the maximum information coefficient is as follows: ; In the formula, For variables and variables The maximum information coefficient between them, with a value range of 0 to 1; and They are respectively shaft and The number of grid divisions for the axis; The maximum number of grid cells is, empirically, [value]. , The number of samples; In order to be in Mutual information values under grid partitioning. Key input feature variables are extracted based on the magnitude of the maximum information coefficient, selecting those with a maximum information coefficient greater than a threshold. The variables are used as key input feature variables, among which The default value is 0.5. The deep belief network uses a restricted Boltzmann machine for unsupervised pre-training, and the energy function calculation formula is as follows: ; In the formula, Let be the system energy function; The visible layer unit vector has a dimension of ; Let be the hidden layer unit vector, with dimension . ; For the first The bias of each visible layer cell; For the first The bias of each hidden layer unit; Visible layer unit With hidden layer unit Connection weights between them; This represents the number of visible layer cells. This represents the number of hidden layer units; This is the visible layer cell number, with a value ranging from 1 to... ; This is the hidden layer unit number, with a value ranging from 1 to... ; For the first The state values of each visible layer cell; For the first The state values of each hidden layer unit.
[0067] The specific implementation of step S05 is as follows: The feature attention mechanism calculates the feature attention weight coefficients, and the formula for calculating the feature attention weight coefficients is expressed as follows: ; In the formula, For the first Feature attention weight coefficients for key input feature variables; For the first Attention scores for key input feature variables; The total number of key input feature variables; The key input feature variable is numbered, with a value range of 1 to 1. ; The summation index variable takes values ranging from 1 to... The formula for calculating the power change rate of the fast detection path in a dual-path temporal attention structure is as follows: ; In the formula, For a moment The normalized rate of change of power; For a moment The photovoltaic output power, in kW; For a moment The photovoltaic output power, in kW; For reference power, the rated power of the photovoltaic system is used, in kW; The time window length is expressed in seconds. For reference time, the default value is 1 second; The formula for calculating the temporal attention weights of a stable learning path is as follows: (This refers to the current moment.) ; In the formula, For a moment Time attention weights; For a moment The query vector; This is the weight matrix; For a moment The hidden state vector; This represents the total length of the time series. This is the time step index, with a value range of 1 to... ; The hyperbolic tangent activation function; superscript This represents the vector transpose operation; This serves as a time marker in a time series.
[0068] The specific implementation of step S06 is: determining whether the power change rate exceeds the power mutation threshold. The power surge threshold is determined based on the standard deviation of historical photovoltaic output power data, and the calculation formula is as follows: ; In the formula, This is the normalized power mutation threshold; This represents the average historical power change rate, in kW / s. The standard deviation of the historical power change rate is expressed in kW / s. For reference time, the default value is 1 second; The reference power is expressed in kW. The formula for calculating the irradiance abrupt change threshold is as follows: ; In the formula, This represents the normalized threshold for irradiance mutation. This represents the average historical rate of change in irradiance, in units of... ; The standard deviation of the historical rate of change of irradiance, in units of ; For reference irradiance, an irradiance of 1000 under standard test conditions is used. When the sparse attention weight fast reconstruction mechanism is triggered, the Sparsemax function is used to calculate the sparse temporal attention weight coefficients. The formula for the Sparsemax function is as follows: ; In the formula, For a moment Sparse temporal attention weight coefficients; For a moment The original attention score; Let the threshold parameter be the solution obtained by projecting it onto the probability simplex, such that... ; The time number in the time series, with a value ranging from 1 to... ; This is the attention score vector. The formula for calculating the fused feature vector is as follows: ; In the formula, For a moment fused feature vectors; For the forward long short-term memory layer at time The forward-hidden state; For the reverse long short-term memory layer at time The reverse hidden state; This represents a vector concatenation operation; This is the time step index, with a value range of 1 to... ; This is the current moment of integration; For a moment The sparse temporal attention weighting coefficients. The formula for the output of the photovoltaic power generation prediction value is expressed as follows: ; In the formula, This represents the predicted photovoltaic power generation capacity, in kW. This is the weight matrix of the fully connected layer; This is the bias vector of the fully connected layer; This is a reference power, measured in kW.
[0069] The specific implementation of step S07 is as follows: The bidirectional long short-term memory network prediction framework is trained using the Adam adaptive optimization algorithm, and the first-order moment estimate update formula is expressed as follows: ; In the formula, For the first The first-order moment estimate of the next iteration; This is the first-order moment attenuation coefficient, with a default value of 0.9; For the first The gradient vector of the next iteration; Number the number of iterations; For the first The first-order moment estimate is obtained in the next iteration. The formula for updating the second-order moment estimate is as follows: ; In the formula, For the first The second moment estimate of the next iteration; This is the second-order moment attenuation coefficient, with a default value of 0.999; This represents the element-wise square of the gradient vector; For the first The second moment estimate from the next iteration. The bias-corrected first and second moment estimates are respectively... and In the formula This is the first-order moment estimate after bias correction. This is the second-order moment estimate after bias correction. The parameter update formula is expressed as follows: ; In the formula, For the first Network parameters for the next iteration; For the first Network parameters for the next iteration; The learning rate is empirically defined as 0.001 to 0.01. This is a numerically stable term, and the default value is... The formula for calculating the mean squared error loss function is as follows: ; In the formula, This represents the normalized mean square error loss function value. The number of samples; For the first The actual photovoltaic power generation value of each sample, in kW; For the first The predicted photovoltaic power generation value for each sample is in kW; Reference power, unit is kW; The sample number is a number ranging from 1 to 1. The trained bidirectional long short-term memory network prediction framework is applied to real-time meteorological data input to output photovoltaic power generation prediction values for the next 15 minutes to 1 hour.
[0070] To better understand and implement this invention, a specific application scenario is provided below as Example 2: To utilize this invention to solve the problem of ultra-short-term power prediction in actual photovoltaic power plants, technicians conducted an application practice at a 50MW photovoltaic power plant. This power plant is equipped with a comprehensive meteorological monitoring system and data acquisition system, capable of recording photovoltaic output power and various meteorological parameters in real time. Technicians first extracted 90 consecutive days of historical operating data from the data acquisition system, with a sampling interval of 5 minutes, obtaining a total of 25,920 valid samples. The dataset includes seven dimensions of characteristic variables: photovoltaic output power, total irradiance, normal irradiance, horizontal diffuse irradiance, ambient temperature, atmospheric pressure, and relative humidity.
[0071] During the data preprocessing stage, technicians used the interquartile range method to detect outliers in the raw data. Taking photovoltaic output power data as an example, the first quartile was calculated. It is 12.8 MW, the third quartile. The mean MW was 38.6 MW, and the interquartile range (IQR) was 25.8 MW. Based on this, the lower limit of normal data was determined to be -26.0 MW, and the upper limit to be 77.4 MW. A total of 183 outlier data points were identified, accounting for 0.71% of the total sample. These outliers were mainly concentrated during equipment maintenance and under extreme weather conditions. For missing data, technicians used multiple imputation to generate five complete datasets for processing, with a missing data ratio of 1.2%. After imputation, the data integrity of each meteorological feature was restored. Subsequently, all feature variables were normalized, mapping the numerical range uniformly to between 0 and 1, eliminating the influence of different physical units on model training.
[0072] Technicians calculated the Shannon entropy and energy entropy values for the normalized historical photovoltaic output power data, which were 3.87 and 2.14, respectively, indicating that the power sequence has high information uncertainty. To select the optimal wavelet basis function, a particle swarm optimization algorithm was used to search the wavelet basis function family space, with a particle population size of 50 and a maximum number of iterations of 100. After iterative optimization, the db4 wavelet was determined as the optimal basis function, minimizing the reconstruction error to 0.032. Subsequently, adaptive noise-complete ensemble empirical mode decomposition was performed on the normalized power data, with the ensemble mean set to 100 and the white noise standard deviation set to 0.2. The decomposition process generated eight layers of intrinsic mode function components, corresponding to fluctuation characteristics at different time scales, with the frequency range decreasing sequentially from high-frequency disturbances to low-frequency trends. The wavelet decomposition is shown below. Figure 1 As shown.
[0073] For each intrinsic mode function component, the technicians calculated the multi-scale permutation entropy and signal complexity. The permutation entropy values of the high-frequency components IMF1 to IMF3 were 0.89, 0.76, and 0.64, respectively, exhibiting high randomness and complexity. The permutation entropy values of the mid-frequency components IMF4 to IMF6 ranged from 0.45 to 0.58, reflecting semi-periodic fluctuation characteristics. The permutation entropy values of the low-frequency components IMF7 and IMF8 decreased to 0.31 and 0.18, showing obvious trend characteristics. Based on the Bayesian risk minimization criterion, the technicians constructed a prior probability distribution and calculated the expected risk value under different thresholds. By analyzing the meteorological conditions of the day, it was determined to be sunny and stable weather, so the denoising intensity was increased, and the adaptive denoising threshold was determined to be 0.42. Under this threshold, the two high-frequency components IMF1 and IMF2 were filtered out, and the effective components IMF3 to IMF8 were retained for reconstruction, resulting in the photovoltaic power trend signal and the effective high-frequency photovoltaic power signal.
[0074] To extract key input feature variables, technicians calculated the maximum information coefficient between each meteorological feature and the photovoltaic power trend signal. The calculation results are shown in Table 1.
[0075] Table 1. Maximum Information Coefficient of Meteorological Characteristics and Photovoltaic Power
[0076] Based on the analysis results in Table 1, the feature variables with a maximum information coefficient greater than 0.6 were selected as key input features, including total irradiance, normal irradiance, horizontal diffuse irradiance, and ambient temperature. The engineers constructed a deep belief network for unsupervised pre-training of the intrinsic mode function components. The network structure consisted of three layers of restricted Boltzmann machines, with the number of nodes in each layer set to 128, 64, and 32, respectively. The contrastive divergence algorithm was used for training, with a learning rate of 0.01, a momentum coefficient of 0.9, and 200 pre-training iterations. After pre-training, the network successfully extracted 32-dimensional abstract feature representation vectors, which captured the deep nonlinear characteristics of the power sequence.
[0077] like Figure 2 and Figure 3As shown, the engineers established a bidirectional long short-term memory network prediction framework. The network input layer receives four key meteorological feature variables and a 32-dimensional abstract feature representation vector, for a total of 36 dimensions of input. A feature attention mechanism is introduced into the input layer, learning the feature weight distribution through a two-layer fully connected neural network. The first layer contains 64 neurons and uses the ReLU activation function. The second layer outputs 36-dimensional feature attention weight coefficients, which are processed using Softmax normalization. After feature attention weighting, total irradiance and normal irradiance obtained the highest weight coefficients, at 0.31 and 0.27 respectively, while the weight coefficients for atmospheric pressure and relative humidity were only 0.06 and 0.08, achieving dynamic highlighting of key features.
[0078] The bidirectional Long Short-Term Memory (LSTM) network comprises a forward layer and a backward layer, each with three LSTM units and a hidden layer dimension of 128. The forward layer processes the input sequence in forward chronological order, capturing historical dependencies. The backward layer processes the input sequence in reverse chronological order, extracting future associations. At each time step, the forward and backward hidden states are concatenated to form a 256-dimensional bidirectional feature representation. To handle sudden changes in illumination and rapid changes in weather conditions, a dual-path temporal attention structure was constructed at the network output. A sliding window of 6 time steps is used for fast path detection, calculating the power change rate between adjacent time steps. The power change threshold is set to 8 MW every 5 minutes, and the irradiance change threshold is set to 150. Every 5 minutes, a stable learning path uses a window of 24 time steps to learn periodic temporal patterns and capture intraday light variation. The outputs of the two paths are merged with a weight of 0.4 to 0.6 to form the final temporal attention weight distribution.
[0079] During model training, technicians detected a power change rate of 12.3 MW every 5 minutes, exceeding the power surge threshold. This triggered a rapid reconstruction mechanism for sparse attention weights, recalculating the temporal attention weights using the Sparsemax function. The Sparsemax function achieves sparsity by projecting onto a probabilistic simplex, reducing the weights to zero at 19 time steps and retaining non-zero weights at only 5 key moments. The weight coefficients for these 5 moments are 0.35, 0.28, 0.19, 0.12, and 0.06, respectively, concentrated in the critical periods before and after the power surge. The fused feature vector, weighted by sparse attention, is input to a fully connected layer containing 64 neurons and 1 output node to calculate the predicted photovoltaic power output.
[0080] The technicians divided the dataset into training and test sets in a 7:3 ratio, with the training set containing 18,144 samples and the test set containing 7,776 samples. The Adam adaptive optimization algorithm was used for model training, with an initial learning rate of 0.001, an exponential decay rate of 0.9 for the first moment estimate, and an exponential decay rate of 0.999 for the second moment estimate. The mean squared error function was used as the loss function, with a batch size of 32 and a maximum of 150 training epochs. After 87 iterations, the loss function value on the training set converged to 0.0028, and the loss function value on the test set stabilized at 0.0035, indicating successful model training. The trained network was then applied to real-time weather data input to perform rolling forecasts of photovoltaic power generation for the next 15 to 60 minutes. After inverse normalization, the average absolute error of the 15-minute advance prediction is 0.87MW, the average absolute error of the 30-minute advance prediction is 1.34MW, and the average absolute error of the 60-minute advance prediction is 2.16MW, which meets the accuracy requirements for power plant dispatching and operation.
[0081] This invention utilizes wavelet decomposition to break down non-stationary photovoltaic power sequences into components at different frequency scales, effectively separating trend information from noise interference and providing more stable and regular input features for subsequent predictions. The introduction of a dual attention mechanism enables the model to dynamically focus simultaneously on both the feature and time dimensions. The feature attention mechanism adaptively identifies key influencing factors under different meteorological conditions, while the time attention mechanism accurately locates critical moments in power changes. Their synergistic effect significantly enhances the model's ability to capture complex time-varying features. The bidirectional long short-term memory network structure overcomes the limitations of unidirectional networks in extracting temporal dependencies by employing forward and backward bidirectional modeling and utilizing both historical information and future associations. The sparse attention fast reconstruction mechanism enables rapid adjustment and sparse allocation of attention weights for anomalous events such as sudden changes in illumination, allowing the model to maintain predictive stability even when facing drastic changes in meteorological conditions. Unsupervised pre-training of the deep belief network fully exploits the deep nonlinear features of the power sequence, providing high-quality feature representations for the supervised learning stage. These technological innovations work together to optimize the entire process from data preprocessing and feature extraction to model prediction. This enables the invention to enhance its adaptability to different meteorological conditions and its response speed to sudden events while ensuring prediction accuracy, providing reliable technical support for the intelligent scheduling and grid-connected operation of photovoltaic power plants.
[0082] It should be noted that the variables involved in this invention are explained in detail in Tables 2, 3, and 4.
[0083] Table 2. Variable Explanation Table (Part 1)
[0084] Table 3. Variable Explanation Table (Part Two)
[0085] Table 4. Variable Explanation Table (Part 3)
[0086] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.
Claims
1. A bidirectional LSTM photovoltaic power generation prediction method based on wavelet decomposition and dual attention, characterized in that, Historical photovoltaic (PV) output power data, total irradiance data, normal irradiance data, horizontal diffuse irradiance data, temperature data, atmospheric pressure data, and humidity data of the PV power generation system are collected and preprocessed. The optimal wavelet basis function is searched using a particle swarm optimization algorithm to perform adaptive noise-complete ensemble empirical mode decomposition on the historical PV output power data, obtaining multi-layer intrinsic mode function (IMF) components. Adaptive denoising and reconstruction of the IMF components yields the PV power trend signal and the effective high-frequency signal of PV power. Key input feature variables are extracted using the maximum information coefficient and unsupervised pre-training is performed using a deep belief network. A bidirectional long short-term memory (LSTM) network prediction framework is established, introducing a feature attention mechanism at the input layer and constructing a dual-path temporal attention structure at the output. When the power change rate or irradiance change rate exceeds a threshold, a sparse attention weight fast reconstruction mechanism is triggered. PV power prediction is completed by weighted fusion of the forward and backward hidden states.
2. The method according to claim 1, characterized in that, The preprocessing method uses interquartile range to detect and remove outliers, multiple interpolation to complete missing data, and data normalization.
3. The method according to claim 2, characterized in that, The interquartile range method determines the normal data range by calculating the first quartile and the third quartile. Data points that exceed the normal data range are considered outliers and are removed.
4. The method according to claim 3, characterized in that, The multiple imputation method generates multiple complete datasets through multiple random samplings, and calculates the average estimated value of missing values in the multiple complete datasets as the imputation result.
5. The method according to claim 4, characterized in that, Before searching for the optimal wavelet basis function, the particle swarm optimization algorithm first calculates the Shannon entropy and energy entropy values of the normalized historical photovoltaic output power data.
6. The method according to claim 5, characterized in that, The adaptive noise-complete ensemble empirical mode decomposition adds adaptive white noise at each decomposition stage and eliminates mode aliasing through ensemble averaging, decomposing historical photovoltaic output power data into a finite number of intrinsic mode function components and residual components.
7. The method according to claim 6, characterized in that, The adaptive denoising method calculates the multi-scale permutation entropy and signal complexity for each intrinsic mode function component, determines the adaptive denoising threshold based on the Bayesian risk minimization criterion, and combines meteorological data to determine the current meteorological conditions and perform filtering and reconstruction.
8. The method according to claim 7, characterized in that, The multi-scale permutation entropy value is used to quantitatively assess the complexity and regularity of intrinsic mode function components by calculating the distribution entropy value of the permutation pattern of the time series at different time scales.
9. The method according to claim 8, characterized in that, The maximum information coefficient is used to measure the strength of the nonlinear correlation between two variables. It is obtained by calculating the mutual information coefficient under different grid partitioning methods and then normalizing it.
10. The method according to claim 9, characterized in that, The deep belief network is composed of multiple layers of restricted Boltzmann machines stacked together. It is used for unsupervised pre-training through a contrastive divergence algorithm to extract abstract feature representation vectors layer by layer.
Citation Information
Cited By
Small sample electricity consumption prediction method based on mutual information feature screening
CN121858968A