Distributed photovoltaic generating capacity prediction method and device and medium
By adopting a prediction model of deep separable convolution and intergroup cross-attention mechanism in distributed photovoltaic power generation prediction, the problem of failing to fully utilize multiple data sources in the prior art is solved, and higher prediction accuracy and robustness are achieved.
Patent Information
- Application Number
- CN202411734317.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-03-04
AI Technical Summary
Existing deep learning models fail to fully utilize the potential of multiple data sources in distributed photovoltaic power generation prediction, resulting in limited prediction accuracy.
A prediction model based on the deep separable convolution and inter-group cross-attention mechanism is adopted, and a multi-mode information fusion module and a decoding prediction module are combined with historical photovoltaic output data, meteorological data and node labels, cross-fusion feature extraction and timing decoding are performed to predict the total distributed photovoltaic power generation in the region in the future period.
It significantly improves the accuracy and robustness of distributed photovoltaic power generation prediction, enhances the feature extraction and fusion capabilities of the prediction model, and is suitable for large-scale and real-time prediction tasks.
Smart Images

Figure CN119561037A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of power systems, and in particular to a distributed photovoltaic power generation prediction method. Background Art
[0002] With the transformation of the global energy structure, distributed photovoltaic power generation, as a clean and renewable energy form, is gradually becoming an important part of the new power system. By installing photovoltaic modules on the roofs of buildings, parking lots and other places, distributed photovoltaic power generation uses solar energy, which has significant advantages such as reducing energy transmission losses, reducing carbon emissions, and improving energy self-sufficiency. Compared with traditional centralized power generation, distributed photovoltaic power generation can achieve localized production and consumption of energy, which can not only alleviate the pressure on the power grid, but also promote the optimization of the energy structure. However, the volatility and uncertainty of distributed photovoltaic power generation will be affected by factors such as weather changes, light intensity, temperature and humidity fluctuations, which makes the dispatch and management of electricity face many challenges, especially during the peak period of electricity demand, the instability of photovoltaic power generation will affect the reliability and stability of the power grid.
[0003] Accurate prediction of photovoltaic power generation has become the key to improving the stability of power systems and optimizing dispatch. Traditional prediction methods mainly rely on physical modeling and statistical analysis, such as autoregressive (AR) models and autoregressive moving average (ARMA) models. Although these methods can provide predictions of photovoltaic power generation under certain conditions, they cannot effectively capture complex nonlinear characteristics and time series dependencies, so the accuracy of predictions is limited. In recent years, deep learning methods have gradually become the mainstream technology for solving such problems, especially models such as convolutional neural networks (CNN), long short-term memory networks (LSTM) and Transformer. Due to their powerful data-driven learning capabilities, they can process complex time series data and capture nonlinear relationships, so they have shown significant advantages in photovoltaic power generation prediction.
[0004] However, most existing deep learning models focus on processing a single data type and fail to fully utilize the potential of multiple data sources. In practical applications, the total photovoltaic power generation in a region is composed of the photovoltaic power generation of each node, and the photovoltaic power generation of each node is closely related to a variety of meteorological factors and historical power generation. In order to improve the prediction performance, how to reasonably integrate and model the data information from these different sources has become the key to improving the prediction accuracy of distributed photovoltaic power generation.
[0005] In order to improve the above-mentioned deficiencies, providing a distributed photovoltaic power generation prediction method has become an urgent problem to be solved in this field. Summary of the invention
[0006] The purpose of the present invention is to provide a distributed photovoltaic power generation prediction method, which can effectively improve the resource scheduling efficiency of electricity by predicting the total distributed photovoltaic power generation in a region in the future period of time through a prediction model based on deep separable convolution and inter-group cross attention mechanism.
[0007] In order to solve the above technical problems, on the one hand, the present invention provides a distributed photovoltaic power generation prediction method, comprising the following steps:
[0008] S1: Collect raw data to obtain historical photovoltaic output data, meteorological data and node labels of each distributed photovoltaic node in the region;
[0009] S2: pre-processing the collected historical photovoltaic output data and meteorological data;
[0010] S3: construct a prediction model based on deep separable convolution and inter-group cross attention mechanism, and train the prediction model based on pre-processed historical photovoltaic output data and meteorological data; the prediction model includes a multi-mode information fusion module and a decoding prediction module; the multi-mode information fusion module obtains a cross-fusion feature map through deep separable convolution and inter-group cross attention mechanism; the decoding prediction module performs time series decoding on the cross-fusion feature map and outputs a prediction result;
[0011] S4: Input the historical photovoltaic output data, meteorological data and node labels of each distributed photovoltaic node in the region into the prediction model to predict the total distributed photovoltaic power generation in the region in the future.
[0012] Preferably, step S2 pre-processes the collected historical photovoltaic output data and meteorological data, specifically: firstly cleans the historical photovoltaic output data and meteorological data, and then performs data normalization on the cleaned data;
[0013] The data cleaning includes correcting outliers in the data and filling missing values in the data, which is specifically implemented as follows: (1) judging outliers in the data by the 3sigma criterion, and then assigning corrections to the outliers;
[0014] The formula for determining the abnormal value in the data is as follows:
[0015]
[0016] Among them, x n,t represents the value at time t on day n, represents the mean of all moments on the nth day, and σ represents the standard deviation of all moments on the nth day;
[0017] If x n,t If the above inequality cannot be satisfied, then x n,t is the normal value;
[0018] If x n,t If the above inequality is satisfied, then x n,t For outliers, the outliers are corrected by assigning values to the mean values of all moments on the nth day. The correction formula is expressed as follows:
[0019]
[0020] Among them, x ′ n,t is the corrected value at time t on day n, represents the mean of all sampling moments on day n; (2) the number of missing values is compared with the number of time points recorded in a day;
[0021] If the number of missing values is greater than or equal to one-third of the number of time points recorded in a day, the data for that day are discarded;
[0022] If the missing value is less than one-third of the number of time points recorded in a day, the missing value is filled based on the data of one time point before and after the missing value on the same day and the data of the same time point one day before and after the missing value. The formula is as follows:
[0023]
[0024] Among them, x ′ n ′ ,t is the value at time t on the nth day after filling, x n+1,t and x n-1,t are the values at time t on day n+1 and day n-1, respectively, n,t+1 and x n,t-1 are the values at time t+1 and time t-1 on the nth day, α1 and α2 are weight coefficients, and α1+α2=1;
[0025] The data normalization processing of the cleaned data is implemented by the min-max normalization method, and the formula is expressed as follows:
[0026]
[0027] in, represents the normalized value at time t on day n, d n.t Indicates the value at time t on day n after data cleaning, maxd n and mind n They represent the maximum and minimum values at all times on the nth day after data cleaning.
[0028] Preferably, step S3 comprises the following steps:
[0029] S3.1: Multi-mode time series information and node labels are fused as input features to construct an input tensor of the prediction model, and the input tensor is sent to the multi-mode information fusion module, wherein the multi-mode time series information is the historical photovoltaic output data and meteorological data of the photovoltaic nodes in the region preprocessed in step S2;
[0030] S3.2: Extract local spatial features of each modality through depth-wise separable convolution and output the fused feature map;
[0031] S3.3: Through the inter-group cross-attention mechanism, the feature map after convolution in step S302 is weighted fused to obtain a cross-fused feature map.
[0032] S3.4: Send the cross-fusion feature map to the decoding prediction module for temporal decoding, and output the prediction result.
[0033] Preferably, in step S3.2, the depthwise separable convolution includes depthwise convolution and pointwise convolution, and the specific steps are as follows:
[0034] S3.21: Perform independent convolution on the channels of each modality through deep convolution to extract the local spatial features of each modality. The formula is as follows:
[0035]
[0036] Among them, Input h+i,w+j,c Represents the value of the position (h+i,w+j) in the cth channel of the input feature, Kernel i,j,c Denotes the depth convolution kernel parameters at position (i, j) in the cth channel, DeptHwiseOutput H,w,c represents the value of the output feature map after depth convolution at position (h, w) in the cth channel, and S represents the size of the depth convolution kernel, that is, the dimension of the filter used in the convolution operation;
[0037] S3.22: Through point-by-point convolution, the local spatial features of different channels are fused together using a 1×1 convolution kernel to achieve information interaction between channels and reduce the amount of calculation and parameters. The formula is expressed as follows:
[0038]
[0039] Among them, Output h,w,c′ Represents the cth output feature map of the point-by-point convolution at position (h, w) ′ The value of each channel, DepthwiseOutput h,w,c Represents the value of the output feature map after depth convolution at position (h, w) in the cth channel, Kernel c,c′Represents the weight parameter of the point-by-point convolution, corresponding to a 1×1 convolution kernel, which is used to map the value of the c channel to the new c ′ On the channel, C represents the number of channels.
[0040] Preferably, step S3.3 comprises the following steps:
[0041] S3.31: Divide the feature map in step S3.2 into several groups;
[0042] S3.32: The feature map of the first group is calculated by self-attention to obtain the intra-group cross feature map of the first group;
[0043] S3.33: Add and fuse the intra-group cross feature map of the first group in step S3.32 with the feature map of the next group to obtain an added fused feature map, and the added fused feature map is calculated by self-attention to obtain an intra-group cross feature map of the second group, and so on, until the intra-group cross feature map of the last group is obtained;
[0044] S3.34: Concatenate the intra-group cross feature maps of several groups to obtain a cross fusion feature map.
[0045] Preferably, in step S3.3, the inter-group cross attention mechanism is calculated by the following formula:
[0046] F l=1:p =Split(Output)
[0047]
[0048] Where p represents the total number of ICA groups and 1≤l≤p, Split represents the splitting operation, Output represents the output of the depthwise separable convolution, and F l , and They represent the feature map of the lth group, the added fusion feature map and the cross feature map within the group respectively. Attention represents the attention operation. and They represent the query parameter matrix, key parameter matrix and value parameter matrix of the lth group respectively, and Concat represents the concatenation operation.
[0049] Preferably, the decoding prediction module includes 5 levels, namely Flatten and position encoding layer, self-attention layer, feedforward neural network layer, residual connection and normalization layer and fully connected layer.
[0050] Preferably, step S3 also includes optimizing the parameters of the prediction model by a mean square error loss function during the training of the prediction model; the loss function is expressed as follows:
[0051]
[0052] in, represents the predicted value of photovoltaic power generation in the region at the tth time, y t It represents the real value of photovoltaic power generation in the region at the tth moment. The value range of t is 1 to L, L represents the number of time points predicted in the future, and Loss represents the loss value.
[0053] On the other hand, the present invention provides a distributed photovoltaic power generation prediction device, including a processor and a memory, wherein the memory stores a computer program, and when the computer program is called and executed by the processor, the distributed photovoltaic power generation prediction method based on the inter-group cross-attention mechanism as described in any one of claims 1-8 is implemented.
[0054] On the other hand, the present invention provides a computer-readable medium storing a computer program. When the computer program is called and executed by a computer, the distributed photovoltaic power generation prediction method based on the inter-group cross-attention mechanism as described in any one of claims 1 to 8 is implemented.
[0055] Compared with the prior art, the beneficial effects of the present invention are as follows: (1) The present invention decomposes the total photovoltaic power generation in the region into the photovoltaic output aggregation of multiple distributed photovoltaic nodes, and collects multi-source data on each different photovoltaic node, and then fits the inherent complex relationship between the distributed photovoltaic nodes through the prediction model to achieve accurate prediction of the total photovoltaic power generation in the region. Compared with the existing method of using the historical total power generation in the region to predict the total power generation of the region in the future, the present invention expands the mapping function domain of input and output, ensures the richness of the model training data, and makes the output prediction data more accurate; (2) The present invention can significantly enhance the feature extraction and fusion capabilities of the prediction model while improving the computational efficiency through a multi-mode information fusion module based on the fusion design of deep separable convolution and ICA mechanism. The deep separable convolution decomposes the convolution operation into deep convolution and point-by-point convolution, significantly reducing the number of parameters and the amount of calculation, making the prediction model more lightweight and efficient, and suitable for large-scale and real-time prediction tasks. At the same time, the deep separable convolution performs convolution operations independently on each modal channel, which can effectively capture the local spatial characteristics of each modality, laying the foundation for subsequent multi-modal fusion. Combined with the adaptive weighting mechanism of ICA, the prediction model can dynamically adjust the fusion strategy according to the importance of different modal and temporal features, further improving the accuracy and robustness of the prediction of photovoltaic power generation in the region. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0057] Figure 1 It is a schematic diagram of the process of the distributed photovoltaic power generation prediction method of the present invention;
[0058] Figure 2 It is a structural diagram of the prediction model based on the depth-separable convolution and inter-group cross attention mechanism in the present invention;
[0059] Figure 3 It is a flow chart of the inter-group cross attention mechanism (ICA mechanism) in the present invention;
[0060] Figure 4 It is a structural diagram of the decoding prediction module in the present invention. DETAILED DESCRIPTION
[0061] The following is a further detailed description of the present invention in conjunction with the accompanying drawings. The terminal technical solution of the embodiment of the present invention is clearly and completely described. Obviously, the described embodiment is a part of the embodiment of the present invention, not all of the embodiments. Based on the embodiment of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0062] like Figure 1 As shown, the present invention provides a distributed photovoltaic power generation prediction method, comprising the following steps:
[0063] S1: Collect raw data and obtain historical photovoltaic output data, meteorological data and node labels of each distributed photovoltaic node in the region.
[0064] In this embodiment, the meteorological data are selected from four factors that have a greater impact on photovoltaic power generation, namely, sunshine intensity, temperature, wind speed and humidity.
[0065] In this embodiment, the node label adopts one-hot encoding. Taking 50 distributed photovoltaic nodes as an example, the number of one-hot encoding bits of the node label is 50, and the one-hot encoding of the mth node is 1 in the mth bit and 0 in the rest of the bits. At the same time, in order to make the length of the node label consistent with the length of the historical photovoltaic output data and meteorological data, it is necessary to add 0 after the one-hot encoding. The node label is only a feature label and is only used to distinguish node information.
[0066] S2: Preprocess the collected historical photovoltaic output data and meteorological data.
[0067] The preprocessing specifically includes: firstly performing data cleaning on the historical photovoltaic output data and meteorological data, and then performing data normalization processing on the cleaned data.
[0068] The data cleaning includes correcting outliers in the data and filling missing values in the data, which is specifically implemented as follows:
[0069] (1) Use the 3sigma criterion to determine outliers in the data and then assign corrections to the outliers;
[0070] The formula for determining the abnormal value in the data is as follows:
[0071]
[0072] Among them, x n,t represents the value at time t on day n, represents the mean of all moments on the nth day, and σ represents the standard deviation of all moments on the nth day;
[0073] If x n,t If the above inequality cannot be satisfied, then x n,t is the normal value;
[0074] If x n,t If the above inequality is satisfied, then x n,t For outliers, the outliers are corrected by assigning values to the mean values of all moments on the nth day. The correction formula is expressed as follows:
[0075]
[0076] Among them, x ′ n,t is the corrected value at time t on day n, represents the mean of all sampling times on the nth day;
[0077] (2) compare the number of missing values to the number of time points recorded in a day;
[0078] If the number of missing values is greater than or equal to one-third of the number of time points recorded in a day, the data for that day are discarded;
[0079] If the missing value is less than one-third of the number of time points recorded in a day, the missing value is filled based on the data of one time point before and after the missing value on the same day and the data of the same time point one day before and after the missing value. The formula is as follows:
[0080]
[0081] Among them, x ′ n′ ,t is the value at time t on the nth day after filling, x n+1,t and x n-1,t are the values at time t on day n+1 and day n-1, respectively, n,t+1 and x n,t-1 are the values at time t+1 and time t-1 on the nth day respectively, α1 and α2 are weight coefficients, and α1+α2=1.
[0082] After completing the outlier correction and missing value filling of the historical photovoltaic output data and meteorological data of the photovoltaic nodes, it is also necessary to normalize each type of data separately to eliminate the impact of dimensions between different categories of data and improve the accuracy of the prediction model.
[0083] The data normalization processing of the cleaned data is implemented by the min-max normalization method, and the formula is expressed as follows:
[0084]
[0085] in, represents the normalized value at time t on day n, d n.t Indicates the value at time t on day n after data cleaning, maxd n and mind n They represent the maximum and minimum values at all times on the nth day after data cleaning.
[0086] S3: Construct a prediction model based on deep separable convolution and inter-group cross attention mechanism (ICA mechanism), and train the prediction model based on pre-processed historical photovoltaic output data and meteorological data; the prediction model includes a multi-mode information fusion module and a decoding prediction module; the multi-mode information fusion module obtains a cross-fusion feature map through deep separable convolution and inter-group cross attention mechanism; the decoding prediction module performs time series decoding on the cross-fusion feature map and outputs a prediction result, such as Figure 2 shown.
[0087] S3.1: Multi-mode time series information and node labels are fused as input features to construct an input tensor of a prediction model, and the input tensor is sent to a multi-mode information fusion module. The multi-mode time series information is the historical photovoltaic output data and meteorological data of photovoltaic nodes in the region preprocessed in step S2.
[0088] In this embodiment, in the data pre-processed in step S2, the T time points before the predicted target period (the time point interval is 30 minutes, that is, a total of The historical photovoltaic output, sunshine intensity, temperature, wind speed and humidity of each photovoltaic node in the past 24 hours (hours) are collected, and node labels are added at the same time. There are P photovoltaic nodes, and each node has N types of features. The input of the prediction model is a multi-mode distributed tensor with a dimension of N×T×P. T=96, P=50, and N=6, so the input of the prediction model is a multi-mode distributed tensor with a dimension of 6×96×50.
[0089] The multimodal information fusion module is a key front-end module in the entire prediction model, which is used to extract features from each modality and fuse information from different modalities, providing high-quality feature information for subsequent decoding predictions. At the same time, it maximizes the retention of key information of the input data and optimizes computational efficiency.
[0090] S3.2: Extract the local spatial features of each modality through depth-wise separable convolution and output the fused feature map.
[0091] The depth-wise separable convolution includes depth-wise convolution and point-wise convolution, and the specific steps are as follows:
[0092] S3.21: Perform independent convolution on the channels of each modality through deep convolution to extract the local spatial features of each modality. The formula is as follows:
[0093]
[0094] Among them, Input h+i,w+j,c Represents the value of the position (h+i,w+j) in the cth channel of the input feature, Kernel i,j,c DepthwiseOutput represents the depth convolution kernel parameters at position (i, j) in the cth channel. h,w,c It represents the value of the position (h, w) in the cth channel of the output feature map after the depth convolution, and S represents the size of the depth convolution kernel, that is, the dimension of the filter used in the convolution operation.
[0095] S3.22: Through point-by-point convolution, the local spatial features of different modes are fused together using a 1×1 convolution kernel to achieve information interaction between channels, reduce the amount of calculation and the number of parameters, and improve the calculation efficiency and feature learning effect. The formula is expressed as follows:
[0096]
[0097] Among them, Output h,w,c′ Represents the cth output feature map of the point-by-point convolution at position (h, w) ′ The value of each channel, DepthwiseOutput h,w,c Represents the value of the output feature map after depth convolution at position (h, w) in the cth channel, Kernelc,c′ Represents the weight parameter of the point-by-point convolution, corresponding to a 1×1 convolution kernel, which is used to map the value of the c channel to the new c ′ In the channel, C represents the number of channels, and the number of channels is the same as the number of photovoltaic nodes, which is 50.
[0098] The depthwise separable convolution reduces the input multi-mode distributed tensor of dimension N×T×P to dimension N×T×P through convolution operation. The multi-mode distributed tensor of the input is reduced to a multi-mode distributed tensor of dimension 3×48×50, thereby reducing the spatial dimension of the feature map while extracting features.
[0099] Through deep separable convolution, the prediction model can maintain its performance while significantly reducing the amount of calculation and parameters. This has important practical significance for distributed photovoltaic power generation prediction systems that need to process large amounts of multi-mode data and real-time predictions.
[0100] S3.3: Through the cross-attention mechanism between groups, the feature map after convolution in step S302 is weighted fused to obtain the cross-fused feature map, such as Figure 3 As shown, the specific steps are as follows:
[0101] S3.31: Divide the feature map in step S3.2 into p groups along the feature channel, and the size of each feature map group is
[0102] S3.32: The feature map of the first group is calculated by self-attention to obtain the intra-group cross feature map of the first group
[0103]
[0104] S3.33: The intra-group cross-feature map of the first group in step S3.32 The feature map of the next group is added and fused to obtain the added fusion feature map, and the added fusion feature map is calculated by self-attention to obtain the intra-group cross feature map of the second group. And so on, until the intra-group cross-feature graph of group p is obtained
[0105] S3.34: Concatenate the cross-feature maps within the p groups to obtain a dimension of The cross-fusion feature map.
[0106] In this embodiment, the feature map is divided into 50 groups along the feature channel, and the size of each feature map group is 3×48; the feature map of the first group is calculated by self-attention to obtain the intra-group cross feature map of the first group The first group of intra-group cross-feature maps The feature map of the next group is added and fused to obtain the added fusion feature map, and the added fusion feature map is calculated by self-attention to obtain the intra-group cross feature map of the second group. And so on, until the intra-group cross-feature graph of the 50th group is obtained The 50 groups of intra-group cross feature maps are concatenated to obtain a cross-fusion feature map with a dimension of 3×48×50.
[0107] Based on the above steps, the inter-group cross attention mechanism is calculated as follows:
[0108] F l=1:p =Split(Output)
[0109]
[0110] Where p represents the total number of ICA groups and 1≤l≤p, Split represents the splitting operation, Output represents the output of the depthwise separable convolution, and F l , and They represent the feature map of the lth group, the added fusion feature map and the cross feature map within the group respectively. Attention represents the attention operation. and They represent the query parameter matrix, key parameter matrix and value parameter matrix of the lth group respectively, and Concat represents the concatenation operation.
[0111] In this embodiment, the attention operation (Attention), that is, the attention encoding method, is specifically as follows: first, the input sequence with a height of H and a width of W is multiplied by several parameter matrices of different sizes of W×W to obtain a query matrix Q, a key matrix K and a value matrix V respectively; secondly, the query matrix Q is multiplied by the key matrix K to obtain an attention matrix; then, the attention matrix is normalized by the Softmax function; finally, the normalized attention matrix is multiplied by the value matrix V to obtain the output sequence O of the attention encoding method, which is expressed as follows:
[0112] O = Softmax(Q·K T )·V
[0113] Where T is the transpose operation.
[0114] The attention encoding method learns the correlation between different sequences through sufficient data interaction between input sequences, thereby completing the information fusion of the input data.
[0115] The ICA mechanism performs self-attention calculations within each group, pays attention to local information, and extracts cross-features within the group. After the calculation within the group is completed, a global attention calculation is performed across groups to establish a global connection between groups and capture cross-modal and time-series information. This hierarchical attention calculation mechanism can reduce the complexity of calculations and effectively reduce the redundancy between attention heads, so that the prediction model can achieve a balance between local and global features. The cross-fused feature map processed by the deep separable convolution and ICA mechanism has compact features after dimensionality reduction and fusion of multimodal information. The cross-fused feature map will be used in the subsequent decoding prediction module. It contains local and global information, which can ensure that the prediction model uses comprehensive features to make high-quality predictions.
[0116] The ICA mechanism also has significant advantages in computational efficiency and information utilization. First, the number of parameters that need to be calculated is reduced by grouping, avoiding the all-to-all comparison of sequences in traditional multi-head self-attention (MHSA), significantly reducing the complexity of calculations, and is especially suitable for processing long sequence data, making the attention mechanism more efficient. Secondly, the ICA mechanism adopts a hierarchical attention mechanism, which performs attention calculations on local features within the group and performs global attention calculations between groups, thereby reducing the capture of redundant information between attention heads and improving information utilization. This not only ensures that the prediction model captures important local features, but also understands the relationship between these features in the global context, making the prediction model more efficient and accurate while taking into account both local and global information.
[0117] S3.4: Send the cross-fused feature map with a dimension of 3×48×50 to the decoding prediction module for temporal decoding, and output the prediction result.
[0118] like Figure 4As shown in the figure, the decoding prediction module includes 5 hierarchical structures, namely Flatten and position encoding layer, self-attention layer, feedforward neural network layer, residual connection and normalization layer and fully connected layer, which are used to predict the final output of the model. The specific implementation is as follows: First, the cross-fusion feature map with a dimension of 3×48×50 obtained by the multimodal information fusion module is input into the Flatten and position encoding layer, flattened into a two-dimensional sequence of 144×50, and a position code is added to each position of the flattened two-dimensional sequence to provide time series information. Then, the self-attention layer is entered to capture the relationship in the time series information. The calculation principle and mechanism of this layer are the same as the attention calculation in the multimodal information fusion module. After the self-attention layer, the decoding prediction module adds a feedforward neural network layer, which is used to process the output of the self-attention layer to enhance the nonlinear mapping ability of the prediction model. In order to avoid the problem of gradient disappearance, the decoding prediction module also adds a residual connection and normalization layer after the feedforward neural network layer to ensure the stability of the information flow. Finally, the prediction result is output through the fully connected layer, that is, the output of the decoder is mapped to the total photovoltaic output at L future time points, and the prediction result of the output prediction model is an L-dimensional vector.
[0119] In this embodiment, during the training of the prediction model, the parameters of the prediction model are optimized by using a mean square error loss function; the loss function is expressed as follows:
[0120]
[0121] in, represents the predicted value of photovoltaic power generation in the region at the tth time, y t It represents the real value of photovoltaic power generation in the region at the tth moment. The value range of t is 1 to L, L represents the number of time points predicted in the future, and Loss represents the loss value.
[0122] S4: Input the historical photovoltaic output data, meteorological data and node labels of each distributed photovoltaic node in the region into the prediction model to predict the total distributed photovoltaic power generation in the region in the future.
[0123] In this embodiment, the prediction goal is to use historical photovoltaic output data and meteorological data to predict the total photovoltaic power generation in the region at the next 12 time points, with an interval of 30 minutes between each two time points, that is, to predict the total distributed photovoltaic power generation in the region for the next 6 hours. Specifically, the historical photovoltaic output, sunshine intensity, temperature, wind speed, humidity and node label of each photovoltaic node in the region at the 96 time points before the prediction time period are input into the prediction model, and the prediction value with an output length of 12 is the predicted value of the total distributed photovoltaic power generation in the region for the next 6 hours (predicted every 30 minutes).
[0124] Another specific embodiment of the present application provides a distributed photovoltaic power generation prediction device, including a processor and a memory, wherein the memory stores a computer program, and when the computer program is called and executed by the processor, the distributed photovoltaic power generation prediction method based on the inter-group cross-attention mechanism as described in any one of claims 1-8 is implemented.
[0125] Another specific embodiment of the present application provides a computer-readable medium, which stores a computer program. When the computer program is called and executed by a computer, it implements the distributed photovoltaic power generation prediction method based on the inter-group cross-attention mechanism as described in any one of claims 1-8.
[0126] The parts not involved in the present invention are the same as the prior art or are implemented by using the prior art.
[0127] The above contents are further detailed descriptions of the present invention in combination with specific implementation methods, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field of the present invention, several simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as falling within the scope of protection of the present invention.
Claims
1. A distributed photovoltaic power generation prediction method, characterized by: The steps include: S1: Collect raw data to obtain historical photovoltaic output data, meteorological data and node labels of each distributed photovoltaic node in the region; S2: pre-processing the collected historical photovoltaic output data and meteorological data; S3: construct a prediction model based on deep separable convolution and inter-group cross attention mechanism, and train the prediction model based on pre-processed historical photovoltaic output data and meteorological data; the prediction model includes a multi-mode information fusion module and a decoding prediction module; The multi-modal information fusion module obtains a cross-fusion feature map through deep separable convolution and inter-group cross-attention mechanism; the decoding prediction module performs temporal decoding on the cross-fusion feature map and outputs a prediction result; S4: Input the historical photovoltaic output data, meteorological data and node labels of each distributed photovoltaic node in the region into the prediction model to predict the total distributed photovoltaic power generation in the region in the future.
2. A distributed photovoltaic power generation prediction method according to claim 1, characterized in that: Step S2 pre-processes the collected historical photovoltaic output data and meteorological data, specifically: first, clean the historical photovoltaic output data and meteorological data, and then normalize the cleaned data; the data cleaning includes correcting outliers in the data and filling missing values in the data, which is specifically implemented as follows: (1) judging outliers in the data by the 3sigma criterion, and then assigning corrections to the outliers; The formula for determining the abnormal value in the data is as follows: Among them, x n,t represents the value at time t on day n, represents the mean of all moments on the nth day, and σ represents the standard deviation of all moments on the nth day; If x n,t If the above inequality cannot be satisfied, then x n,t is the normal value; If x n,t If the above inequality is satisfied, then x n,t For outliers, the outliers are corrected by assigning values to the mean values of all moments on the nth day. The correction formula is expressed as follows: Among them, x ′ n,t is the corrected value at time t on day n, represents the mean of all sampling moments on day n; (2) the number of missing values is compared with the number of time points recorded in a day; If the number of missing values is greater than or equal to one-third of the number of time points recorded in a day, the data for that day are discarded; If the missing value is less than one-third of the number of time points recorded in a day, the missing value is filled based on the data of one time point before and after the missing value on the same day and the data of the same time point one day before and after the missing value. The formula is as follows: Among them, x″ n,t is the value at time t on the nth day after filling, x n+1,t and x n-1,t are the values at time t on day n+1 and day n-1, respectively, n,t+1 and x n,t-1 are the values at time t+1 and time t-1 on the nth day, α1 and α2 are weight coefficients, and α1+α2=1; The data normalization processing of the cleaned data is implemented by the min-max normalization method, and the formula is expressed as follows: in, represents the normalized value at time t on day n, d n.t Indicates the value at time t on day n after data cleaning, maxd n and mind n They represent the maximum and minimum values at all times on the nth day after data cleaning.
3. A distributed photovoltaic power generation prediction method according to claim 1, characterized in that: Step S3 includes the following steps: S3.1: Multi-mode time series information and node labels are fused as input features to construct an input tensor of the prediction model, and the input tensor is sent to the multi-mode information fusion module, wherein the multi-mode time series information is the historical photovoltaic output data and meteorological data of the photovoltaic nodes in the region preprocessed in step S2; S3.2: Extract local spatial features of each modality through depth-wise separable convolution and output the fused feature map; S3.3: Through the inter-group cross-attention mechanism, the feature map after convolution in step S302 is weighted fused to obtain a cross-fused feature map. S3.4: Send the cross-fusion feature map to the decoding prediction module for temporal decoding, and output the prediction result.
4. A distributed photovoltaic power generation prediction method according to claim 3, characterized in that: In step S3.2, the depthwise separable convolution includes depthwise convolution and pointwise convolution, and the specific steps are as follows: S3.21: Perform independent convolution on the channels of each modality through deep convolution to extract the local spatial features of each modality. The formula is as follows: Among them, Input h+i,w+j,c Represents the value of the position (h+i, w+j) in the cth channel of the input feature, Kernel i,j,c DepthwiseOutput represents the depth convolution kernel parameters at position (i, j) in the cth channel. h,w,c represents the value of the output feature map after the depth convolution at position (h, w) in the cth channel, and S represents the size of the depth convolution kernel, that is, the dimension of the filter used in the convolution operation; S3.22: Through point-by-point convolution, the local spatial features of different channels are fused together using a 1×1 convolution kernel to achieve information interaction between channels and reduce the amount of calculation and parameters. The formula is expressed as follows: Among them, Output h,w,c′ Represents the value of the c′th channel of the output feature map of the point-by-point convolution at position (h, w), DepthwiseOutput h,w,c Represents the value of the output feature map after depth convolution at position (h, w) in the cth channel, Kernel c,c′ Represents the weight parameter of point-by-point convolution, corresponding to a 1×1 convolution kernel, which is used to map the value of the c channel to the new c′ channel. C represents the number of channels.
5. A distributed photovoltaic power generation prediction method according to claim 3, characterized in that: Step S3.3 includes the following steps: S3.31: Divide the feature map in step S3.2 into several groups; S3.32: The feature map of the first group is calculated by self-attention to obtain the intra-group cross feature map of the first group; S3.33: Add and fuse the intra-group cross feature map of the first group in step S3.32 with the feature map of the next group to obtain an added fused feature map, and the added fused feature map is calculated by self-attention to obtain an intra-group cross feature map of the second group, and so on, until the intra-group cross feature map of the last group is obtained; S3.34: Concatenate the intra-group cross feature maps of several groups to obtain a cross fusion feature map.
6. A distributed photovoltaic power generation prediction method according to claim 3, characterized in that: In step S3.3, the inter-group cross attention mechanism is calculated as follows: F l=1:p =Split(Output) Where p represents the total number of ICA groups and 1≤l≤p, Split represents the splitting operation, Output represents the output of the depthwise separable convolution, and F l , and They represent the feature map of the lth group, the added fusion feature map and the cross feature map within the group, Attention represents the attention operation, and W l Q , W l K and W l V They represent the query parameter matrix, key parameter matrix and value parameter matrix of the lth group respectively, and Concat represents the concatenation operation.
7. A distributed photovoltaic power generation prediction method according to claim 3, characterized in that: The decoding prediction module includes 5 layers, namely Flatten and position encoding layer, self-attention layer, feedforward neural network layer, residual connection and normalization layer and fully connected layer.
8. A distributed photovoltaic power generation prediction method according to claim 1, characterized in that: Step S3 also includes optimizing the parameters of the prediction model by using a mean square error loss function during the training of the prediction model; the loss function is expressed as follows: in, represents the predicted value of photovoltaic power generation in the region at the tth time, y t It represents the real value of photovoltaic power generation in the region at the tth moment. The value range of t is 1 to L, L represents the number of time points predicted in the future, and Loss represents the loss value.
9. A distributed photovoltaic power generation prediction device, comprising a processor and a memory, characterized in that: The memory stores a computer program, and when the computer program is called and executed by the processor, it implements the distributed photovoltaic power generation prediction method based on the inter-group cross-attention mechanism as described in any one of claims 1-8.
10. A computer readable medium, characterized in that: The computer-readable medium stores a computer program, and when the computer program is called and executed by a computer, it implements the distributed photovoltaic power generation prediction method based on the inter-group cross-attention mechanism as described in any one of claims 1-8.
Citation Information
Cited By
Regional carbon emission factor prediction model training method, prediction method and electric carbon metering terminal
CN120470553A