Photovoltaic power generation power medium and short term prediction method and system
Through a model of endogenous and exogenous variables combined with K-Medoids clustering and DTW technology, the TimeXer network is used to predict photovoltaic power generation, which solves the problems of photovoltaic power generation power volatility and data incompleteness, and achieves high-precision prediction under different weather conditions, improving the monitoring and management effect of photovoltaic systems.
Patent Information
- Application Number
- CN202510437931.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-09
- Publication Date
- 2025-08-26
AI Technical Summary
The existing photovoltaic power prediction methods face high volatility and incomplete data, the prediction accuracy is insufficient, especially in long-term seasonal changes and sudden weather events, and the computing resources are consumed, making it difficult to meet the actual application needs.
A model based on joint learning of endogenous and exogenous variables is adopted, combined with K-Medoids clustering algorithm and dynamic time regularization (DTW) technology, similar days are selected from historical data, and the influence of endogenous and exogenous variables is processed through the TimeXer network, and a multi-head self-attention mechanism is used for collaborative modeling to identify complex input data relationships.
It improves the accuracy and stability of photovoltaic power generation prediction, can achieve medium- and short-term accurate prediction under different weather conditions, and improves the online monitoring and energy management efficiency of photovoltaic systems.
Smart Images

Figure CN120545950A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of photovoltaic power generation system monitoring, and in particular to a method and system for short- to medium-term prediction of photovoltaic power generation. Background Art
[0002] Fossil fuels have long dominated global energy consumption. However, with growing global concern about climate change, energy security, and environmental pollution, their drawbacks are becoming increasingly apparent. The large amounts of greenhouse gases released during the combustion of fossil fuels not only exacerbate global climate change but also contribute to air pollution and ecological damage, imposing significant environmental and social costs. In contrast, solar energy, as a clean, renewable energy source, offers significant advantages. Its use produces virtually no harmful emissions, significantly reducing its negative environmental impact. Its widespread and durable source, with virtually no geographical restrictions, can provide a sustainable energy supply worldwide. Large-scale application of solar energy for photovoltaic power generation can not only reduce carbon emissions and enhance energy security, but also promote the transition of the economy towards a green and sustainable future.
[0003] However, photovoltaic power generation exhibits significant fluctuations, primarily due to factors such as meteorological conditions, light intensity, and climate change. This makes photovoltaic power prediction particularly complex and, in practical applications, poses significant challenges to the safety and economic viability of power systems. Therefore, accurately predicting photovoltaic power generation, especially power variations under varying weather and climate conditions, has become a hot topic of current research. Research on photovoltaic power prediction is an important approach to improving the efficiency of photovoltaic energy utilization. Accurate power prediction not only provides reliable data support for grid dispatch, enabling more accurate load forecasting and generation scheduling, but also helps reduce power system operating costs and improve reliability.
[0004] Traditional PV power forecasting methods primarily rely on statistical models and machine learning algorithms, such as autoregressive integrated moving average (ARIMA), support vector machines (SVM), and random forests. These methods are generally suitable for data with certain regularities and relative stability. However, due to the inherent volatility and complexity of PV power data, the forecast accuracy of these methods often falls short of practical application requirements. This is particularly true when faced with complex factors such as long-term seasonal variations and sudden weather events. Furthermore, statistical models such as ARIMA struggle to handle nonlinear relationships and are unable to fully exploit the deeper characteristics of PV power data.
[0005] In recent years, with advances in neural network technology, the Transformer and its derivatives, such as the Informer, Autoformer, and Temporal Convolutional Networks (TCNs), have been widely used in time series forecasting. The Transformer, through its self-attention mechanism, effectively captures dependencies over long time spans, making it suitable for processing complex time series data. The Informer, with its sparse attention mechanism, optimizes computational efficiency and reduces computational complexity for long time series, making it particularly suitable for processing large-scale time series. The Autoformer, through its seasonal decomposition strategy, better captures long-term trends and cyclical fluctuations in time series, making it suitable for series with significant seasonality and cyclical characteristics. Meanwhile, the TCN, through causal convolution and dilated convolution, captures local patterns and trends in the series, avoiding the vanishing and exploding gradient problems and demonstrating high parallelism and training speed for short-term forecasting tasks. While these methods demonstrate strong capabilities in modeling long time series and capturing complex patterns, they still face challenges, particularly high requirements for data volume and quality. This can lead to unstable model performance, particularly when dealing with highly volatile and incomplete photovoltaic power data. In addition, although these models have advantages in processing long sequences, the training process is complex and consumes a lot of computing resources. Therefore, how to effectively deal with data noise, missing and incompleteness remains a problem that needs to be solved in their practical applications.
[0006] To address the challenges in photovoltaic power forecasting, this paper proposes a medium- and short-term photovoltaic power forecasting method based on a joint learning model of endogenous and exogenous variables. By combining the K-Medoids clustering algorithm with the dynamic time warping (DTW) technology, days with similar weather conditions to the forecast day are selected from historical data. This similar day selection strategy can effectively capture the periodic and seasonal variations in photovoltaic power data and reduce the noise caused by extreme weather or other abnormal factors. More importantly, based on the TimeXer network, endogenous variables (such as historical power data) are efficiently processed and their influence is effectively integrated with the influence of exogenous variables (such as meteorological data, time information, etc.) to model and predict similar day data, so as to efficiently identify the complex interrelationships between various types of input data, thereby providing more accurate predictions. Combining these two methods, the proposed model has more powerful modeling capabilities, flexibility, and robustness, significantly improving the prediction effect and stability. Experimental results show that this method can achieve high photovoltaic power forecasting accuracy regardless of sunny, cloudy or rainy conditions. Compared with the prediction results of traditional models, the prediction method based on the joint learning model of endogenous and exogenous variables has the smallest mean absolute error (MAE) and mean square error (MSE), and has outstanding advantages in photovoltaic power generation prediction. It can be applied to actual photovoltaic power generation prediction tasks and provide a reference for the coordinated scheduling, risk analysis and scientific decision-making of photovoltaic power generation systems. Summary of the Invention
[0007] In view of the above problems in the prior art, the present invention is proposed.
[0008] The purpose of this invention is to address the problem that photovoltaic power generation is difficult to predict and propose a medium- and short-term prediction method for photovoltaic power generation based on a joint learning model of endogenous and exogenous variables.
[0009] To solve the above technical problems, the present invention provides the following technical solution: a method for short- to medium-term prediction of photovoltaic power generation, comprising: preprocessing photovoltaic power generation data and performing feature selection;
[0010] The DTW algorithm is used for similarity assessment to model the relationship between weather conditions and power generation;
[0011] Clustering of similar days is performed using K-Medoids combined with the DTW algorithm;
[0012] Train a predictive model and evaluate its performance.
[0013] As a preferred solution of the method for medium- to short-term prediction of photovoltaic power generation according to the present invention, the preprocessing of photovoltaic power generation data is expressed as follows:
[0014]
[0015] Among them, x * is the data after standardization, x is the data before standardization, μ is the mean of all data, and σ is the standard deviation of all data.
[0016] As a preferred solution of the method for medium- to short-term prediction of photovoltaic power generation according to the present invention, the feature selection is expressed as follows:
[0017]
[0018] Where ρ is the Spearman correlation coefficient, d i is the rank difference of each pair of observations in the two variables, and n is the number of samples.
[0019] As a preferred solution of the method for medium- to short-term prediction of photovoltaic power generation according to the present invention, the DTW algorithm is expressed as:
[0020]
[0021] Among them, A and B represent the meteorological time series that need to be compared on two similar days. i Represents the i-th data point or element in sequence A. b j Represents the j-th data point or element in sequence B.
[0022] As a preferred solution of the method for medium- to short-term prediction of photovoltaic power generation according to the present invention, the similar day clustering is represented as follows:
[0023]
[0024]
[0025] Among them, σ j is the standard deviation of the jth column, μ j is the mean of the jth column, w j is the weight of the jth feature, k is the number of meteorological features selected, and the DTW distance of the multivariate meteorological characteristic curve is weighted to construct D mdtw The numerical distance similarity and morphological change similarity between multivariate meteorological characteristic curves are measured and expressed as:
[0026] D mdtw =w1D1+w2D2+L+w j D j
[0027] j=1,2,Lm
[0028] Where m is the total number of meteorological characteristics; w j is the weight D of the jth meteorological featurej is the dynamic time warping distance of the jth meteorological feature, D mdtw Represents the distance of the multivariate meteorological feature sequence obtained by DTW measurement.
[0029] As a preferred solution of the medium- and short-term prediction method of photovoltaic power generation described in the present invention, the training prediction model includes initializing the parameters of the TimeXer model and training the model using training set data. The model adjusts the parameters and optimizes the objective function by minimizing the prediction error.
[0030] As a preferred solution of the medium- and short-term prediction method of photovoltaic power generation described in the present invention, the reward function generated by the optimal response strategy generated by reinforcement learning is expressed as follows: the test set data is input into the trained TimeXer model to predict the photovoltaic power generation power, and compared with the actual observation value, and the mean square error and mean absolute error analysis methods are used as indicators for evaluating the prediction effect.
[0031] As a preferred solution of the medium- and short-term photovoltaic power generation prediction system described in the present invention, it includes: a preprocessing module, a modeling module, a similar day clustering module, and a training and evaluation module.
[0032] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and is characterized in that when the processor executes the computer program, the steps of any one of the methods for medium- and short-term prediction of photovoltaic power generation are implemented.
[0033] A computer-readable storage medium having a computer program stored thereon, characterized in that when the computer program is executed by a processor, the steps of any one of the methods for medium- to short-term prediction of photovoltaic power generation are implemented.
[0034] The beneficial effects of this invention are as follows: First, the correlation between meteorological factors and photovoltaic power generation was analyzed using K-Medoids-DTW, and a cluster analysis of similar days was performed based on weather conditions. Subsequently, the TimeXer model was used to perform joint time-series forecasting of endogenous and exogenous variables, enabling accurate prediction of photovoltaic power generation under three common weather conditions: sunny, cloudy, and rainy. This method enables short- to medium-term photovoltaic power generation forecasts under these three common weather conditions, improving the accuracy and efficiency of online monitoring and energy management of photovoltaic systems. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of 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.
[0036] Figure 1 A schematic flow chart of a method for short- to medium-term prediction of photovoltaic power generation provided by one embodiment of the present invention. DETAILED DESCRIPTION
[0037] To make the above-mentioned objects, features, and advantages of the present invention more clearly understood, the following detailed description of the specific embodiments of the present invention is given in conjunction with the accompanying drawings. It is obvious that the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in this field without creative work should fall within the scope of protection of the present invention.
[0038] Example 1
[0039] Reference Figure 1 , which is the first embodiment of the present invention, provides a method for short- to medium-term prediction of photovoltaic power generation, such as Figure 1 As shown, including:
[0040] The technical solution adopted by the present invention is: a medium- and short-term photovoltaic power generation prediction modeling strategy based on K-Medoids-DTW and TimeXer. First, the K-Medoids clustering algorithm is combined with the dynamic time warping (DTW) technology, the weights of multiple meteorological characteristics are considered, and days with similar weather conditions to the predicted day are selected from historical data as the input of the model, and the future photovoltaic power generation power prediction value is used as the output of the model; then, the TimeXer network is used to efficiently process endogenous variables (such as historical power data) and effectively integrate them with the influence of exogenous variables (such as meteorological data, time information, etc.); then, through the multi-head self-attention mechanism, TimeXer automatically adjusts the weights of endogenous and exogenous variables to achieve collaborative modeling, effectively identify the complex relationships between various types of input data, and thus provide more accurate photovoltaic power prediction. The specific steps of the photovoltaic power prediction method based on similar day selection are as follows:
[0041] Step 1: Photovoltaic power data preprocessing
[0042] First, the input photovoltaic power data is standardized to ensure that they have the same unit and dimension to avoid affecting the model training effect and prediction accuracy. The standardization formula is as follows:
[0043]
[0044] Step 2: Feature Selection
[0045] To effectively select the meteorological features most closely related to PV power generation, reduce noise and redundant features, and improve model performance, the preprocessed PV power generation data was evaluated using the Spearman correlation coefficient. Based on the ranking of the PV data, the meteorological features most closely related to PV power generation were selected. The Spearman correlation coefficient was calculated as follows:
[0046]
[0047] Step 3: DTW algorithm evaluates PV data similarity
[0048] Considering that the photovoltaic output is similar and the situation is similar under similar weather conditions at different times, the DTW distance D mdtw =w1D1+w2D2+L+w j D j (j=1,2,Lm), measure the numerical distance similarity and morphological change similarity of PV data, and then weight the DTW distance of PV data according to the Spearman correlation coefficient.
[0049] According to the degree of influence of different weather conditions on power generation, the DTW algorithm is used to perform similarity evaluation to better model the relationship between weather conditions and power generation. K-Medoids randomly selects K data points as the initial medoid. Before clustering, the conditions for clustering each point must be found. In photovoltaic data, these points are the photovoltaic power output sequence of a day, and then each data point is assigned to the cluster with the highest similarity (that is, the cluster with the closest medoid). The distance between clusters is measured by DTW, that is, the similarity between photovoltaic data sequences can be measured by DTW. Here, two photovoltaic power output sequences A = {a1, a2, ..., a j} and B={b1,b2,...,b j} as an example, the DTW calculation formula is:
[0050]
[0051] This method categorizes different dates into different weather types (such as sunny, cloudy, and rainy) based on weather types and historical power generation data. Cluster analysis of historical data effectively groups similar time series data, ensuring diverse training data and accurate model evaluation, thereby improving the model's prediction accuracy under different weather conditions.
[0052] Step 4: Cluster similar days using K-Medoids combined with the DTW algorithm:
[0053] The Spearman correlation coefficient ranks data and then calculates correlations based on these rankings, making it particularly advantageous for evaluating nonparametric and nonlinear data relationships. Given the varying impacts of various meteorological factors on evaporation, and to more intuitively demonstrate the interactions between each variable in the dataset and power, as well as the seasonal variations in correlation, and taking into account the potential nonlinearity of these relationships, the Spearman correlation coefficient was used to analyze the correlation between meteorological factors and power.
[0054] After calculating DTW based on the meteorological data selected by the Spearman correlation coefficient, the coefficient of variation CV j Determine each D DTW The weight of , the coefficient determination method is as follows:
[0055]
[0056] Among them, σ j is the standard deviation of the jth column, μ j is the mean of the jth column, w j is the weight of the jth feature, and k is the number of meteorological features selected. Then the DTW distance of the multivariate meteorological characteristic curve is weighted to construct D mdtw To measure the numerical distance similarity and morphological change similarity between multivariate meteorological characteristic curves, the formula is as follows:
[0057] D mdtw =w1D1+w2D2+L+w j D j
[0058] j=1,2,Lm
[0059] Where: m is the total number of meteorological characteristics; w j is the weight D of the jth meteorological feature j is the dynamic time warping distance of the jth meteorological feature. mdtw Represents the distance of the multivariate meteorological feature sequence obtained by DTW. DTW is used to calculate the alignment distance between individual meteorological features, and then weightedly combines multiple meteorological features to measure their similarity. mdtw , each data point will be assigned to the D with its medoid mdtw The cluster with the smallest distance is finally divided into K categories. That is, in K-Medoids clustering K categories, D mdtwThe distance is used to measure the similarity of meteorological characteristics between similar days, and the K is divided into training set, validation set and test set in a ratio of 6:2:2 to ensure the diversity of training data and the accuracy of model evaluation.
[0060] The goal of K-Medoids clustering is to partition a dataset into K clusters by selecting actual data points as cluster centers (medoids), ensuring that the points within each cluster are as similar as possible while maximizing the differences between clusters. K-Medoids clustering divides the PV data into K clusters based on the weighted DTW distance of the data's meteorological characteristics. This allows for nonlinear alignment to find the optimal matching path even when similar parts of the PV data sequence are temporally dislocated or delayed.
[0061] Input the photovoltaic data after cluster analysis into the TimeXer model and use the power generation as the endogenous variable Taking meteorological data and solar irradiance as exogenous variables TimeXer embeds endogenous and exogenous sequences in blocks and introduces tags for each variable to bridge meteorological data and historical power generation data. This design avoids information misalignment caused by combining tags of different granularities. A multi-head self-attention mechanism is then applied simultaneously to both endogenous time tags and global tags to capture block-by-block dependencies. Finally, cross-attention is applied to endogenous and exogenous variables to integrate external information. The self-attention mechanism enables TimeXer to identify and capture correlations between input features at different time steps, effectively learning the dependency characteristics between photovoltaic power generation data and meteorological data.
[0062] The TimeXer prediction model ultimately outputs the medium- and short-term prediction results of photovoltaic power generation.
[0063] Step 5: Train the prediction model
[0064] After data preprocessing and feature selection, the model training process begins. First, the TimeXer model parameters are initialized and trained using the training set data. During training, the model adjusts parameters by minimizing prediction error and optimizing the objective function (such as mean squared error or root mean squared error). Training requires multiple iterations of the model, using a validation set to evaluate the effectiveness of each training round. Model parameters are adjusted based on the performance of the validation set to achieve the optimal model.
[0065] Step 6: Test set to evaluate model performance
[0066] After model training is complete, the test set is used for final evaluation. The trained TimeXer model is fed with the test set data to predict PV power generation and compare it with the actual observed values. The mean squared error (MSE) and mean absolute error (MAE) are used as metrics for evaluating prediction performance.
[0067] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
[0068] Example 2
[0069] The second embodiment of the present invention provides a medium- to short-term photovoltaic power generation prediction system, which is characterized by including a preprocessing module, a modeling module, a similar day clustering module, and a training and evaluation module.
[0070] The preprocessing module preprocesses the photovoltaic power data and performs feature selection;
[0071] The modeling module uses the DTW algorithm to perform similarity evaluation and model the relationship between weather conditions and power generation;
[0072] Similar day clustering module, which performs similar day clustering by combining K-Medoids with DTW algorithm;
[0073] The training and evaluation module trains the prediction model and evaluates the model effect.
[0074] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0075] The logic and / or steps represented in the flowcharts or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing the logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (e.g., a computer-based system, a system including a processor, or other system that can fetch and execute instructions from an instruction execution system, apparatus, or device). For purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transport a program for use by, or in conjunction with, an instruction execution system, apparatus, or device.
[0076] More specific examples (a non-exhaustive list) of computer-readable media include the following: an electrical connection with one or more wires (electronic devices), a portable computer disk cartridge (magnetic devices), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disc read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering, or processing in another suitable manner as necessary, and then stored in a computer memory.
[0077] It should be understood that various parts of the present invention can be implemented using hardware, software, firmware, or a combination thereof. In the above-described embodiments, multiple steps or methods can be implemented using software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented using hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof can be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application-specific integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0078] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. A method for short- to medium-term prediction of photovoltaic power generation, characterized by: include, Preprocess photovoltaic power data and perform feature selection; Clustering of similar days is performed using K-Medoids combined with the DTW algorithm; Use the TimeXer algorithm to build a prediction model for the relationship between weather conditions and power generation; Train a predictive model and evaluate its performance.
2. The method for short- to medium-term prediction of photovoltaic power generation according to claim 1, wherein: The preprocessing of photovoltaic power generation data is expressed as follows: Among them, x * is the data after standardization, x is the data before standardization, μ is the mean of all data, and σ is the standard deviation of all data.
3. The method for short- to medium-term prediction of photovoltaic power generation according to claim 2, wherein: The feature selection is expressed as: Where ρ is the Spearman correlation coefficient, d i is the rank difference of each pair of observations in the two variables, and n is the number of samples.
4. The method for short- to medium-term prediction of photovoltaic power generation according to claim 3, wherein: The DTW algorithm is expressed as, Among them, A and B represent the meteorological time series to be compared on two similar days; a i represents the i-th data point or element in sequence A; b j Represents the jth data point or element in sequence B.
5. The method for short- to medium-term prediction of photovoltaic power generation according to claim 4, characterized in that: The similar day clustering is expressed as: Among them, σ j is the standard deviation of the jth column, μ j is the mean of the jth column, w j is the weight of the jth feature, k is the number of meteorological features selected, and the DTW distance of the multivariate meteorological characteristic curve is weighted to construct D mdtw The numerical distance similarity and morphological change similarity between multivariate meteorological characteristic curves are measured and expressed as: D mdtw =w1D1+w2D2+L+w j D j j=1,2,Lm Where m is the total number of meteorological characteristics; w j is the weight D of the jth meteorological feature j is the dynamic time warping distance of the jth meteorological feature, D mdtw Represents the distance of the multivariate meteorological feature sequence obtained by DTW measurement.
6. The method for short- to medium-term prediction of photovoltaic power generation according to claim 5, characterized in that: The training prediction model includes initializing the parameters of the TimeXer model and training the model using training set data. The model adjusts the parameters and optimizes the objective function by minimizing the prediction error.
7. The method for short- to medium-term prediction of photovoltaic power generation according to claim 6, wherein: The evaluation model effect is generated by generating a reward function for the optimal response strategy through reinforcement learning. The test set data is input into the trained TimeXer model to predict the photovoltaic power generation power and compare it with the actual observation value. The mean square error and mean absolute error analysis methods are used as indicators for evaluating the prediction effect.
8. A system based on the method for short- to medium-term photovoltaic power generation prediction according to any one of claims 1 to 7, characterized in that: It includes preprocessing module, modeling module, similar day clustering module, and training evaluation module.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
User group charging load baseline quantification method and system fusing multi-source data
CN121256705A
Similar day retrieval method and device, computer equipment, storage medium and product
CN121614522A