Photovoltaic power generation capacity time sequence prediction method based on improved Transform model
Through the improved Transformer model, combined with convolutional layer and dynamic weight module, a staged decoding mechanism is used to predict photovoltaic power generation, which solves the problem that existing methods are difficult to capture complex relationships and long-term dependencies, and achieves more efficient and accurate prediction effects.
Patent Information
- Application Number
- CN202411558049.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-04
- Publication Date
- 2025-03-04
AI Technical Summary
Existing time series prediction methods for photovoltaic power generation are difficult to effectively capture complex nonlinear relationships and long-term dependencies, resulting in insufficient prediction performance.
The improved Transformer model is adopted, combining the convolutional layer to extract local features and dynamic adjustment weight modules, and prediction is performed through a phased decoding mechanism to optimize the attention mechanism and the training process of the generative decoder.
It improves the accuracy and efficiency of photovoltaic power generation prediction, can better capture the complex relationship between environmental data and power generation, reduce operation and maintenance costs, and improve operation and maintenance efficiency.
Smart Images

Figure CN119557586A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of photovoltaic power generation technology, and more specifically, to a photovoltaic power generation time series prediction method based on an improved Transformer model. Background Art
[0002] With the continuous growth of global energy demand and the improvement of environmental protection awareness, photovoltaic power generation has been widely used as a clean and renewable energy form. However, during the operation of distributed photovoltaic systems, the performance and output power of key equipment such as inverters will fluctuate and change due to the influence of various factors such as environment, environment, and equipment aging. Building a photovoltaic operation and maintenance platform based on time series prediction algorithm can realize real-time monitoring and trend prediction of inverter power generation, thereby improving the operation and maintenance efficiency of photovoltaic power stations and reducing operation and maintenance costs.
[0003] The existing time series prediction algorithms mainly include the following: traditional methods such as ARI MA model exponential smoothing method and prophet algorithm, which are simple and intuitive, easy to understand and implement, but difficult to handle complex nonlinear relationships; machine learning algorithms such as support vector regression (SVR), random forest (RF) and GBM regression algorithms can handle complex nonlinear relationships, but have limitations in handling long-term dependencies and sequence information modeling; deep learning algorithms such as recurrent neural networks (RNN), long short-term memory networks (LSTM), convolutional neural networks (CNN), etc., can effectively capture the dependencies and complex relationships in time series data and have achieved remarkable prediction performance.
[0004] In recent years, the Transformer architecture has made revolutionary progress in the field of natural language processing. Its core mechanism, the self-attention mechanism, can handle long-distance dependency problems. The basic idea of the self-attention mechanism is that when processing each input sequence element, the model not only pays attention to local information, but also pays attention to all other elements in the input sequence and assigns different weights according to the importance of these elements. This enables the Transformer model to simultaneously consider the relationship between all elements in the sequence and capture global dependencies.
[0005] Compared with traditional recurrent neural networks (RNN) and long short-term memory networks (LSTM), Transformer has the following significant advantages: First, it has strong parallel computing capabilities. RNN and LSTM are difficult to implement parallel computing due to their sequential dependencies, while the self-attention mechanism of the Transformer model allows the entire input sequence to be processed in parallel, greatly improving computing efficiency. Second, Transformer performs well in capturing long-distance dependencies. When processing long sequences, RNN and LSTM are prone to gradient vanishing or gradient explosion problems, which makes it difficult to capture long-distance dependencies. The self-attention mechanism can effectively capture long-distance dependencies by calculating the correlation between all positions. In addition, the Transformer model has strong expressive power. Through the multi-head self-attention mechanism, different heads can capture different features and dependencies, thereby enhancing the expressive power and robustness of the model. Finally, Transformer has higher flexibility and scalability. Since there is no restriction on sequential processing, Transformer can be more easily expanded and adjusted, such as increasing the number of layers and the number of attention heads, thereby improving the performance and adaptability of the model.
[0006] Applying Transformer to time series forecasting can effectively capture the global dependencies in time series data and further improve the performance of the forecasting model. In particular, when processing long sequence data, Transformer has demonstrated the ability to surpass traditional recurrent neural networks. By making full use of the self-attention mechanism, Transformer can improve computational efficiency while ensuring accuracy, making it a powerful tool in the field of time series forecasting. Summary of the invention
[0007] In order to overcome the shortcomings of the prior art, the present invention provides a photovoltaic power generation time series prediction method based on an improved Transformer model.
[0008] To achieve the above object, the present invention provides the following technical solution: a photovoltaic power generation time series prediction method based on an improved Transformer model, comprising the following steps:
[0009] Step S1, cleaning and standardizing environmental data and power generation data;
[0010] Step S2, extracting local features from the input multivariate time series data using a convolutional layer;
[0011] Step S3: introducing a new dynamic weight adjustment module to dynamically adjust the attention weight according to the correlation between environmental factors and power generation;
[0012] Step S4, a phased decoding mechanism is proposed to reduce the amount of computation and focus on important information through preliminary prediction and refined decoding;
[0013] Step S5: Combine the optimized attention mechanism and generative decoder to perform end-to-end training on the model;
[0014] Step S6: Use the trained model to predict the power generation of new data, and use evaluation indicators to evaluate the prediction results.
[0015] As a preferred technical solution of the present invention, the specific process of step S1 is as follows:
[0016] Step S11, identifying and processing missing values and outliers, removing or filling missing data, and smoothing outliers;
[0017] Step S12: Ensure that the timestamps of the time series data are consistent, and perform time alignment or resampling to ensure that all sequences are aligned at the same time step;
[0018] Step S13, standardizing the data;
[0019] The standardization processing method includes but is not limited to Z-score standardization.
[0020] As a preferred technical solution of the present invention, the specific process of S2 is as follows:
[0021] S21. Design a feature embedding layer to map the environmental features of each time step into a high-dimensional space to obtain a more expressive feature representation.
[0022] The input multivariate time series data X = [x t ,x2,…,x t ], each time step x t Contains multiple environmental characteristics and a power generation data y t , that is, x t =[x t,1 ,x t,2 ,…,x t,n ,y t ]; t is the index of the time step, which indicates the position of the data in time;
[0023] S22, for the input time series data X = [x1, x2, ..., x t ]Introduce convolutional layers to extract local features; convolutional layers capture short-term dependencies between local time steps and compress the dimensions of the input data; use multi-scale convolutions to capture features within different time windows:
[0024]
[0025] in, is the local feature corresponding to the convolution kernel k, w k is the window size of the kth convolution kernel, For input data in window w k The fragment inside, b (k) is the bias term;
[0026] S23. Use these local features as Transformer input to further capture global dependencies:
[0027]
[0028] Combining the local feature extraction capability of convolutional neural networks with the global dependency capture capability of Transformer, the modeling of short-term and long-term dependencies is optimized.
[0029] As a preferred technical solution of the present invention, the specific process of step S3 is:
[0030] Step S31: For each environmental factor, calculate the Pearson correlation coefficient or Spearman correlation coefficient between it and the power generation, and obtain the correlation score r of each factor to the power generation. i ;
[0031] r i =corr(X i ,y);
[0032] Among them, X i is the data sequence of the i-th environmental factor, and y is the data sequence of power generation;
[0033] Step S32: normalize the calculated correlation score to obtain the weight w of each environmental factor. i :
[0034]
[0035] Where n is the total number of environmental factors;
[0036] Step S33: introduce an attention mechanism weighted by environmental factors, dynamically adjust the attention weight according to the correlation between environmental factors and power generation; when calculating the attention weight, take the correlation of each input feature as an additional weighting factor; assume that the correlation weight is w i , then the calculation formula of the attention mechanism can be modified as follows:
[0037]
[0038] Where W = [w1,w2,…,w n] is the weight matrix related to the correlation of environmental factors, ⊙ represents the element-by-element multiplication operation;
[0039] Step S34: introduce a dynamic weight update mechanism. This module continuously monitors the impact of various environmental factors on the model prediction accuracy during the training process and adjusts the relevance weight w in the attention mechanism in real time. i ; The dynamic weight adjustment module periodically calculates a time decay factor α t , which is used to update the initial relevance weight; the updated weight can be expressed as:
[0040]
[0041] Among them, α t is the time decay factor, corr(X i ,y) represents the correlation between the i-th environmental factor and the power generation at the current time step t. Time decay factor α t It can be dynamically adjusted based on the validity of historical data or other criteria to ensure that weight updates reflect the latest environmental data and power generation relationships.
[0042] As a preferred technical solution of the present invention, step S4 includes the following steps:
[0043] Step S41: The model makes a preliminary prediction on the time series data through a standard generative decoder to generate a rough prediction result: Y rough =Decoder(X);
[0044] Among them, Y rough Represents the preliminary forecast result, X is the input time series data;
[0045] Step S42: Analyze the preliminary prediction results and use the importance evaluation module to identify the time series segments that need further fine decoding; the importance evaluation module determines the identification of the important parts based on multiple indicators, including but not limited to the uncertainty of the prediction, the error estimate, and the mutation rate of certain key time points: I = ImportanceEvaluator (Y rough );
[0046] Among them, I is the identifier of the important part, indicating which sequence segments need to be decoded in detail;
[0047] Step S43: The model processes important segments by refining the decoder, and the calculation accuracy of the attention mechanism is restored to normal levels, making high-precision predictions for key parts:
[0048] Y refined =Decoder refined (X I );
[0049] Among them, Y refined To refine the prediction results after decoding, X I represents the time series segments selected according to their importance;
[0050] Step S44: Combine the roughly predicted non-critical part and the refined decoded critical part to form the final prediction result: Y final =Y rough ⊙(1-I)+Y refined ⊙I;
[0051] Among them, Y final is the final prediction result, and ⊙ represents the element-by-element multiplication operation.
[0052] As a preferred technical solution of the present invention, step S5 comprises the following steps:
[0053] Step S51: Use the optimized attention mechanism and generative decoder to perform end-to-end training on the model;
[0054] Step S52: using a variety of training strategies such as dynamic learning rate scheduling, early stopping, hyperparameter optimization, and regularization techniques to avoid overfitting and ensure the robustness of the model under different data distributions;
[0055] Step S53: Evaluate the performance of the model on the validation set and adjust the model parameters according to the evaluation results.
[0056] As a preferred technical solution of the present invention, the specific steps of step S6 are as follows:
[0057] Step S61: Integrate the model into the prediction system;
[0058] Step S62: Compare the prediction result with the actual power generation, and use the mean square error, mean absolute error, root mean square error and mean absolute percentage error statistical indicators to evaluate the prediction effect;
[0059] Step S63: Based on the evaluation results, further optimize and adjust the model to improve its performance in practical applications.
[0060] Compared with the prior art, the beneficial effects of the present invention are as follows: The present invention comprehensively processes environmental data and power generation data by combining local convolution feature extraction with dynamic weight adjustment. The local convolution feature extraction module captures short-term dependencies and compresses data dimensions, and the dynamic weight adjustment module monitors the impact of environmental factors in real time and dynamically updates weights to ensure that the model continues to maintain prediction accuracy in long-term applications. Subsequently, the staged decoding mechanism optimizes the prediction process and improves the efficiency of long sequence prediction. This method can improve the accuracy and efficiency of photovoltaic power generation prediction, thereby providing effective auxiliary decision-making for the operation and maintenance of photovoltaic power stations, reducing operation and maintenance costs, and improving operation and maintenance efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] Figure 1 It is a schematic diagram of the process of the present invention;
[0062] Figure 2 This is a flowchart of the phased decoder of the present invention. DETAILED DESCRIPTION
[0063] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0064] like Figure 1 to Figure 2 As shown, the present invention provides a photovoltaic power generation time series prediction method based on an improved Transformer model, comprising the following steps:
[0065] Step S1: Clean and standardize the environmental data and power generation data to eliminate noise and ensure data quality, so that the data is suitable for model training.
[0066] The specific steps are as follows:
[0067] Step S11: Identify and process missing values and outliers, remove or fill in missing data, and smooth outliers.
[0068] Step S12: Ensure that the timestamps of the time series data are consistent, and perform time alignment or resampling to ensure that all series are aligned at the same time step.
[0069] Step S13: Standardize the data, such as Z-score standardization, to reduce the scale difference of the data and improve the convergence speed of the model.
[0070] Step S2: Use a convolutional layer to extract local features from the input multivariate time series data.
[0071] The purpose of step S2 is to capture the short-term dependencies in the time series data and reduce the dimension of the input data. The specific steps are as follows:
[0072] Step S21: Design a feature embedding layer to map the environmental features of each time step into a high-dimensional space to obtain a more expressive feature representation.
[0073] Input multivariate time series data X = [x1, x2, ..., x t ], each time step x t Contains multiple environmental characteristics and a power generation data y t , that is, x t =[x t,1 ,x t,2 ,…,x t,n ,y t ]. t is the index of the time step, which indicates the position of the data in time.
[0074] Step S22: For the input time series data X=[x1, x2, ..., x t ]Introducing convolutional layers to extract local features. Convolutional layers capture short-term dependencies between local time steps and compress the dimensions of the input data. Use multi-scale convolutions to capture features in different time windows:
[0075]
[0076] in, is the local feature corresponding to the convolution kernel k, w k is the window size of the kth convolution kernel, For input data in window w k The fragment inside, b (k) is the bias term.
[0077] The choice of window size is related to the frequency of data collection and the objectives of the specific prediction task. If data is collected every 15 minutes, the setting of the window size needs to consider the following factors: the time span of the prediction task, the periodicity of the data, and the model's ability to handle long sequences. Because photovoltaic power generation has obvious daily periodicity, the window size needs to cover at least one day (24 hours), that is, 96 time steps. For common photovoltaic power generation prediction tasks, if intraday predictions are to be made (for example, predicting the power generation for the next day), 24 hours (that is, 96 time steps) are usually selected as the window size, which can effectively capture the periodicity and trend information of the previous day. If a longer time span is predicted, the window size can be further increased, such as 48 hours or 72 hours (that is, 192 to 288 time steps). If the model has a high computational complexity when processing long sequence data, the computational burden can be reduced by downsampling (for example, once an hour) or selecting a smaller window size.
[0078] Step S23: Use these local features as Transformer input to further capture global dependencies:
[0079]
[0080] Combining the local feature extraction capability of convolutional neural networks with the global dependency capture capability of Transformer, and optimizing the modeling of short-term and long-term dependencies, this hybrid architecture can better capture the complex relationship between power generation and environmental factors.
[0081] Step S3: Introduce a new dynamic weight adjustment module to dynamically adjust the attention weight according to the correlation between environmental factors and power generation, to ensure that factors with high correlation (such as daily radiation) receive more attention in the attention mechanism; the purpose is to dynamically adjust the attention weight and enhance the model's ability to allocate weights to different environmental factors.
[0082] Step S3 specifically includes the following steps:
[0083] Step S31: Consider paying more attention to environmental factors with higher relevance (such as daily radiation) and assigning smaller weights to factors with lower relevance (such as wind speed). Before the attention mechanism is calculated, the influence of each environmental factor on power generation is first estimated through the feature correlation evaluation module, so that the model can better reflect the actual impact of each environmental factor when predicting power generation. This can be achieved through historical data analysis or weight setting based on domain knowledge. For each environmental factor, calculate its Pearson correlation coefficient or Spearman correlation coefficient with power generation to obtain the correlation score r of each factor on power generation. i :
[0084] r i =corr(X i ,y);
[0085] Among them, X i is the data sequence of the i-th environmental factor, and y is the data sequence of power generation.
[0086] Step S32: normalize the calculated correlation score to obtain the weight w of each environmental factor i :
[0087]
[0088] Where n is the total number of environmental factors.
[0089] Step S33: Introduce an attention mechanism with weighted environmental factors. According to the correlation between environmental factors and power generation, the attention weight is dynamically adjusted to ensure that factors with high correlation (such as daily radiation) receive more attention in the attention mechanism. When calculating the attention weight, the correlation of each input feature is used as an additional weighting factor. Assume that the correlation weight is w i , then the calculation formula of the attention mechanism can be modified as follows:
[0090]
[0091] Where W = [w1,w2,…,w n ] is the weight matrix related to the correlation of environmental factors, and ⊙ represents the element-by-element multiplication operation.
[0092] Step S34: In order to ensure that the model remains accurate in long-term applications, especially in the face of seasonal changes or complex interactions between environmental factors, a dynamic weight update mechanism can be introduced. This module continuously monitors the impact of various environmental factors on the model prediction accuracy during the training process and adjusts the relevance weight w in the attention mechanism in real time. i The dynamic weight adjustment module periodically (e.g. after each training cycle) calculates a time decay factor α t , which is used to update the initial relevance weight. The updated weight can be expressed as:
[0093]
[0094] Among them, α i is the time decay factor, corr(X j ,y) represents the correlation between the i-th environmental factor and the power generation at the current time step t. Time decay factor α t It can be dynamically adjusted based on the validity of historical data or other criteria to ensure that weight updates reflect the latest environmental data and power generation relationships.
[0095] Step S4: A phased decoding mechanism is proposed to improve the efficiency and accuracy of long sequence prediction, reduce the amount of computation and focus on important information through preliminary prediction and refined decoding.
[0096] The specific steps include:
[0097] Step S41: The model first makes a preliminary prediction of the time series data through a standard generative decoder. At this stage, the calculation accuracy of the attention mechanism is intentionally reduced to improve the overall calculation efficiency and quickly generate a rough prediction result: Y rough =Decoder(X);
[0098] Among them, Y roughRepresents the preliminary prediction result, and X is the input time series data.
[0099] Step S42: Analyze the preliminary prediction results and use the importance assessment module to identify the time series segments that need further fine decoding. The importance assessment module identifies the important parts based on multiple indicators, such as the uncertainty of the prediction (calculated by variance or prediction interval width), error estimate (deviation from the historical true value), and the mutation rate of certain key time points (such as sunrise or sunset):
[0100] I=ImportanceEvaluator(Y rough );
[0101] Wherein, I is the identifier of the important part, indicating which sequence segments need to be decoded in detail.
[0102] Step S43: Perform more refined decoding for the selected time series segments. At this stage, the model processes these important segments through a refined decoder, and the calculation accuracy of the attention mechanism is restored to normal levels to ensure high-precision prediction of key parts:
[0103] Y refined =Decoder refined (X I );
[0104] Among them, Y refined To refine the prediction results after decoding, X I Represents time series segments selected according to their importance.
[0105] Step S44: Combine the roughly predicted non-critical part and the refined decoded critical part to form the final prediction result:
[0106] Y final =Y rough ⊙(1-I)+Y refined ⊙I;
[0107] Among them, Y final is the final prediction result, and ⊙ represents the element-by-element multiplication operation.
[0108] The standard decoder uses a shallower network structure, usually containing only a small number of decoding layers. Fewer attention heads (optionally, 2 or 4) are used to reduce the amount of computation. These attention heads are responsible for capturing the main patterns and global dependencies in the data, and pay less attention to local fine dependencies. The refined decoder uses a deeper network structure with more decoding layers. More attention heads (optionally, 8 or 16) are used to increase the expressiveness of the model. These attention heads can capture subtle dependencies in local time segments and pay more attention to important environmental factors.
[0109] Step S5: Combine the optimized attention mechanism and generative decoder to train the model end-to-end to ensure that the model can accurately capture the relationship between the environment and power generation.
[0110] The purpose of step S5 is to train the model to minimize the prediction error and evaluate the generalization ability of the model through the validation set. The specific steps are as follows:
[0111] Step S51: Use the optimized attention mechanism and generative decoder to train the model end-to-end.
[0112] Step S52: In order to improve the generalization ability of the model, we adopt multiple training strategies such as dynamic learning rate scheduling, early stopping, hyperparameter optimization, and regularization techniques to avoid overfitting and ensure the robustness of the model under different data distributions.
[0113] Step S53: Evaluate the performance of the model on the validation set and adjust the model parameters according to the evaluation results.
[0114] Step S6: Use the trained model to predict the power generation of new data, and use appropriate evaluation indicators (such as MAE, RMSE, etc.) to evaluate the prediction results.
[0115] The purpose of step S6 is to use the trained model to make actual predictions and evaluate the prediction results. The specific steps are as follows:
[0116] Step S61: Integrate the model into the prediction system to ensure that it can receive real-time data and output prediction results.
[0117] Step S62: Compare the prediction result with the actual power generation, and use statistical indicators such as mean square error, mean absolute error, root mean square error, and mean absolute percentage error to evaluate the prediction effect.
[0118] Step S63: Based on the evaluation results, further optimize and adjust the model to improve its performance in practical applications.
[0119] The present invention effectively improves the accuracy and efficiency of photovoltaic power generation prediction by introducing local convolution feature extraction, dynamic weight adjustment module and phased decoding mechanism. The local convolution feature extraction module can capture short-term dependencies in time series, while the dynamic weight adjustment module better captures the complex relationship between environmental variables and power generation by real-time monitoring of the impact of environmental factors and dynamically updating weights. The phased decoding mechanism significantly reduces the amount of calculation by combining preliminary prediction with refined decoding, while ensuring the prediction accuracy of key time steps. The overall solution not only improves the model's ability to process long sequence data, but also shows significant advantages in the real-time and accuracy of power generation prediction, which makes the present invention have broad application prospects and practical value in time series prediction tasks in the energy field.
[0120] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.
[0121] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A photovoltaic power generation time series prediction method based on an improved Transformer model, characterized in that: The steps include: Step S1, cleaning and standardizing environmental data and power generation data; Step S2, extracting local features from the input multivariate time series data using a convolutional layer; Step S3: introducing a new dynamic weight adjustment module to dynamically adjust the attention weight according to the correlation between environmental factors and power generation; Step S4, a phased decoding mechanism is proposed to reduce the amount of computation and focus on important information through preliminary prediction and refined decoding; Step S5: Combine the optimized attention mechanism and generative decoder to perform end-to-end training on the model; Step S6: Use the trained model to predict the power generation of new data, and use evaluation indicators to evaluate the prediction results.
2. According to claim 1, a photovoltaic power generation time series prediction method based on an improved Transformer model is characterized by: The specific process of step S1 is as follows: Step S11, identifying and processing missing values and outliers, removing or filling missing data, and smoothing outliers; Step S12: Ensure that the timestamps of the time series data are consistent, and perform time alignment or resampling to ensure that all sequences are aligned at the same time step; Step S13, standardizing the data; The standardization processing method includes but is not limited to Z-score standardization.
3. The photovoltaic power generation time series prediction method based on the improved Transformer model according to claim 1 is characterized by: The specific process of S2 is as follows: S21. Design a feature embedding layer to map the environmental features of each time step into a high-dimensional space to obtain a more expressive feature representation. Input multivariate time series data X = [x1, x2, ..., x t ], each time step x t Contains multiple environmental characteristics and a power generation data y t , that is, x t =[x t,1 ,x t,2 ,…,x t,n ,y t ]; t is the index of the time step, which indicates the position of the data in time; S22, for the input time series data X = [x1, x2, ..., x t ]Introduce convolutional layers to extract local features; convolutional layers capture short-term dependencies between local time steps and compress the dimensions of the input data; use multi-scale convolutions to capture features within different time windows: in, is the local feature corresponding to the convolution kernel k, w k is the window size of the kth convolution kernel, For input data in window w k The fragment inside, b (k) is the bias term; S23. Use these local features as Transformer input to further capture global dependencies: Combining the local feature extraction capability of convolutional neural networks with the global dependency capture capability of Transformer, the modeling of short-term and long-term dependencies is optimized.
4. The photovoltaic power generation time series prediction method based on the improved Transformer model according to claim 1 is characterized by: The specific process of step S3 is: Step S31: For each environmental factor, calculate the Pearson correlation coefficient or Spearman correlation coefficient between it and the power generation, and obtain the correlation score r of each factor to the power generation. i ; r i =corr(X i ,y); Among them, X i is the data sequence of the i-th environmental factor, and y is the data sequence of power generation; Step S32: normalize the calculated correlation score to obtain the weight w of each environmental factor. i : Where n is the total number of environmental factors; Step S33: introduce an attention mechanism weighted by environmental factors, dynamically adjust the attention weight according to the correlation between environmental factors and power generation; when calculating the attention weight, take the correlation of each input feature as an additional weighting factor; assume that the correlation weight is w i , then the calculation formula of the attention mechanism can be modified as follows: Where W = [w1,w2,…,w n ] is the weight matrix related to the correlation of environmental factors, ⊙ represents the element-by-element multiplication operation; Step S34: introduce a dynamic weight update mechanism. This module continuously monitors the impact of various environmental factors on the model prediction accuracy during the training process and adjusts the relevance weight w in the attention mechanism in real time. i ; The dynamic weight adjustment module periodically calculates a time decay factor α t , which is used to update the initial relevance weight; the updated weight can be expressed as: Among them, α t is the time decay factor, corr(X i ,y) represents the correlation between the i-th environmental factor and the power generation at the current time step t; the time decay factor α t It can be dynamically adjusted based on the validity of historical data or other criteria to ensure that weight updates reflect the latest environmental data and power generation relationships.
5. The photovoltaic power generation time series prediction method based on the improved Transformer model according to claim 1 is characterized by: The step S4 comprises the following steps: Step S41: The model makes a preliminary prediction on the time series data through a standard generative decoder to generate a rough prediction result: Y rough =Decoder(X); Among them, Y rough Represents the preliminary forecast result, X is the input time series data; Step S42: Analyze the preliminary prediction results and use the importance evaluation module to identify the time series segments that need further fine decoding; the importance evaluation module determines the identification of the important parts based on multiple indicators, including but not limited to the uncertainty of the prediction, the error estimate, and the mutation rate of certain key time points: I = ImportanceEvaluator (Y rough ); Among them, I is the identifier of the important part, indicating which sequence segments need to be decoded in detail; Step S43: The model processes important segments by refining the decoder, and the calculation accuracy of the attention mechanism is restored to normal levels, making high-precision predictions for key parts: Y refined =Decoder refined (X I ); Among them, Y refined To refine the prediction results after decoding, X I represents the time series segments selected according to their importance; Step S44: Combine the roughly predicted non-critical part and the refined decoded critical part to form the final prediction result: AND final =And rough ⊙(1-I)+Y refined ⊙I; Among them, Y final is the final prediction result, and ⊙ represents the element-by-element multiplication operation.
6. The photovoltaic power generation time series prediction method based on the improved Transformer model according to claim 1 is characterized by: The step S5 comprises the following steps: Step S51: Use the optimized attention mechanism and generative decoder to perform end-to-end training on the model; Step S52: using a variety of training strategies such as dynamic learning rate scheduling, early stopping, hyperparameter optimization, and regularization techniques to avoid overfitting and ensure the robustness of the model under different data distributions; Step S53: Evaluate the performance of the model on the validation set and adjust the model parameters according to the evaluation results.
7. The photovoltaic power generation time series prediction method based on the improved Transformer model according to claim 1 is characterized by: The specific steps of step S6 are as follows: Step S61: Integrate the model into the prediction system; Step S62: Compare the prediction result with the actual power generation, and use the mean square error, mean absolute error, root mean square error and mean absolute percentage error statistical indicators to evaluate the prediction effect; Step S63: Based on the evaluation results, further optimize and adjust the model to improve its performance in practical applications.
Citation Information
Cited By
Global ionosphere TEC prediction method based on coding and decoding space-time Transform model
CN120144967A
Power distribution system energy efficiency dynamic optimization and energy-saving control method for massive time series data
CN121390961A
A power distribution system energy efficiency dynamic optimization and energy saving control method for mass time series data
CN121390961B
Hybrid deep learning-based photovoltaic generating capacity prediction method and system
CN121479631A