Photovoltaic power prediction method and system, computer equipment and medium
By combining the Dualformer model with techniques such as BiLSTM, EMD, and K-means clustering, hierarchical modeling is used to capture photovoltaic power characteristics, solving the problem of accuracy in photovoltaic power prediction under sudden weather changes and achieving high-precision and stable operation of photovoltaic power generation systems.
Patent Information
- Application Number
- CN202511125766.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-12
- Publication Date
- 2025-11-07
AI Technical Summary
Existing photovoltaic power prediction methods lack accuracy under sudden weather conditions, have poor model robustness, and cannot achieve real-time updates, leading to challenges in the operational stability of photovoltaic power generation systems and grid dispatch.
By employing the Dualformer model combined with techniques such as BiLSTM, EMD, and K-means clustering, and using a hierarchical modeling approach, photovoltaic power characteristics at different time scales are captured. By integrating meteorological information, fine-grained similarity predictions are generated, thereby improving prediction accuracy and stability.
It significantly improves the prediction accuracy and system stability of photovoltaic power under sudden weather changes, enhances the adaptability and robustness of the model under drastic fluctuation scenarios, and improves the adaptive capability of multi-model fusion.
Smart Images

Figure CN120914765A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the field of photovoltaic power generation output power prediction, and particularly relates to a photovoltaic power prediction method, system, computer device and medium. BACKGROUND
[0002] As a clean and renewable energy source, photovoltaic power generation plays an increasingly important role in the global energy transition, especially in addressing climate change and reducing greenhouse gas emissions. However, the power output of photovoltaic power generation is affected by many factors such as solar radiation, weather changes, and seasonal changes, and its power generation has great volatility and uncertainty. Compared with traditional thermal power generation or hydroelectric power generation, photovoltaic power generation cannot provide stable and controllable power output, which makes the operation of photovoltaic power stations and the dispatching of power systems face greater challenges.
[0003] In order to realize the efficient utilization of photovoltaic power generation and ensure the safe and stable operation of the power grid, photovoltaic power generation power prediction technology has emerged. Accurate power generation prediction can not only help the power system to reasonably dispatch the load and balance the power grid, but also improve the adaptability of the power grid to renewable energy fluctuations. By combining meteorological data and historical power generation data, modern photovoltaic power generation power prediction models can predict the power generation in the future, providing important decision-making basis for power grid operation. Especially in the context of the gradual integration of large amounts of volatile renewable energy into the power system, photovoltaic power generation power prediction technology will help optimize power dispatching, reduce peak shaving costs, and improve the efficiency of power grid operation.
[0004] Photovoltaic power generation will play a greater role in the optimization of global energy structure and sustainable development, providing important support for promoting green energy development and achieving carbon neutralization goals. In recent years, with the development of big data and artificial intelligence technology, photovoltaic power prediction methods based on machine learning, deep learning, neural networks and other advanced algorithms have gradually become a research hotspot. However, these methods cannot accurately extract useful information from massive data, and the accuracy of short-term and long-term power prediction is not strong, and the robustness of the prediction model is poor, which cannot actively respond to photovoltaic power prediction under sudden weather conditions, and cannot completely realize real-time updating. However, the development of green energy requires higher prediction accuracy, and the existing methods cannot guarantee accurate photovoltaic power prediction under sudden weather conditions, which urgently needs to be solved. SUMMARY
[0005] In order to solve the problem of strong non-stationarity of the model and inaccurate prediction results in the above background, the application provides a photovoltaic power prediction method, system, computer device and medium.
[0006] In order to achieve the above purpose, the application provides a photovoltaic power prediction method, comprising: At multiple different time points, the short-term photovoltaic power sequence and the meteorological sequence are synchronously collected respectively.
[0007] The bidirectional power time sequence features of each short-term photovoltaic power sequence are extracted, the weight corresponding to each bidirectional power time sequence feature is calculated, all bidirectional power time sequence features and the weight are weighted and summed to obtain a global perception time sequence feature, and the global perception time sequence feature is mapped to a coarse-grained global prediction value of the short-term photovoltaic power.
[0008] Each short-term photovoltaic power sequence is decomposed into a set of local time-frequency feature components and a residual term, the fluctuation features of each local time-frequency feature component are captured respectively to obtain fluctuation features of multiple different time scales, and the fluctuation features of multiple different time scales and the residual term are mapped to a fine-grained adjacent prediction value of the short-term photovoltaic power.
[0009] A set of feature vectors fused with power and meteorological information is generated by splicing multiple groups of short-term photovoltaic power sequences and corresponding meteorological sequences, local power and meteorological comprehensive features are extracted from the set of feature vectors, the set of feature vectors is clustered according to weather patterns to generate weather embedding vectors, and the set of feature vectors is subjected to time sequence position coding to obtain a set of position coding vectors, the local power and meteorological comprehensive features, the weather embedding vectors and the set of position coding vectors are fused to obtain fused features, and the fused features are used to generate a fine-grained similar prediction value of the short-term photovoltaic power.
[0010] The final power prediction value is determined by the coarse-grained global prediction value, the fine-grained adjacent prediction value and the fine-grained similar prediction value of the short-term photovoltaic power.
[0011] Preferably, the Dualformer model is used to predict the short-term photovoltaic power sequence and the corresponding meteorological sequence to obtain the fine-grained similar prediction value of the short-term photovoltaic power, the Dualformer model is modified from a traditional Transform model, and the modification includes adding a one-dimensional feature extraction module and a weather embedding vector module before the input layer of the traditional Transform model, and adding a local convolution enhancement module between the traditional multi-head attention module and the feedforward network; wherein the one-dimensional feature extraction module is responsible for extracting the local power and meteorological comprehensive features; the weather embedding vector module is responsible for generating the weather embedding vectors; and the local convolution enhancement module is composed of a convolution layer, a batch normalization layer, an activation function and a pooling layer connected in sequence, and is responsible for enhancing the local power and meteorological comprehensive features.
[0012] Preferably, the use of the fused features to generate the fine-grained similar prediction value of the short-term photovoltaic power includes: query Q, key K, and value V of the fusion feature; calculating the weight of V using Q and K, and performing weighted summation on V using the weight to generate a global dependency fusion feature; generating a similar feature prediction sequence using the global dependency fusion feature; and mapping the similar feature prediction sequence to a fine-grained similar prediction value of the short-term photovoltaic power.
[0013] Preferably, the forward and backward bidirectional power time sequence features of the short-term photovoltaic power sequence are extracted by a bidirectional long short-term memory network (BiLSTM), the weights corresponding to the forward and backward bidirectional power time sequence features are calculated by an attention mechanism (Attention Mechanism), and finally a coarse-grained global prediction value of the short-term photovoltaic power is predicted.
[0014] Preferably, the EMD is used to decompose each short-term photovoltaic power sequence into a set of local time-frequency feature components and a residual term; a BiLSTM model is independently trained for each component in the set of local time-frequency feature components, a plurality of BiLSTM models are used to capture the fluctuation features of each local time-frequency feature component, and finally a fine-grained adjacent prediction value of the short-term photovoltaic power is predicted.
[0015] Preferably, after the short-term photovoltaic power sequence and the meteorological sequence are synchronously collected at a plurality of different time points, the method further comprises preprocessing the short-term photovoltaic power sequence and the meteorological sequence, specifically including: performing preliminary screening and data cleaning on the short-term photovoltaic power sequence and the meteorological sequence; extracting high-frequency sampling data from the cleaned short-term photovoltaic power sequence and the meteorological sequence, and setting a uniform time length for the high-frequency sampling data to obtain preprocessed short-term photovoltaic power sequence and meteorological sequence.
[0016] Also provided is a photovoltaic power prediction system, comprising: A data acquisition module is configured to synchronously collect a short-term photovoltaic power sequence and a meteorological sequence at a plurality of different time points.
[0017] The three-branch training module is used for extracting bidirectional power time sequence features of each short-term photovoltaic power sequence; calculating weights corresponding to each bidirectional power time sequence feature, and weighting and summing all bidirectional power time sequence features and weights to obtain global perception time sequence features; mapping the global perception time sequence features to coarse-grained global prediction values of the short-term photovoltaic power; decomposing each short-term photovoltaic power sequence into a set of local time-frequency feature components and a residual term; capturing fluctuation features of each local time-frequency feature component to obtain fluctuation features of multiple different time scales; mapping the fluctuation features of multiple different time scales and the residual term to fine-grained adjacent prediction values of the short-term photovoltaic power; splicing multiple groups of short-term photovoltaic power sequences and corresponding meteorological sequences to generate a set of feature vectors fusing power and meteorological information; extracting local power and meteorological comprehensive features from the set of feature vectors; clustering the set of feature vectors according to weather patterns to generate weather embedding vectors; performing time sequence position coding on the set of feature vectors to obtain a set of position coding vectors; fusing the local power and meteorological comprehensive features, the weather embedding vectors and the set of position coding vectors to obtain fused features; and generating fine-grained similar prediction values of the short-term photovoltaic power by using the fused features.
[0018] The prediction value generation module is used for determining a final power prediction value from the coarse-grained global prediction values, the fine-grained adjacent prediction values and the fine-grained similar prediction values of the short-term photovoltaic power.
[0019] The application further provides a computer device comprising a memory, a processor and a computer program stored on the memory, wherein the processor executes the computer program to implement the steps of any one of the photovoltaic power prediction methods.
[0020] The application further provides a computer readable storage medium, wherein the storage medium stores a computer program, and the computer program can execute the steps of any one of the photovoltaic power prediction methods when loaded by a processor.
[0021] The photovoltaic power prediction method provided by the application has the following beneficial effects: for photovoltaic power sequences under sudden weather conditions, the application obtains coarse-grained global prediction values, fine-grained adjacent prediction values and fine-grained similar prediction values of the short-term photovoltaic power by using three different prediction methods, and adds the weights of the three prediction values to obtain a final power prediction value; the prediction process is divided into two levels of coarse-grained and fine-grained, the layered modeling method not only captures key features at different scales, but also effectively improves the adaptability and stability of the model in the scene of severe fluctuations, fully fuses coarse-grained and fine-grained information, significantly improves the prediction accuracy and system stability of photovoltaic power under sudden weather conditions, and improves the robustness and self-adaptive ability of multi-model fusion. BRIEF DESCRIPTION OF DRAWINGS
[0022] In order to more clearly illustrate the embodiments of the present application and the design scheme thereof, the following will briefly introduce the drawings required by the present embodiment. The drawings in the following description are only part of the embodiments of the present application, and other drawings can also be obtained according to these drawings without creative labor for those skilled in the art.
[0023] Figure 1 A flow chart of a photovoltaic power prediction method according to an embodiment of the present application; Figure 2 A structure schematic diagram of the photovoltaic power prediction method according to an embodiment of the present application; Figure 3 A Dualformer model structure diagram according to an embodiment of the present application; Figure 4 A comparison diagram of actual value and predicted value of photovoltaic power under sudden weather condition according to an embodiment of the present application. DETAILED DESCRIPTION
[0024] In order to make those skilled in the art better understand the technical scheme of the present application and can be implemented, the present application will be described in detail below in combination with the drawings and specific embodiments. The following embodiments are only used to more clearly illustrate the technical scheme of the present application, and cannot limit the protection scope of the present application.
[0025] The present application provides a photovoltaic power prediction method, specifically as shown in Figure 1 , comprising: S1, synchronously collecting short-term photovoltaic power sequence and meteorological sequence at multiple different time points, respectively.
[0026] The operation data of a typical photovoltaic power station in Xinjiang is selected as the research object, and the photovoltaic power output data and the corresponding multi-dimensional meteorological observation data during the summer operation period are collected. Since the climate characteristics in Xinjiang are significant in summer, sudden weather such as sandstorm, sudden rain and strong convection is easy to occur, and the output power of the photovoltaic power generation system changes dramatically and fluctuates frequently during this period, which has typical mutation characteristics.
[0027] In order to effectively capture the power response behavior under sudden weather, high-frequency sampling data containing sudden weather period is extracted from the monitoring system, and the time granularity is set to 15 minutes. The synchronously collected meteorological data includes: component temperature, temperature, air pressure, humidity, total radiation, direct radiation, scattering radiation and other key parameters.
[0028] By preliminarily screening and cleaning the collected original data, invalid, missing or abnormal data are removed, and a high-quality historical data set covering the mutation weather condition is constructed. The data set not only contains the change trend of photovoltaic power, but also contains the related sudden weather characteristics, which provides stable, true and representative basic data support for the subsequent model training and evaluation.
[0029] S2, extract the forward and backward bidirectional power time sequence features of each short-term photovoltaic power sequence; calculate the weight corresponding to each forward and backward bidirectional power time sequence feature, and weight sum all the forward and backward bidirectional power time sequence features and the weight to obtain a global perception time sequence feature; map the global perception time sequence feature to a coarse-grained global prediction value of the short-term photovoltaic power; decompose each short-term photovoltaic power sequence into a set of local time-frequency feature components and a residual term; capture the fluctuation characteristics of each local time-frequency feature component respectively to obtain a plurality of fluctuation characteristics of different time scales; map the plurality of fluctuation characteristics of different time scales and the residual term to a fine-grained adjacent prediction value of the short-term photovoltaic power; splice a plurality of short-term photovoltaic power sequences and corresponding meteorological sequences to generate a feature vector set fusing power and meteorological information; extract local power and meteorological comprehensive features from the feature vector set; cluster the feature vector set according to weather patterns to generate weather embedding vectors; perform time sequence position coding on the feature vector set to obtain a position coding vector set; fuse the local power and meteorological comprehensive features, the weather embedding vectors and the position coding vector set to obtain fused features; and generate fine-grained similar prediction values of the short-term photovoltaic power using the fused features.
[0030] S2, extract the forward and backward bidirectional power time sequence features of each short-term photovoltaic power sequence; calculate the weight corresponding to each forward and backward bidirectional power time sequence feature, and weight sum all the forward and backward bidirectional power time sequence features and the weight to obtain a global perception time sequence feature; map the global perception time sequence feature to a coarse-grained global prediction value of the short-term photovoltaic power; decompose each short-term photovoltaic power sequence into a set of local time-frequency feature components and a residual term; capture the fluctuation characteristics of each local time-frequency feature component respectively to obtain a plurality of fluctuation characteristics of different time scales; map the plurality of fluctuation characteristics of different time scales and the residual term to a fine-grained adjacent prediction value of the short-term photovoltaic power; splice a plurality of short-term photovoltaic power sequences and corresponding meteorological sequences to generate a feature vector set fusing power and meteorological information; extract local power and meteorological comprehensive features from the feature vector set; cluster the feature vector set according to weather patterns to generate weather embedding vectors; perform time sequence position coding on the feature vector set to obtain a position coding vector set; fuse the local power and meteorological comprehensive features, the weather embedding vectors and the position coding vector set to obtain fused features; and generate fine-grained similar prediction values of the short-term photovoltaic power using the fused features.
[0031] A BiLSTM network is constructed to enable the model to simultaneously consider the forward and reverse information of the input data. The traditional LSTM model can only capture the forward dependency relationship in the time sequence, while in the photovoltaic power prediction problem, there may be bidirectional correlation between historical data. In order to enhance the modeling ability of the context information, the BiLSTM network is constructed so that the output of each time step contains state information in both forward and reverse directions. Let the input sequence be , then in the BiLSTM, the output is:
[0032] ; wherein, denotes the hidden state obtained from the forward LSTM, denotes the hidden state obtained from the backward LSTM, denotes a vector concatenation operation.
[0033] Within each LSTM cell, the update of the state relies on multiple gating mechanisms, mainly including the forget gate, the input gate, the output gate, and the cell state update, with the following specific calculations: ; ; ; ; ; ; wherein, is the current input, is the hidden state at the previous time step, is the memory cell state at the previous time step, and denote trainable weight matrices, is a bias term, denotes a sigmoid activation function, denotes Hadamard (element-wise) multiplication.
[0034] Through the above gating mechanisms, the LSTM cell can flexibly filter, memorize, and forget the input information, effectively modeling complex temporal dynamic characteristics. In the BiLSTM structure, the bidirectional LSTM is independently run and then the outputs are concatenated, thereby obtaining a more comprehensive time series representation.
[0035] On the basis of BiLSTM, an attention mechanism is added to improve the model's attention ability to different time steps. Since the importance of input at different time steps to the final output may be different, an attention mechanism is introduced to dynamically allocate the weights of time steps, improving the model's ability to identify key time series features. The attention mechanism derives the attention weight by calculating the correlation between the hidden state of each time step and the global context, with the formula:
[0036] ; ; wherein, is the attention weight of the th time step, is a learnable attention scoring function, and The trainable parameters in the attention mechanism. The final output is achieved by weighted summation:
[0037] ; The context vector is considered as the global perception representation of the model for the entire input sequence.
[0038] The relevant parameters of BiLSTM and attention mechanism are set according to the characteristics of the data and the requirements of the model. The parameters of BiLSTM include the number of hidden layer units, the number of network layers, and the selection of activation function. The dot product attention is selected for the attention mechanism, and the weight calculation method and the activation function form are set. At the same time, the hyperparameters are configured for the overall training process, including the optimizer, the learning rate, the batch size, the number of training rounds, and other hyperparameters, to ensure that the model can fully learn and maintain good stability and convergence during the training process.
[0039] The prepared training data is used for model training. During the training process, the input data will be processed through the BiLSTM network, and then the important time steps will be weighted through the attention mechanism to output the coarse-grained prediction results. The mean square error (MSE) is used as the loss function in the training process:
[0040] ; wherein, represents the value of the mean square error loss function, is the total number of samples, is the true value of the th sample, is the corresponding predicted value, represents the square of the prediction error of the sample.
[0041] The network parameters are continuously optimized through backpropagation and gradient descent, so that the prediction error gradually decreases. As the number of training rounds increases, the fitting ability of the model on the training set is continuously improved, and finally the output of the global trend prediction result is more accurate.
[0042] For the adjacent features in the fine-grained information, EMD decomposition and BiLSTM are used for prediction to obtain the adjacent feature prediction results. Each short-term photovoltaic power sequence is decomposed into a set of local time-frequency feature components and a residual term; the fluctuation characteristics of each local time-frequency feature component are captured to obtain multiple fluctuation characteristics of different time scales; the residual term is fitted to obtain a residual fitting value; the multiple fluctuation characteristics of different time scales and the residual fitting value are superimposed to obtain a fine-grained adjacent feature sequence; and the fine-grained adjacent feature sequence is mapped to a fine-grained adjacent prediction value of the short-term photovoltaic power.
[0043] The EMD algorithm is used to decompose historical adjacency feature data and extract intrinsic mode function (IMF) components at different time scales. Adjacency features reflect the high-frequency disturbances and short-term drastic changes in photovoltaic power under abrupt weather changes; therefore, directly modeling the original feature sequence may lead to unstable prediction accuracy. EMD, as an adaptive signal processing method, can decompose non-stationary, nonlinear time series into several IMF components with local time-frequency characteristics and a residual term. Let the original feature sequence be... After EMD decomposition, the following was obtained:
[0044] ; in, Indicates the first One eigenmode function For IMF quantity, These are the final residual components. Each IMF represents a local fluctuation component at a different scale in the original sequence.
[0045] A BiLSTM network is constructed to perform time series modeling of each IMF component. Each As independent inputs, they are fed into a bidirectional long short-term memory network with the same structure for training, enabling the model to capture the temporal evolution features of each component. Compared with traditional LSTM, BiLSTM can simultaneously consider the positive and negative dependencies of time series, performs better in capturing the contextual features of photovoltaic output changes, and has a stronger expressive ability for modeling the dynamic correlation between adjacent features.
[0046] The BiLSTM model parameters are configured and trained independently. Based on the feature complexity of the IMF, the network structure parameters of the BiLSTM are set, such as the number of hidden layer units, the number of layers, and the activation function. Simultaneously, training hyperparameters, such as the learning rate, batch size, and number of iterations, are also set. During training, MSE is used as the loss function to minimize the difference between predicted and actual values. By training the BiLSTM network for each IMF component individually, the model can accurately model the changing trends of different frequency bands.
[0047] All IMF predictions are reconstructed to obtain the final prediction results for adjacency features. This is done by reconstructing all IMF predictions into the BiLSTM models. After prediction, the estimated value of each IMF component within the prediction period is obtained. All predicted components are summed point by point according to the time series, and the residual term is added to obtain the complete fine-grained adjacency feature prediction result.
[0048] ; in, This represents the final predicted adjacency feature value; For the first the predicted IMF component after the BiLSTM model; a predicted value representing the residual term.
[0049] For similar features in fine-grained information, K-means clustering, CNN feature extraction and Dualformer model are used for prediction to obtain similar feature prediction results.
[0050] Based on K-means clustering, the historical features are divided into weather types to construct weather embedding vectors. First, representative features such as temperature, pressure, humidity, total radiation, direct radiation and scattered radiation are extracted from the historical photovoltaic power sequence and its corresponding multi-dimensional meteorological data to form a feature vector. Using K-means algorithm, these vectors are unsupervised clustered into several categories , each category represents a typical weather type. The objective function of K-means is to minimize the intra-class squared error:
[0051] ; wherein, is the center of the th class.
[0052] In order to make the model have meteorological scene perception ability when predicting, the clustering label is converted into a dense vector form as a learnable weather embedding vector (Weather Embedding). This embedding is similar to position encoding, which guides the model to adapt to the input feature changes under different weather backgrounds in the model.
[0053] One-dimensional CNN is used to extract local features from the input sequence. Photovoltaic power usually shows local sharp fluctuations under sudden weather conditions, and these disturbance features may be diluted by the global modeling mechanism in the traditional Transformer structure. Therefore, a one-dimensional convolutional neural network module is designed to extract features from the input time sequence, extracting high-frequency response features within the local window. Let the input time sequence be , then the operation of CNN sliding convolution is:
[0054] ; wherein, is the convolution kernel weight, is the window length, is the bias, is the activation function.
[0055] The feature sequence output by CNN can effectively retain the local change pattern of time as the input of the subsequent Dualformer structure.
[0056] A Dualformer prediction model is constructed to fuse multi-source information for joint modeling and training. The Dualformer model is an improved time series modeling architecture proposed by the present application, which aims to capture both global dependency structure and local disturbance information in the input sequence. The structural diagram is shown in Figure 3 The Dualformer model embeds a one-dimensional feature extraction module and a weather embedding vector module before the input layer of the traditional Transform model, and adds a local convolution enhancement LocalConv Block module between the traditional multi-head attention module and the feedforward network. The one-dimensional feature extraction module is responsible for extracting local power meteorological feature sequences The weather embedding vector module is responsible for generating weather embedding vectors The LocalConv Block module is composed of a convolution layer, a batch normalization layer, an activation function, and a pooling layer connected in turn, and is responsible for extracting deep local features of short-term photovoltaic power sequences and meteorological sequences .
[0057] The fine-grained similar prediction value of short-term photovoltaic power is generated by fusing features, including: calculating Q, K, and V of the fused features; using Q and K to weight and sum V to generate features fused with global dependency relationships; using the features fused with global dependency relationships to generate similar feature prediction sequences; and mapping the similar feature prediction sequences to fine-grained similar prediction values of short-term photovoltaic power.
[0058] The input end first fuses the features extracted by CNN with weather embedding and position encoding : ; Then input into the stacked Dualformer encoding layer, each layer containing a multi-head self-attention module (Multi-Head Attention) and a convolution enhancement module. The attention calculation is as follows:
[0059] ; Wherein, the calculation of each head is: ; In the formula, , , is the weight matrix of each head, is the linear transformation matrix of the final output.
[0060] The convolution enhancement module extracts short-term disturbance features through a local convolution receptive field, which is represented as: ; Through the multi-layer stacking, the model not only learns the time-series global trend, but also strengthens the recognition ability of small-scale disturbances. After the linear transformation and regression layer of the output sequence feature, the output prediction result is obtained.
[0061] The output prediction result is output and a complete prediction sequence of similar features is constructed. The Dualformer model outputs a prediction sequence , which represents the change trend of similar structural features in the future time period under the current meteorological embedding condition. This result has strong context consistency and disturbance response ability, and is suitable for precise prediction scenarios in photovoltaic systems under sudden weather. Finally, the similar feature prediction results output by the model are integrated and restored according to the time index to form a complete fine-grained similar feature prediction sequence, which is output as a key branch in the final prediction system and provides high-quality input for the subsequent fusion module.
[0062] S3, determining the final power prediction value from the coarse-grained global prediction value, fine-grained adjacent prediction value and fine-grained similar prediction value of the short-term photovoltaic power.
[0063] Align the prediction results of the three models and perform trend partitioning. First, align the prediction sequences output by the three sub-models (global trend prediction result, adjacent feature prediction result, similar feature prediction result) to the same length, and calculate the first-order difference according to the step sliding in the time dimension. Based on the sign and amplitude of the difference value, the overall prediction sequence is dynamically partitioned into:
[0064] Rising area: the first-order difference of power is positive, representing an upward trend of power; Downward area: the first-order difference of power is negative, representing a downward trend of power; Fluctuation area: the direction of power change frequently switches, and the amplitude of the difference value is small, representing a disturbance section.
[0065] Through this partitioning strategy, the localized use of the prediction advantages of different models can be realized, providing a structural basis for subsequent weight adjustment.
[0066] Assign fusion weights to three types of prediction results in different trend areas. For each partitioned trend area (rising, fluctuating, falling), assign fusion weights to the three prediction results. Let the prediction outputs of the three models be (global trend), (adjacent features), (similar features), then the fusion output can be represented as:
[0067] ; where, represents the fusion weight of the prediction result in the area Within (rising / fluctuating / falling), the first The weight coefficients of each model. It satisfies the following constraints: ; Each segment employs an independent weighting and reorganization, thereby achieving dynamic and adaptive regional fusion capabilities.
[0068] A Bayesian optimization algorithm is used to perform a global search on the fusion weights to obtain the optimal prediction result. To obtain the optimal combination of regional weights, a Bayesian optimization algorithm is introduced into each type of segment. The parameters are automatically adjusted. Bayesian optimization constructs a posterior surrogate function and guides parameter sampling in each round based on the acquisition function. The specific objective is to minimize the prediction error on the validation set, i.e., the mean squared error.
[0069] ; in, Represents the actual value. For weighted fusion output.
[0070] Through multiple rounds of iterative search, the weight combination that satisfies the global minimum error is found. This data is then applied to the actual testing phase. Finally, the weighted prediction results from all regions are merged to form the final prediction output of the system, achieving optimal integration of multi-granularity model results.
[0071] To better understand the technical solution of this invention, one embodiment of the invention will be further explained with reference to the accompanying drawings. The following examples are not intended to limit the scope of application, but are only for illustrative purposes. Photovoltaic power data is estimated according to the method described herein. The specific process is as follows:
[0072] Actual photovoltaic power generation data from a region in Xinjiang, my country, during the summer months of June to August 2019, was selected as the data source for this case study. The raw data was recorded every 15 minutes, totaling 8832 records. The overall process of the proposed prediction method is as follows: Figure 2 As shown, firstly, photovoltaic power data and meteorological data under abrupt weather changes are collected to form a historical database. Secondly, BiLSTM and an attention mechanism are used for coarse-grained information prediction to obtain global trend prediction results. Thirdly, for the adjacency features in the fine-grained information, EMD decomposition and BiLSTM are used for prediction to obtain adjacency feature prediction results. Finally, for the similarity features in the fine-grained information, K-means clustering, CNN feature extraction, and a Dualformer model are used for prediction to obtain similarity feature prediction results. The three prediction results are partitioned, and the dynamic weights of different regions are optimized using a Bayesian optimization algorithm to obtain the final prediction result.
[0073] To further illustrate the effectiveness and feasibility of the present application, comparative experiments were conducted using three models, LSTM, BiLSTM and Transformer. LSTM is a commonly used recurrent neural network model with strong time series modeling capability, which can effectively capture short-term and long-term dependencies in the data. BiLSTM introduces two information channels, forward and backward, based on LSTM, so as to consider past and future context information simultaneously in the modeling process, improving the complete expression ability of time series features. The Transformer model is based on the self-attention mechanism, which has the advantages of high parallel computing efficiency and strong global modeling capability by constructing the dependency relationship between positions in the sequence, and has been widely used in time series prediction tasks. By comparing the model proposed in the embodiment of the present application with the above three classical models, the performance advantage and adaptability of the method in handling photovoltaic power prediction tasks under sudden weather conditions can be more intuitively verified.
[0074] Figure 4 The comparison results between the photovoltaic power prediction curves generated by different prediction models and the true values under sudden weather conditions are shown. It can be obviously observed that the traditional LSTM model has a lag in responding to dramatic fluctuations, especially in the rapid rising and falling stages of power, and its predicted value deviates greatly from the true value. The BiLSTM model has improved trend fitting compared to LSTM due to the introduction of bidirectional time series information, but there is still a significant deviation near the local dramatic disturbance point, and the description of wave peaks and troughs is not accurate enough. The overall trend prediction of the Transformer model is relatively smooth, but it lacks the ability to identify short-term mutations, especially in the high-frequency fluctuation section before and after noon, the prediction curve has obvious smoothing errors, and cannot fully reflect the dramatic fluctuation characteristics of the actual power. The model proposed in the embodiment of the present application exhibits good performance in both global trend fitting and local disturbance response, and its prediction curve is highly consistent with the true curve in the power surge and drop period, which can capture the mutation characteristics in time, indicating that it has stronger robustness and adaptability under complex weather conditions.
[0075] To further evaluate the accuracy of the prediction model described in the embodiment of the present application, the mean absolute error (MAE), mean square error (MSE) and determination coefficient (R²) of the fluctuation type data prediction model described in the embodiment of the present application are compared with those of other prediction models, and the results are shown in Table 1.
[0076] Table 1 Comparison of prediction error indicators of four methods for fluctuation type data As can be seen from Table 1, the three indicators of the fluctuation type data prediction model described in the embodiment of the application, namely, RMSE, MAE and R², are the smallest among all the models, indicating that the prediction error is the smallest and the change trend is more consistent with the true value. In terms of the RMSE indicator, the prediction model described in the embodiment of the application is 2.004, 1.482 and 1.571 lower than other models respectively. In terms of the MAE indicator, the prediction model described in the embodiment of the application is 1.872, 1.175 and 0.886 lower than other models respectively. In terms of the R² indicator, the prediction model described in the embodiment of the application is 6.9%, 4.7% and 5.1% higher than other models respectively. It is proved that the data prediction model described in the embodiment of the application has shown higher prediction performance under the sudden weather condition.
[0077] Based on the same inventive concept, the application further provides a photovoltaic power prediction system, comprising: a data acquisition module, configured to synchronously acquire a short-term photovoltaic power sequence and a meteorological sequence at a plurality of different time points respectively.
[0078] a three-branch training module, configured to extract a bidirectional power time sequence feature before and after each short-term photovoltaic power sequence; calculate a weight corresponding to each bidirectional power time sequence feature, and sum all the bidirectional power time sequence features and the weights to obtain a global perception time sequence feature; map the global perception time sequence feature to a coarse-grained global prediction value of the short-term photovoltaic power; decompose each short-term photovoltaic power sequence into a set of local time-frequency feature components and a residual term; capture the fluctuation features of each local time-frequency feature component to obtain fluctuation features of different time scales; map the fluctuation features of different time scales and the residual term to a fine-grained adjacent prediction value of the short-term photovoltaic power; splice a plurality of short-term photovoltaic power sequences and corresponding meteorological sequences to generate a feature vector set fusing power and meteorological information; extract a local power and meteorological comprehensive feature from the feature vector set; perform clustering processing on the feature vector set according to a weather pattern to generate a weather embedding vector; perform time sequence position coding on the feature vector set to obtain a position coding vector set; fuse the local power and meteorological comprehensive feature, the weather embedding vector and the position coding vector set to obtain a fusion feature; and generate a fine-grained similar prediction value of the short-term photovoltaic power by using the fusion feature.
[0079] a prediction value generation module, configured to determine a final power prediction value from the coarse-grained global prediction value, the fine-grained adjacent prediction value and the fine-grained similar prediction value of the short-term photovoltaic power.
[0080] The application further provides a computer device. At a hardware level, the computer device comprises a processor, an internal bus, a network interface, a memory and a nonvolatile memory, and can further comprise other hardware required by a business. The processor reads a corresponding computer program from the nonvolatile memory into the memory and then runs, so as to implement the photovoltaic power prediction method provided above.
[0081] The application further provides a computer-readable storage medium, which stores a computer program, and the computer program can be used to execute the photovoltaic power prediction method provided above.
[0082] The specific limitations of the photovoltaic power prediction method computing system can refer to the limitations of the photovoltaic power prediction method provided above, which will not be described here. Each module in the photovoltaic power prediction system can be realized by software, hardware and a combination thereof in whole or in part. Each module can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory in the computer device in software form, so as to be called and executed by the processor to perform the operation corresponding to each module.
[0083] Each technical feature of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of each technical feature in the above embodiments are not described, however, as long as the combination of the technical features does not exist contradictory, it should be considered as the scope of the present application. In addition, the above embodiments only express several embodiments of the present application, the description is more specific and detailed, but it should not be understood as the limitation of the patent scope. It should be pointed out that, for those skilled in the art, without departing from the concept of the present application, some modifications and improvements can be made, which are all within the protection scope of the present application. Therefore, the patent protection scope of the present application should be subject to the appended claims.
Claims
1. A photovoltaic power prediction method, characterized in that, The method comprises: Synchronously collecting short-term photovoltaic power sequences and meteorological sequences at different time points respectively; Extracting forward and backward bidirectional power time sequence features of each short-term photovoltaic power sequence; calculating weights corresponding to each forward and backward bidirectional power time sequence feature; summing all forward and backward bidirectional power time sequence features and weights to obtain global perception time sequence features; and mapping the global perception time sequence features to coarse-grained global prediction values of the short-term photovoltaic power. Decomposing each short-term photovoltaic power sequence into a set of local time-frequency feature components and a residual term; capturing fluctuation features of each local time-frequency feature component to obtain fluctuation features of different time scales; and mapping the fluctuation features of different time scales and the residual term to fine-grained adjacent prediction values of the short-term photovoltaic power. Splicing multiple sets of short-term photovoltaic power sequences and corresponding meteorological sequences to generate a set of feature vectors integrating power and meteorological information; extracting local power and meteorological comprehensive features from the set of feature vectors; clustering the set of feature vectors according to weather patterns to generate weather embedding vectors; performing time sequence position coding on the set of feature vectors to obtain a set of position coding vectors; fusing the local power and meteorological comprehensive features, the weather embedding vectors and the set of position coding vectors to obtain fusion features; and generating fine-grained similar prediction values of the short-term photovoltaic power by using the fusion features. Determining final power prediction values from coarse-grained global prediction values, fine-grained adjacent prediction values and fine-grained similar prediction values of the short-term photovoltaic power.
2. The photovoltaic power prediction method of claim 1, wherein, The Dualformer model is used to predict the short-term photovoltaic power sequences and corresponding meteorological sequences to obtain fine-grained similar prediction values of the short-term photovoltaic power; the Dualformer model is modified from a traditional Transform model, and the specific modifications include adding a one-dimensional feature extraction module and a weather embedding vector module before the input layer of the traditional Transform model, and adding a local convolution enhancement module between the traditional multi-head attention module and the feedforward network; wherein the one-dimensional feature extraction module is responsible for extracting local power and meteorological comprehensive features; the weather embedding vector module is responsible for generating weather embedding vectors; and the local convolution enhancement module is composed of a convolution layer, a batch normalization layer, an activation function and a pooling layer connected in sequence, and is responsible for enhancing the local power and meteorological comprehensive features.
3. The photovoltaic power prediction method of claim 1, wherein, The generation of fine-grained similar prediction values of the short-term photovoltaic power by using the fusion features comprises: Calculating a query Q, a key K and a value V of the fusion features; calculating a weight of the value V by using the query Q and the key K; and summing the value V by using the weight to generate a global dependency relationship fusion feature; Generating a similar feature prediction sequence by using the global dependency relationship fusion feature; and mapping the similar feature prediction sequence to fine-grained similar prediction values of the short-term photovoltaic power.
4. The photovoltaic power prediction method of claim 1, wherein, The forward and backward bidirectional power time sequence features of the short-term photovoltaic power sequences are extracted by a bidirectional long short-term memory network BiLSTM, and the weights corresponding to the forward and backward bidirectional power time sequence features are calculated by an attention mechanism Attention Mechanism, so as to finally predict coarse-grained global prediction values of the short-term photovoltaic power.
5. The photovoltaic power prediction method of claim 1, wherein, Each short-term photovoltaic power sequence is decomposed into a set of local time-frequency characteristic components and a residual term by empirical mode decomposition (EMD); a BiLSTM model is independently trained for each component in the set of local time-frequency characteristic components, and multiple BiLSTM models are used to capture the fluctuation characteristics of each local time-frequency characteristic component, so as to finally predict the fine-grained adjacent prediction value of the short-term photovoltaic power.
6. The photovoltaic power prediction method of claim 1, wherein, After the short-term photovoltaic power sequence and the meteorological sequence are synchronously collected at different time points, the short-term photovoltaic power sequence and the meteorological sequence are preprocessed, specifically including: performing preliminary screening and data cleaning on the short-term photovoltaic power sequence and the meteorological sequence; extracting high-frequency sampling data from the cleaned short-term photovoltaic power sequence and the meteorological sequence, and setting a uniform time length for the high-frequency sampling data to obtain the preprocessed short-term photovoltaic power sequence and the meteorological sequence.
7. A photovoltaic power prediction system, characterized by, It comprises: a data collection module configured to synchronously collect short-term photovoltaic power sequences and meteorological sequences at different time points; a three-branch training module configured to extract bidirectional power time sequence features before and after each short-term photovoltaic power sequence; calculate the weight corresponding to each bidirectional power time sequence feature, and sum all bidirectional power time sequence features and weights to obtain global perception time sequence features; mapping the global perception time sequence features to the coarse-grained global prediction value of the short-term photovoltaic power; decomposing each short-term photovoltaic power sequence into a set of local time-frequency characteristic components and a residual term; capturing the fluctuation characteristics of each local time-frequency characteristic component to obtain fluctuation characteristics of multiple different time scales; mapping the fluctuation characteristics of multiple different time scales and the residual term to the fine-grained adjacent prediction value of the short-term photovoltaic power; concatenating multiple groups of short-term photovoltaic power sequences and corresponding meteorological sequences to generate a feature vector set that integrates power and meteorological information; extracting local power and meteorological comprehensive features from the feature vector set; clustering the feature vector set according to weather patterns to generate weather embedding vectors; performing time sequence position encoding on the feature vector set to obtain a position encoding vector set; fusing the local power and meteorological comprehensive features, the weather embedding vectors, and the position encoding vector set to obtain a fusion feature; and generating a fine-grained similar prediction value of the short-term photovoltaic power using the fusion feature. a prediction value generation module configured to determine a final power prediction value from the coarse-grained global prediction value, the fine-grained adjacent prediction value, and the fine-grained similar prediction value of the short-term photovoltaic power.
8. A computer device comprising a memory, a processor, and a computer program stored on the memory, wherein the computer program comprises instructions that, when executed by the processor, cause the processor to perform the method of any one of claims 1-7. The processor executes the computer program to implement the method steps of any one of claims 1 to 6.
9. A computer readable storage medium storing a computer program, characterized in that, The computer program is executed by the processor to implement the method steps of any one of claims 1 to 6. The computer program is executed by the processor to implement the method steps of any one of claims 1 to 6.