A Photovoltaic Power Prediction Method Based on Dynamic Sensing LSTM
By fusing photovoltaic module surface images and environmental data using a dynamic sensing LSTM model, the problem of insufficient perception of shading status due to contaminants in photovoltaic power prediction is solved. This enables rapid response to sudden weather changes and stable model updates, thereby improving the accuracy of photovoltaic power prediction and system stability.
Patent Information
- Application Number
- CN202611126800.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-28
- Publication Date
- 2026-11-17
AI Technical Summary
Existing photovoltaic power prediction methods cannot effectively detect changes in the shading status of photovoltaic module surfaces due to contaminants, and they are slow to respond to sudden environmental changes. They are also prone to catastrophic forgetting during model updates, which affects the long-term stability and reliability of the system.
By acquiring surface images of photovoltaic modules and environmental monitoring data, we extract features of pollutants and environmental characteristics, construct a dynamic perception LSTM model, and combine incremental learning and long-term memory mechanisms to achieve dynamic weighted fusion and online updating of multi-source data.
It significantly improves the accuracy of photovoltaic power prediction, enables rapid response to sudden weather changes, reduces model oscillations, and enhances the stability and reliability of long-term operation.
Smart Images

Figure CN123117418A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of photovoltaic power generation, specifically a photovoltaic power prediction method based on dynamic sensing LSTM. Background Technology
[0002] Photovoltaic power generation, as an important component of clean energy, has been widely used globally. With the continuous growth of photovoltaic installed capacity, accurate power generation forecasting is of great significance for power system dispatch, resource optimization, and grid operation stability.
[0003] Currently, photovoltaic (PV) power prediction methods are mainly divided into physical model methods, statistical regression methods, and artificial intelligence-based prediction methods. Physical model methods rely on numerical weather forecasts and the physical parameters of PV modules to estimate power, but are limited by the accuracy of weather forecasts and the aging of module parameters, resulting in significant prediction errors. Statistical regression methods and time series models (such as ARIMA) are based on historical power data, but PV power exhibits strong nonlinearity and non-stationarity, making it difficult for these methods to fully fit its complex variation patterns. While deep learning models (such as artificial neural networks and LSTM) have been introduced into PV power prediction and have improved prediction accuracy to some extent, existing methods still generally suffer from the following shortcomings: First, they ignore the actual impact of surface contaminants on PV modules (such as dust, bird droppings, snow, and leaf shading) on power generation efficiency, relying solely on meteorological data and historical data. First, it fails to capture the power reduction effect of changes in component surface conditions on historical power data. Second, it lacks effective fusion of multi-source heterogeneous information such as historical time-series data, environmental meteorological data, and component surface image data at the feature level. Image data and environmental data are often processed independently and simply stitched together at the decision level, failing to fully utilize the correlation between different types of data. Third, it does not fully consider the continuous updating problem during the online operation phase of the model. Static models trained offline are difficult to maintain prediction accuracy in the long term, and when new samples are introduced to update the model, catastrophic forgetting can easily occur, that is, the model loses its ability to predict historical conditions while adapting to new operating conditions, affecting the stability and reliability of the system in the long term. Summary of the Invention
[0004] To address the technical problems of existing photovoltaic power prediction methods that rely solely on historical power data and meteorological data, are unable to detect changes in the shading status of photovoltaic module surfaces due to contamination, and are prone to catastrophic omissions during model updates.
[0005] This invention provides a photovoltaic power prediction method based on dynamic sensing LSTM. It extracts contaminant features from images of the photovoltaic module surface, fuses environmental features with historical power time-series features for power prediction, and triggers incremental updates based on an error threshold during online operation. Simultaneously, it introduces regularization terms and long-term memory mechanisms to maintain model stability. Specifically, the method includes the following steps:
[0006] Step S1: Sample at fixed time intervals to obtain photovoltaic module surface images, environmental monitoring data, and measured photovoltaic power values at K consecutive historical sampling times of the target photovoltaic site, and obtain the corresponding image sequence, environmental data sequence, and photovoltaic power sequence; where K is a positive integer ≥ 2;
[0007] Step S2: Extract spatial features from the images at each time point in the image sequence to obtain the spatial features of the images at each time point; extract environmental features from the data at each time point in the environmental data sequence to obtain the environmental feature vectors at each time point; perform time-series modeling on the power measurement value sequence to extract the historical time-series features at each time point.
[0008] Step S3: Dynamically weightedly fuse the image spatial features, environmental features, and historical temporal features to obtain the dynamically weighted fused features at each time point;
[0009] Step S4: Construct a time-series prediction network. Input the dynamically weighted fusion features of K consecutive historical time points into the time-series prediction network and output the predicted power value at the next sampling time. Use the measured power value at the next sampling time as a label, calculate the loss between the predicted power value and the measured power value, and update the network parameters through backpropagation until convergence to obtain the trained photovoltaic power prediction model.
[0010] Step S5: Input the real-time collected multi-source data of the time to be predicted into the photovoltaic power prediction model, and output the photovoltaic power prediction result for the future time.
[0011] Furthermore, in step S2, feature extraction is performed on the image data using a convolutional neural network to obtain image spatial features; the convolutional neural network includes a classification branch and a regression branch connected in parallel, the classification branch is used to output the identification result of the type of contaminant, and the regression branch is used to output the estimated value of the contamination area.
[0012] Furthermore, the environmental monitoring data includes irradiance, temperature, and humidity. The environmental monitoring data is used for feature extraction through a convolutional neural network. The convolutional neural network uses a one-dimensional convolution kernel to perform convolution operations on the three types of data along the time dimension, and outputs an environmental feature vector that integrates irradiance, temperature, and humidity.
[0013] Further, in step S2, the historical power time series data is used to extract features through a time series feature extraction network to obtain the historical time series features. The time series feature extraction network includes an LSTM layer and a self-attention layer. The LSTM layer takes the historical power time series sequence as input and outputs the hidden state sequence at each time step. The self-attention layer takes the hidden state sequence as input, performs self-attention weighting on the hidden state at each time step, and outputs the historical time series features.
[0014] This invention uses an LSTM model to perform time-series modeling of historical photovoltaic power sequences over K consecutive time periods, and uses a self-attention layer to weight different historical time periods, enabling the model to select key time steps with higher relevance to the current prediction task from a 24-hour historical time window, thereby reducing the impact of irrelevant historical fluctuations and noise on the prediction results.
[0015] Furthermore, the process of obtaining the dynamically weighted fusion features in step S3 is as follows:
[0016] Step S31: Extract the spatial features of the image at the k-th sampling time. Environmental characteristics and historical time sequence characteristics The features are concatenated along the feature dimension to obtain the initial fused feature vector; where k=1,2......K;
[0017] Step S32: Obtain the estimated pollution area, environmental change amplitude, and historical power fluctuation amplitude at the k-th sampling time, and construct a dynamic sensing state vector based on the above three data. ;in, Represents the dynamic sensing state vector. Indicates the historical power fluctuation range. This represents the estimated area of contamination. The magnitude of environmental change represents the distance between the current environmental feature vector and the historical environmental feature vector.
[0018] Step S33: Construct a dynamic weight generation layer, which includes at least one fully connected layer. Its input is the dynamic perception state vector, and its output is the weight scores corresponding to image features, environmental features, and historical temporal features, respectively. Softmax normalization is applied to the weight scores to obtain image feature weights, environmental feature weights, and temporal feature weights. Based on these weights, the corresponding features in the initial fusion feature vector are weighted and modulated to obtain the dynamically weighted fusion features at the k-th sampling time. The image feature weights, environmental feature weights, and temporal feature weights are obtained using the following formulas:
[0019]
[0020] The dynamic weighted fusion feature at the k-th sampling time is obtained by the following formula:
[0021]
[0022] in, Let represent the dynamic sensing state vector at the k-th sampling time. and These represent the trainable weight parameters and bias parameters of the dynamic weight generation layer, respectively. , , Let represent the image feature weights, environmental feature weights, and temporal feature weights at the k-th sampling time, respectively. , , All are non-negative real numbers and satisfy ; This represents the spatial features of the image at the k-th sampling time. This represents the environmental characteristics at the k-th sampling time. This represents the historical time-series characteristics of the k-th sampling time. Let represent the dynamically weighted fusion feature at the k-th sampling time. Here, [·] indicates concatenation along the feature dimension.
[0023] This invention sets up a dynamic weight generation layer based on the estimated contaminated area. Magnitude of environmental change and historical power fluctuation amplitude Image feature weights, environmental feature weights, and temporal feature weights are generated so that the contributions of image spatial features, environmental features, and historical temporal features can be adaptively adjusted as the running state changes.
[0024] Furthermore, during the model training phase, when new data arrives, the model parameters are updated online using an incremental learning approach; during the online prediction phase, when the online incremental update trigger condition is met, the model parameters are updated based on the new samples using an incremental learning approach.
[0025] Furthermore, the online incremental update triggering conditions include at least one of the following: the error between the photovoltaic power prediction value and the actual power generation value exceeds a preset error threshold; the change in irradiance, temperature, or humidity exceeds the corresponding environmental change threshold; the difference between the photovoltaic panel image feature vector and the historical image feature vector exceeds a preset image feature change threshold; the result of the identification of the type of contaminant changes; the change in the estimated contamination area exceeds a preset contamination area change threshold and reaches a preset periodic update time.
[0026] Furthermore, the incremental learning method specifically includes: setting up a long-term memory for storing historical representative samples; acquiring new multi-source data and corresponding measured photovoltaic power values as candidate incremental samples, wherein the multi-source data includes image data, meteorological environmental data, and historical power time-series data; evaluating the importance of the candidate incremental samples, and storing the sample in the long-term memory when the obtained importance score exceeds a preset threshold; the sample importance score is:
[0027] ,in, The importance score represents the candidate incremental sample. , , and These represent the weighting coefficients corresponding to prediction error, environmental change, image feature change, and pollution area change, respectively, and are all positive real numbers; The prediction error for online prediction samples represents the absolute error between the predicted power value and the corresponding measured power value for the current sample. The magnitude of environmental change represents the distance between the current environmental feature vector and the historical environmental feature vector. It represents the magnitude of image feature changes and the distance between the current image spatial features and historical image spatial features; The change in polluted area represents the difference between the current estimated polluted area and the historical estimated polluted area; where, , , and These represent the prediction error threshold, environmental change threshold, image feature change threshold, and pollution area change threshold, respectively. , , and All are positive real numbers.
[0028] Training is performed on the newly added samples to construct a joint loss function, which consists of the current prediction task loss function and the elastic weight consolidation regularization term. Using the joint loss function as the optimization objective, gradient descent training is performed on the newly added samples to obtain short-term update parameters. Based on the historical representative samples in the long-term memory and the optimal parameters of the old task, long-term memory parameters are obtained. The short-term update parameters and the long-term memory parameters are weighted and fused to obtain the updated model parameters.
[0029] Compared with the prior art, the present invention has the following significant advantages:
[0030] 1) This invention introduces images of the photovoltaic module surface and extracts features of dirt types and pollution coverage areas, enabling the prediction model to effectively perceive changes in the module surface condition such as dust, bird droppings, snow, and leaf obstruction, thereby improving the problem of traditional methods that rely solely on historical power or meteorological data while ignoring the actual surface condition of the module.
[0031] 2) This invention extracts environmental features such as temperature, irradiance, and humidity and calculates the magnitude of environmental changes between adjacent moments, enabling the prediction model to not only grasp the current environmental state but also effectively perceive instantaneous environmental fluctuations such as cloud cover, sudden changes in irradiance, and sudden changes in humidity, thereby significantly improving the model's ability to predict the rapid response of short-term photovoltaic power under sudden weather changes.
[0032] 3) During the online operation phase, this invention sets error thresholds, environmental change thresholds, image feature change thresholds, and pollution area change thresholds, and filters incremental samples based on sample importance scores, so that the model is updated only when the prediction error is large or the photovoltaic site status changes significantly, thus avoiding model oscillations caused by frequent updates.
[0033] 4) This invention introduces elastic weights to consolidate regularization terms and long-term memory mechanisms during incremental learning. It constrains important model parameter changes for old tasks through Fisher information matrix and saves historical representative samples through long-term memory. This can reduce the risk of catastrophic forgetting while adapting to new samples and improve the stability of the model in long-term operation. Attached Figure Description
[0034] Figure 1 This is a flowchart of the photovoltaic power prediction method based on dynamic sensing LSTM of the present invention. Detailed Implementation
[0035] To more clearly illustrate the technical solution of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the scope of protection of the present invention.
[0036] Example 1
[0037] like Figure 1 As shown, this invention discloses a photovoltaic power prediction method based on dynamic sensing LSTM. In this embodiment, a distributed photovoltaic power station is selected as the target photovoltaic site. This photovoltaic site has a rated capacity of 500kW and is equipped with a fixed photovoltaic module surface image acquisition device, an environmental monitoring device, and an inverter power acquisition device. The image acquisition device is used to acquire images of the photovoltaic module surface, the environmental monitoring device is used to acquire temperature, irradiance, and humidity, and the inverter power acquisition device is used to acquire measured values of photovoltaic power.
[0038] In this embodiment, the data sampling time interval Δt is set to 15 minutes, and sampling data from 96 consecutive time points are selected, i.e., K=96; the corresponding historical time window length is 96 × 15 minutes = 24 hours; a sampling interval is measured in advance for prediction, i.e., the photovoltaic power at the next sampling time is predicted based on the data of the current time and the previous 96 consecutive sampling times. The method includes the following steps.
[0039] Step S1: Collect historical photovoltaic module surface images, historical environmental monitoring data, and historical photovoltaic power measured values at 96 consecutive time points at the target photovoltaic site to obtain the corresponding image sequence, environmental data sequence, and photovoltaic power sequence.
[0040] Let the k-th sampling time be... The measured photovoltaic power value is Environmental monitoring data is The surface image of the photovoltaic module is Then the sampling time is represented as:
[0041] K
[0042] in, Indicates the initial sampling time. Δt represents the sampling sequence number, and Δt represents the data sampling time interval.
[0043] In this embodiment, environmental monitoring data Composed of temperature, irradiance, and humidity, it is represented as:
[0044]
[0045] in, This represents the temperature at the k-th sampling time. This represents the irradiance at the k-th sampling time. This represents the humidity at the k-th sampling time. (The last part, "current time," appears to be a typo and can be left as is.) Using the endpoint as the starting point, select K consecutive historical photovoltaic power measurement values from previous sampling times to construct a historical photovoltaic power sequence:
[0046] Historical photovoltaic module surface image sequence at K consecutive sampling times and historical environmental monitoring data sequences They are represented as follows:
[0047]
[0048]
[0049] Among them, historical photovoltaic module surface image sequences are used in the offline training phase to enhance the first feature extraction network's learning of different contamination states, and the current image... The data is used to characterize the current surface state of components during the online prediction phase; historical environmental monitoring data sequences are used by the second feature extraction network to extract environmental change trends, and the current environmental monitoring data... Used to characterize the current state of the environment.
[0050]
[0051] in, Indicates the current time The historical photovoltaic power series is the endpoint, and K represents the length parameter of the historical time series.
[0052] This represents the measured photovoltaic power at the k-th sampling time.
[0053] Image of the photovoltaic module surface at the current moment Current environmental monitoring data and the measured value of photovoltaic power at the next sampling time Compared with historical photovoltaic power series Combined, forming the kth training sample:
[0054]
[0055] in, This represents the k-th training sample. Represents the historical photovoltaic power sequence, This represents the current image of the photovoltaic module surface. This represents the environmental monitoring data at the current moment. This represents the actual photovoltaic power at the next sampling time.
[0056] When the image acquisition time and the power acquisition time are not the same, let the acquisition time of the j-th frame be... Then select with The image with the smallest time difference is used as the image at the current time:
[0057]
[0058] in, Indicates the current power sampling time The closest image frame number, This indicates the acquisition time of the j-th frame of the image.
[0059] like If the time interval is greater than 2 minutes, the image is determined to be out of sync with the power data, and the previous valid image is used as a replacement; if the image is unusable for more than 3 consecutive sampling times, the data segment is discarded.
[0060] Time alignment is performed on environmental monitoring data. If a certain environmental factor e occurs at adjacent valid sampling times... and The values are respectively and ,and Then linear interpolation is used to obtain Environmental factor values at any given time:
[0061]
[0062] in, Indicates the interpolated result Environmental factor values at any time and They represent The effective environmental sampling times that are adjacent to each other.
[0063] Anomaly detection is performed on the measured photovoltaic power values. Assume the rated capacity of the target photovoltaic site is... The allowable deviation coefficient δ is taken as 0.05, and the following condition is met: Abnormal power value:
[0064]
[0065] Isolated anomalous power values are replaced by linear interpolation of adjacent effective power values; for data segments with continuous anomalous power or continuous missing power for more than 30 minutes, no training samples are constructed. The measured photovoltaic power values are normalized to their rated capacity to obtain:
[0066]
[0067] in, This represents the normalized photovoltaic power value.
[0068] The normalized historical photovoltaic power series is represented as follows:
[0069]
[0070] Z-score standardization is applied to the environmental monitoring data. For the r-th environmental factor, its mean in the training set is calculated. and standard deviation The standardized result is obtained by the following formula:
[0071]
[0072] in, This represents the standardized value of the r-th type of environmental factor at the k-th sampling time. This indicates the corresponding original value. and Let represent the mean and standard deviation of the r-th environmental factor in the training set, respectively, and ε be a very small positive number to prevent the denominator from being zero.
[0073] Where ε takes The standardized environmental monitoring data are represented as follows:
[0074]
[0075] Image of the photovoltaic module surface at the current moment Preprocessing is performed, including photovoltaic module area cropping, size normalization, brightness correction, and pixel normalization. In this embodiment, the image is scaled to 224×224 pixels, retaining the RGB three channels. The original pixel values for the u-th row, v-th column, and c-th channel are set to... The normalized pixel value is:
[0076]
[0077] in, This represents the original pixel value of the image at row u, column v, and channel c. This represents the normalized pixel value.
[0078] The training samples are divided into training set, validation set, and test set in chronological order. In this embodiment, the first 70% of the samples are used as the training set, the middle 10% as the validation set, and the last 20% as the test set; using chronological order can prevent future data leakage into the training phase.
[0079] Step S2: Using the first feature extraction network, spatial features are extracted from the images at each moment of the historical photovoltaic module surface image sequence to obtain the spatial features of the images at each moment. These features cover the information on the type of contaminants and the distribution characteristics of the contamination coverage area. Using the second feature extraction network, environmental features are extracted from the data at each moment of the historical environmental data sequence to obtain the environmental feature vector at each moment. Using the temporal feature extraction network, temporal modeling is performed on the historical power measurement value sequence to extract the historical temporal features at each moment.
[0080] In this embodiment, the first feature extraction network is a convolutional neural network with an input size of 224×224×3, including a first convolutional block, a second convolutional block, a third convolutional block, a global average pooling layer, a pollutant classification branch, and a pollution area regression branch.
[0081] The first convolutional block consists of a convolutional layer Conv1, a batch normalization layer, a ReLU activation layer, and a max pooling layer Pool1. Conv1 has a 3×3 kernel size, 32 kernels, a stride of 1, and padding of 1. Pool1 has a 2×2 pooling window with a stride of 2. The second convolutional block consists of a convolutional layer Conv2, a batch normalization layer, a ReLU activation layer, and a max pooling layer Pool2. Conv2 has a 3×3 kernel size, 64 kernels, a stride of 1, and padding of 1. Pool2 has a 2×2 pooling window with a stride of 2.
[0082] The third convolutional block includes a convolutional layer (Conv3), a batch normalization layer, a ReLU activation layer, and a max pooling layer (Pool3). The Conv3 convolutional kernel size is 3×3, the number of kernels is 128, the stride is 1, and the padding is 1. The Pool3 pooling window is 2×2 with a stride of 2. Based on these parameters, the input image, after passing through the first convolutional block, yields a 112×112×32 feature map; after passing through the second convolutional block, it yields a 56×56×64 feature map; and after passing through the third convolutional block, it yields a 28×28×128 high-order image feature map.
[0083] For any convolutional layer, let the first... The layer input feature map is , No. Each convolutional kernel is , bias is Then the first layer The output feature maps are:
[0084]
[0085] in, Indicates the first The m-th output feature map of layer 1 Indicates the first The m-th convolutional kernel in layer m, Indicates the first Layer input feature map, The symbol represents the bias term, φ represents the activation function, and * represents the convolution operation. The ReLU activation function is:
[0086]
[0087] in, This represents the linear output value of a convolutional or fully connected layer. This represents the output value after ReLU activation.
[0088] The formula for calculating the max pooling layer is:
[0089]
[0090] in, Let Ω represent the value of the m-th feature map at position (u, v) after pooling. Ω represents the 2×2 pooling window. The 28×28×128 high-order image feature map output from the third convolutional block is input into the global average pooling layer to obtain a 128-dimensional image space feature vector. Let the size of the high-order image feature map be H×W, then the m-th dimension image space feature is:
[0091]
[0092] in, Let H represent the m-th dimension of the image space features, and let W represent the height and width of the higher-order image feature map, respectively. Indicates the position of the m-th feature map. The eigenvalue at that location.
[0093] The image spatial feature vector is represented as:
[0094]
[0095] in, Let represent the image spatial feature vector at the k-th sampling time, with a dimension of 128.
[0096] The soiling classification branch uses a fully connected layer with 128 input dimensions and 5 output dimensions. The five soiling states are: no soiling, dust, bird droppings, snow, and leaf cover. Let the classification score for the s-th soiling state be... Then the probability of the s-th type of contamination state is:
[0097]
[0098] in, This represents the predicted probability of the s-th type of contamination state. This represents the classification score for the s-th type of contamination. Indicates the first Classification score corresponding to each type of contamination state; Index representing the category of contamination status; =1,2,...,5, It is a natural exponential function.
[0099] Results of soil type identification for:
[0100]
[0101] The contaminated area regression branch uses a fully connected layer with an input dimension of 128 and an output dimension of 1, and outputs the estimated contaminated area value through a sigmoid function. :
[0102]
[0103] in, This represents the estimated area of contamination. This represents the linear output of the pollution area regression branch.
[0104] If the actual soiling category label is The actual proportion of polluted area is Then the image-assisted training loss is:
[0105]
[0106] in, This represents the image-assisted training loss. Indicates the true type of soiled material on the label. Indicates the area regression loss weights. =0.5. Through the above structure, the first feature extraction network can simultaneously obtain information on the type of contaminants and the distribution characteristics of the contamination coverage area.
[0107] In this embodiment, the second feature extraction network is a one-dimensional convolutional neural network. The input is standardized environmental monitoring data from K consecutive time steps, and the input matrix size is 96×3. The first one-dimensional convolutional layer ConvE1 has a kernel size of 3, a number of kernels of 16, a stride of 1, and padding of 1. The second one-dimensional convolutional layer ConvE2 has a kernel size of 3, a number of kernels of 32, a stride of 1, and padding of 1. After global average pooling, a 32-dimensional environmental feature vector is obtained.
[0108] The formula for calculating a one-dimensional convolutional layer is:
[0109]
[0110] in, Indicates the first The nth output environmental feature sequence of layer 1 This represents the nth one-dimensional convolution kernel. This represents the sequence of environmental features from the previous layer.
[0111] The environmental feature vector is obtained after global average pooling:
[0112]
[0113] in, Let represent the environmental feature vector at the k-th sampling time, with a dimension of 32.
[0114] To characterize dynamic environmental changes, the magnitude of environmental change is calculated:
[0115]
[0116] in, This represents the magnitude of environmental change at the k-th sampling time. Indicates the category of environmental factors.
[0117] In this embodiment, the time-series feature extraction network adopts the LSTM model, and its input is the normalized historical photovoltaic power sequence. The sequence length is 96, the input dimension is 1; the number of LSTM layers is 2, the hidden state dimension is 64, and the Dropout ratio is 0.2. For the j-th time step, the computation process of the LSTM unit is as follows:
[0118]
[0119] in, This represents the output of the forget gate in the LSTM at time step j. and These represent the forget gate weight matrix and the bias term, respectively.
[0120]
[0121] in, This represents the input gate output of the LSTM at time step j. and These represent the input gate weight matrix and the bias term, respectively.
[0122]
[0123] in, This represents the candidate memory unit at the j-th time step. and These represent the weight matrix and bias term of the candidate memory unit, respectively.
[0124]
[0125] in, This represents the state of the memory cell at time step j. ⊙ represents the state of the memory cell at the previous time step, and ⊙ represents element-wise multiplication.
[0126]
[0127] in, This represents the output gate of the LSTM at time step j. and These represent the output gate weight matrix and the bias term, respectively.
[0128]
[0129] in, This represents the hidden state at the j-th time step, used to form the temporal features of the historical power sequence.
[0130] The LSTM output hidden state sequence is:
[0131]
[0132] in, Let represent the LSTM hidden state sequence corresponding to the k-th training sample.
[0133] The hidden state sequence output by the LSTM is input into the self-attention layer, where the query vector, key vector, and value vector are all 64-dimensional. For each hidden state... calculate:
[0134]
[0135] in, , and Let these represent the query vector, key vector, and value vector corresponding to the hidden state at time step j, respectively. , and These represent the corresponding mapping matrices.
[0136] Attention score and attention weight are as follows:
[0137]
[0138] in, This represents the attention score between the j-th time step and the m-th time step; Let represent the key vector corresponding to the hidden state at the m-th time step, and Represents the key vector transpose; This represents the scaling factor.
[0139]
[0140] in, This represents the normalized attention weights.
[0141] Using the last time step as the prediction query, we obtain 64-dimensional historical time-series features:
[0142]
[0143] in, This represents the historical time series feature corresponding to the k-th sampling time, with a dimension of 64.
[0144] Step S3: Perform dynamic weighted fusion of image spatial features, environmental features, and historical temporal features to obtain the dynamic weighted fused features at each time point.
[0145] 128-dimensional image space feature vector 32-dimensional environmental feature vector and 64-dimensional historical time series features The concatenation yields an initial 224-dimensional multimodal fusion feature vector:
[0146]
[0147] in, This represents the initial multimodal fusion feature vector, which is obtained by concatenating image spatial features, environmental features, and historical temporal features.
[0148] Calculate the historical power fluctuation range:
[0149]
[0150] in, Indicates the historical power fluctuation range. This represents the normalized power mean within a historical time window.
[0151]
[0152] Constructing a dynamic sensing state vector:
[0153]
[0154] in, This represents the dynamic sensing state vector, derived from the estimated contaminated area. Magnitude of environmental change and historical power fluctuation amplitude composition.
[0155] Construct a dynamic weight generation layer, which includes at least one fully connected layer, to... Input the dynamic weight generation layer to obtain image feature weights. Environmental feature weights and time series feature weights The image feature weights, environmental feature weights, and temporal feature weights are obtained using the following formulas:
[0156]
[0157] The dynamic weighted fusion feature at the k-th sampling time is obtained by the following formula:
[0158]
[0159] in, Let represent the dynamic sensing state vector at the k-th sampling time. and These represent the trainable weight parameters and bias parameters of the dynamic weight generation layer, respectively. , , Let represent the image feature weights, environmental feature weights, and temporal feature weights at the k-th sampling time, respectively. , , All are non-negative real numbers and satisfy ; This represents the spatial features of the image at the k-th sampling time. This represents the environmental characteristics at the k-th sampling time. This represents the historical time-series characteristics of the k-th sampling time. This represents the dynamically weighted fusion feature at the k-th sampling time. Here, [·] indicates concatenation along the feature dimension.
[0160] in, This represents the dynamic weighted fusion characteristic. When the estimated contaminated area... Increase the image feature weights when the size is increased. When the magnitude of environmental change When increasing, increase the weight of environmental features. When the historical power fluctuation amplitude Increase the weight of time series features when the value increases. .
[0161] Will The input feature mapping layer is a fully connected layer with an input dimension of 224 and an output dimension of 128. The calculation formula is as follows:
[0162]
[0163] in, This represents the fused features after processing by the feature mapping layer. and These represent the feature mapping layer weight matrix and bias term, respectively.
[0164] Step S4: Construct a time-series prediction network. Input the dynamically weighted fusion features of K consecutive historical time points into the time-series prediction network and output the predicted power value at the next sampling time. Use the measured power value at the next sampling time as a label, calculate the loss between the predicted power value and the measured power value, and update the network parameters through backpropagation until convergence to obtain the trained photovoltaic power prediction model.
[0165] In this embodiment, the temporal prediction network is a fully connected neural network, including FC1, FC2, and an output layer; FC1 has an input dimension of 128 and an output dimension of 64, FC2 has an input dimension of 64 and an output dimension of 32, and the output layer has an input dimension of 32 and an output dimension of 1. The calculation process is as follows:
[0166]
[0167] in, This indicates the prediction of the output of the first fully connected layer of the network. and These represent the weight matrix and bias term of this layer, respectively.
[0168]
[0169] in, This indicates the output of the second fully connected layer of the prediction network. and These represent the weight matrix and bias term of this layer, respectively.
[0170]
[0171] in, This represents the normalized photovoltaic power prediction value at the next sampling time.
[0172] By inversely normalizing the normalized prediction value, we obtain the photovoltaic power prediction value at the next sampling time:
[0173]
[0174] in, This represents the predicted photovoltaic power after inverse normalization.
[0175] During the training phase, the mean squared error between the predicted and actual values is the primary optimization objective. For N training samples, the prediction loss is:
[0176]
[0177] in, denoted as the prediction loss, and N represents the number of training samples.
[0178] The current prediction task loss is:
[0179]
[0180] in, This indicates the current predicted task loss. Represents the image-assisted loss weights, where, The initial learning rate is set to 0.2. In this embodiment, the Adam optimizer is used to train the model, with an initial learning rate of 0.001, a batch size of 64, and a maximum number of training epochs of 100. If the validation set loss does not decrease for 10 consecutive epochs, training is stopped early.
[0181] After the model training is complete, save the parameters of the first feature extraction network, the second feature extraction network, the LSTM model, the self-attention layer, the dynamic weight generation layer, the feature mapping layer, and the prediction network, and also save the environment-normalized parameters. , and rated capacity This is for use during the online prediction phase.
[0182] Step S5: Collect the surface image of the photovoltaic modules and environmental data of the target photovoltaic site at the current moment, and extract the image feature vector and environmental feature vector; at the same time, obtain the historical photovoltaic power data of the K consecutive moments preceding the current moment, and input it into the LSTM model for time series modeling to obtain the historical time series feature representation; fuse the historical time series feature representation with the image feature vector and environmental feature vector at the current moment to obtain the fused feature; input the fused feature into the fully connected prediction network to output the photovoltaic power prediction value at the future moment; when the online incremental update trigger condition is met, update the model parameters based on the new samples using an incremental learning method.
[0183] The actual photovoltaic power at the next sampling moment Upon arrival, calculate the prediction error:
[0184]
[0185] in, This represents the prediction error of the k-th online prediction sample.
[0186] If satisfied > This triggers an online incremental update. In this embodiment... Take 8% of the rated capacity. The environmental change triggering condition is:
[0187]
[0188] in, The value is set to 1.5; the triggering condition for image feature changes is:
[0189]
[0190] in, The threshold is set to 0.8; the trigger condition for changes in contaminated area is:
[0191]
[0192] in, Set the value to 0.05; when any one of the following conditions is met—prediction error, environmental change, image feature change, or pollution area change—the current sample is used as a candidate incremental sample.
[0193] Furthermore, when the identification result of the type of contaminant changes, an online incremental update is also triggered, with the following triggering conditions:
[0194]
[0195] in, and These represent the soil type identification results at the current sampling time and the previous sampling time, respectively.
[0196] In addition, if the aforementioned error, environmental, image, or contamination area triggering conditions do not occur, but the preset cycle has elapsed since the last model update... Then, periodic incremental updates are performed. In this embodiment, Take 7 days.
[0197] The importance of candidate incremental samples is evaluated, and the sample importance score is:
[0198]
[0199] in, The importance score represents the candidate incremental sample. , , and These represent the weighting coefficients corresponding to prediction error, environmental change, image feature change, and pollution area change, respectively. , , and These represent the prediction error threshold, environmental change threshold, image feature change threshold, and pollution area change threshold, respectively. Take 8% of the rated capacity. Take 1.5, Take the sum of 0.8 Take 0.05.
[0200] in, All are taken as 0.25. If If the value is greater than 1, then the sample will be stored in long-term memory.
[0201] Long-term memory capacity set One sample. In this embodiment... Take 2000; when the long-term memory is not full, directly store important samples; when the long-term memory is full, retain scores based on the samples. Replace the sample with the lowest score.
[0202] During incremental learning, elastic weights are introduced to reinforce the regularization term, and the joint loss function is:
[0203]
[0204] in, For the joint loss function; The loss function for the current prediction task; The regularization coefficient is set to 10. This refers to the i-th parameter to be updated in the current model. The i-th optimal parameter obtained from training on the old task; This represents the importance weight of the i-th parameter in the Fisher information matrix.
[0205] The importance weights of the parameters in the Fisher information matrix are estimated by the following formula:
[0206]
[0207] in, This represents the importance weight of the i-th parameter in the Fisher information matrix. Indicates the number of historically representative samples. and These represent the input and the actual output of the nth historical sample, respectively. Indicates the input to the model and parameters Under the condition that the predicted output is the true output value The conditional probability; This represents the number of historical representative samples in long-term memory used to calculate the importance weights of the parameters. For the model input of the nth historical representative sample, This corresponds to the actual power value.
[0208] The model parameters are updated using a short-term learner and a long-term memory mechanism. First, short-term updated parameters are obtained by training on newly added samples. Then, based on the historical representative samples in long-term memory and the optimal parameters of the old task, the long-term memory parameters are obtained. Finally, the updated model parameters are obtained by merging them:
[0209]
[0210] Where α∈[0,1]. In this embodiment, the initial value of α is 0.3; when or When α is adjusted to 0.6; when the prediction error is less than 0.6 for 10 consecutive sampling times. When α is adjusted to 0.2.
[0211] After updating the model parameters, the average prediction error before and after the update is calculated on the validation samples and long-term memory samples. If the average prediction error after the update is not greater than 1.05 times the average prediction error before the update, then the model is accepted. Use it as the current model parameter; otherwise, reduce α and update again, or revert to the model parameter before the update.
[0212] When the long-term memory capacity reaches its limit, replacements are made according to the sample retention score. Let the sample diversity score be... Then the sample retention score is:
[0213]
[0214] in, This represents the sample retention score in long-term memory, and γ represents the balance coefficient between the importance score and the diversity score. This indicates the sample diversity score.
[0215] Where γ is set to 0.7; long-term memory is preferentially retained. A larger sample size ensures both sample importance and sample diversity.
[0216] Example 2
[0217] The difference between this embodiment and Embodiment 1 is that the prediction is made 4Δt in advance, that is, the photovoltaic power is predicted 1 hour after the current moment. At this time, the labels in the training samples are changed from... Replace with The training samples are represented as follows:
[0218]
[0219] The predicted network output is:
[0220]
[0221] in, This represents the normalized photovoltaic power prediction value output by the prediction network. This represents the predicted actual photovoltaic power after inverse normalization. This represents the actual photovoltaic power value at the corresponding sampling time.
[0222] Except for the difference in predicted labels and output time, the data preprocessing, first feature extraction network, second feature extraction network, LSTM temporal modeling, dynamic perception fusion and online incremental update process in this embodiment are the same as in embodiment one.
[0223] In summary, this invention introduces photovoltaic module surface images and environmental monitoring data into historical power sequences to construct a multimodal fusion prediction architecture. A first feature extraction network extracts the types of pollutants and the distribution features of the polluted coverage area, enabling the model to perceive the impact of changes in module surface conditions such as dust, bird droppings, snow, and leaf shading on power generation. A second feature extraction network extracts environmental features such as temperature, irradiance, and humidity, and calculates the magnitude of environmental changes at adjacent time points, enhancing the model's response to sudden weather events such as cloud cover and abrupt changes in irradiance. LSTM combined with a self-attention mechanism is used for time-series modeling and key time-step weighting of historical power sequences, reducing the impact of irrelevant historical fluctuations and noise. A dynamic weight generation layer is set up to adaptively adjust the multi-source feature fusion weights based on the polluted area, the magnitude of environmental changes, and the magnitude of power fluctuations, achieving stable prediction performance under different operating conditions.
[0224] Furthermore, this invention employs multi-dimensional threshold filtering to select incremental samples and updates them as needed during the online phase. Combined with elastic weight consolidation and long-term memory replay strategies, it adapts to new data while suppressing catastrophic forgetting, ensuring long-term operational reliability. The network module parameters of this invention are clearly configured, the data flow is clear, and it has strong engineering practicality, facilitating direct deployment and implementation.
[0225] This invention is not limited to the specific embodiments described above. Any modifications, variations, and equivalent substitutions made by those skilled in the art without departing from the core concept of this invention should fall within the protection scope of this invention. The technical solutions disclosed in this invention can be widely applied to power prediction systems for various photovoltaic power plants, and are of significant practical importance for improving the intelligence level of photovoltaic grid-connected operation and the accuracy of grid dispatch. All equivalent transformations, improvements, or combinations made based on the above technical solutions of this invention are within the protection scope of this invention.
Claims
1. A photovoltaic power prediction method based on dynamic sensing LSTM, characterized in that, The method includes the following steps: Step S1: Sample at fixed time intervals to obtain photovoltaic module surface images, environmental monitoring data, and measured photovoltaic power values at K consecutive historical sampling times of the target photovoltaic site, and obtain the corresponding image sequence, environmental data sequence, and photovoltaic power sequence; where K is a positive integer ≥ 2; Step S2: Extract image spatial features from the images at each time point in the image sequence to obtain the image spatial features at each time point; extract environmental features from the data at each time point in the environmental data sequence to obtain the environmental feature vector at each time point; perform time-series modeling on the power measurement value sequence to extract the historical time-series features at each time point. Step S3: Dynamically weightedly fuse the image spatial features, environmental features, and historical temporal features to obtain the dynamically weighted fused features at each time point; Step S4: Construct a time-series prediction network. Input the dynamically weighted fusion features of K consecutive historical time points into the time-series prediction network and output the predicted power value at the next sampling time. Use the measured power value at the next sampling time as a label, calculate the loss between the predicted power value and the measured power value, and update the network parameters through backpropagation until convergence to obtain the trained photovoltaic power prediction model. Step S5: Input the real-time collected multi-source data of the time to be predicted into the photovoltaic power prediction model, and output the photovoltaic power prediction result for the future time.
2. The method according to claim 1, characterized in that, In step S2, the image data is used to extract features through a first convolutional neural network to obtain image spatial features. The first convolutional neural network includes a classification branch and a regression branch connected in parallel. The classification branch is used to output the identification result of the type of contaminant, and the regression branch is used to output the estimated value of the contamination area.
3. The method according to claim 1, characterized in that, The environmental monitoring data includes irradiance, temperature, and humidity. The environmental monitoring data is used for feature extraction through a second convolutional neural network. The second convolutional neural network uses a one-dimensional convolution kernel to perform convolution operations on the three types of data along the time dimension, and outputs an environmental feature vector that integrates irradiance, temperature, and humidity.
4. The method according to claim 1, characterized in that, In step S2, the historical power time series data is used to extract features through a time series feature extraction network to obtain the historical time series features. The time series feature extraction network includes an LSTM layer and a self-attention layer. The LSTM layer takes the historical power time series sequence as input and outputs the hidden state sequence at each time step. The self-attention layer takes the hidden state sequence as input, performs self-attention weighting on the hidden state at each time step, and outputs the historical time series features.
5. The method according to claim 1, characterized in that, The process of obtaining the dynamically weighted fusion features in step S3 is as follows: Step S31: Extract the spatial features of the image at the k-th sampling time. Environmental characteristics and historical time sequence characteristics The features are concatenated along the feature dimension to obtain the initial fused feature vector; where k is a positive integer and k=1,2......K; Step S32: Obtain the estimated pollution area, environmental change amplitude, and historical power fluctuation amplitude at the k-th sampling time, and construct a dynamic sensing state vector based on the above three data. ;in, Represents the dynamic sensing state vector. Indicates the historical power fluctuation range. This represents the estimated area of contamination. The magnitude of environmental change; Step S33: Construct a dynamic weight generation layer, which includes at least one fully connected layer. It takes the dynamic perception state vector as input and outputs the weights of the three types of features: image, environment, and time series. The weight scores are normalized by Softmax to obtain the weights of each feature. The corresponding features in the initial fusion feature vector are weighted and modulated using the weights of each feature to generate the dynamic weighted fusion feature at the k-th sampling time, which is represented as follows. in, , , Let represent the image feature weights, environmental feature weights, and temporal feature weights at the k-th sampling time, respectively. , , All are non-negative real numbers and satisfy ; This represents the spatial features of the image at the k-th sampling time. This represents the environmental characteristics at the k-th sampling time. This represents the historical time-series characteristics of the k-th sampling time. This represents the dynamic weighted fusion feature at the k-th sampling time.
6. The method according to claim 1, characterized in that, The time-series prediction network is a fully connected neural network, comprising a first fully connected layer, a second fully connected layer, and an output layer connected in sequence. The dynamically weighted fusion features are nonlinearly transformed by the first and second fully connected layers and then mapped by the output layer to the predicted power value at the next sampling time.
7. The method according to claim 1, characterized in that, During the model training phase, when new data arrives, the model parameters are updated online using an incremental learning approach. During the online prediction phase, when the online incremental update trigger condition is met, the model parameters are updated based on the new samples using an incremental learning approach.
8. The method according to claim 7, characterized in that, The online incremental update triggering conditions include at least one of the following: the error between the photovoltaic power prediction value and the actual power generation value exceeds a preset error threshold; the change in irradiance, temperature or humidity exceeds the corresponding environmental change threshold; the difference between the photovoltaic panel image feature vector and the historical image feature vector exceeds a preset image feature change threshold; the result of the identification of the type of contaminant changes; the change in the estimated contamination area exceeds a preset contamination area change threshold and reaches a preset periodic update time.
9. The method according to claim 7, characterized in that, The incremental learning method specifically includes: setting up a long-term memory for storing historical representative samples; acquiring new multi-source data and corresponding measured photovoltaic power values as candidate incremental samples, wherein the multi-source data includes image data, meteorological environmental data, and historical power time-series data; evaluating the importance of the candidate incremental samples, and storing the sample in the long-term memory when the obtained importance score exceeds a preset threshold; the sample importance score is: ,in, The importance score represents the candidate incremental sample. , , and These represent the weighting coefficients corresponding to prediction error, environmental change, image feature change, and pollution area change, respectively, and are all positive real numbers; The prediction error for online prediction samples; The magnitude of environmental change; Indicates the magnitude of changes in image features; This represents the change in the area of pollution; among which, , , and These represent the prediction error threshold, environmental change threshold, image feature change threshold, and pollution area change threshold, respectively. , , and All are positive real numbers; then, training is performed based on the newly added samples to construct a joint loss function that includes the current prediction task loss function and the elastic weight consolidation regularization term; using the joint loss function as the optimization objective, gradient descent training is performed on the newly added samples to obtain short-term update parameters; based on historical representative samples in long-term memory and the optimal parameters of the old task, long-term memory parameters are obtained; the short-term update parameters and long-term memory parameters are weighted and fused to obtain the updated model parameters.
10. The method according to claim 9, characterized in that, For the short-term update parameters and the long-term memory parameters Perform weighted fusion to obtain updated model parameters. Specifically Where α∈[0,1], For short-term parameter updates; These are parameters for long-term memory.
