Photovoltaic generating capacity prediction method, system and device and storage medium
By combining a physical prior model with an attention mechanism, the uncertainty problem in predicting the power generation of residential photovoltaic systems is solved, improving prediction accuracy and robustness, and adapting to local shading and environmental changes.
Patent Information
- Application Number
- CN202511604448.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-05
- Publication Date
- 2026-02-06
AI Technical Summary
The power generation forecast of residential photovoltaic systems is subject to uncertainty and volatility. Existing methods are unable to fully and accurately characterize the system characteristics, resulting in insufficient forecast accuracy.
By combining physical prior models with attention mechanisms, a power generation prediction model is constructed through the fusion of residual modeling, deformable attention, self-attention and cross-attention, and predictions are made using historical power generation and weather data.
It improves the accuracy, interpretability, and robustness of power generation forecasting, adapting to the uncertainties brought about by local shading and environmental changes in residential photovoltaic systems.
Smart Images

Figure CN121484848A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of new energy forecasting and artificial intelligence, and in particular to a method, system, device and storage medium for forecasting photovoltaic power generation. Background Technology
[0002] Residential photovoltaic (PV) systems refer to small-scale solar power generation systems installed on the roofs or in the courtyards of residential buildings. Primarily for household use, surplus electricity can be fed into the grid or stored. It is an important form of distributed photovoltaic (PV) power generation. With the large-scale adoption of residential PV systems, distributed PV power generation has become an important component of the power grid. However, residential PV power generation is affected by multiple factors, including roof orientation, module degradation, partial shading, and weather changes, resulting in greater uncertainty and volatility in power generation.
[0003] Existing prediction methods mainly include physical model methods and data-driven methods. Physical model methods calculate theoretical power generation based on irradiance and system energy efficiency, while data-driven methods are based on neural networks and use historical power generation data for prediction.
[0004] Predicting the power generation of residential photovoltaic systems involves complex physical processes and data patterns. Relying solely on physical models or data-driven methods is insufficient to fully and accurately characterize the system characteristics, resulting in inadequate accuracy in photovoltaic power generation prediction. Summary of the Invention
[0005] To accurately predict residential photovoltaic power generation, this application provides a photovoltaic power generation prediction method, system, device, and storage medium.
[0006] Firstly, this application provides the following technical solution: Construct a physical prior model, which includes a formula for calculating power generation; Receive historical power generation data and historical weather data; The historical prior power generation for each day is calculated using the power generation calculation formula based on the historical power generation data and the historical weather data. A dataset is obtained by integrating the historical power generation data, the historical weather data, and the historical prior power generation data. A power generation prediction model is constructed, which includes a first encoder employing a deformable attention mechanism, a second encoder employing a self-attention mechanism, and a decoder employing a cross-attention mechanism. The power generation prediction model is trained using the dataset, and the trained power generation prediction model is used to predict photovoltaic power generation.
[0007] Based on the above technical solutions, this application proposes a method for predicting the power generation of residential photovoltaic systems. By combining physical priors (system performance factors) with attention mechanisms, and through the fusion of residual modeling, deformable attention, self-attention and cross-attention, the accuracy, interpretability and robustness of power generation prediction are improved. It is particularly suitable for the uncertainties brought about by local shading and environmental changes in residential photovoltaic systems.
[0008] In one specific feasible implementation, the construction of the physical prior model includes: Set the system performance factor calculation formula as follows:
[0009]
[0010] in, Let i be the system performance factor of the device at time i on a certain day; and These are the upper and lower limits of the performance factor, respectively; The differential power distribution at each moment of a given day; The differential irradiance at each moment on a given day; Let i be the irradiance at time i on a certain day; The formula for calculating power generation is as follows:
[0011] in, Let be the differential distribution quantity at time i on a certain day; Let be the differential irradiance at time i on a certain day; The daily performance factor of the equipment on a given day; A physical prior model is constructed based on the system performance factor calculation formula and the power generation calculation formula.
[0012] In one specific implementation scheme, the historical weather data includes historical radiation data, and the calculation of the historical prior power generation for each day using the power generation calculation formula based on the historical power generation data and the historical weather data includes: The daily system performance factor for each day is calculated using the system performance factor calculation formula based on the historical power generation data and the historical irradiance data. The historical prior power generation for each day is calculated using the power generation calculation formula based on the daily system performance factor and the historical irradiance data.
[0013] Through the above technical solutions, physical prior modeling provides preliminary predictions based on physical mechanisms, overcoming the problem of lack of physical constraints in purely data-driven methods. By introducing performance factors and combining them with predicted irradiance data to calculate physical prior power generation data, the physical mechanisms are combined with data-driven methods, enhancing the interpretability of the model.
[0014] In one specific implementation scheme, the dataset obtained by integrating the historical power generation data, the historical weather data, and the historical prior power generation data includes: The residual power generation is calculated based on the historical power generation data and the historical prior power generation, using the following formula:
[0015] in, This represents the daily residual power generation. This represents the actual daily power generation. Based on historical prior power generation; Normalize the historical power generation data and the historical prior power generation; The historical weather data and the residual power generation are standardized based on the calculated mean and standard deviation. The dataset is obtained by integrating the historical power generation data, the historical weather data, the historical prior power generation, and the residual power generation.
[0016] The above technical solutions normalize the power generation data, limiting it to the [0, 1] interval, which helps stabilize the model's training. Standardizing weather data and residual power generation ensures consistent scale across different features, which is beneficial for model learning. Logarithmic transformation of precipitation data compresses the data range and better handles extreme precipitation conditions.
[0017] In one specific implementation, training the power generation prediction model using the dataset includes: The residual power generation and the historical weather data are input into the first encoder and processed to obtain the first feature; The historical power generation data is input into the second encoder and processed to obtain the second feature; The first feature and the second feature are combined to obtain a comprehensive feature; The integrated features are input into the decoder for processing to obtain the model's predicted power generation; The training loss of the model is calculated based on the predicted power generation from the model and the historical power generation data. Train the power generation prediction model until the training loss is less than a preset value.
[0018] Through the above technical solutions, the dual encoder structure of this application captures local weather-sensitive features and global temporal patterns respectively, complementing each other. The self-attention mechanism helps capture long-term dependencies, while deformable attention focuses more on local changes. The cross-attention mechanism of the decoder realizes the dynamic correlation between historical features and future weather data, improving the accuracy and robustness of predictions.
[0019] In one specific implementation, the fusion of the first feature and the second feature to obtain the comprehensive feature includes: The first feature and the second feature are combined to obtain the target feature, which includes target sub-features from different sources; The comprehensive features are obtained by segmenting and encoding several target sub-features according to their sources.
[0020] By employing the aforementioned technical solution and assigning independent segment vector codes to features from different sources, the model can effectively distinguish features from different sources during attention computation. This enhances the model's ability to identify and utilize the complementarity between "weather-sensitive information" and "time-dependent information." It also improves the model's accuracy in capturing the interaction relationships between various types of data, thereby enhancing prediction performance.
[0021] In one specific implementation scheme, the step of predicting photovoltaic power generation using the trained power generation prediction model includes: Receive future weather data, including predicted radiation data; The daily system performance factor for each day is calculated using the system performance factor calculation formula based on the historical power generation data and the historical irradiance data. The predicted daily system performance factor is obtained by sorting the daily system performance factors for each day and taking the average value of the middle segment. The future prior power generation data is calculated using the power generation calculation formula based on the predicted daily system performance factor and the predicted irradiance data for each day. The future prior power generation data and the future weather data are concatenated and input into the decoder of the power generation prediction model to predict photovoltaic power generation.
[0022] Based on the above technical solutions, this application proposes a method for predicting the power generation of residential photovoltaic systems. By combining physical priors (system performance factors) with attention mechanisms, and through the fusion of residual modeling, deformable attention, self-attention and cross-attention, the accuracy, interpretability and robustness of power generation prediction are improved. It is particularly suitable for the uncertainties brought about by local shading and environmental changes in residential photovoltaic systems.
[0023] Secondly, this application provides a photovoltaic power generation prediction system, which adopts the following technical solution: the system includes: The physical prior model module is used to construct a physical prior model, which includes a formula for calculating power generation. The data receiving module is used to receive historical power generation data and historical weather data; The prior power generation calculation module is used to calculate the historical prior power generation for each day based on the historical power generation data and the historical weather data using the power generation calculation formula. The dataset integration module is used to integrate the historical power generation data, the historical weather data, and the historical prior power generation data to obtain a dataset. The model training module is used to construct a power generation prediction model, which includes a first encoder employing a deformable attention mechanism, a second encoder employing a self-attention mechanism, and a decoder employing a cross-attention mechanism. The power generation prediction module is used to train the power generation prediction model using the dataset, and to predict photovoltaic power generation using the trained power generation prediction model.
[0024] Thirdly, this application provides a computer device that adopts the following technical solution: it includes a memory and a processor, wherein the memory stores a computer program that can be loaded by the processor and executed as described above for a photovoltaic power generation prediction method.
[0025] Fourthly, this application provides a computer-readable storage medium, which employs the following technical solution: storing a computer program that can be loaded by a processor and executed as described above for a photovoltaic power generation prediction method.
[0026] In summary, this application has the following beneficial technical effects: (1) This application proposes a method for predicting the power generation of residential photovoltaic systems. It combines physical priors (system performance factors) with attention mechanisms. By integrating residual modeling, deformable attention, self-attention and cross-attention, it improves the accuracy, interpretability and robustness of power generation prediction. It is especially suitable for the uncertainties caused by local shading and environmental changes in residential photovoltaic systems.
[0027] (2) Physical prior modeling provides preliminary predictions based on physical mechanisms, overcoming the problem of lack of physical constraints in pure data-driven methods. By introducing performance factors and combining them with predicted irradiance data to calculate physical prior power generation data, the physical mechanisms are combined with data-driven methods to enhance the interpretability of the model.
[0028] (3) The dual encoder structure of this application captures local weather-sensitive features and global temporal patterns respectively, complementing each other. The self-attention mechanism helps to capture long-term dependencies, while deformable attention focuses more on local changes. The cross-attention mechanism of the decoder realizes the dynamic correlation between historical features and future weather data, improving the accuracy and robustness of prediction. Attached Figure Description
[0029] Figure 1 This is a flowchart of a photovoltaic power generation prediction method in an embodiment of this application.
[0030] Figure 2 This is a diagram of the power generation prediction model architecture.
[0031] Figure 3 It is a deformable attention architecture diagram.
[0032] Figure 4 Flowchart for calculating daily performance factor and prior power generation.
[0033] Figure 5 This is a flowchart for calculating residual power generation.
[0034] Figure 6 This is a structural block diagram of a photovoltaic power generation prediction method according to an embodiment of this application.
[0035] Figure labels: 601, Physical prior model module; 602, Data receiving module; 603, Prior power generation calculation module; 604, Data set integration module; 605, Model training module; 606, Power generation prediction module. Detailed Implementation
[0036] The following is in conjunction with the appendix Figures 1-6 This application will be described in further detail.
[0037] This application discloses a method for predicting photovoltaic power generation, which is used to accurately predict household photovoltaic power generation.
[0038] Residential photovoltaic (PV) systems refer to small-scale solar power generation systems installed on the roofs or in the courtyards of residential buildings. Primarily for household use, surplus electricity can be fed into the grid or stored. It is an important form of distributed photovoltaic (PV) power generation. With the large-scale adoption of residential PV systems, distributed PV power generation has become an important component of the power grid. However, residential PV power generation is affected by multiple factors, including roof orientation, module degradation, partial shading, and weather changes, resulting in greater uncertainty and volatility in power generation.
[0039] Existing prediction methods mainly include physical model methods and data-driven methods. Physical model methods calculate theoretical power generation based on irradiance and system energy efficiency, while data-driven methods are based on neural networks and use historical power generation data for prediction.
[0040] Predicting the power generation of residential photovoltaic systems involves complex physical processes and data patterns. Relying solely on physical models or data-driven methods is insufficient to fully and accurately characterize the system characteristics, resulting in inadequate accuracy in photovoltaic power generation prediction.
[0041] Therefore, this application proposes a method for predicting photovoltaic power generation, which can be used to accurately predict household photovoltaic power generation.
[0042] like Figure 1 As shown, the method includes: S10, Construct a physical prior model, which includes the formula for calculating power generation.
[0043] Specifically, a physical prior model is an innovative method that embeds physical laws, constraints, or known physical knowledge into a model to enhance the model's understanding and predictive ability regarding physical phenomena. This application pre-defines a formula for calculating power generation to construct the physical prior model.
[0044] S20 receives historical power generation data and historical weather data.
[0045] Specifically, during the implementation of this application, historical power generation data and historical weather data for the 30 days preceding the predicted target date are collected. The historical weather data includes: irradiance, cloud cover, temperature, precipitation, humidity, wind speed, air pressure, and evapotranspiration.
[0046] S30 uses the power generation calculation formula to calculate the historical prior power generation for each day based on historical power generation data and historical weather data.
[0047] Specifically, the historical prior power generation for each day is calculated using the power generation calculation formula based on historical power generation data and historical weather data.
[0048] S40 integrates historical power generation data, historical weather data, and historical prior power generation data to obtain a dataset.
[0049] Specifically, the data is integrated to obtain a dataset, which includes historical power generation data, historical prior power generation data, and historical weather data.
[0050] S50, construct a power generation prediction model, which includes a first encoder using a deformable attention mechanism, a second encoder using a self-attention mechanism, and a decoder using a cross-attention mechanism.
[0051] Specifically, a power generation prediction model is constructed, and the architecture diagram of the power generation prediction model is as follows: Figure 2 As shown, the power generation prediction model includes a first encoder (Encoder1), a second encoder (Encoder2), and a decoder (Decoder).
[0052] The first encoder employs a deformable attention mechanism. The structure is as follows: Figure 2 The Encoder1 part and Figure 3 As shown, specifically, a set of reference points is set at a fixed frequency along the time dimension. For each reference point, an offset network is used to learn one or more offsets. The original reference point features are replaced by the features of the position after adding the offset to the original reference point's location. The final sparse features are used as keys and values in attention calculation, while all queries are retained. (Compared to traditional self-attention, deformable attention does not require attention calculations at all time steps. Instead, it dynamically selects relevant moments based on learnable sampling points, thereby reducing computational cost and enhancing the ability to model local fluctuations.) Next, layer normalization (LayerNorm) and feedforward neural network (FFN) layers are used to stabilize training and improve feature representation capabilities. Residual connections are used in the decoder to alleviate the vanishing gradient problem and improve model training efficiency.
[0053] The second encoder employs a self-attention mechanism to model the global dependencies of the input long-term series, enabling it to characterize daily periodic patterns and long-term temporal regularities spanning multiple days. Layer normalization and the use of feedforward neural networks ensure stability and generalization ability. Residual connections are also used to alleviate the vanishing gradient problem and improve model training efficiency.
[0054] The decoder employs a cross-attention mechanism. The decoder input serves as the query, and the encoder's combined output serves as the key and value. Through cross-attention, the decoder can dynamically retrieve and aggregate relevant historical feature information when given future priors as input. For example, when predicting power at noon in the future, the decoder will focus on the pattern features of sunny midday days in historical sequences and refine the prediction by incorporating future weather forecasts. Layer normalization and the use of feedforward neural networks ensure stable information flow and enhance nonlinear representation. Residual connections are also used to mitigate the vanishing gradient problem and improve model training efficiency.
[0055] S60 uses the dataset to train a power generation prediction model, and then uses the trained power generation prediction model to predict photovoltaic power generation.
[0056] Specifically, the dataset is input into the power generation prediction model for training, and the trained power generation prediction model is used to predict photovoltaic power generation.
[0057] This application proposes a method for predicting the power generation of residential photovoltaic systems. It combines physical priors (system performance factors) with attention mechanisms, and improves the accuracy, interpretability and robustness of power generation prediction by fusing residual modeling, deformable attention, self-attention and cross-attention. It is particularly suitable for the uncertainties caused by local shading and environmental changes in residential photovoltaic systems.
[0058] In one embodiment, the step of constructing a physical prior model to accurately predict residential photovoltaic power generation can be specifically performed as follows: For continuous data, the relationship between power generation and solar irradiance can be expressed by the following formula.
[0059] in, This refers to instantaneous power generation, measured in W. The instantaneous irradiance per unit area is expressed in J / m². t represents the performance factor, which is related to the photovoltaic array area and photoelectric efficiency; t represents time, in seconds.
[0060] For discrete data, and considering the performance factor within a day as a constant, the above calculation formula can be adjusted to the following formula.
[0061] in, The daily performance factor of the equipment on a given day is updated daily. Let be the average power generation from time i to time i+1 on that day, simply referred to as power generation, with the unit being kW; The cumulative irradiance per unit area from time i to time i+1 on that day is simply called irradiance, and the unit is kWh / m^2; , These represent the differential power generation and differential irradiance at time i on that day, respectively; i is the hour index. (The same applies below.)
[0062] For boundary points, forward or backward differencing is used; for interior points, central differencing is used. The calculation formulas are as follows.
[0063] in, , These represent the data for the first and last points of the day, respectively. .
[0064] If the historical power generation data and corresponding historical irradiance data of the equipment on a certain day are known, the differential power generation at each moment on that day can be calculated using formula (3). Sum of differential irradiance Then, the performance factor of the equipment at each moment of the day can be calculated. The calculation formula is as follows:
[0065] in, Let i be the system performance factor of the device at time i on a certain day; Let be the differential distribution quantity at time i on a certain day; Let i be the differential irradiance at time i on a certain day; Let i be the irradiance at time i on a certain day; Let i be the irradiance at time i on a certain day; and These represent the upper and lower limits of the performance factor; the calculation method is as follows: First, calculate the hourly performance factor set based on all historical power generation data and historical irradiance data of the equipment. Then, identify and remove extreme values based on the corrected Z-score. The maximum value in the processed set is the performance factor. The minimum value is .
[0066] In one embodiment, to accurately predict residential photovoltaic power generation, the step of calculating the historical prior power generation for each day using a power generation calculation formula based on historical power generation data and historical weather data can be specifically performed as follows: The daily system performance factor for each day is calculated using the system performance factor calculation formula based on historical power generation data and historical irradiance data; the historical prior power generation for each day is calculated using the power generation calculation formula based on the daily system performance factor for each day and historical irradiance data.
[0067] Specifically, the calculation process for the daily system performance factor is explained in detail below: First, missing values in the original data are handled. Linear interpolation is used to process missing values in each continuous feature.
[0068] Next, calculate the daily performance factor for each day. The calculation process is as follows: Figure 4 As shown, the specific calculation process is as follows: Step 1: Based on the historical power generation data for the 30 days prior to the target date, the historical irradiance data from historical weather data, and the above formula (3), calculate the differential power generation for each time period over the 30 days. Sum of differential irradiance The total differential power distribution matrix is obtained. and total differential irradiance matrix .
[0069] Among them, the daily differential distribution power vector Diurnal differential irradiance vector j is the day index. The same applies below; Step 2: Based on the results obtained in Step 1 and formula (4), calculate the performance factors for 30 days and each time period. The total performance factor matrix is obtained. Among them, the daily performance factor vector When the irradiance is 0, the performance factor is set to 0. After setting it to 0, a de-zeroing process is performed. For a given date, Where N is the number of valid hours; ;
[0070] Step 3: Based on the results obtained in Step 2 and Formula (5), perform further processing, using the upper and lower limits of the performance factor. and Truncate the daily performance factor vector; Step 4: For vectors with a valid length greater than or equal to 6 obtained in Step 3... Sort them separately, take the 30%-80% range and calculate the average. The results are expressed using the total performance factor vector. This indicates that M represents the number of valid days; ; Step 5: Analyze the total performance factor vector obtained in Step 4. Sort the data, take the 30%-80% range and calculate the average to obtain the daily performance factor for that day. ; Finally, repeat the above steps to calculate the daily performance factor for each day. .
[0071] The calculation process for historical prior power generation is as follows: Figure 4 As shown, the details are as follows: Step 1: Calculate the differential irradiance at each moment based on the historical weather data for the target date and the formula (3) above. The diurnal differential irradiance vector is obtained. ; Step 2: Based on the results obtained in Step 1, the daily performance factor for the target date. And using formula (2), calculate the differential historical prior power generation at each moment of the day. The daily difference prior power generation vector is obtained. ; Step 3: [Regarding...] Perform forward accumulation, then limit to the device's rated power. Then, the historical prior power generation can be obtained. ; Finally, repeat the above steps to calculate the historical prior power generation for each day. .
[0072] It should be noted that prior power generation is divided into historical prior power generation and future prior power generation. During training, the performance factor is calculated using historical power generation and irradiance data for the 30 days prior to the target date, and then combined with the irradiance data for the target date to calculate the historical prior power generation data for the target date.
[0073] Physical prior modeling provides preliminary predictions based on physical mechanisms, overcoming the lack of physical constraints in purely data-driven methods. By introducing performance factors and combining them with predicted irradiance data to calculate physical prior power generation data, the physical mechanisms are integrated with data-driven methods, enhancing the interpretability of the model.
[0074] In one embodiment, to accurately predict residential photovoltaic power generation, the step of integrating historical power generation data, historical weather data, and historical prior power generation data to obtain a dataset can be specifically performed as follows: Based on the actual daily power generation and historical prior power generation Calculate the daily residual power generation. The calculation process is as follows: Figure 5 As shown, the calculation formula is as follows:
[0075] in, This represents the daily residual power generation. This represents the actual daily power generation. Based on historical prior power generation; The dataset was divided into training, validation, and test sets in a 7:1:2 ratio to ensure the time order was not disrupted, and then standardized (mean 0, variance 1). The processing procedure is as follows: (1) For actual power generation and prior power generation Divide by the rated power of the equipment Normalize to the interval [0, 1]; (2) For residual power generation No scaling is applied to avoid weakening the values due to their small range. The residual power generation in the training set is standardized, and the corresponding mean is saved. and standard deviation The transformation formula is as follows:
[0076] (3) Perform a logarithmic transformation on the precipitation data in the weather data of the training set. The transformation formula is as follows:
[0077] Then, standardization is performed, and the corresponding mean is saved. and standard deviation ; (4) Standardize the irradiance, cloud cover, temperature, humidity, wind speed, air pressure and evapotranspiration in the weather data of the training set, and save the corresponding mean values. and standard deviation ; (5) Use the multiple sets of means saved in the above steps. and standard deviation The corresponding data in the validation set and test set are standardized to ensure no information leakage.
[0078] Finally, training, validation, and test samples are obtained by sliding windows on the training, validation, and test sets, respectively. The input data length is 7×24 (7 days), the output data length is 24 (1 day), and the sliding window step size is 24 (1 day).
[0079] Normalizing power generation data and limiting it to the [0,1] interval helps stabilize model training. Standardizing weather data and residual power generation ensures consistent scale across different features, which is beneficial for model learning. Logarithmic transformation of precipitation data compresses the data range and better handles extreme precipitation events.
[0080] In one embodiment, to accurately predict residential photovoltaic power generation, the step of training a power generation prediction model using a dataset can be specifically performed as follows: First, the residual power generation and historical weather data are input into the first encoder to obtain the first feature. Specifically, the historical residual power generation data (the difference between the actual power generation and the prior power generation) for 7 consecutive days is concatenated with the historical weather data at the corresponding time, segmented encoding is added, and then the whole data is encoded and used as the input of the first encoder. The first encoder extracts feature representations of the first feature of the input that are highly correlated with local weather changes, such as the impact of shadow occlusion and cloud changes on short-term power fluctuations.
[0081] Then, the historical power generation data is input into the second encoder to obtain the second feature. Specifically, the historical power generation data for 7 consecutive days is input into the second encoder to extract global time series features, especially the periodic patterns, historical regularities and trend information of photovoltaic power generation.
[0082] Next, the first feature and the second feature are fused to obtain the comprehensive feature. Specifically, the output features of encoder 1 and encoder 2 are fused and then sent to the decoder. Then, the comprehensive features are input into the decoder to obtain the model's predicted power generation. Specifically, the decoder output is mapped to the predicted household photovoltaic power generation for the next 24 hours (i.e., 24 time points) through a fully connected layer (Projection). The prediction result is a normalized power value, which is then denormalized to the actual power in the post-processing stage. The training loss of the model is calculated based on the predicted power generation and historical power generation data. The power generation prediction model is trained until the training loss is less than a preset value. Specifically, the model is trained using mean squared error (MSE) or mean absolute error (MAE), and backpropagation is used to optimize the parameters. The loss function can be replaced with Huber Loss to enhance robustness.
[0083] This application employs a dual-encoder structure to capture local weather-sensitive features and global temporal patterns, complementing each other. The self-attention mechanism helps capture long-term dependencies, while deformable attention focuses more on local changes. The decoder's cross-attention mechanism enables dynamic correlation between historical features and future weather data, improving prediction accuracy and robustness.
[0084] In one embodiment, to accurately predict residential photovoltaic power generation, the step of integrating the first feature and the second feature to obtain the comprehensive feature can be specifically performed as follows: The first and second features are concatenated to obtain the target features, which include target sub-features from different sources. Several target sub-features are segmented and encoded according to their sources to obtain the comprehensive features.
[0085] Specifically, the output features of encoder 1 and encoder 2 are fused and then fed into the decoder.
[0086] The fusion method is as follows: First, concatenate the local weather-sensitive features output by the first encoder with the global temporal features output by the second encoder.
[0087] Then, segment embedding is introduced: segment embedding is used to distinguish features from different sources. When concatenating the outputs of the first encoder and the second encoder, each is assigned an independent segment vector code. In this way, the model can effectively distinguish features from different sources during attention computation, and can identify and utilize the complementarity between "weather-sensitive information" and "time-dependent information", thereby more accurately capturing the interaction relationships between various types of data.
[0088] In one embodiment, to accurately predict residential photovoltaic power generation, the step of using a trained power generation prediction model to predict photovoltaic power generation can be specifically performed as follows: First, receive future weather data, which includes predicted radiation data; Then, the daily system performance factor is calculated based on historical power generation and historical irradiance data using the system performance factor calculation formula. The daily system performance factors are sorted and the average value of the middle range is taken to obtain the predicted daily system performance factor. Specifically, the performance factors for 30 days are calculated hourly first. The hourly performance factors for each day are further processed: outliers are removed, sorted, and the average value of the middle range is taken to obtain the daily performance factor for that day. The performance factors for each day are sorted, and the average value of the middle range is taken to obtain the performance factor for the target date.
[0089] Next, the future prior power generation data is calculated using the power generation calculation formula based on the predicted daily system performance factor and predicted irradiance data for each day. Specifically, the performance factor is calculated using the historical power generation and irradiance data of the most recent 30 days, and then combined with the predicted irradiance data for the next day, the future prior power generation data for the next day is calculated. Finally, the future prior power generation data and future weather data are concatenated and input into the decoder of the power generation prediction model to predict photovoltaic power generation. Specifically, the input to the decoder is a concatenation of the future prior power generation data and future weather data for a future date. This input is then fed into the decoder of the power generation prediction model to predict photovoltaic power generation, thus obtaining the prediction results for the next 24 hours.
[0090] This application proposes a method for predicting the power generation of residential photovoltaic systems. It combines physical priors (system performance factors) with attention mechanisms, and improves the accuracy, interpretability and robustness of power generation prediction by fusing residual modeling, deformable attention, self-attention and cross-attention. It is particularly suitable for the uncertainties caused by local shading and environmental changes in residential photovoltaic systems.
[0091] It should be noted that: 1. The calculation of prior power generation is not limited to performance factor modeling methods; other physical prior modeling approaches can also be used, such as those based on photovoltaic module equivalent circuit models, empirical formulas, correction factor models, or combinations of multiple modeling methods. By employing different physical modeling methods, more robust prior power generation can be obtained under various application scenarios, providing a reliable benchmark for subsequent residual modeling and prediction.
[0092] 2. If the weather data is incomplete (e.g., only containing irradiance and temperature), then the inputs to encoder 1 and decoder will use limited weather features. In this case, the model can still compensate for the missing features by using historical power generation information across days, maintaining high prediction accuracy.
[0093] 3. If the performance factor calculation window is not 30 days, but 15 days or 60 days, a more reasonable daily performance factor can still be obtained and prior power generation can be generated. The model structure remains unchanged, and predictions can still be made.
[0094] 4. The encoder can be replaced with other network structures, such as Convolutional Neural Networks (CNN), Long Short-Term Memory Networks (LSTM), etc. This is suitable for reducing model complexity when computational resources are limited.
[0095] 5. The method of this invention can be integrated into a cloud server or a residential inverter system. In actual operation: Users or the system automatically collect historical power generation and weather data for the past 30 days; automatically calculate performance factors and generate future prior power generation; the system inputs 7 days of historical weather data, 7 days of historical residual power generation data, future weather data, and future prior power generation data into the model to obtain the power generation prediction curve for the next 24 hours; the prediction results can be used for energy management, dispatch optimization, or revenue assessment.
[0096] 6. Optional solutions: (1) The segmented encoding method is not limited to fixed embedding; learnable ID vectors can be used.
[0097] (2) The optimizer can be Adam, SGD or AdamW.
[0098] (3) The loss function can be replaced with Huber Loss to enhance robustness.
[0099] (4) The model deployment method can be either centralized cloud-based prediction or real-time prediction via embedded devices.
[0100] Based on the above method, this application also discloses a photovoltaic power generation prediction system. For example... Figure 6 The system includes the following modules: The physical prior model module 601 is used to construct a physical prior model, which includes the formula for calculating power generation. Data receiving module 602 is used to receive historical power generation data and historical weather data; The prior power generation calculation module 603 is used to calculate the historical prior power generation for each day based on historical power generation data and historical weather data using the power generation calculation formula. The dataset integration module 604 is used to integrate historical power generation data, historical weather data, and historical prior power generation data to obtain a dataset. The model training module 605 is used to build a power generation prediction model, which includes a first encoder using a deformable attention mechanism, a second encoder using a self-attention mechanism, and a decoder using a cross-attention mechanism. The power generation prediction module 606 is used to train a power generation prediction model using a dataset, and then use the trained power generation prediction model to predict photovoltaic power generation.
[0101] In one embodiment, the physical prior model module 601 is specifically used to set the system performance factor calculation formula, as follows:
[0102]
[0103] in, Let i be the system performance factor of the device at time i on a certain day; and These are the upper and lower limits of the performance factor, respectively; Let be the differential distribution quantity at time i on a certain day; Let i be the differential irradiance at time i on a certain day; Let i be the irradiance at time i on a certain day; Let i be the irradiance at time i on a certain day; The formula for calculating power generation is as follows:
[0104] in, Let be the differential distribution quantity at time i on a certain day; Let be the differential irradiance at time i on a certain day; The daily performance factor of the equipment on a given day; A physical prior model is constructed based on the system performance factor calculation formula and the power generation calculation formula.
[0105] In one embodiment, the prior power generation calculation module 603 is specifically used to calculate the daily system performance factor for each day based on historical power generation data and historical irradiance data using the system performance factor calculation formula. The historical prior power generation for each day is calculated using the power generation calculation formula based on the daily system performance factor and historical irradiance data.
[0106] In one embodiment, the dataset integration module 604 is specifically used to calculate the residual power generation based on historical power generation data and historical prior power generation, using the following formula:
[0107] in, This represents the daily residual power generation. This represents the actual daily power generation. Based on historical prior power generation; Normalize historical power generation data and historical prior power generation; standardize historical weather data and residual power generation based on the calculated mean and standard deviation; integrate historical power generation data, historical weather data, historical prior power generation, and residual power generation to obtain a dataset.
[0108] In one embodiment, the model training module 605 is specifically used to input residual power generation and historical weather data into a first encoder to obtain a first feature; input historical power generation data into a second encoder to obtain a second feature; fuse the first feature and the second feature to obtain a comprehensive feature; input the comprehensive feature into a decoder to obtain the model's predicted power generation; calculate the model's training loss based on the model's predicted power generation and historical power generation data; and train the power generation prediction model until the training loss is less than a preset value.
[0109] In one embodiment, the model training module 605 is specifically used to concatenate the first feature and the second feature to obtain the target feature, the target feature including target sub-features from different sources; and to perform segmented encoding processing on several target sub-features according to their sources to obtain the comprehensive feature.
[0110] In one embodiment, the power generation prediction module 606 is specifically used to receive future weather data, including predicted irradiance data; calculate the daily system performance factor for each day based on historical power generation data and historical irradiance data using the system performance factor calculation formula; sort the daily system performance factors for each day and take the average value of the middle segment to obtain the predicted daily system performance factor; calculate the future prior power generation data based on the predicted daily system performance factor and predicted irradiance data using the power generation calculation formula; input the historical weather data, historical residual power generation data, and historical power generation data into the encoder of the power generation prediction model, and simultaneously concatenate the future prior power generation data and future weather data into the decoder of the power generation prediction model to perform photovoltaic power generation prediction.
[0111] This application also discloses a computer device.
[0112] Specifically, the computer device includes a memory and a processor, the memory storing a computer program that can be loaded by the processor and executed as described above for predicting photovoltaic power generation.
[0113] This application also discloses a computer-readable storage medium.
[0114] Specifically, the computer-readable storage medium stores a computer program that can be loaded by a processor and executed, such as the photovoltaic power generation prediction method described above. The computer-readable storage medium includes, for example, various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0115] This specific embodiment is merely an explanation of the present invention and is not intended to limit the invention. After reading this specification, those skilled in the art can make modifications to this embodiment without contributing any inventive step, but such modifications are protected by patent law as long as they are within the scope of the claims of the present invention.
Claims
1. A method for predicting photovoltaic power generation, characterized in that, The method includes: Construct a physical prior model, which includes a formula for calculating power generation; Receive historical power generation data and historical weather data; The historical prior power generation for each day is calculated using the power generation calculation formula based on the historical power generation data and the historical weather data. A dataset is obtained by integrating the historical power generation data, the historical weather data, and the historical prior power generation data. A power generation prediction model is constructed, which includes a first encoder employing a deformable attention mechanism, a second encoder employing a self-attention mechanism, and a decoder employing a cross-attention mechanism. The power generation prediction model is trained using the dataset, and the trained power generation prediction model is used to predict photovoltaic power generation.
2. The method according to claim 1, characterized in that, The construction of the physical prior model includes: Set the system performance factor calculation formula as follows: in, Let i be the system performance factor of the device at time i on a certain day; and These are the upper and lower limits of the performance factor, respectively; Let be the differential distribution quantity at time i on a certain day; Let i be the differential irradiance at time i on a certain day; Let i be the irradiance at time i on a certain day; The formula for calculating power generation is as follows: in, Let be the differential distribution quantity at time i on a certain day; Let be the differential irradiance at time i on a certain day; The daily performance factor of the equipment on a given day; A physical prior model is constructed based on the system performance factor calculation formula and the power generation calculation formula.
3. The method according to claim 2, characterized in that, The historical weather data includes historical radiation data, and the calculation of the historical prior power generation for each day using the power generation calculation formula based on the historical power generation data and the historical weather data includes: The daily system performance factor for each day is calculated using the system performance factor calculation formula based on the historical power generation data and the historical irradiance data. The historical prior power generation for each day is calculated using the power generation calculation formula based on the daily system performance factor and the historical irradiance data.
4. The method according to claim 3, characterized in that, The dataset obtained by integrating the historical power generation data, the historical weather data, and the historical prior power generation data includes: The residual power generation is calculated based on the historical power generation data and the historical prior power generation, using the following formula: in, This represents the daily residual power generation. This represents the actual daily power generation. Based on historical prior power generation; Normalize the historical power generation data and the historical prior power generation; The historical weather data and the residual power generation are standardized based on the calculated mean and standard deviation. The dataset is obtained by integrating the historical power generation data, the historical weather data, the historical prior power generation, and the residual power generation.
5. The method according to claim 4, characterized in that, The step of training the power generation prediction model using the dataset includes: The residual power generation and the historical weather data are input into the first encoder and processed to obtain the first feature; The historical power generation data is input into the second encoder and processed to obtain the second feature; The first feature and the second feature are combined to obtain a comprehensive feature; The integrated features are input into the decoder for processing to obtain the model's predicted power generation; The training loss of the model is calculated based on the predicted power generation from the model and the historical power generation data. Train the power generation prediction model until the training loss is less than a preset value.
6. The method according to claim 5, characterized in that, The integrated feature obtained by fusing the first feature and the second feature includes: The first feature and the second feature are combined to obtain the target feature, which includes target sub-features from different sources; The comprehensive features are obtained by segmenting and encoding several target sub-features according to their sources.
7. The method according to claim 6, characterized in that, The process of predicting photovoltaic power generation using the trained power generation prediction model includes: Receive future weather data, including predicted radiation data; The daily system performance factor for each day is calculated using the system performance factor calculation formula based on the historical power generation data and the historical irradiance data. The predicted daily system performance factor is obtained by sorting the daily system performance factors for each day and taking the average value of the middle segment. The future prior power generation data is calculated using the power generation calculation formula based on the predicted daily system performance factor and the predicted irradiance data for each day. The future prior power generation data and the future weather data are concatenated and input into the decoder of the power generation prediction model to predict photovoltaic power generation.
8. A photovoltaic power generation prediction system, characterized in that, The system includes: The physical prior model module (601) is used to construct a physical prior model, which includes a formula for calculating power generation. The data receiving module (602) is used to receive historical power generation data and historical weather data; The prior power generation calculation module (603) is used to calculate the historical prior power generation for each day based on the historical power generation data and the historical weather data using the power generation calculation formula. The dataset integration module (604) is used to integrate the historical power generation data, the historical weather data, and the historical prior power generation to obtain a dataset. The model training module (605) is used to construct a power generation prediction model, which includes a first encoder employing a deformable attention mechanism, a second encoder employing a self-attention mechanism, and a decoder employing a cross-attention mechanism. The power generation prediction module (606) is used to train the power generation prediction model using the dataset and to predict photovoltaic power generation using the trained power generation prediction model.
9. A computer device, characterized in that, It includes a memory and a processor, wherein the memory stores a computer program that can be loaded by the processor and executed according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer program is stored that can be loaded by a processor and executed according to any one of claims 1 to 7.