A photovoltaic power generation prediction method based on the Transformer model

By using a photovoltaic power generation prediction method based on the Transformer model, data preprocessing and clustering algorithms are employed to filter similar time periods. Combined with multi-head self-attention and feedforward neural network layers, the problem of low prediction accuracy for photovoltaic power generation is solved, achieving high-precision and stable prediction results.

CN120450104BActive Publication Date: 2025-10-31ANHUI COMM IND SERVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510433535.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-08
Publication Date
2025-10-31
Estimated Expiration
2045-04-08

AI Technical Summary

Technical Problem

Existing photovoltaic power generation forecasting methods suffer from low forecasting accuracy and insufficient ability to handle complex factors, making them difficult to adapt to changing environmental conditions.

Method used

A photovoltaic power generation prediction method based on the Transformer model is adopted. By collecting and preprocessing historical power generation data and meteorological data of photovoltaic power plants, the k-means clustering algorithm is used to screen similar time periods, and the comprehensive similarity is calculated by combining the Pearson correlation coefficient and MSSIM index. A photovoltaic power prediction model with a multi-head self-attention layer and a feedforward neural network layer is constructed.

Benefits of technology

It significantly improves the accuracy of photovoltaic power generation forecasts, reduces forecast errors, enhances the ability to handle complex meteorological factors, improves model training efficiency and stability, and ensures accurate forecasts under different conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120450104B_ABST
    Figure CN120450104B_ABST
Patent Text Reader

Abstract

This invention discloses a photovoltaic (PV) power generation prediction method based on the Transformer model, relating to the field of PV power generation technology. The method includes the following steps: collecting historical power generation data, meteorological data, and time information from PV power plants; preprocessing the collected data to remove erroneous data and outliers, and performing normalization to map data from different ranges to specific intervals; by collecting historical power generation data, meteorological data, and time information from PV power plants, and after preprocessing, combining this data with the k-means clustering algorithm to screen similar time periods, and using the Pearson correlation coefficient and MSSIM index to calculate the comprehensive similarity, this method can accurately locate historical time periods similar to the current prediction period. This method fully considers the characteristics of PV power generation being affected by multiple factors, and compared with traditional methods, it captures data features more comprehensively, laying the foundation for improving prediction accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of photovoltaic power generation technology, and more specifically, to a photovoltaic power generation prediction method based on the Transformer model. Background Technology

[0002] With the increasing global demand for clean energy, photovoltaic (PV) power generation, as an important renewable energy source, has received widespread attention. However, the power output of PV power generation is affected by various factors, such as solar radiation intensity, temperature, wind speed, humidity, and weather changes, exhibiting significant uncertainty and volatility. This poses a significant challenge to power system dispatching, grid stability, and effective energy management.

[0003] In existing technologies, traditional photovoltaic power generation forecasting methods, such as physical modeling, require precise geographical 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 modeling methods, such as time series analysis, can capture the temporal characteristics of data to a certain extent, but they have limited ability to handle complex meteorological factors and nonlinear relationships, making them 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] To address the problems in related technologies, this 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 existing technologies, and achieves high-precision prediction of photovoltaic power generation.

[0006] The technical solution of this invention is implemented as follows:

[0007] A photovoltaic power generation prediction method based on the Transformer model includes the following steps:

[0008] Historical power generation data, meteorological data, and time information of photovoltaic power plants are collected. The collected data are preprocessed to remove erroneous data and outliers, and normalized to map data from different ranges to specific intervals. The meteorological data includes at least solar radiation intensity, temperature, wind speed, and humidity.

[0009] The time sliding window is calibrated, including the time resolution and prediction duration of ultra-short-term power prediction; the historical power data of photovoltaic power generation is analyzed according to the k-means clustering algorithm, and the photovoltaic power generation data of each time period is divided into different weather types. The time period that is consistent with the weather type of the current day to be predicted is selected from the historical data as the preliminary similar time period.

[0010] The Pearson correlation coefficient of photovoltaic power generation curves in different daily search periods was calculated to assess the similarity of power sequence fluctuations during the search periods. Using satellite remote sensing data, the average structural similarity index (MSSIM) of cloud cover rate during the forecast period was calculated using the sliding window method to assess the similarity of weather changes during the forecast period.

[0011] For each initially similar time period, the comprehensive similarity index S is calculated based on its Pearson correlation coefficient r and MSSIM value m with the current time period to be predicted, denoted as:

[0012] S = α × r + β × m;

[0013] Where α is the Pearson correlation coefficient, β is the weight of MSSIM, and α+β=1;

[0014] All preliminary similar time periods are sorted from largest to smallest according to the comprehensive similarity index S. The time period with the largest comprehensive similarity index S is selected as the most similar time period. Power data of similar time periods are constructed as model input according to the needs 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. Preprocessed data is input into the model for training. The loss function is calibrated as mean squared error. 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 calibration time sliding window includes: when calibrating 15 minutes as the time resolution 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 taken as the search period, and the period from t+1 to t+16 is taken as the period to be predicted. The sliding window advances backward in steps 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, rHere, v1 and v2 represent two photovoltaic power generation time series, and n is the number of data points. and These are the mean values ​​of v1 and v2, respectively.

[0020] Furthermore, the calculation of the average structural similarity index (MSSIM) of cloud coverage for the period to be predicted includes the following steps:

[0021] For two sets of satellite remote sensing data X and Y, the MSSIM similarity is expressed as:

[0022]

[0023] Where MSSIM(X,Y) is the average structural similarity index calculated for X and Y, μ X μ Y These are the means of X and Y, respectively, and σ X σ Y These are the standard deviations of X and Y, respectively, and σ XY Let C1 and C2 be the covariances of X and Y, and C1 and C2 be constants.

[0024] Furthermore, the step of constructing power data for similar time periods as model input according to the requirements of the photovoltaic power prediction model includes: setting the expected number of similar time periods as n; when the number of similar time periods found is less than n, using a masking technique to fill the missing data with a minimum value; wherein, if the number of similar time periods exceeds n, sorting them from largest to smallest similarity and selecting the data of the top n most similar time periods as reference input models.

[0025] Furthermore, the multi-head self-attention layer calculates the query, key, and value matrix, represented as:

[0026] Q = XW Q K = XW K V = XW V ;

[0027] Among them, W Q W K and W V It is a weight matrix.

[0028] Furthermore, the multi-head self-attention layer calculates the attention score, expressed as:

[0029]

[0030] Where, d k It is the dimension of the query and key vector.

[0031] Furthermore, the multi-head self-attention layer calculates the multi-head attention, 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 It is a weight matrix.

[0034] Furthermore, the feedforward neural network layer is calculated and represented as follows:

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

[0036] Where W1 and W2 are weight matrices, and b1 and b2 are bias vectors.

[0037] The beneficial effects of this invention are:

[0038] 1. This invention collects historical power generation data, meteorological data, and time information from photovoltaic power plants. After preprocessing, it uses the k-means clustering algorithm to screen similar time periods and calculates the comprehensive similarity using the Pearson correlation coefficient and MSSIM index. This allows for the accurate location of historical time periods similar to the current time period to be predicted. This method fully considers the characteristics of photovoltaic power generation being affected by multiple factors and, compared to traditional methods, captures data features more comprehensively, laying the foundation for improving prediction accuracy.

[0039] Meanwhile, the photovoltaic power prediction model built on the Transformer model features 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 uncover complex patterns in the data. In numerous experiments, the model's prediction mean square error (MSE) was reduced by 30%-50% and the mean absolute error (MAE) by 20%-40% compared to traditional physical model methods, significantly improving prediction accuracy.

[0040] 2. This invention enhances the ability to handle complex factors. Photovoltaic power generation is affected by various meteorological factors such as solar radiation intensity, temperature, wind speed, humidity, and weather changes. This method uses satellite remote sensing data to calculate the MSSIM index of cloud cover rate for the forecast period, which can effectively assess the similarity of weather changes. Combined with the Pearson correlation coefficient, it comprehensively addresses the impact of complex meteorological factors on power generation. In practical applications under different seasons and weather conditions, it can accurately reflect the effect of meteorological changes on photovoltaic power generation.

[0041] Meanwhile, photovoltaic power generation exhibits complex nonlinear relationships with various influencing factors. The Transformer model's self-attention mechanism and neural network structure can automatically learn these nonlinear relationships without requiring complex assumptions and transformations of the data as traditional statistical models. Practical verification has shown that when dealing with data possessing complex nonlinear characteristics, the predictive performance of this method far surpasses traditional time series analysis methods, ensuring reliable prediction results under various complex conditions.

[0042] 3. This invention preprocesses the collected data, removing 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 show that after data preprocessing, model training time is shortened by 20%-30%. Simultaneously, normalization makes the data distribution more stable, enhancing model stability, reducing the model's sensitivity to data fluctuations, and improving the model's generalization ability on different datasets.

[0043] 4. The high-precision photovoltaic power generation forecasting of this invention provides an accurate basis for power system dispatching. Power dispatching departments can rationally arrange power generation plans based on the forecast results, adjust grid operation modes in advance, and avoid problems such as grid voltage instability and frequency fluctuations caused by large fluctuations in photovoltaic power generation, effectively ensuring the stable operation of the grid. In power grids in regions with a high proportion of photovoltaic power generation, the application of this method has reduced the range of grid voltage fluctuations by 15%-25% and the amplitude of frequency fluctuations by 10%-20%. Accurate forecasting 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 based on the predicted photovoltaic power generation, reducing energy waste and storage costs; in electricity market transactions, it provides more reliable power forecasting data for power suppliers and users, optimizes trading strategies, and promotes the healthy development of the electricity market. Attached Figure Description

[0044] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0045] Figure 1 This is a flowchart illustrating a photovoltaic power generation prediction method based on the Transformer model according to an embodiment of the present invention. Detailed Implementation

[0046] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. All other embodiments obtained by those skilled in the art 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 the 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] Historical power generation data, meteorological data, and time information of photovoltaic power plants are collected in advance. The collected data is preprocessed to remove erroneous data and outliers, and normalized to map data of different ranges to specific intervals in order to improve the efficiency and stability of model training.

[0050] Meteorological data should include at least: solar radiation intensity, temperature, wind speed, and humidity.

[0051] This technical solution handles outliers by setting thresholds or using Z-score statistical methods to identify and process them. Specifically, if the power generation at a given moment is significantly higher or lower than the normal range, it can be considered an outlier, and smoothing or removing that data point will be applied. Additionally, normalization processing normalizes the power data and meteorological data to the [0,1] interval according to their respective value ranges.

[0052] This technical solution utilizes data cleaning algorithms to remove erroneous data, such as identifying and correcting erroneous values ​​through data consistency checks and logical judgments. Outliers are identified and processed using either the statistical 3σ principle or the machine learning-based Isolation Forest algorithm. For outliers, if the deviation from the normal range is small, linear interpolation is used for smoothing; if the deviation is too large, the data point is removed. A normalization function is applied to normalize power and meteorological data to the [0,1] interval according to their respective value ranges, improving model training efficiency and stability.

[0053] To perform similar time period matching, the following steps are included:

[0054] Pre-calibrate the time sliding window, including at least the time resolution and prediction duration for ultra-short-term power prediction;

[0055] Specifically, this technical solution, during implementation, uses a 15-minute time resolution to predict the photovoltaic power generation for the next 4 hours, as detailed below:

[0056] Taking the current time 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 in steps of 1 timestamp, and each day can be divided into 96 periods.

[0057] For similar time periods, the historical photovoltaic power generation data is analyzed using the k-means clustering algorithm, dividing the photovoltaic power generation data for each time period into three weather types: sunny, cloudy, and overcast. Time periods from the historical data that match the weather type of the current day to be predicted are selected as preliminary similar time periods.

[0058] This technical solution analyzes historical photovoltaic power generation data using the k-means clustering algorithm. This algorithm prioritizes data points farther from existing centers during initial cluster center selection, improving clustering effectiveness. Based on the clustering results, the photovoltaic power generation data for each time period is categorized into weather types such as sunny, cloudy, and overcast. Time periods from historical data that match the weather type of the current predicted day are selected as preliminary similarity periods.

[0059] The similarity assessment includes the following steps:

[0060] The Pearson correlation coefficient of photovoltaic power generation curves within different daily search periods is calculated to assess the similarity of power series fluctuations during the search periods, and is expressed as follows:

[0061]

[0062] in, r Here, v1 and v2 represent two photovoltaic power generation time series, and n is the number of data points. and These 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 their trend changes.

[0063] Using satellite remote sensing data, the mean structural similarity index (MSSIM) of cloud cover rate for the forecast period is calculated using the sliding window method. This assesses the similarity of weather changes during the forecast period and includes 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 The MSSIM similarity is expressed as follows:

[0065]

[0066] Where MSSIM(X,Y) is the average structural similarity index calculated for X and Y, μ X μ Y These are the means of X and Y, respectively, and σ X σ Y These are the standard deviations of X and Y, respectively, and σ XY Let C1 and C2 be the covariances of X and Y, and C1 and C2 be constants.

[0067] In this technical solution, C1 = (k1L) 2 C2 = (k2L) 2 k1 = 0.01, k2 = 0.03, and L is the dynamic range of the data.

[0068] The most similar time period and its similarity score are selected from similar time periods and provided to the power prediction model, including the following steps:

[0069] Each preliminary similarity period is identified, 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, expressed as:

[0070] S = α × r + β × m;

[0071] Among them, the α Pearson correlation coefficient is 0.6, the SSIM weight is β, which is 0.4, and α + β = 1.

[0072] In application of this technical solution, if fluctuations in the photovoltaic power generation curve are found to have a significant impact on the prediction results, the weight of the Pearson correlation coefficient should be increased; if weather changes have a more significant impact on photovoltaic power generation, the weight of the MSSIM should be increased.

[0073] All preliminary similar time periods are sorted from largest to smallest according to the comprehensive similarity index S. 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 for similar time periods as model input based on the requirements of the photovoltaic power prediction model. The desired number of similar time periods is set to n. When fewer than n similar time periods are found, a masking technique is used to fill in the missing data with minimum values. If more than n similar time periods are found, they are sorted by similarity from highest to lowest, and the data from the top n most similar time periods are selected as the reference input model.

[0075] Specifically, the expected number of similar time periods is set to n=5. If fewer than 5 similar time periods are found, a masking technique is used to fill the missing data with a minimum value of 0.001. If more than 5 similar time periods are found, they are sorted from largest to smallest 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.

[0077] The input layer takes the preprocessed data and feeds it into the model in time series. The input for each time step includes power generation, meteorological data and time information features.

[0078] Multi-head self-attention layers: These allow the model to focus on different parts of the input sequence in parallel across different representation subspaces, capturing long-term dependencies within the sequence. For the input sequence X = (x1, x2, ..., x...),... n ), Calculate multi-head self-attention, including the following steps:

[0079] The query, key, and value matrix is ​​calculated and represented as follows:

[0080]

[0081] Among them, W Q W K and W V It is a weight matrix.

[0082] The attention score is calculated and expressed as:

[0083]

[0084] Where, d k It is the dimension of the query and key vector.

[0085] Multi-head attention: The attention calculation is repeated h times (number of heads), and the results are concatenated and transformed through a linear layer, represented 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 It is a weight matrix.

[0088] Feed-Forward Network: Consists of two linear layers and an activation function, which performs a non-linear transformation on the output of the multi-head self-attention layer, as shown below:

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

[0090] Where 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 process of inputting preprocessed data into the model for training includes the following steps:

[0094] Defining the loss function: Using the mean squared error (MSE) as the loss function, it is expressed as:

[0095]

[0096] Among them, y i This is the actual power generation value. is the predicted power generation value from the model, and n is the number of samples.

[0097] The Adam optimizer is used to update the model's parameters, and the model is trained by minimizing the loss function.

[0098] In this technical solution, the Adam optimizer is used to update model parameters, with an initial learning rate of 0.001 and 100 training epochs. During training, the loss value is recorded every 10 epochs, and its changes are observed. If the loss value decreases by less than 0.001 over 5 consecutive epochs, training is terminated early to prevent overfitting.

[0099] Using the above approach, mean squared error (MSE) is employed as the loss function, combined with the Adam optimizer to update model parameters. This combination enables rapid adjustment of model parameters during training, guiding the model towards the optimal solution. By appropriately setting hyperparameters such as the learning rate, the model is effectively prevented from getting stuck in local optima, further improving the efficiency and stability of model training and ensuring the reliability of prediction results.

[0100] In summary, by employing the above-described technical solution of the present invention, the following effects can be achieved:

[0101] 1. This invention collects historical power generation data, meteorological data, and time information from photovoltaic power plants. After preprocessing, it uses the k-means clustering algorithm to screen similar time periods and calculates the comprehensive similarity using the Pearson correlation coefficient and MSSIM index. This allows for the accurate location of historical time periods similar to the current time period to be predicted. This method fully considers the characteristics of photovoltaic power generation being affected by multiple factors and, compared to traditional methods, captures data features more comprehensively, laying the foundation for improving prediction accuracy.

[0102] Meanwhile, the photovoltaic power prediction model built on the Transformer model features 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 uncover complex patterns in the data. In numerous experiments, the model's prediction mean square error (MSE) was reduced by 30%-50% and the mean absolute error (MAE) by 20%-40% compared to traditional physical model methods, significantly improving prediction accuracy.

[0103] 2. This invention enhances the ability to handle complex factors. Photovoltaic power generation is affected by various meteorological factors such as solar radiation intensity, temperature, wind speed, humidity, and weather changes. This method uses satellite remote sensing data to calculate the MSSIM index of cloud cover rate for the forecast period, which can effectively assess the similarity of weather changes. Combined with the Pearson correlation coefficient, it comprehensively addresses the impact of complex meteorological factors on power generation. In practical applications under different seasons and weather conditions, it can accurately reflect the effect of meteorological changes on photovoltaic power generation.

[0104] Meanwhile, photovoltaic power generation exhibits complex nonlinear relationships with various influencing factors. The Transformer model's self-attention mechanism and neural network structure can automatically learn these nonlinear relationships without requiring complex assumptions and transformations of the data as traditional statistical models. Practical verification has shown that when dealing with data possessing complex nonlinear characteristics, the predictive performance of this method far surpasses traditional time series analysis methods, ensuring reliable prediction results under various complex conditions.

[0105] 3. This invention preprocesses the collected data, removing 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 show that after data preprocessing, model training time is shortened by 20%-30%. Simultaneously, normalization makes the data distribution more stable, enhancing model stability, reducing the model's sensitivity to data fluctuations, and improving the model's generalization ability on different datasets.

[0106] 4. The high-precision photovoltaic power generation forecasting of this invention provides an accurate basis for power system dispatching. Power dispatching departments can rationally arrange power generation plans based on the forecast results, adjust grid operation modes in advance, and avoid problems such as grid voltage instability and frequency fluctuations caused by large fluctuations in photovoltaic power generation, effectively ensuring the stable operation of the grid. In power grids in regions with a high proportion of photovoltaic power generation, the application of this method has reduced the range of grid voltage fluctuations by 15%-25% and the amplitude of frequency fluctuations by 10%-20%. Accurate forecasting 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 based on the predicted photovoltaic power generation, reducing energy waste and storage costs; in electricity market transactions, it provides more reliable power forecasting data for power suppliers and users, optimizes trading strategies, and promotes the healthy development of the electricity market.

[0107] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Those skilled in the art, upon considering the disclosure in the specification and embodiments, will readily conceive of other embodiments of this disclosure. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and embodiments are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.

[0108] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.

Claims

1. A photovoltaic power generation prediction method based on the Transformer model, characterized in that, Includes the following steps: Historical power generation data, meteorological data, and time information of photovoltaic power plants are collected. The collected data are preprocessed to remove erroneous data and outliers, and normalized to map data from different ranges to specific intervals. The meteorological data includes at least solar radiation intensity, temperature, wind speed, and humidity. The time sliding window is calibrated, including the time resolution and prediction duration of ultra-short-term power prediction; the historical power data of photovoltaic power generation is analyzed according to the k-means clustering algorithm, and the photovoltaic power generation data of each time period is divided into different weather types. The time period that is consistent with the weather type of the current day to be predicted is selected from the historical data as the preliminary similar time period. The Pearson correlation coefficients of photovoltaic power generation curves within different daily search periods were calculated to assess the similarity of power sequence fluctuations during the search periods. Using satellite remote sensing data, the mean structural similarity index (MSSIM) of cloud cover rate for the predicted period was calculated using the sliding window method to assess the similarity of weather changes during the predicted period. The calculation of the MSSIM includes: calibrating two sets of satellite remote sensing data sets X and Y; the MSSIM similarity is expressed as: Where MSSIM(X,Y) is the average structural similarity index calculated for X and Y, μ X μ Y These are the means of X and Y, respectively, and σ X σ Y These are the standard deviations of X and Y, respectively, and σ XY Let C1 and C2 be the covariances of X and Y, and C1 and C2 be constants. For each initially similar time period, the comprehensive similarity index S is calculated based on its Pearson correlation coefficient r and MSSIM value m with the current time period to be predicted, denoted as: S = α × r + β × m; Where α is the Pearson correlation coefficient, β is the weight of MSSIM, and α+β=1; All preliminary similar time periods are sorted from largest to smallest according to the comprehensive similarity index S. The time period with the largest comprehensive similarity index S is selected as the most similar time period. Power data of similar time periods are constructed as model input according to the needs 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. Preprocessed data is input into the model for training. The loss function is calibrated as mean squared error. 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 calibration time sliding window includes: when calibrating 15 minutes as the time resolution 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 taken as the search period, and the period from t+1 to t+16 is taken as the period to be predicted. The sliding window advances backward in steps 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 and expressed as follows: Where r is the Pearson correlation coefficient, v1 and v2 represent two photovoltaic power generation time series, and n is the number of data points. and These are the mean values ​​of v1 and v2, respectively.

4. The photovoltaic power generation prediction method based on the Transformer model according to claim 1, characterized in that, The step of constructing power data for similar time periods as model input according to the requirements of the photovoltaic power prediction model includes: setting the expected number of similar time periods as n; when the number of similar time periods found is less than n, using a masking technique to fill the missing data with a minimum value; wherein, if the number of similar time periods exceeds n, sorting them from largest to smallest similarity and selecting the data of the top n most similar time periods as reference input model.

5. 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 matrix, represented as follows: Q=XW Q ,K=XW K ,V=XW V ; Among them, W Q W K and W V It is a weight matrix.

6. The photovoltaic power generation prediction method based on the Transformer model according to claim 5, characterized in that, The multi-head self-attention layer calculates the attention score, which is expressed as: Where, d k It represents the dimensions of the query and key vectors.

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 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 It is a weight matrix.

8. The photovoltaic power generation prediction method based on the Transformer model according to claim 7, characterized in that, The feedforward neural network layer is calculated as follows: FFN(x)=max(0,xW1+b1)W2+b2; Where 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