Photovoltaic power generation prediction method and device

By building a parallel prediction model, combining the Transformer encoder layer and the BIGRU network, the problem of low accuracy and insufficient flexibility of photovoltaic power generation prediction is solved, and the photovoltaic power generation prediction with higher accuracy and flexibility is achieved, which is suitable for different application scenarios .

CN118760888BActive Publication Date: 2024-11-15CHINA NORTHWEST ARCHITECTURE DESIGN & RES INST CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411252114.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-09
Publication Date
2024-11-15
Estimated Expiration
2044-09-09

AI Technical Summary

Technical Problem

The existing photovoltaic power generation prediction technology is difficult to fully deal with long-term dependence and multimodal information fusion, resulting in low prediction accuracy, lack of flexibility and versatility, and it is difficult to adapt to the specific needs and data characteristics of different photovoltaic power stations.

Method used

By synchronously collecting photovoltaic power generation and influencing factor data, screening key feature variables, combining Transformer encoder layer and BIGRU network to build a parallel prediction model, perform feature extraction and mapping, and support single-step and multi-step prediction modes to adapt to different application scenarios.

Benefits of technology

It significantly improves the accuracy and flexibility of photovoltaic power generation prediction, has wide applicability and efficiency, can automatically adapt to weather and seasonal changes, and improves the utilization and economics of energy storage systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118760888B_ABST
    Figure CN118760888B_ABST
Patent Text Reader

Abstract

The present application discloses a photovoltaic power generation prediction method and device, which relates to the photovoltaic power generation prediction technology field, including: synchronously collecting historical photovoltaic power generation and meteorological data, screening out key meteorological factor data as key feature variables, organizing photovoltaic power generation data sets and key feature variables into input sequences according to time series, constructing a parallel prediction model integrating Transformer encoder and BIGRU network, and using input sequences for feature extraction and enhancement. Training the parallel prediction model, and optimizing the parameters in the parallel prediction model. Based on the new input sequence, the parallel prediction model generates a continuous photovoltaic power generation sequence through single-step and / or multi-step prediction modes. The problem of low prediction accuracy, lack of flexibility and versatility in the existing technology for photovoltaic power generation prediction is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of photovoltaic power generation prediction, and in particular to a photovoltaic power generation prediction method and device. Background Art

[0002] Photovoltaic power generation, as an important form of renewable energy, is widely used in electricity production due to its advantages of being pollution-free and renewable. However, its power generation is affected by multiple factors such as solar radiation, weather and seasons, showing high volatility, which poses a challenge to the stable operation of the power system. Therefore, accurate photovoltaic power generation forecasting is crucial to optimize power dispatching and improve system efficiency.

[0003] At present, photovoltaic power generation prediction technology is mainly divided into physical methods and statistical methods. The physical method builds a physical model based on meteorological data and photovoltaic cell parameters, while the statistical and deep learning methods focus more on data-driven. Although statistical methods are widely used, they face the limitations of limited prediction accuracy and too small a window.

[0004] Existing technologies cannot adequately handle the long-term dependence of photovoltaic power generation, lack the ability to integrate multimodal information, fail to effectively utilize external factors such as weather and season to improve prediction accuracy, and lack sufficient flexibility and versatility to adapt to the specific needs and data characteristics of different photovoltaic power stations.

[0005] Therefore, how to develop a photovoltaic power generation prediction model that can comprehensively handle the long-term dependence of photovoltaic power generation on time series, effectively integrate multimodal information and has high flexibility and versatility has become a problem to be solved. Summary of the invention

[0006] In the embodiments of the present application, a photovoltaic power generation prediction method is provided to solve the problems of low prediction accuracy, lack of flexibility and versatility in the prior art for photovoltaic power generation prediction.

[0007] In a first aspect, an embodiment of the present application provides a photovoltaic power generation prediction method, the method comprising: synchronously collecting photovoltaic power generation and meteorological factor data affecting photovoltaic power generation in a past preset time period at the same preset time interval, and forming a photovoltaic power generation data set and a meteorological factor data set respectively; wherein each time interval constitutes a different data point, and the meteorological factor data set includes observation values ​​of multiple meteorological factors; analyzing the correlation between each meteorological factor data and photovoltaic power generation in each data point, and taking the meteorological factor corresponding to the meteorological factor data with a correlation greater than a preset threshold as a key characteristic variable; organizing the photovoltaic power generation data set and the key characteristic variables into an input sequence according to time series; wherein each data point in the input sequence includes the value of photovoltaic power generation and the key characteristic variable; constructing a parallel prediction A model is constructed, and an input sequence is used for feature extraction to obtain a result of feature enhancement fusion; wherein the parallel prediction model includes a Transformer encoder layer and a BIGRU network; the result of feature enhancement fusion obtained is mapped to a photovoltaic power generation prediction value through a fully connected layer; the parallel prediction model is trained using data in a first preset number of data points as a training set, the output photovoltaic power generation prediction value is compared with the actual photovoltaic power generation data, and the parameters in the parallel prediction model are adjusted according to the comparison result to obtain a trained parallel prediction model; a new input sequence is input into the trained parallel prediction model, and a continuous photovoltaic power generation sequence is generated through a single-step prediction mode and / or a multi-step prediction mode; wherein the new input sequence includes meteorological factor data.

[0008] In a possible implementation, before forming the photovoltaic power generation data set and the meteorological factor data set, the method further includes: preprocessing the collected photovoltaic power generation and the collected meteorological factor data affecting photovoltaic power generation.

[0009] In a possible implementation, the correlation between each meteorological factor data and photovoltaic power generation in each data point is analyzed, and the calculation formula is as follows: ;in, is a metric that reflects the correlation between meteorological factor data and photovoltaic power generation. n is the total number of data points, i is the identifier of the meteorological factor data set, o is the identifier of the photovoltaic power generation factor data set, and k is the data point index, which is used to traverse each data point and calculate the absolute difference between photovoltaic power generation and meteorological factor data at each data point. is the value of the kth data point in the photovoltaic power generation data set, is the value of the kth data point in the meteorological factor data set, is the resolution coefficient.

[0010] In a possible implementation, the use of the input sequence for feature extraction to obtain a result of feature enhancement fusion includes: constructing a multi-head attention mechanism in the Transformer encoder layer, processing the input sequence and generating a multi-head attention output; using a BIGRU network to process the forward information and reverse information of the input sequence, generating a context vector through a global attention mechanism to obtain an enhanced output; and fusing the multi-head attention output and the enhanced output through a cross-attention mechanism to obtain a result of feature enhancement fusion.

[0011] In one possible implementation, a multi-head attention mechanism is constructed in the Transformer encoder layer, an input sequence is processed and a multi-head attention output is generated, including: performing a second preset number of groups of different linear transformations on each data point in the input sequence, generating a second preset number of groups of three different vectors, and calculating the weighted value vector of the current attention head according to the three different vectors; wherein the second preset number is the number of attention heads in the multi-head attention mechanism, and the three different vectors are a query vector, a key vector and a value vector; the weighted value vector of each attention head is concatenated and linearly transformed to generate a multi-head attention output.

[0012] In a possible implementation, the weighted value vector of the current attention head is calculated based on the three different vectors, including: calculating the dot product between the query vector and the transposed matrix of the key vector through a dot product operation to obtain a similarity matrix; dividing each element in the similarity matrix by the square root of the key vector dimension to perform a scaling operation to obtain a scaled similarity matrix; normalizing the scaled similarity matrix using a softmax function to obtain an attention weight matrix; and using the attention weight matrix to perform weighted summation on the value vector to obtain the weighted value vector of the current attention head.

[0013] In a possible implementation, the method uses a BIGRU network to process the forward information and reverse information of an input sequence, generates a context vector through a global attention mechanism, and obtains an enhanced output, including: using two GRU units to process the forward information and reverse information of the input sequence respectively, and generating a forward hidden state and a reverse hidden state at each data point; merging the forward hidden state and the reverse hidden state to form a bidirectional hidden state sequence; constructing a global attention mechanism in the BIGRU network, generating a global context vector, and concatenating the global context vector with the output of the bidirectional hidden state sequence to obtain an enhanced output.

[0014] In a possible implementation, the new input sequence is input into the trained parallel prediction model, and a continuous photovoltaic power generation sequence is generated through a single-step prediction mode and / or a multi-step prediction mode, including: in the single-step prediction mode, the trained parallel prediction model predicts the photovoltaic power generation of a preset time step in the future each time; in the multi-step prediction mode, the trained parallel prediction model predicts the photovoltaic power generation of multiple preset time steps in the future each time.

[0015] In a second aspect, an embodiment of the present application provides a photovoltaic power generation prediction device, which includes: a collection module, which is used to synchronously collect photovoltaic power generation and meteorological factor data affecting photovoltaic power generation in a past preset time period at the same preset time interval, and form a photovoltaic power generation data set and a meteorological factor data set respectively; wherein each time interval constitutes a different data point, and the meteorological factor data set includes observation values ​​of multiple meteorological factors; an analysis module, which is used to analyze the correlation between each meteorological factor data and photovoltaic power generation in each data point, and use the meteorological factor corresponding to the meteorological factor data with a correlation greater than a preset threshold as a key feature variable; an organization module, which is used to organize the photovoltaic power generation data set and the key feature variables into an input sequence according to time series; wherein each data point in the input sequence includes the value of the photovoltaic power generation and the key feature variable; a construction module, which is used to construct and A parallel prediction model is constructed, and an input sequence is used for feature extraction to obtain a result of feature enhancement fusion; wherein the parallel prediction model includes a Transformer encoder layer and a BIGRU network; a mapping module is used to map the obtained result of feature enhancement fusion to a photovoltaic power generation prediction value through a fully connected layer; a training module is used to use the data in a first preset number of data points as a training set to train the parallel prediction model, compare the output photovoltaic power generation prediction value with the actual photovoltaic power generation data, and adjust the parameters in the parallel prediction model according to the comparison result to obtain a trained parallel prediction model; a generation module is used to input a new input sequence into the trained parallel prediction model, and generate a continuous photovoltaic power generation sequence through a single-step prediction mode and / or a multi-step prediction mode; wherein the new input sequence includes meteorological factor data.

[0016] One or more technical solutions provided in the embodiments of the present application have at least the following technical effects:

[0017] The embodiment of the present application provides a photovoltaic power generation prediction method, which significantly improves the input data quality of the prediction model by synchronously collecting photovoltaic power generation and key meteorological factors affecting photovoltaic power generation, and screening out meteorological factors highly correlated with photovoltaic power generation as key feature variables. The parallel prediction model combined with the Transformer encoder layer and the BIGRU network can effectively capture the long-term dependence and short-term fluctuations in time series data, thereby achieving a more accurate photovoltaic power generation prediction. The parallel prediction model supports single-step prediction mode and multi-step prediction mode, which can be flexibly selected according to actual needs. The single-step prediction mode is suitable for scenarios that require immediate feedback, while the multi-step prediction mode can generate a continuous photovoltaic power generation sequence, providing strong support for long-term planning and scheduling. This flexibility ensures the wide applicability and efficiency of the model in different application scenarios. Through synchronous data collection at preset time intervals and screening of key feature variables, the parallel prediction model can automatically adapt to the impact of different weather conditions and seasonal changes on photovoltaic power generation. At the same time, using a large amount of historical data for training, the model has strong generalization ability and robustness, and can still maintain a high prediction accuracy in the face of unknown or extreme weather conditions. By predicting photovoltaic power generation in advance, the charging and discharging strategy of the energy storage system can be reasonably arranged to improve the utilization and economy of the energy storage system. This solves the problem of low prediction accuracy, lack of flexibility and versatility of the existing technology for photovoltaic power generation prediction. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments of the present application or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0019] Figure 1 A flowchart of a photovoltaic power generation prediction method provided in an embodiment of the present application;

[0020] Figure 2 A specific flow chart of using an input sequence to extract features and obtain feature enhancement and fusion results provided in an embodiment of the present application;

[0021] Figure 3 A specific flow chart for calculating the weighted value vector of the current attention head according to three different vectors provided in an embodiment of the present application;

[0022] Figure 4 A specific flow chart of using a BIGRU network to process the forward and reverse information of an input sequence and generate a context vector through a global attention mechanism to obtain an enhanced output provided in an embodiment of the present application;

[0023] Figure 5 A schematic diagram of the overall architecture of a parallel prediction model for photovoltaic power generation prediction provided in an embodiment of the present application;

[0024] Figure 6 A schematic diagram of a photovoltaic power generation prediction device provided in an embodiment of the present application;

[0025] Figure 7 A schematic diagram of a photovoltaic power generation prediction server provided in an embodiment of the present application. DETAILED DESCRIPTION

[0026] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0027] The following describes some of the techniques involved in the embodiments of the present application to facilitate understanding, and they should be considered as exemplary only. Therefore, it should be appreciated by those skilled in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, some descriptions of well-known functions and structures are omitted in the following description.

[0028] The present application embodiment provides a photovoltaic power generation prediction method, such as Figure 1 As shown, the method includes steps S101 to S107. Among them, Figure 1 This is only an execution order shown in the embodiment of the present application, and does not represent the only execution order of a photovoltaic power generation prediction method. In the case where the final result can be achieved, Figure 1 The steps shown may be performed in parallel or reversed.

[0029] S101: synchronously collect the photovoltaic power generation and the meteorological factor data affecting photovoltaic power generation in the past preset time period at the same preset time interval, and form a photovoltaic power generation data set and a meteorological factor data set respectively. Each time interval constitutes a different data point, and the meteorological factor data set includes observation values ​​of multiple meteorological factors.

[0030] Specifically, a specific time range needs to be identified as a preset time period. This preset time period can be set according to research or application requirements, such as one month, one quarter or one year. Within the preset time period, data is collected at the same time interval (such as every hour, every half hour or every 15 minutes). The selection of time intervals should be based on data availability, analysis requirements and computing resources. Record the photovoltaic power generation within each preset time interval. These data come from the monitoring system or data acquisition system of the photovoltaic power station. At the same time, collect data on multiple meteorological factors that affect photovoltaic power generation, including but not limited to solar radiation intensity, ambient temperature, photovoltaic panel temperature, wind speed, wind direction, humidity, air pressure and cloud cover. These data can come from meteorological stations, satellite remote sensing or special meteorological monitoring equipment.

[0031] It should be noted that, for the photovoltaic power generation data set, the data point formed by each preset time interval includes the photovoltaic power generation within the time interval. The meteorological factor data set includes observations of multiple meteorological factors, and the data point of each time interval will include multiple data items, each data item corresponding to an observation value of a meteorological factor. Therefore, in the meteorological factor data set of the present application, the data point formed by each time interval is actually a record including multiple data items (or observations). When performing data analysis, some or all of these data items can be selectively used as needed.

[0032] Before forming the photovoltaic power generation data set and the meteorological factor data set, the method further includes: preprocessing the collected photovoltaic power generation and the collected meteorological factor data affecting photovoltaic power generation. The preprocessing includes missing value processing and outlier detection.

[0033] Specifically, STL decomposition (a time series analysis method) can be combined with interpolation technology to handle missing values. STL decomposition is performed on the data before and after the missing values. At the missing values, the trend component and seasonal component obtained by STL decomposition can be used for interpolation. Interpolation methods include seasonal interpolation, trend interpolation, and comprehensive interpolation. Seasonal interpolation is: interpolation using the seasonal component of the season where the missing value is located. If the missing value occurs at a fixed time point in a particular season, the average or median of the seasonal component at that time point in the past few years can be used as the interpolation. If the seasonal pattern changes over time (such as trend seasonality), the impact of the trend on the seasonal component can be considered and the interpolation can be adjusted accordingly. Trend interpolation is: interpolation using the trend component before and after the missing value, which can be done through linear interpolation, polynomial interpolation, etc. Comprehensive interpolation is: adding the results of seasonal interpolation and trend interpolation to obtain an interpolation estimate of the missing value.

[0034] Specifically, the outlier detection method is to calculate the average distance (local density) between each data point and its nearest preset number of neighbors, collect the local densities of all data points into a set to form a local density set, and then dynamically set an outlier threshold to identify outliers based on the local density distribution of the local density set. The outlier threshold can be set to a certain quantile of the local density distribution (such as 0.25 or 0.5), and data points with a local density distribution below this quantile are considered outliers. The method for handling outliers can be selected according to the specific situation. You can choose to delete the outliers or replace them with the mean, median, or mode.

[0035] Specifically, assuming is the local density set of all data points, and n is the total number of data points. The outlier threshold T is defined as , where q is the selected quantile, represents the qth quantile of the local density set D. Specifically, the qth quantile refers to the local density of the data point at position q after sorting a set of data from small to large. For any data point k, if , then the data point k is regarded as an outlier. It should be noted that the nearest preset number of neighbors can be determined in the feature space based on a distance metric (such as Euclidean distance).

[0036] S102: Analyze the correlation between each meteorological factor data and photovoltaic power generation in each data point, and use the meteorological factor corresponding to the meteorological factor data with a correlation greater than a preset threshold as a key characteristic variable. It should be noted that the value of the preset threshold can be set to 0.25, and of course, it can also be set to other values, and this application is not limited to this value.

[0037] Analyze the correlation between each meteorological factor data and photovoltaic power generation in each data point, and the calculation formula is as follows: .in, is a metric that reflects the correlation between meteorological factor data and photovoltaic power generation. n is the total number of data points, i is the identifier of the meteorological factor data set, o is the identifier of the photovoltaic power generation factor data set, and k is the data point index, which is used to traverse each data point and calculate the absolute difference between photovoltaic power generation and meteorological factor data at each data point. is the value of the kth data point in the photovoltaic power generation data set, is the value of the kth data point in the meteorological factor data set, is the resolution coefficient.

[0038] S103: Organize the photovoltaic power generation data set and the key characteristic variables into an input sequence according to the time series, wherein each data point in the input sequence includes the photovoltaic power generation and the value of the key characteristic variable.

[0039] S104: construct a parallel prediction model, and use the input sequence to extract features to obtain feature enhancement and fusion results. The parallel prediction model includes a Transformer encoder layer and a BIGRU network.

[0040] Figure 2 The specific flow chart of using the input sequence to extract features and obtain the result of feature enhancement fusion provided in the embodiment of the present application is as follows: Figure 2 As shown, it includes steps S201 to S203.

[0041] S201: Build a multi-head attention mechanism in the Transformer encoder layer to process the input sequence and generate a multi-head attention output.

[0042] Specifically, the Transformer encoder layer is a deep learning model based on the self-attention mechanism, which is good at processing sequence data such as text, time series, etc. Through the self-attention mechanism, the Transformer encoder layer can model the dependency between any two positions in the input sequence, thereby obtaining a context vector and capturing context information. At the same time, the residual connection adds the input directly to the output of the layer, alleviating the gradient vanishing problem in the deep network, and promoting the flow of information, so that the model can be trained more effectively. The purpose of layer normalization is to standardize the output of each layer, keeping the mean at 0 and the variance at 1. It helps to speed up the training convergence, improve the model stability, and prevent overfitting. The feedforward neural network performs a nonlinear transformation on the representation of each position, thereby enhancing the expressive power of the model. It processes the information of each position independently in each Transformer encoder layer, which is different from the processing of global information by the self-attention mechanism. In this application, the batch size of the Transformer encoder layer is set to 64, indicating the number of samples processed simultaneously during each training. The input feature dimension is set to 7, that is, the feature vector length of each input sample. The output feature dimension is set to 1. The attention dimension, i.e., the dimension of the key vector, is set to 128. Setting the number of encoder layers to 2 means that the Transformer encoder is composed of two identical layers stacked together. Setting the number of multi-head attention heads to 4 means that the self-attention mechanism is split into 4 parallel attention heads, each of which independently calculates the weighted value vector, and then concatenates their outputs and restores them to the original attention dimension through a linear transformation to obtain the multi-head attention output.

[0043] Specifically, a multi-head attention mechanism is constructed in the Transformer encoder layer to process the input sequence and generate a multi-head attention output, including: performing a second preset number of different linear transformations on each data point in the input sequence, generating a second preset number of three different vectors, and calculating the weighted value vector of the current attention head according to the three different vectors. Among them, the second preset number is the number of attention heads in the multi-head attention mechanism, and the three different vectors are the query vector, the key vector, and the value vector. The weighted value vector of each attention head is concatenated and linearly transformed to generate a multi-head attention output.

[0044] Figure 3 A specific flow chart of calculating the weighted value vector of the current attention head according to three different vectors provided in the embodiment of the present application, such as Figure 3 As shown, it includes steps S301 to S304.

[0045] Specifically, the calculation formula for calculating the weighted value vector of the current attention head according to three different vectors is: .in, For the The attention weights of the attention heads, is the query vector, is the key vector, is a value vector, is the dimension of the key vector, For the similarity matrix Normalize.

[0046] S301: Calculate the dot product between the query vector and the transposed matrix of the key vector through a dot product operation to obtain a similarity matrix.

[0047] Specifically, each element in the similarity matrix represents the similarity between each element in the query vector and each element in the key vector.

[0048] S302: Divide each element in the similarity matrix by the square root of the key vector dimension to perform a scaling operation to obtain a scaled similarity matrix.

[0049] Specifically, a scaling operation is performed to avoid the problem of gradient vanishing or gradient exploding due to the dot product result being too large.

[0050] S303: Use the softmax function to normalize the scaled similarity matrix to obtain an attention weight matrix.

[0051] Specifically, normalization processing can ensure that the sum of elements in each row of the similarity matrix is ​​1.

[0052] S304: Use the attention weight matrix to perform weighted summation on the value vector to obtain the weighted value vector of the current attention head.

[0053] Furthermore, the weighted value vector of each attention head is concatenated and linearly transformed to generate the calculation formula for the multi-head attention output: .in, For the The attention weights of the attention heads, For splicing operation, is the weight matrix, which is used to perform linear transformation on the concatenated output. is a function representation of the multi-head attention mechanism, which receives the input sequence X and returns the output after multi-head attention.

[0054] S202: Use the BIGRU network to process the forward and reverse information of the input sequence, and generate a context vector through the global attention mechanism to obtain enhanced output.

[0055] Figure 4 The specific flow chart of using the BIGRU network to process the forward information and reverse information of the input sequence provided in the embodiment of the present application, generating a context vector through a global attention mechanism to obtain an enhanced output, such as Figure 4 As shown, it includes steps S401 to S403.

[0056] S401: Use two GRU units to process the forward information and reverse information of the input sequence respectively, and generate a forward hidden state and a reverse hidden state at each data point.

[0057] Specifically, the BIGRU network is a variant of a recurrent neural network. The GRU unit is a gated recurrent unit. Therefore, the BIGRU network used in this application is a bidirectional gated recurrent unit network optimized based on a global attention mechanism. This network structure effectively improves the model's ability to perceive and capture important features in the input sequence by combining the bidirectional processing capabilities of the BIGRU network and the focusing capabilities of the global attention mechanism.

[0058] Specifically, the BIGRU network processes the forward and reverse information of the input sequence through two parallel GRU units. Each GRU unit has the ability to capture long-distance dependencies in the sequence and control the flow of information through its internal gating mechanism (such as reset gate and update gate). One GRU unit is used to process the forward information of the input sequence (from left to right), and the other GRU unit is used to process the reverse information of the input sequence (from right to left). Each GRU unit traverses the entire input sequence and generates a hidden state at each data point. These hidden states capture the sequence information up to the current data point.

[0059] Furthermore, 32 stacked bidirectional GRU layers are set in the BIGRU network, each layer contains 64 hidden units, which means that at each data point, the BIGRU network can generate a 64-dimensional hidden state sequence, which contains rich sequence information. The activation function of the GRU unit uses the tanh function, which can map any real value to the interval (-1,1), which helps to learn complex nonlinear relationships. In order to prevent overfitting, a dropout mechanism is introduced between the stacked bidirectional GRU layers, and the dropout rate is set to 0.2, which means that during the training process, each hidden unit has a 20% probability of being randomly discarded, thereby forcing the model to learn a more robust feature representation.

[0060] S402: Merge the forward hidden state and the reverse hidden state to form a bidirectional hidden state sequence.

[0061] Specifically, the forward hidden state and the reverse hidden state of each data point can be merged through a concatenation operation to form a bidirectional hidden state sequence.

[0062] S403: Construct a global attention mechanism in the BIGRU network, generate a global context vector, and concatenate the global context vector with the output of the bidirectional hidden state sequence to obtain an enhanced output.

[0063] Specifically, the calculation formula for generating the global context vector is: .in, is the global context vector, T is the length of the input sequence, is the attention weight of the bidirectional hidden state of the s-th data point in the input sequence, is the bidirectional hidden state of the s-th data point.

[0064] Furthermore, the enhanced output not only contains the local information of each data point in the input sequence, but also incorporates the global information of the entire sequence. The local information of each data point in the input sequence is captured through the bidirectional hidden state, and the global information of the entire sequence is obtained through the global context vector generated by the global attention mechanism.

[0065] S203: Fuse the multi-head attention output and the enhanced output through the cross-attention mechanism to obtain the result of feature enhancement fusion.

[0066] Specifically, fusing multi-head attention outputs and enhanced outputs through a cross-attention mechanism is an effective feature fusion strategy that can combine the advantages of both to generate a more comprehensive and powerful feature representation.

[0067] S105: Mapping the obtained feature enhancement fusion result into a photovoltaic power generation prediction value through a fully connected layer.

[0068] Specifically, the role of the fully connected layer is to convert the high-dimensional representation in the feature space into the final prediction target (i.e., photovoltaic power generation). By training the weights and biases of the fully connected layer, the parallel prediction model can learn the mapping relationship from feature representation to prediction value. The input dimension size of the fully connected layer is 7, indicating that the result of feature enhancement fusion is a 7-dimensional vector. The output dimension size of the fully connected layer is 1, because the goal of this application is to predict a single photovoltaic power generation value, and the output value of the fully connected layer is a continuous real number, representing the photovoltaic power generation prediction value.

[0069] S106: Use the data in the first preset number of data points as a training set to train the parallel prediction model, compare the output photovoltaic power generation prediction value with the actual photovoltaic power generation data, adjust the parameters in the parallel prediction model according to the comparison result, and obtain a parallel prediction model that has completed training.

[0070] Specifically, the photovoltaic power generation prediction value output by the parallel prediction model is compared with the actual photovoltaic power generation data, and the loss value (such as mean square error MSE, mean absolute error MAE, etc.) is calculated to measure the accuracy of the prediction. According to the loss value, the gradient of the parallel prediction model parameters is calculated by the back propagation algorithm, and the model parameters are updated using an optimization algorithm (such as SGD, Adam, etc.) to reduce the loss value and optimize the performance of the parallel prediction model. It should be noted that the first preset number of data points can be the first 80% of the data points of the data set.

[0071] S107: Input the new input sequence into the trained parallel prediction model, and generate a continuous photovoltaic power generation sequence through a single-step prediction mode and / or a multi-step prediction mode. The new input sequence includes meteorological factor data.

[0072] The new input sequence is input into the trained parallel prediction model, and a continuous photovoltaic power generation sequence is generated through a single-step prediction mode and / or a multi-step prediction mode, including: in the single-step prediction mode, the trained parallel prediction model predicts the photovoltaic power generation of a preset time step in the future each time. In the multi-step prediction mode, the trained parallel prediction model predicts the photovoltaic power generation of multiple preset time steps in the future each time.

[0073] Specifically, in order to make a single-step prediction, this application uses the historical 36-hour photovoltaic power generation, which is recorded at a sampling interval of 30 minutes. At the same time, key characteristic variables are also combined as input sequences for input. These key characteristic variables may include solar radiation intensity, ambient temperature, humidity, wind speed, etc., which have a significant impact on photovoltaic power generation. In the single-step prediction mode, the output sequence size of the trained parallel prediction model is also 30 minutes, that is, the trained parallel prediction model predicts the photovoltaic power generation in the next 30 minutes. This prediction method is suitable for scenarios that require real-time or near real-time photovoltaic power generation prediction.

[0074] Furthermore, in order to perform multi-step predictions, the present application takes into account the obvious periodicity of photovoltaic power generation and uses data from the past 72 time steps as the input sequence. Similar to single-step predictions, the input sequence for multi-step predictions also contains photovoltaic power generation and combines key characteristic variables as input sequences for input. These data are also recorded at a sampling interval of 30 minutes, so the total time span of the input sequence is 36 hours. In the multi-step (three-step) prediction mode, the output sequence size of the trained parallel prediction model is 3 30-minute time periods, or a total of 1.5 hours. This means that the trained parallel prediction model predicts the photovoltaic power generation in the next 1.5 hours at one time, divided into three consecutive 30-minute time periods for prediction. This prediction method is suitable for scenarios where photovoltaic power generation predictions are required over a longer time range, which helps decision-making in aspects such as power grid dispatching and energy management.

[0075] It should be noted that the above specific time settings can be selected according to actual conditions, and this application is not limited to the above time settings.

[0076] Figure 5 A schematic diagram of the overall architecture of the parallel prediction model for photovoltaic power generation prediction provided in the embodiment of the present application is shown in FIG. Figure 5As shown, the parallel prediction model includes a multi-head attention Transformer encoder layer and a BIGRU network. Among them, the BIGRU network is a BIGRU network optimized using Global Attention. The encoder layer is designed to extract long-term dependent features in time series data. The multi-head attention mechanism allows the model to focus on different feature subsets when processing data by calculating attention weights on different subspaces, thereby capturing complex dependencies in time series data; the BIGRU network is used to extract global spatial features in time series data. The present application effectively integrates information from different sources, improves the model's ability to process multimodal or complex data, and enables the BIGRU network to better capture global information, thereby improving the effect of feature extraction. The cross-attention mechanism is used to fuse the features of the Transformer encoder layer and the BIGRU network. The present application calculates the attention weights of the features from two different modules, namely the Transformer encoder layer and the BIGRU network optimized by GlobalAttention, and performs Transformer feature extraction (F trans ) and feature extraction of the BIGRU network optimized by Global Attention (F bigru-att ), different features are weighted differently, and the input sequence is obtained by different linear transformations. , and , and optimize these weight matrices through training, so that the model can better capture the relationship between input sequences in specific tasks, thereby achieving effective feature fusion. , and are learnable parameters.

[0077] The present application embodiment also provides a photovoltaic power generation prediction device 600, such as Figure 6 As shown, the device includes: a collection module 601, an analysis module 602, an organization module 603, a construction module 604, a mapping module 605, a training module 606 and a generation module 607.

[0078] The acquisition module 601 is used to synchronously collect the photovoltaic power generation and the meteorological factor data affecting photovoltaic power generation in the past preset time period at the same preset time interval, and form a photovoltaic power generation data set and a meteorological factor data set respectively. Each time interval constitutes a different data point, and the meteorological factor data set includes the observation values ​​of multiple meteorological factors.

[0079] The analysis module 602 is used to analyze the correlation between each meteorological factor data and the photovoltaic power generation in each data point, and take the meteorological factor corresponding to the meteorological factor data with a correlation greater than a preset threshold as a key characteristic variable.

[0080] The organization module 603 is used to organize the photovoltaic power generation data set and the key characteristic variables into an input sequence according to the time series, wherein each data point in the input sequence includes the photovoltaic power generation and the value of the key characteristic variable.

[0081] The construction module 604 is used to construct a parallel prediction model and use the input sequence to perform feature extraction to obtain a result of feature enhancement fusion. The parallel prediction model includes a Transformer encoder layer and a BIGRU network.

[0082] The mapping module 605 is used to map the obtained feature enhancement fusion result into a photovoltaic power generation prediction value through a fully connected layer.

[0083] The training module 606 is used to train the parallel prediction model using the data in the first preset number of data points as a training set, compare the output photovoltaic power generation prediction value with the actual photovoltaic power generation data, adjust the parameters in the parallel prediction model according to the comparison result, and obtain a parallel prediction model that has completed training.

[0084] The generation module 607 is used to input the new input sequence into the trained parallel prediction model, and generate a continuous photovoltaic power generation sequence through a single-step prediction mode and / or a multi-step prediction mode. The new input sequence includes meteorological factor data.

[0085] Some modules in the apparatus described in the present application can be described in the general context of computer executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, classes, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0086] The devices or modules described in the above application embodiments can be implemented by computer chips or entities, or by products with certain functions. For the convenience of description, the above devices are described in various modules according to their functions. When implementing the embodiments of the present application, the functions of each module can be implemented in the same or multiple software and / or hardware. Of course, the module that implements a certain function can also be implemented by combining multiple sub-modules or sub-units.

[0087] The methods, devices or modules described in this application can be implemented in the form of computer-readable program codes. The controller can be implemented in any appropriate manner. For example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program codes (such as software or firmware) that can be executed by the (micro)processor, logic gates, switches, application-specific integrated circuits (English: Application Specific Integrated Circuit, referred to as: ASIC), programmable logic controllers and embedded microcontrollers. Examples of controllers include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20 and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in the form of pure computer-readable program codes, the controller can be implemented in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers and embedded microcontrollers by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included in it for implementing various functions can also be regarded as structures within the hardware component. Or even, the means for realizing various functions may be regarded as both a software module for realizing the method and a structure within a hardware component.

[0088] like Figure 7 As shown, an embodiment of the present application also provides a photovoltaic power generation prediction server, including a memory 701 and a processor 702; the memory 701 is used to store computer executable instructions; the processor 702 is used to execute computer executable instructions to implement a photovoltaic power generation prediction method described above in an embodiment of the present application.

[0089] The embodiment of the present application also provides a computer-readable storage medium, which stores executable instructions. When a computer executes the executable instructions, it can implement the photovoltaic power generation prediction method described above in the embodiment of the present application.

[0090] It can be seen from the description of the above implementation methods that those skilled in the art can clearly understand that the present application can be implemented by means of software plus necessary hardware. Based on this understanding, the technical solution of the present application can be essentially or partly contributed to the prior art in the form of a software product, or it can be reflected in the implementation process of data migration. The computer software product can be stored in a storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a mobile terminal, a server, or a network device, etc.) to execute the method described in the embodiment of the present application.

[0091] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. All or part of this application can be used in many general or special computer system environments or configurations.

[0092] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit the present application. Although the present application has been described in detail with reference to the aforementioned embodiments, a person of ordinary skill in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some or all of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the present application.

Claims

1. A photovoltaic power generation prediction method, characterized in that: include: The photovoltaic power generation and the meteorological factor data affecting the photovoltaic power generation in the past preset time period are synchronously collected at the same preset time interval to form a photovoltaic power generation data set and a meteorological factor data set respectively; wherein each time interval constitutes a different data point, and the meteorological factor data set includes observation values ​​of multiple meteorological factors; Analyze the correlation between each meteorological factor data and photovoltaic power generation in each data point, and take the meteorological factor corresponding to the meteorological factor data with a correlation greater than a preset threshold as the key characteristic variable; The photovoltaic power generation data set and key characteristic variables are organized into an input sequence according to time series; wherein each data point in the input sequence includes the value of photovoltaic power generation and key characteristic variables; Construct a parallel prediction model and use the input sequence to extract features to obtain the result of feature enhancement fusion; the parallel prediction model includes the Transformer encoder layer and the BIGRU network; The obtained feature enhancement fusion result is mapped into the photovoltaic power generation prediction value through the fully connected layer; Using the data in the first preset number of data points as a training set to train the parallel prediction model, comparing the output photovoltaic power generation prediction value with the actual photovoltaic power generation data, and adjusting the parameters in the parallel prediction model according to the comparison result to obtain a parallel prediction model that has completed training; A new input sequence is input into the trained parallel prediction model, and a continuous photovoltaic power generation sequence is generated through a single-step prediction mode and / or a multi-step prediction mode; wherein the new input sequence includes meteorological factor data.

2. The photovoltaic power generation prediction method according to claim 1, characterized in that: Before forming the photovoltaic power generation data set and the meteorological factor data set, the method further includes: The collected photovoltaic power generation and the collected meteorological factor data affecting photovoltaic power generation are preprocessed.

3. The photovoltaic power generation prediction method according to claim 1, characterized in that: The correlation between each meteorological factor data and photovoltaic power generation in each data point is analyzed and calculated as follows: ;in, is a metric that reflects the correlation between meteorological factor data and photovoltaic power generation. n is the total number of data points, i is the identifier of the meteorological factor data set, o is the identifier of the photovoltaic power generation factor data set, and k is the data point index, which is used to traverse each data point and calculate the absolute difference between photovoltaic power generation and meteorological factor data at each data point. is the value of the kth data point in the photovoltaic power generation data set, is the value of the kth data point in the meteorological factor data set, is the resolution coefficient.

4. The photovoltaic power generation prediction method according to claim 1, characterized in that: The method of using the input sequence to extract features and obtain the result of feature enhancement fusion includes: Build a multi-head attention mechanism in the Transformer encoder layer to process the input sequence and generate a multi-head attention output; Use the BIGRU network to process the forward and reverse information of the input sequence, and generate a context vector through a global attention mechanism to obtain enhanced output; The multi-head attention output and enhanced output are fused through the cross-attention mechanism to obtain the result of feature enhancement fusion.

5. The photovoltaic power generation prediction method according to claim 4, characterized in that: The multi-head attention mechanism is constructed in the Transformer encoder layer to process the input sequence and generate the multi-head attention output, including: Perform a second preset number of different linear transformations on each data point in the input sequence, generate three different vectors of the second preset number of groups respectively, and calculate the weighted value vector of the current attention head according to the three different vectors respectively; wherein the second preset number is the number of attention heads in the multi-head attention mechanism, and the three different vectors are the query vector, the key vector and the value vector; The weighted value vector of each attention head is concatenated and linearly transformed to generate multi-head attention output.

6. The photovoltaic power generation prediction method according to claim 5, characterized in that: The weighted value vector of the current attention head is calculated according to three different vectors, including: Calculate the dot product between the query vector and the transposed matrix of the key vector through the dot product operation to obtain the similarity matrix; Divide each element in the similarity matrix by the square root of the key vector dimension to perform a scaling operation to obtain a scaled similarity matrix; Use the softmax function to normalize the scaled similarity matrix to obtain the attention weight matrix; Use the attention weight matrix to perform weighted summation on the value vector to obtain the weighted value vector of the current attention head.

7. The photovoltaic power generation prediction method according to claim 4, characterized in that: The BIGRU network is used to process the forward and reverse information of the input sequence, and a context vector is generated through a global attention mechanism to obtain enhanced output, including: Use two GRU units to process the forward and reverse information of the input sequence respectively, and generate a forward hidden state and a reverse hidden state for each data point; Merge the forward hidden state and the reverse hidden state to form a bidirectional hidden state sequence; A global attention mechanism is built in the BIGRU network to generate a global context vector, which is then concatenated with the output of the bidirectional hidden state sequence to obtain an enhanced output.

8. The photovoltaic power generation prediction method according to claim 1, characterized in that: The step of inputting a new input sequence into the trained parallel prediction model and generating a continuous photovoltaic power generation sequence through a single-step prediction mode and / or a multi-step prediction mode includes: In the single-step prediction mode, the trained parallel prediction model predicts the photovoltaic power generation of a preset time step in the future each time; In the multi-step prediction mode, the trained parallel prediction model predicts the photovoltaic power generation for multiple preset time steps in the future each time.

9. A photovoltaic power generation prediction device, characterized in that: include: A collection module is used to synchronously collect the photovoltaic power generation and the meteorological factor data affecting the photovoltaic power generation in the past preset time period at the same preset time interval, and form a photovoltaic power generation data set and a meteorological factor data set respectively; wherein each time interval constitutes a different data point, and the meteorological factor data set includes the observation values ​​of multiple meteorological factors; An analysis module is used to analyze the correlation between each meteorological factor data and photovoltaic power generation in each data point, and to use the meteorological factor corresponding to the meteorological factor data with a correlation greater than a preset threshold as a key characteristic variable; An organization module, used for organizing the photovoltaic power generation data set and the key characteristic variables into an input sequence according to time series; wherein each data point in the input sequence includes the value of the photovoltaic power generation and the key characteristic variable; A construction module is used to construct a parallel prediction model and use the input sequence to extract features to obtain the result of feature enhancement fusion; wherein the parallel prediction model includes a Transformer encoder layer and a BIGRU network; A mapping module, used to map the obtained feature enhancement fusion results into a photovoltaic power generation prediction value through a fully connected layer; A training module, used to train the parallel prediction model using data in a first preset number of data points as a training set, compare the output photovoltaic power generation prediction value with the actual photovoltaic power generation data, and adjust the parameters in the parallel prediction model according to the comparison result to obtain a trained parallel prediction model; A generation module is used to input a new input sequence into the trained parallel prediction model, and generate a continuous photovoltaic power generation sequence through a single-step prediction mode and / or a multi-step prediction mode; wherein the new input sequence includes meteorological factor data.