Transform model-based photovoltaic power generation prediction method
Through the photovoltaic power generation prediction method based on the Transformer model, combined with the multi-head self-attention layer and the feedforward neural network layer, the existing photovoltaic power generation prediction problem is solved, and high-precision photovoltaic power generation prediction is achieved, supporting the stable operation of the power system and energy management optimization.
Patent Information
- Application Number
- CN202510433535.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-08
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2045-04-08
AI Technical Summary
The existing photovoltaic power generation prediction methods have low prediction accuracy, making it difficult to effectively integrate multi-source data, and lack of ability to handle complex factors, which makes it difficult to ensure power system scheduling and grid stability.
Using the photovoltaic power generation prediction method based on the Transformer model, the historical power generation power data, meteorological data and time information of the photovoltaic power station are collected and preprocessed, and the k-means clustering algorithm and Pearson correlation coefficient and MSSIM indicators are combined to screen similar time periods, and a photovoltaic power prediction model of the multi-head self-attention layer and the feedforward neural network layer is constructed.
It significantly improves the prediction accuracy of photovoltaic power generation, reduces prediction errors, enhances the stability and generalization capabilities of the model, helps power system scheduling and energy management to optimize grid operation, and improves energy utilization efficiency.
Smart Images

Figure CN120450104A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of photovoltaic power generation, and in particular to a photovoltaic power generation prediction method based on a Transformer model. Background Art
[0002] With the growing global demand for clean energy, photovoltaic power generation has attracted widespread attention as a key renewable energy source. However, the power output of photovoltaic power generation is affected by a variety of factors, such as solar radiation intensity, temperature, wind speed, humidity, and weather changes, resulting in significant uncertainty and volatility. This poses significant challenges to power system scheduling, stable grid operation, and efficient energy management.
[0003] In existing technologies, traditional photovoltaic power generation prediction methods, such as physical model methods, require accurate geographic information, photovoltaic equipment parameters and complex meteorological data. The calculation process is cumbersome and has extremely high requirements for data quality. The prediction accuracy is often limited by the accuracy and completeness of the data. Statistical model methods, such as time series analysis, can capture the temporal characteristics of data to a certain extent, but have limited processing capabilities for complex meteorological factors and nonlinear relationships, and are difficult to adapt to changing environmental conditions.
[0004] Therefore, it is urgent to develop a method that can effectively integrate multi-source data, accurately capture the complex relationships between data, and improve the accuracy of photovoltaic power generation prediction. Summary of the Invention
[0005] In response to the problems in the related technology, the present invention proposes a photovoltaic power generation prediction method based on the Transformer model, which overcomes the problems of low prediction accuracy and insufficient ability to handle complex factors in the existing technology, and realizes high-precision prediction of photovoltaic power generation.
[0006] The technical solution of the present invention is achieved as follows:
[0007] A photovoltaic power generation prediction method based on a Transformer model includes the following steps:
[0008] Collect historical power generation data, meteorological data, and time information of the photovoltaic power station, preprocess the collected data to remove erroneous data and outliers, and perform normalization processing to map data of different ranges to specific intervals, wherein the meteorological data includes at least solar radiation intensity, temperature, wind speed, and humidity;
[0009] Calibrate the time sliding window, including calibrating the time resolution and prediction duration of the ultra-short-term power forecast; analyze the historical photovoltaic power data based on the k-means clustering algorithm, divide the photovoltaic power data of each period into different weather types, and select the period with the same weather type as the current day to be predicted from the historical data as the preliminary similar period;
[0010] The Pearson correlation coefficient of photovoltaic power generation curves during different daily search periods was calculated to evaluate the similarity of power series fluctuations during the search period. Using satellite remote sensing data, the sliding window method was used to calculate the mean structural similarity index (MSSIM) of cloud coverage during the forecast period to evaluate the similarity of weather changes during the forecast period.
[0011] Calibrate each preliminary similar period, and calculate the comprehensive similarity index S based on its Pearson correlation coefficient r and MSSIM value m with the current period to be predicted, which is expressed as
[0012] S = α × r + β × m;
[0013] Among them, α is the Pearson correlation coefficient, β is the weight of MSSIM, and α+β=1;
[0014] Sort all preliminary similar periods from largest to smallest according to the comprehensive similarity index S, select the period with the largest comprehensive similarity index S as the most similar period, and construct the power data of similar periods as the model input according to the requirements of the photovoltaic power prediction model;
[0015] A photovoltaic power prediction model is constructed based on the Transformer model. The model includes an input layer, a multi-head self-attention layer, a feedforward neural network layer, and an output layer. The preprocessed data is input into the model for training, the loss function is calibrated as the mean square error, and the model parameters are updated using the Adam optimizer. After the photovoltaic power prediction model is trained, the current environmental data is input into the model to obtain the current power prediction data.
[0016] Furthermore, the calibrated time sliding window includes: when calibrating the time resolution to 15 minutes to predict the photovoltaic power generation in the next 4 hours, the current time is taken as t=0, the period from t-15 to t is used as the search period, and the period from t+1 to t+16 is used as the period to be predicted. The sliding window advances backward with a step size of 1 timestamp, and each day is divided into 96 periods.
[0017] Furthermore, the Pearson correlation coefficient is calculated and expressed as:
[0018]
[0019] in, ris the Pearson correlation coefficient, v1 and v2 represent two photovoltaic power generation time series, n is the number of data points, and are the means of v1 and v2 respectively.
[0020] Furthermore, the calculation of the average structural similarity index MSSIM of the cloud coverage rate in the predicted period includes the following steps:
[0021] Calibrate two sets of satellite remote sensing data sets X and Y, and the MSSIM similarity is expressed as:
[0022]
[0023] Among them, MSSIM(X,Y) is the average structural similarity index calculated for X and Y, μ X 、μ Y are the means of X and Y, σ X , σ Y are the standard deviations of X and Y, σ XY is the covariance of X and Y, and C1 and C2 are constants.
[0024] Furthermore, the power data of similar time periods is constructed as model input according to the requirements of the photovoltaic power prediction model, including: setting the expected number of similar time periods to n, and when the number of similar time periods searched is less than n, using mask covering technology to fill the missing data with minimum values, wherein, if the similar time periods exceed n, they are sorted from large to small according to similarity, and the data of the first n most similar time periods are selected as the reference input model.
[0025] Furthermore, the multi-head self-attention layer calculates the query, key, and value matrices, expressed as:
[0026] Q=XW Q ,K=XW K ,V=XW V ;
[0027] Among them, W Q 、W K and W V is the weight matrix.
[0028] Furthermore, the multi-head self-attention layer calculates the attention score, which is expressed as:
[0029]
[0030] Among them, d k is the dimension of the query and key vectors.
[0031] Furthermore, the multi-head self-attention layer calculates the multi-head attention, which is expressed as:
[0032] MultiHead(Q,K,V)=Concat(head1,…,head h )W O ;
[0033] Among them, head i =Attention(QW i Q ,KW i K ,VW i V ), QW i Q , KW i K and VW i V is the weight matrix.
[0034] Furthermore, the feedforward neural network layer is calculated as:
[0035] FFN(x)=max(0,xW1+b1)W2+b2;
[0036] Among them, W1 and W2 are weight matrices, and b1 and b2 are bias vectors.
[0037] Beneficial effects of the present invention:
[0038] 1. This method collects historical power generation data, meteorological data, and time information from photovoltaic power stations. After preprocessing, it uses the k-means clustering algorithm to screen similar time periods. The method then calculates comprehensive similarity using the Pearson correlation coefficient and the MSSIM indicator. This method accurately locates historical time periods similar to the current forecast period. This method fully considers the fact that photovoltaic power generation is affected by multiple factors. Compared with traditional methods, it captures data characteristics more comprehensively, laying the foundation for improving forecast accuracy.
[0039] Furthermore, the photovoltaic power prediction model built on the Transformer model uses a multi-head self-attention layer that can focus on different parts of the input sequence in parallel, effectively capturing long-term dependencies between data. The feedforward neural network layer performs nonlinear transformations to further mine complex patterns in the data. In extensive experiments, this model's prediction mean squared error (MSE) was reduced by 30%-50% and mean absolute error (MAE) by 20%-40% compared to traditional physical model methods, significantly improving prediction accuracy.
[0040] 2. This invention enhances its ability to handle complex factors. Photovoltaic power generation is affected by a variety of meteorological factors, including solar radiation intensity, temperature, wind speed, humidity, and weather variations. This method uses satellite remote sensing data to calculate the MSSIM indicator of cloud cover during the forecast period. This effectively assesses the similarity of weather variations and, combined with the Pearson correlation coefficient, comprehensively addresses the impact of complex meteorological factors on power generation. In practical applications across different seasons and weather conditions, it accurately reflects the impact of changing meteorological factors on photovoltaic power generation.
[0041] Furthermore, complex nonlinear relationships exist between photovoltaic power generation and various influencing factors. The Transformer model's self-attention mechanism and neural network structure can automatically learn these nonlinear relationships, eliminating the need for complex assumptions and data transformations required by traditional statistical models. This method has been proven to outperform traditional methods such as time series analysis when processing data with complex nonlinear characteristics, ensuring reliable forecasts in a wide range of complex scenarios.
[0042] 3. This method preprocesses the collected data to remove erroneous data and outliers, and performs normalization to map data from different ranges to specific intervals. This not only reduces the interference of erroneous data on model training but also makes the model converge more easily during training, improving training efficiency. Experiments have shown that after data preprocessing, model training time is shortened by 20%-30%. Furthermore, normalization stabilizes the data distribution, enhances the stability of the model, reduces the model's sensitivity to data fluctuations, and improves the model's ability to generalize across different datasets.
[0043] 4. The high-precision photovoltaic power generation prediction of the present invention provides an accurate basis for power system dispatching. The power dispatching department can reasonably arrange the power generation plan based on the prediction results, adjust the power grid operation mode in advance, and avoid problems such as unstable grid voltage and frequency fluctuations caused by large fluctuations in photovoltaic power generation, thereby effectively ensuring the stable operation of the power grid. In regional power grids where photovoltaic power generation accounts for a high proportion, after applying this method, the grid voltage fluctuation range has been reduced by 15%-25%, and the frequency fluctuation range has been reduced by 10%-20%. Accurate prediction results help energy management departments better plan energy production and distribution and improve energy utilization efficiency. For example, when formulating energy reserve plans, the reserves of other energy sources can be adjusted according to the predicted photovoltaic power generation power to reduce energy waste and storage costs; in electricity market transactions, more reliable power forecast data can be provided to power suppliers and users, optimizing trading strategies and promoting the healthy development of the electricity market. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0045] Figure 1 3 is a flow chart of a photovoltaic power generation prediction method based on a Transformer model according to an embodiment of the present invention. DETAILED DESCRIPTION
[0046] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention are within the scope of protection of the present invention.
[0047] According to an embodiment of the present invention, a photovoltaic power generation prediction method based on a Transformer model is provided.
[0048] like Figure 1 As shown, the photovoltaic power generation prediction method based on the Transformer model according to an embodiment of the present invention includes the following steps:
[0049] The historical power generation data, meteorological data and time information of the photovoltaic power station are collected in advance, and the collected data are preprocessed to remove erroneous data and outliers, and normalized to map data in different ranges to specific intervals to improve the efficiency and stability of model training.
[0050] Among them, meteorological data includes at least: solar radiation intensity, temperature, wind speed and humidity
[0051] This technical solution uses outlier processing to identify and address outliers by setting thresholds or using the Z-score statistical method. If the power generated at a given moment is significantly above or below the normal range, it is considered an outlier and smoothed or removed. Furthermore, normalization is performed to normalize power and meteorological data to the [0, 1] range according to their respective value ranges.
[0052] This technical solution utilizes data cleaning algorithms to remove erroneous data. For example, data consistency checks and logical reasoning are used to identify and correct erroneous values. Outliers are identified and processed using the statistical 3σ principle or the machine learning-based isolation forest algorithm. For outliers, linear interpolation is used to smooth data if the deviation from the normal range is small; if the deviation is large, the data point is removed. A normalization function is used to normalize power and meteorological data to the [0, 1] range according to their respective value ranges, improving model training efficiency and stability.
[0053] Matching similar time periods includes the following steps:
[0054] Pre-calibrating the time sliding window, including at least calibrating the time resolution and prediction duration of the ultra-short-term power prediction;
[0055] Specifically, during the implementation of this technical solution, the 15-minute time resolution is used to predict the photovoltaic power generation in the next 4 hours, as follows:
[0056] The current time is taken as t=0, the period from t-15 to t is used as the search period, the period from t+1 to t+16 is used as the period to be predicted, and the sliding window advances backward with a step size of 1 timestamp. Each day can be divided into 96 periods.
[0057] Similar time periods are screened. The historical PV power data is analyzed using the k-means clustering algorithm, and the PV power data for each time period is classified into clear, partly cloudy, and densely cloudy weather types. Time periods that match the weather type of the current day being predicted are selected from the historical data as preliminary similar time periods.
[0058] This technical solution analyzes historical photovoltaic power generation data using the k-means clustering algorithm. When selecting initial cluster centers, the algorithm prioritizes data points that are farther from existing centers to improve clustering effectiveness. Based on the clustering results, the photovoltaic power generation data for each time period is classified into weather types such as sunny, cloudy, and overcast. Time periods with weather types consistent with the current forecasted day are selected from the historical data as preliminary similarity periods.
[0059] Perform similarity assessment, including the following steps:
[0060] The Pearson correlation coefficient of the photovoltaic power generation curve in different daily search periods is calculated to evaluate the similarity of power series fluctuations in the search period, which is expressed as:
[0061]
[0062] in, r is the Pearson correlation coefficient, v1 and v2 represent two photovoltaic power generation time series, n is the number of data points, and are the means of v1 and v2 respectively. This coefficient reflects the consistency of the two sets of curves in the direction and steepness of trend change.
[0063] Using satellite remote sensing data, the sliding window method is used to calculate the average structural similarity index (MSSIM) of cloud cover during the forecast period to evaluate the similarity of weather changes during the forecast period, including the following steps:
[0064] Calibrate two sets of satellite remote sensing data sets X = {x1, x2, x3, ..., x n} and Y={y1,y2,y3,…,y n}, its MSSIM similarity is expressed as:
[0065]
[0066] Among them, MSSIM(X,Y) is the average structural similarity index calculated for X and Y, μ X 、μ Y are the means of X and Y, σ X , σ Y are the standard deviations of X and Y, σ XY is the covariance of X and Y, and C1 and C2 are constants.
[0067] This technical solution, when applied, C1=(k1L) 2 , C2=(k2L) 2 , k1=0.01, k2=0.03, L is the dynamic range of the data.
[0068] The most similar time period and its similarity are selected from the similar time periods and provided to the power prediction model, including the following steps:
[0069] Each preliminary similar period is calibrated, and the comprehensive similarity index S is calculated based on its Pearson correlation coefficient r and MSSIM value m with the current period to be predicted, which is expressed as:
[0070] S = α × r + β × m;
[0071] Among them, α is the Pearson correlation coefficient, which is 0.6, the weight of SSIM is β, which is 0.4, and α+β=1.
[0072] When applying this technical solution, if it is found that the fluctuation of the photovoltaic power generation curve has a greater impact on the prediction results, the weight of the Pearson correlation coefficient is increased; if the impact of weather changes on photovoltaic power generation is more significant, the weight of MSSIM can be increased.
[0073] All preliminary similar time periods are sorted from large to small according to the comprehensive similarity index S, and the time period with the largest comprehensive similarity index S is selected as the most similar time period. The relevant data of the most similar time period and its comprehensive similarity index S are provided to the power prediction model.
[0074] This technical solution constructs power data from similar time periods as model input based on the requirements of the photovoltaic power prediction model. The expected number of similar time periods is set to n. If fewer than n similar time periods are found, a masking technique is used to fill in the missing data with the minimum value. If more than n similar time periods are found, the data from the top n most similar time periods are sorted by similarity from highest to lowest, and the data is selected as the reference input model.
[0075] Specifically, the expected number of similar time periods n=5 is set. If the number of similar time periods found is less than 5, the masking technique is used to fill the missing data with a minimum value of 0.001. If the number of similar time periods exceeds 5, the data of the top 5 most similar time periods are sorted from large to small by similarity, and the data of the top 5 most similar time periods are selected as the reference input model.
[0076] A photovoltaic power prediction model is constructed based on the Transformer model, including an input layer, a multi-head self-attention layer, a feedforward neural network layer, and an output layer, where;
[0077] The input layer inputs the preprocessed data into the model in time series. The input of each time step contains the power generation power, meteorological data and time information features.
[0078] Multi-Head Self-Attention Layer: It is used to allow the model to focus on different parts of the input sequence in parallel in different representation subspaces, capturing long-term dependencies in the sequence. For the input sequence X = (x1, x2, ..., x n ), calculate the multi-head self-attention, including the following steps:
[0079] Calculate the query, key, and value matrices, expressed as:
[0080]
[0081] Among them, W Q 、W K and W V is the weight matrix.
[0082] Calculate the attention score, expressed as:
[0083]
[0084] Among them, d k is the dimension of the query and key vectors.
[0085] Multi-head attention: The attention calculation is repeated h times (number of heads), and the results are then concatenated and transformed through a linear layer, expressed as:
[0086] MultiHead(Q,K,V)=Concat(head1,...,head h )W O
[0087] Among them, head i =Attention(QW i Q ,KW i K ,VW i V ), QW i Q , KW i K and VW i V is the weight matrix.
[0088] Feed-Forward Network layer: It consists of two linear layers and an activation function, which performs a nonlinear transformation on the output of the multi-head self-attention layer, expressed as:
[0089] FFN(x)=max(0,xW1+b1)W2+b2;
[0090] Among them, W1 and W2 are weight matrices, and b1 and b2 are bias vectors.
[0091] Output layer: After stacking several multi-head self-attention layers and feedforward neural network layers, the predicted power generation is output through a linear layer.
[0092] The preprocessed data is input into the model for training. After the photovoltaic power prediction model is trained, the current environmental data is input into the model to obtain the current power prediction data.
[0093] The pre-processed data is input into the model for training, which includes the following steps:
[0094] Calibration loss function: Use mean square error (MSE) as the loss function, expressed as:
[0095]
[0096] Among them, y i is the actual power generation value, is the power generation value predicted by the model, and n is the number of samples.
[0097] The Adam optimizer is used to update the model parameters and train the model by minimizing the loss function.
[0098] This technical solution uses the Adam optimizer to update model parameters, setting an initial learning rate of 0.001 and 100 training rounds. During training, the loss value is recorded every 10 rounds and the change in loss value is observed. If the loss value decreases by less than 0.001 in 5 consecutive rounds, training is terminated early to prevent overfitting.
[0099] This approach uses the mean squared error (MSE) as the loss function and the Adam optimizer to update model parameters. This combination rapidly adjusts model parameters during training, allowing the model to converge toward the optimal solution. By properly setting hyperparameters such as the learning rate, the model effectively avoids being trapped in local optimal solutions, further improving the efficiency and stability of model training and ensuring the reliability of prediction results.
[0100] In summary, with the help of the above technical solution of the present invention, the following effects can be achieved:
[0101] 1. This method collects historical power generation data, meteorological data, and time information from photovoltaic power stations. After preprocessing, it uses the k-means clustering algorithm to screen similar time periods. The method then calculates comprehensive similarity using the Pearson correlation coefficient and the MSSIM indicator. This method accurately locates historical time periods similar to the current forecast period. This method fully considers the fact that photovoltaic power generation is affected by multiple factors. Compared with traditional methods, it captures data characteristics more comprehensively, laying the foundation for improving forecast accuracy.
[0102] Furthermore, the photovoltaic power prediction model built on the Transformer model uses a multi-head self-attention layer that can focus on different parts of the input sequence in parallel, effectively capturing long-term dependencies between data. The feedforward neural network layer performs nonlinear transformations to further mine complex patterns in the data. In extensive experiments, this model's prediction mean squared error (MSE) was reduced by 30%-50% and mean absolute error (MAE) by 20%-40% compared to traditional physical model methods, significantly improving prediction accuracy.
[0103] 2. This invention enhances its ability to handle complex factors. Photovoltaic power generation is affected by a variety of meteorological factors, including solar radiation intensity, temperature, wind speed, humidity, and weather variations. This method uses satellite remote sensing data to calculate the MSSIM indicator of cloud cover during the forecast period. This effectively assesses the similarity of weather variations and, combined with the Pearson correlation coefficient, comprehensively addresses the impact of complex meteorological factors on power generation. In practical applications across different seasons and weather conditions, it accurately reflects the impact of changing meteorological factors on photovoltaic power generation.
[0104] Furthermore, complex nonlinear relationships exist between photovoltaic power generation and various influencing factors. The Transformer model's self-attention mechanism and neural network structure can automatically learn these nonlinear relationships, eliminating the need for complex assumptions and data transformations required by traditional statistical models. This method has been proven to outperform traditional methods such as time series analysis when processing data with complex nonlinear characteristics, ensuring reliable forecasts in a wide range of complex scenarios.
[0105] 3. This method preprocesses the collected data to remove erroneous data and outliers, and performs normalization to map data from different ranges to specific intervals. This not only reduces the interference of erroneous data on model training but also makes the model converge more easily during training, improving training efficiency. Experiments have shown that after data preprocessing, model training time is shortened by 20%-30%. Furthermore, normalization stabilizes the data distribution, enhances the stability of the model, reduces the model's sensitivity to data fluctuations, and improves the model's ability to generalize across different datasets.
[0106] 4. The high-precision photovoltaic power generation prediction of the present invention provides an accurate basis for power system dispatching. The power dispatching department can reasonably arrange the power generation plan based on the prediction results, adjust the power grid operation mode in advance, and avoid problems such as unstable grid voltage and frequency fluctuations caused by large fluctuations in photovoltaic power generation, thereby effectively ensuring the stable operation of the power grid. In regional power grids where photovoltaic power generation accounts for a high proportion, after applying this method, the grid voltage fluctuation range has been reduced by 15%-25%, and the frequency fluctuation range has been reduced by 10%-20%. Accurate prediction results help energy management departments better plan energy production and distribution and improve energy utilization efficiency. For example, when formulating energy reserve plans, the reserves of other energy sources can be adjusted according to the predicted photovoltaic power generation power to reduce energy waste and storage costs; in electricity market transactions, more reliable power forecast data can be provided to power suppliers and users, optimizing trading strategies and promoting the healthy development of the electricity market.
[0107] The foregoing is merely a preferred embodiment of the present invention and is not intended to limit the present invention. A person skilled in the art will readily appreciate other embodiments of the present invention after considering the disclosure in the specification and examples. This application is intended to cover any variations, uses, or adaptations of the present invention, which follow the general principles of the present invention and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered merely exemplary, and the true scope and spirit of the present invention are indicated by the claims.
[0108] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A photovoltaic power generation prediction method based on the Transformer model, characterized in that: The following steps are involved: Collect historical power generation data, meteorological data, and time information of the photovoltaic power station, preprocess the collected data to remove erroneous data and outliers, and perform normalization processing to map data of different ranges to specific intervals, wherein the meteorological data includes at least solar radiation intensity, temperature, wind speed, and humidity; Calibrate the time sliding window, including calibrating the time resolution and prediction duration of the ultra-short-term power forecast; analyze the historical photovoltaic power data based on the k-means clustering algorithm, divide the photovoltaic power data of each period into different weather types, and select the period with the same weather type as the current day to be predicted from the historical data as the preliminary similar period; The Pearson correlation coefficient of photovoltaic power generation curves during different daily search periods was calculated to evaluate the similarity of power series fluctuations during the search period. Using satellite remote sensing data, the sliding window method was used to calculate the mean structural similarity index (MSSIM) of cloud coverage during the forecast period to evaluate the similarity of weather changes during the forecast period. Calibrate each preliminary similar period, and calculate the comprehensive similarity index S based on its Pearson correlation coefficient r and MSSIM value m with the current period to be predicted, which is expressed as S = α × r + β × m; Among them, α is the Pearson correlation coefficient, β is the weight of MSSIM, and α+β=1; Sort all preliminary similar periods from largest to smallest according to the comprehensive similarity index S, select the period with the largest comprehensive similarity index S as the most similar period, and construct the power data of similar periods as the model input according to the requirements of the photovoltaic power prediction model; A photovoltaic power prediction model is constructed based on the Transformer model. The model includes an input layer, a multi-head self-attention layer, a feedforward neural network layer, and an output layer. The preprocessed data is input into the model for training, the loss function is calibrated as the mean square error, and the model parameters are updated using the Adam optimizer. After the photovoltaic power prediction model is trained, the current environmental data is input into the model to obtain the current power prediction data.
2. The photovoltaic power generation prediction method based on the Transformer model according to claim 1, characterized in that: The calibrated time sliding window includes: when calibrating the time resolution of 15 minutes to predict the photovoltaic power generation in the next 4 hours, the current time is taken as time t=0, the period from t-15 to t is used as the search period, and the period from t+1 to t+16 is used as the period to be predicted. The sliding window advances backward with a step size of 1 timestamp, and each day is divided into 96 periods.
3. The photovoltaic power generation prediction method based on the Transformer model according to claim 1, characterized in that: The Pearson correlation coefficient is calculated as: in, r is the Pearson correlation coefficient, v1 and v2 represent two photovoltaic power generation time series, n is the number of data points, and are the means of v1 and v2 respectively.
4. The photovoltaic power generation prediction method based on the Transformer model according to claim 3 is characterized in that: The calculation of the average structural similarity index MSSIM of the cloud coverage rate in the predicted period includes the following steps: Calibrate two sets of satellite remote sensing data sets X and Y, and the MSSIM similarity is expressed as: Among them, MSSIM(X,Y) is the average structural similarity index calculated for X and Y, μ X 、μ Y are the means of X and Y, σ X , σ Y are the standard deviations of X and Y, σ XY is the covariance of X and Y, and C1 and C2 are constants.
5. The photovoltaic power generation prediction method based on the Transformer model according to claim 1, characterized in that: The method constructs power data of similar time periods as model input according to the requirements of the photovoltaic power prediction model, including: setting the expected number of similar time periods to n, and when the number of similar time periods searched is less than n, using masking technology to fill the missing data with minimum values. If the number of similar time periods exceeds n, the data of the first n most similar time periods are sorted from large to small according to similarity, and the data of the first n most similar time periods are selected as the reference input model.
6. The photovoltaic power generation prediction method based on the Transformer model according to claim 1, characterized in that: The multi-head self-attention layer calculates the query, key and value matrices, expressed as: Q=XW Q ,K=XW K ,V=XW V ; Among them, W Q 、W K and W V is the weight matrix.
7. The photovoltaic power generation prediction method based on the Transformer model according to claim 6, characterized in that: The multi-head self-attention layer calculates the attention score, expressed as: Among them, d k is the dimension of the query and key vectors.
8. The photovoltaic power generation prediction method based on the Transformer model according to claim 7, characterized in that: The multi-head self-attention layer calculates the multi-head attention, expressed as: MultiHead(Q,K,V)=Concat(head1,…,head h )W O ; Among them, head i =Attention(QW i Q ,KW i K ,VW i V ), QW i Q , KW i K and VW i V is the weight matrix.
9. The photovoltaic power generation prediction method based on the Transformer model according to claim 8, characterized in that: The feedforward neural network layer is calculated as: FFN(x)=max(0,xW1+b1)W2+b2; Among them, W1 and W2 are weight matrices, and b1 and b2 are bias vectors.
Citation Information
Patent Citations
Day-ahead optical power prediction method based on similar day clustering and meteorological factor weighting
CN112070311A
Short-term photovoltaic power generation power prediction method based on L-Transform
CN117034055A
Ultra-short-term photovoltaic power prediction method based on small-scale weather classification and adaptive window
CN119026731A
Photovoltaic power generation power short-term prediction method considering various weather conditions
CN119760629A
Cited By
High-precision ultra-short-term photovoltaic power prediction method based on MSCT-RCM model
CN121813331A