Distributed photovoltaic cluster prediction method, system, equipment and medium
Through the transfer learning and conformal prediction framework, a photovoltaic power prediction model is built, which solves the prediction problem in the small sample scenario of distributed photovoltaic power generation, and improves accuracy and credibility, which is suitable for new photovoltaic power stations and scenarios with insufficient data.
Patent Information
- Application Number
- CN202510415229.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-03
- Publication Date
- 2025-08-12
AI Technical Summary
The prior art is difficult to accurately predict the output of distributed photovoltaic power generation in power systems, especially in the absence of data in small sample scenarios, resulting in a lack of interpretability and credibility in the prediction results.
Using the transfer learning strategy, by constructing data sets of the source and target domains, using multi-dimensional feature analysis to select the site data with the highest similarity, perform data preprocessing and model fine-tuning, combine multi-layer Transformer encoder with multi-head attention mechanism and dynamic weighting function to build a photovoltaic power prediction model, and introduce a conformal prediction framework to provide reliable confidence intervals.
It improves the accuracy and credibility of distributed photovoltaic cluster prediction, is suitable for new photovoltaic power stations or data scarcity scenarios, provides reliable prediction results and confidence intervals, and supports grid scheduling decisions.
Smart Images

Figure CN120473976A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of power systems, and in particular to a distributed photovoltaic cluster prediction method, system, equipment and medium. Background Art
[0002] In recent years, with energy transitions and technological advancements, the penetration of distributed photovoltaic power generation in power systems has continued to increase. However, distributed photovoltaic power generation is characterized by significant intermittency, volatility, and uncertainty. Its output is affected by multiple factors, including meteorological conditions, equipment performance, and operating status. This poses significant challenges to the safe and stable operation of power systems. Accurately predicting the output of distributed photovoltaic power generation is crucial for optimal system scheduling and economic operation.
[0003] Currently, distributed photovoltaic cluster forecasting methods mainly include physical models, statistical models, and machine learning. Physical models require detailed meteorological data and equipment parameters, making modeling complex and lacking universal applicability. Statistical models rely on the integrity and representativeness of historical data, making them difficult to adapt to complex and changing operating environments. While machine learning methods can automatically extract deep data features, they typically require large amounts of training data, and their forecasts lack interpretability and credibility.
[0004] Therefore, how to provide a distributed photovoltaic cluster prediction technology to improve the accuracy, reliability and adaptability of the prediction is an urgent problem to be solved. Summary of the Invention
[0005] The embodiments of the present invention provide a distributed photovoltaic cluster prediction method, system, device and medium to solve the above technical problems in the prior art.
[0006] To provide a basic understanding of some aspects of the disclosed embodiments, the following is a brief summary. This summary is not intended to be a comprehensive review, identify key or essential elements, or delineate the scope of these embodiments. Its sole purpose is to present some concepts in a simplified form as a prelude to the detailed description that follows.
[0007] According to a first aspect of an embodiment of the present invention, a distributed photovoltaic cluster prediction method is provided.
[0008] In one embodiment, the distributed photovoltaic cluster prediction method includes:
[0009] The photovoltaic data of the source domain and target domain in the distributed photovoltaic cluster are obtained respectively, and the source domain dataset and the target domain dataset are constructed;
[0010] According to the source domain dataset, a transfer learning model is constructed based on a transfer learning strategy, and the transfer learning model is fine-tuned using the target domain dataset to construct a photovoltaic power prediction model;
[0011] Based on the photovoltaic power prediction model, the photovoltaic power output of the distributed photovoltaic cluster is predicted.
[0012] In one embodiment, constructing a source domain dataset and a target domain dataset includes:
[0013] Based on the photovoltaic data of the source domain and the target domain, the multi-dimensional feature analysis method is used to calculate the similarity between the source domain stations and the target domain stations, and the photovoltaic data of the station with the highest similarity are selected to construct the source domain dataset and the target domain dataset.
[0014] In one embodiment, the multi-dimensional features include: geographical location features, installed capacity features, operating characteristic features, equipment parameter features, and environmental factor features.
[0015] In one embodiment, the distributed photovoltaic cluster prediction method further includes:
[0016] Before building the transfer learning model, data preprocessing is performed on the source domain dataset and the target domain dataset.
[0017] In one embodiment, performing data preprocessing on the source domain dataset and the target domain dataset includes:
[0018] Linear interpolation is used on the source domain dataset and the target domain dataset respectively to unify the data with different time resolutions into a predetermined time sampling interval to obtain resampled data;
[0019] The moving average method is used to remove random fluctuations and outliers in the resampled data; and the missing data in the resampled data are supplemented;
[0020] The processed resampled data were normalized using the Min-Max normalization method.
[0021] In one embodiment, supplementing missing data in the resampled data includes:
[0022] For short-term missing data, linear interpolation is used to supplement it. For long-term missing data, it is filled based on historical similar day data, where the historical similar days are determined based on weather conditions, seasonal characteristics and date types.
[0023] In one embodiment, building a transfer learning model based on the source domain dataset and a transfer learning strategy includes:
[0024] constructing a source domain input feature vector according to the source domain data set, and forming an input sequence based on the source domain input feature vector;
[0025] The input sequence is subjected to limited projection and position encoding to obtain encoding features, and the encoding features are input into a multi-layer Transformer encoder based on a multi-head attention mechanism for transfer learning training. The output of the Transformer encoder is converted into a prediction result through a fully connected layer to obtain a transfer learning model.
[0026] In one embodiment, fine-tuning the transfer learning model using the target domain dataset to construct a photovoltaic power prediction model includes:
[0027] The feature extraction layer of the transfer learning model is frozen, and the target domain dataset is used to fine-tune the transfer learning model using a maximum mean difference loss function and a dynamic weight function to construct a photovoltaic power prediction model.
[0028] In one embodiment, the formula of the maximum mean difference loss function is:
[0029]
[0030] Where MMD(s,t) represents the difference measure of the feature distribution between the source domain s and the target domain t. It is used to quantify the distance between the two data distributions. The smaller the value, the more similar the two distributions are. φ(·) represents the feature mapping function. and Represent samples of the source domain and target domain respectively; n s and n t Represent the number of samples in the source domain and the target domain respectively, represents the reproducing kernel Hilbert space; i represents the index of the source domain data sample, ranging from 1 to ns, where ns is the total number of source domain samples; j represents the index of the target domain data sample, ranging from 1 to nt, where nt is the total number of target domain samples.
[0031] In one embodiment, the formula of the dynamic weight function is:
[0032]
[0033] Where w t is the data weight of the target domain t. This dynamic weight function refers to the weight coefficient of the target domain data during the training process. It is a weight value that is dynamically adjusted as the number of target domain samples increases. Its core function is to gradually adjust the importance ratio of source domain knowledge and target domain data in model training as the target domain data accumulates. It is a progressive training strategy. tIndicates the number of samples of the current accumulated target domain t, N threshold is the preset target domain sample quantity threshold.
[0034] In one embodiment, based on the photovoltaic power prediction model, predicting the photovoltaic power output of the distributed photovoltaic cluster includes:
[0035] Dividing the historical data of the target domain into a validation set and a test set, wherein each set of the validation set and the test set includes input features and corresponding actually observed photovoltaic power output values;
[0036] The photovoltaic power prediction model is verified using a validation set to obtain a predicted value of the validation set, and a deviation between the predicted value of the validation set and the actually observed photovoltaic power output value in the validation set is calculated to construct a conformal score;
[0037] Calculating a quantile of the conformal score according to a predetermined confidence level; testing the photovoltaic power prediction model using a test set to obtain a point prediction value;
[0038] Based on the obtained point prediction value and the quantile of the residual distribution of the conformal score, the interval prediction result of the photovoltaic output is constructed.
[0039] In one embodiment, the calculation formula of the conformal score is:
[0040] R i =|Y i -Y i ′|
[0041] Where R i is the conformal score of sample i, Y i represents the true value of sample i in the validation set, Y i ′ Represents the predicted value of sample i obtained through the regression model.
[0042] In one embodiment, the calculation formula for the photovoltaic output range is:
[0043] C(x)=[μ(x)-Q 1-α (R,L2),μ(x)+Q 1-α (R,L2)]
[0044] Where x represents the sample input feature vector of the test set, including the time and meteorological variables that affect PV power, C(x) represents the interval prediction result of PV output; μ(x) represents the point prediction result obtained from the test set, α represents the significance level, representing the probability that the prediction interval may not contain the true value, (1-α) represents the confidence level, that is, the probability that the prediction interval contains the true value, and Q 1-αis the (1-α)th quantile of the conformal score R; L2 represents the validation set.
[0045] According to a second aspect of an embodiment of the present invention, a distributed photovoltaic cluster prediction system is provided.
[0046] In one embodiment, the distributed photovoltaic cluster prediction system includes:
[0047] The data acquisition module is used to obtain photovoltaic data of the source domain and target domain in the distributed photovoltaic cluster, and construct the source domain dataset and the target domain dataset;
[0048] A model building module is used to build a transfer learning model based on the source domain dataset and a transfer learning strategy, and to fine-tune the transfer learning model using the target domain dataset to build a photovoltaic power prediction model;
[0049] The model prediction module is used to predict the photovoltaic power output of the distributed photovoltaic cluster based on the photovoltaic power prediction model.
[0050] In one embodiment, when constructing the source domain dataset and the target domain dataset, the data acquisition module calculates the similarity between the source domain station and the target domain station based on the photovoltaic data of the source domain and the target domain using a multi-dimensional feature analysis method, and selects the photovoltaic data of the station with the highest similarity to construct the source domain dataset and the target domain dataset.
[0051] In one embodiment, the multi-dimensional features include: geographical location features, installed capacity features, operating characteristic features, equipment parameter features, and environmental factor features.
[0052] In one embodiment, the distributed photovoltaic cluster prediction system further includes:
[0053] The data preprocessing module is used to perform data preprocessing on the source domain dataset and the target domain dataset before building the transfer learning model.
[0054] In one embodiment, when the data preprocessing module performs data preprocessing on the source domain dataset and the target domain dataset, the data preprocessing module uses linear interpolation to unify data of different time resolutions to a predetermined time sampling interval for the source domain dataset and the target domain dataset, respectively, to obtain resampled data; uses a moving average method to remove random fluctuations and outliers in the resampled data; and performs supplementary processing on missing data in the resampled data; and uses a Min-Max normalization method to standardize the processed resampled data.
[0055] In one embodiment, when the data preprocessing module supplements the missing data in the resampled data, the short-term missing data is supplemented by linear interpolation, and the long-term missing data is filled based on historical similar day data, wherein the historical similar days are determined based on weather conditions, seasonal characteristics and date types.
[0056] In one embodiment, when the model construction module constructs a transfer learning model based on the source domain dataset and the transfer learning strategy, it constructs a source domain input feature vector based on the source domain dataset, and forms an input sequence based on the source domain input feature vector; performs limited projection and position encoding on the input sequence to obtain encoding features, and inputs the encoding features into a multi-layer Transformer encoder based on a multi-head attention mechanism for transfer learning training, and converts the output of the Transformer encoder into a prediction result through a fully connected layer to obtain a transfer learning model.
[0057] In one embodiment, when the model construction module uses the target domain dataset to fine-tune the transfer learning model to construct a photovoltaic power prediction model, it freezes the feature extraction layer of the transfer learning model, and uses the target domain dataset to fine-tune the transfer learning model using the maximum mean difference loss function and the dynamic weight function to construct a photovoltaic power prediction model.
[0058] In one embodiment, the formula of the maximum mean difference loss function is:
[0059]
[0060] Where MMD(s,t) represents the difference measure of the feature distribution between the source domain s and the target domain t. It is used to quantify the distance between the two data distributions. The smaller the value, the more similar the two distributions are. φ(·) represents the feature mapping function. and Represent samples of the source domain and target domain respectively; n s and n t Represent the number of samples in the source domain and the target domain respectively, represents the reproducing kernel Hilbert space; i represents the index of the source domain data sample, ranging from 1 to ns, where ns is the total number of source domain samples; j represents the index of the target domain data sample, ranging from 1 to nt, where nt is the total number of target domain samples.
[0061] In one embodiment, the formula of the dynamic weight function is:
[0062]
[0063] Where w tis the data weight of the target domain t. This dynamic weight function refers to the weight coefficient of the target domain data during the training process. It is a weight value that is dynamically adjusted as the number of target domain samples increases. Its core function is to gradually adjust the importance ratio of source domain knowledge and target domain data in model training as the target domain data accumulates. It is a progressive training strategy. t Indicates the number of samples of the current accumulated target domain t, N threshold is the preset target domain sample quantity threshold.
[0064] In one embodiment, when the model prediction module predicts the photovoltaic power output of a distributed photovoltaic cluster based on a photovoltaic power prediction model, the historical data of the target domain is divided into a validation set and a test set, wherein each set of the validation set and the test set contains input features and corresponding actually observed photovoltaic power output values; the photovoltaic power prediction model is verified using the validation set to obtain a predicted value of the validation set, and the deviation between the predicted value of the validation set and the actually observed photovoltaic power output value in the validation set is calculated to construct a conformal score; according to a predetermined confidence level, the quantile of the conformal score is calculated; the photovoltaic power prediction model is tested using the test set to obtain a point prediction value; and an interval prediction result of the photovoltaic output is constructed based on the obtained point prediction value and the quantile of the residual distribution of the conformal score.
[0065] In one embodiment, the calculation formula of the conformal score is:
[0066] R i =|Y i -Y i ′|
[0067] Where R i is the conformal score of sample i, Y i represents the true value of sample i in the validation set, Y i ′ Represents the predicted value of sample i obtained through the regression model.
[0068] In one embodiment, the calculation formula for the photovoltaic output range is:
[0069] C(x)=[μ(x)-Q 1-α (R,L2),μ(x)+Q 1-α (R,L2)]
[0070] Where x represents the sample input feature vector of the test set, including the time and meteorological variables that affect PV power, C(x) represents the interval prediction result of PV output; μ(x) represents the point prediction result obtained from the test set, α represents the significance level, representing the probability that the prediction interval may not contain the true value, (1-α) represents the confidence level, that is, the probability that the prediction interval contains the true value, and Q 1-α is the (1-α)th quantile of the conformal score R; L2 represents the validation set.
[0071] According to a third aspect of an embodiment of the present invention, a computer device is provided.
[0072] In some embodiments, the computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0073] According to a fourth aspect of embodiments of the present invention, a computer-readable storage medium is provided.
[0074] In one embodiment, the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0075] The technical solution provided by the embodiment of the present invention may have the following beneficial effects:
[0076] This method leverages source domain data to assist target domain prediction tasks, effectively addressing data scarcity in small sample scenarios. This approach uses transfer learning to achieve knowledge transfer and model adaptation. Furthermore, a conformal prediction framework is introduced to provide reliable confidence intervals for prediction results, thereby improving prediction accuracy and reliability. This approach is suitable for scenarios such as the initial commissioning of new photovoltaic power plants, where historical data is scarce or of poor quality, and possesses significant theoretical and practical application value.
[0077] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0078] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0079] Figure 1 is a flow chart of a distributed photovoltaic cluster prediction method according to an exemplary embodiment;
[0080] Figure 2 is a structural block diagram of a distributed photovoltaic cluster prediction system according to an exemplary embodiment;
[0081] Figure 3 is a flowchart illustrating distributed photovoltaic cluster prediction based on transfer learning and conformal prediction according to an exemplary embodiment;
[0082] Figure 4 is a flowchart of constructing a conformal prediction interval for photovoltaic power generation according to an exemplary embodiment;
[0083] Figure 5 is a data preprocessing flowchart according to an exemplary embodiment;
[0084] Figure 6 is a diagram illustrating a transfer learning model architecture according to an exemplary embodiment;
[0085] Figure 7 is a diagram illustrating an MMD loss and dynamic weight adjustment mechanism according to an exemplary embodiment;
[0086] Figure 8 The figure is a schematic diagram showing the structure of a computer device according to an exemplary embodiment. DETAILED DESCRIPTION
[0087] The following description and accompanying drawings sufficiently illustrate the specific embodiments herein to enable those skilled in the art to practice them. Portions and features of some embodiments may be included in or substituted for portions and features of other embodiments. The scope of the embodiments herein includes the entire scope of the claims, including all available equivalents thereof. Herein, the terms "first," "second," and the like are used solely to distinguish one element from another and do not require or imply any actual relationship or order between these elements. In practice, the first element can also be referred to as the second element, and vice versa. Furthermore, the terms "comprise," "comprising," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a structure, device, or apparatus comprising a list of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such structure, device, or apparatus. Without further limitation, an element defined by the phrase "comprising a..." does not preclude the presence of other identical elements in the structure, device, or apparatus comprising the element. The various embodiments herein are described in a progressive manner, with each embodiment focusing on its differences from the other embodiments. Similar or identical parts between the various embodiments can be referenced to each other.
[0088] The terms "longitudinal", "transverse", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside" and the like used herein to indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, are intended only to facilitate the description of this document and simplify the description, and are not intended to indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be construed as a limitation on the present invention. In the description herein, unless otherwise specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, they can be mechanical or electrical connections, or they can be internal connections between two elements, they can be directly connected, or they can be indirectly connected through an intermediate medium. For those of ordinary skill in the art, the specific meanings of the above terms can be understood according to the specific circumstances.
[0089] As used herein, unless otherwise specified, the term "plurality" means two or more.
[0090] In this document, the character " / " indicates that the preceding and following objects are in an "or" relationship. For example, A / B means: A or B.
[0091] In this article, the term "and / or" is used to describe the association relationship between objects, indicating that three relationships can exist. For example, A and / or B means: A or B, or, A and B.
[0092] It should be understood that, although the various steps in the flowchart are shown in sequence as indicated by the arrows, these steps are not necessarily performed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps may be performed in other orders. Moreover, at least a portion of the steps in the figure may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily performed at the same time, but may be performed at different times. The execution order of these sub-steps or stages is not necessarily to be performed in sequence, but may be performed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0093] Each module in the device or system of the present application can be implemented in whole or in part by software, hardware, or a combination thereof. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software so that the processor can call and execute the operations corresponding to the above modules.
[0094] In the absence of conflict, the embodiments of the present invention and the features thereof may be combined with each other.
[0095] Figure 1An embodiment of a distributed photovoltaic cluster prediction method of the present invention is shown.
[0096] In this optional embodiment, the distributed photovoltaic cluster prediction method includes:
[0097] Step S101, respectively obtaining photovoltaic data of a source domain and a target domain in a distributed photovoltaic cluster, and constructing a source domain dataset and a target domain dataset;
[0098] Step S102: constructing a transfer learning model based on the source domain dataset and a transfer learning strategy, and fine-tuning the transfer learning model using the target domain dataset to construct a photovoltaic power prediction model;
[0099] Step S103: predicting the photovoltaic power output of the distributed photovoltaic cluster based on the photovoltaic power prediction model.
[0100] Figure 2 An embodiment of a distributed photovoltaic cluster prediction system of the present invention is shown.
[0101] In this optional embodiment, the distributed photovoltaic cluster prediction system includes:
[0102] The data acquisition module 201 is used to respectively acquire photovoltaic data of the source domain and the target domain in the distributed photovoltaic cluster, and construct a source domain dataset and a target domain dataset;
[0103] A model building module 202 is configured to build a transfer learning model based on the source domain dataset and a transfer learning strategy, and to fine-tune the transfer learning model using the target domain dataset to build a photovoltaic power prediction model.
[0104] The model prediction module 203 is used to predict the photovoltaic power output of the distributed photovoltaic cluster based on the photovoltaic power prediction model.
[0105] In the above embodiment, the source domain refers to the source-load cluster within the distributed photovoltaic cluster for which historical operating data already exists; the target domain refers to a newly built source-load cluster or one for which data is insufficient. When constructing the source and target domain datasets, a multidimensional feature analysis method is used based on the photovoltaic data from the source and target domains to calculate the similarity between the source and target domain stations. The photovoltaic data from the station with the highest similarity is then selected to construct the source and target domain datasets. The multidimensional features include geographic location, installed capacity, operating characteristics, equipment parameter characteristics, and environmental factor characteristics.
[0106] Specifically, the similarity calculation comprehensively considers multiple key dimensions, including geographical location (including latitude and longitude information and geographical environment characteristics), installed capacity (considering the total installed capacity and single unit capacity distribution), operating characteristics (including historical power generation characteristics, efficiency curves, etc.), equipment parameters (such as photovoltaic module type, installation method, etc.), and environmental factors (such as climate conditions, topography, etc.). By designing a reasonable weight system, the similarity of each dimension is weighted and integrated, and finally the K source domain stations with the highest similarity are selected to construct the source domain dataset D S and the target domain dataset D t . This multi-dimensional similarity evaluation method ensures that the selected source domain stations have the greatest correlation with the target stations, laying a good foundation for subsequent knowledge transfer. In addition, in the above embodiment, before constructing the transfer learning model, the source domain dataset and the target domain dataset are preprocessed. Specifically, resampling is first performed, and the data with different time resolutions are unified to a 15-minute sampling interval by a linear interpolation method to ensure the temporal consistency of the data. The second is the noise filtering link, which uses the moving average method to remove random fluctuations and outliers in the data to improve data quality. For the processing of missing data, the present invention adopts different strategies according to the length of the missing data: short-term missing data (usually less than 6 sampling points) are supplemented by linear interpolation, while long-term missing data are filled based on historical similar day data, wherein the selection of historical similar days comprehensively considers multiple factors such as weather conditions, seasonal characteristics and date types. Finally, the Min-Max normalization method is used to map each feature data to the [0,1] interval to complete data standardization, where the normalization formula is: Among them, xnorm represents the normalized eigenvalue, x represents the original eigenvalue, xmin represents the minimum value of the feature, and xmax represents the maximum value of the feature.
[0107] This systematic data preprocessing process not only ensures the quality and consistency of the data, but also provides a reliable data foundation for subsequent model training and prediction.
[0108] In addition, in the above embodiment, when constructing a transfer learning model based on the source domain dataset and the transfer learning strategy, a source domain input feature vector is constructed according to the source domain dataset, and an input sequence is formed based on the source domain input feature vector; the input sequence is subjected to limited projection and position encoding to obtain encoding features, and the encoding features are input into a multi-layer Transformer encoder based on a multi-head attention mechanism for transfer learning training to obtain a transfer learning model.
[0109] Specifically, construct the source domain dataset D S Input feature vector: X = [x pv ,x load ,xmet ,x time ], where x pv is the distributed photovoltaic output data; x load is the user load data; x met is meteorological data (temperature, light intensity, etc.); x time It is a time feature (timestamp, date type, etc.).
[0110] First, the input sequence is linearly projected and positionally encoded:
[0111] h embed =W e ·X+PE(X)
[0112] Where h embed represents the encoded features, W e is a linear projection matrix used to map the original features to the model latent space, X represents the input feature vector, and PE is a position encoding function used to add position information to each position in the sequence.
[0113] PE (pos,2i) =sin(pos / 10000 2i / dmodel )
[0114] PE (pos,2i+1) =cos(pos / 10000 2i / dmodel )
[0115] In the formula, pos represents the position index in the sequence, i represents the index of the encoding dimension, and PE (pos,2i) Indicates the encoding value of position pos on dimension 2i, PE (pos,2i+1) Indicates the encoding value of position pos in dimension 2i+1, d model Represents the hidden layer dimension of the model. This encoding method can provide unique location information for different locations.
[0116] The encoded features are then input into the multi-layer Transformer encoder:
[0117] h l =MultiHead(LayerNorm(h l-1 ))+h l-1
[0118] h l =FFN(LayerNorm(h l ))+h l
[0119] Where h lRepresents the output features of the l-th layer Transformer encoder, LayerNorm represents the layer normalization operation, which is used to stabilize network training, MultiHead is a multi-head self-attention mechanism used to capture the dependencies between different positions in the sequence, and FFN represents a feedforward neural network, which is used to perform nonlinear transformations on features.
[0120] MultiHead(Q,K,V)=Concat(head1,…,head h )W O
[0121]
[0122] Where Q, K, and V represent query, key, and value matrices, respectively, and are all obtained by linear transformation of input features. Denote the linear projection parameter matrices of the query, key, and value corresponding to the i-th attention head, W O Represents the output projection matrix of multi-head attention, head i represents the output of the i-th attention head, QK T Indicates the calculation of the correlation or attention score between different positions, d k Indicates the dimension of the key vector, which is used to scale the dot product attention score. Softmax indicates the softmax normalization function. Concat indicates the concatenation operation, which concatenates the outputs of multiple attention heads. Attention(Q,K,V) indicates the basic attention calculation function. MultiHead(Q,K,V) indicates the multi-head attention mechanism. h Represents the hth attention head output, h is the last one, and represents the total number.
[0123] The Transformer uses a self-attention mechanism to simultaneously capture the long-term dependencies of temporal features and the interaction patterns between features. Finally, the Transformer output is converted into a prediction result through a fully connected layer to achieve a pre-trained model for the source domain:
[0124]
[0125] Where, represents the predicted output of the model, L is the number of Transformer encoder layers; h is the number of attention heads; W1 represents the weight matrix of the first fully connected layer, which is used to map the output of the Transformer encoder to the hidden layer; W2 represents the weight matrix of the second fully connected layer, which is used to map the output of the hidden layer to the final prediction result; b1 represents the bias parameter of the first fully connected layer; b2 represents the bias parameter of the second fully connected layer; ReLU represents the ReLU activation function, which is used to introduce nonlinear characteristics.
[0126] In addition, in the above embodiment, when the transfer learning model is fine-tuned using the target domain dataset to construct a photovoltaic power prediction model, the feature extraction layer of the transfer learning model is frozen, and the target domain dataset is used to fine-tune the transfer learning model using the maximum mean difference loss function and the dynamic weight function to construct a photovoltaic power prediction model.
[0127] Specifically, a small amount of photovoltaic data in the target domain is used to fine-tune the model, and the maximum mean difference (MMD) loss is introduced to reduce the feature distribution difference between the source and target domains, thereby promoting effective knowledge transfer.
[0128] The mathematical expression of the MMD loss function is:
[0129]
[0130] Where MMD(s,t) represents the difference measure of the feature distribution between the source domain s and the target domain t. It is used to quantify the distance between the two data distributions. The smaller the value, the more similar the two distributions are. φ(·) represents the feature mapping function. and Represent samples of the source domain and target domain respectively; n s and n t Represent the number of samples in the source domain and the target domain respectively, represents the reproducing kernel Hilbert space; i represents the index of the source domain data sample, ranging from 1 to ns, where ns is the total number of source domain samples; j represents the index of the target domain data sample, ranging from 1 to nt, where nt is the total number of target domain samples.
[0131] By minimizing the MMD loss, we can effectively reduce the difference in feature distribution between the source and target domains, promoting effective knowledge transfer. The fine-tuning process adopts a progressive training strategy. As target domain data accumulates, the training weight of the target domain data is gradually increased through a dynamic weight adjustment mechanism, which correspondingly reduces the reliance on source domain knowledge and achieves smooth model adaptation.
[0132] The dynamic weight function is:
[0133]
[0134] Where w t is the data weight of the target domain t. This dynamic weight function refers to the weight coefficient of the target domain data during the training process. It is a weight value that is dynamically adjusted as the number of target domain samples increases. Its core function is to gradually adjust the importance ratio of source domain knowledge and target domain data in model training as the target domain data accumulates. It is a progressive training strategy. tIndicates the number of samples of the current accumulated target domain t, N threshold is the preset target domain sample quantity threshold.
[0135] Correspondingly, the weight of the source domain data is 1-w t . In this way, the overall loss function of the training process can be expressed as: in, represents the overall loss function, and Represent the prediction losses of the source domain and the target domain respectively, λ is the weight coefficient of the MMD loss, represents the maximum mean difference loss, which is used to measure the difference between the feature distributions of the source domain and the target domain.
[0136] This dynamic weight adjustment mechanism allows the model to initially rely primarily on source domain knowledge. As target domain data increases, the influence of target domain data gradually increases, ultimately achieving smooth adaptation of the model to the target domain and ensuring steady improvement in predictive performance. This progressive training strategy not only fully utilizes existing knowledge but also ensures the smoothness and reliability of the model adaptation process.
[0137] In addition, in the above embodiment, when predicting the photovoltaic power output of a distributed photovoltaic cluster based on a photovoltaic power prediction model, the historical data of the target domain is divided into a validation set and a test set, wherein each set of the validation set and the test set contains input features and corresponding actually observed photovoltaic power output values; the photovoltaic power prediction model is verified using the validation set to obtain a predicted value of the validation set, and the deviation between the predicted value of the validation set and the actually observed photovoltaic power output value in the validation set is calculated to construct a conformal score; according to a predetermined confidence level, the quantile of the conformal score is calculated; the photovoltaic power prediction model is tested using the test set to obtain a point prediction value; and based on the obtained point prediction value and the quantile of the residual distribution of the conformal score, an interval prediction result of the photovoltaic output is constructed.
[0138] Specifically, a conformal prediction framework is introduced in the target domain, and the dataset is divided into a training set L1, a validation set L2, and a test set L3. First, the training set L1 is used to fit the regression model to learn the mapping relationship between photovoltaic power and input variables such as time characteristics and meteorological factors. The validation set L2 is then used to verify the training effect of the current network. The conformal score is constructed by calculating the deviation between the predicted value and the true value to quantify the uncertainty of the prediction result. The formula for calculating the conformal score is:
[0139] R i =|Y i -Y i ′|
[0140] Where Ri is the conformal score of sample i, Y i represents the true value of sample i in the validation set, Y i ′ represents the predicted value of sample i obtained by the regression model. In this way, the reliability of the model prediction can be effectively evaluated, providing a basis for the subsequent construction of the prediction interval.
[0141] Based on the conformal prediction framework, the present invention uses the validation set to calculate the residual distribution characteristics of the model prediction; then, according to the given confidence level α, the quantile of the residual distribution is calculated to construct the interval prediction result of photovoltaic output. The mathematical expression of interval prediction is:
[0142] C(x)=[μ(x)-Q 1-α (R,L2),μ(x)+Q 1-α (R,L2)]
[0143] Where x represents the sample input feature vector of the test set, including the time and meteorological variables that affect PV power, C(x) represents the interval prediction result of PV output; μ(x) represents the point prediction result obtained from the test set, α represents the significance level, representing the probability that the prediction interval may not contain the true value, (1-α) represents the confidence level, that is, the probability that the prediction interval contains the true value, and Q 1-α is the (1-α)th quantile of the conformal score R; L2 represents the validation set. In this way, we can provide a theoretically guaranteed confidence interval for the prediction results based on the point prediction, making the prediction results more reliable and practical.
[0144] In the above technical solution of the present invention, the data acquisition and preparation stage first needs to collect various types of original data from the source domain and the target domain, including distributed photovoltaic power generation data, user load data, meteorological data (temperature, light intensity, cloud cover, etc.) and time characteristic information (timestamp, seasonal characteristics, date type, etc.), and perform preliminary quality checks on all collected data to ensure the integrity and validity of the data.
[0145] The data preprocessing stage adopts a systematic processing flow. First, the linear interpolation method is used to resample the data to 15-minute intervals to unify the time resolution. Then, the moving average method is used to filter out noise and process outliers. Then, missing data is supplemented based on linear interpolation or historical similar day methods. Finally, the Min-Max normalization method is used to standardize all data to the [0,1] interval, providing a high-quality data foundation for subsequent model training.
[0146] The source domain model pre-training stage mainly involves building a Transformer-based deep learning model architecture, using the pre-processed source domain dataset for model pre-training, and optimizing the model parameters to enable it to effectively capture the complex relationship between the timing characteristics of photovoltaic power generation and various influencing factors.
[0147] In the transfer learning and model fine-tuning phase, the feature extraction layer of the pre-trained model is first frozen, and then the maximum mean difference (MMD) loss function is introduced to reduce the feature distribution difference between the source domain and the target domain. At the same time, a dynamic weight adjustment mechanism is used to fine-tune the model on the target domain, and the model performance is continuously evaluated through the validation set to ensure the effectiveness of transfer learning.
[0148] In the dataset partitioning and conformal prediction preparation phase, the target domain data is scientifically divided into a training set (L1), a validation set (L2), and a test set (L3). The training set is used to further optimize the fine-tuned model, and the non-conformity measure is calculated based on the validation set to prepare for the subsequent construction of the prediction interval.
[0149] In the prediction interval construction phase, the absolute error between the model prediction value and the true value on the validation set is first calculated as the conformal score. Then, the empirical distribution quantile of the conformal score is calculated based on the given confidence level α, and it is combined with the point prediction result to construct a prediction interval with theoretical guarantee. Finally, the validity and reliability of the prediction interval are verified on the test set.
[0150] In summary, the combination of conformal prediction and transfer learning fully leverages the advantages of transfer learning in small sample scenarios. Even when target domain data is limited, it can achieve good prediction results by transferring source domain knowledge. Conformal prediction also provides reliable prediction intervals and quantifies prediction uncertainty. This combination not only solves the problem of insufficient data for newly built photovoltaic power plants, but also provides more reliable decision support for grid dispatch, enhancing the credibility and practical value of prediction results.
[0151] Figure 8 An embodiment of a computer device of the present invention is shown. The computer device may be a server, comprising a processor, a memory, and a network interface connected via a system bus. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the computer device is configured to store static and dynamic information data. The network interface of the computer device is configured to communicate with an external terminal via a network connection. When the computer program is executed by the processor, the steps of the above-described method embodiment are implemented.
[0152] Those skilled in the art will understand that Figure 8 The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present invention and does not constitute a limitation on the computer device to which the solution of the present invention is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0153] In addition, the present invention also provides a computer device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiment when executing the computer program.
[0154] In addition, the present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method embodiment are implemented.
[0155] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0156] The present invention is not limited to the structures described above and shown in the drawings, and various modifications and changes can be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. A distributed photovoltaic cluster prediction method, characterized in that: include: The photovoltaic data of the source domain and target domain in the distributed photovoltaic cluster are obtained respectively, and the source domain dataset and the target domain dataset are constructed; According to the source domain dataset, a transfer learning model is constructed based on a transfer learning strategy, and the transfer learning model is fine-tuned using the target domain dataset to construct a photovoltaic power prediction model; Based on the photovoltaic power prediction model, the photovoltaic power output of the distributed photovoltaic cluster is predicted.
2. The distributed photovoltaic cluster prediction method according to claim 1, characterized in that: Building source domain datasets and target domain datasets includes: Based on the photovoltaic data of the source domain and the target domain, the multi-dimensional feature analysis method is used to calculate the similarity between the source domain stations and the target domain stations, and the photovoltaic data of the station with the highest similarity are selected to construct the source domain dataset and the target domain dataset.
3. The distributed photovoltaic cluster prediction method according to claim 2, characterized in that: Multi-dimensional features include: geographical location features, installed capacity features, operating characteristics features, equipment parameter features and environmental factor features.
4. The distributed photovoltaic cluster prediction method according to claim 1, characterized in that: Also includes: Before building the transfer learning model, data preprocessing is performed on the source domain dataset and the target domain dataset.
5. The distributed photovoltaic cluster prediction method according to claim 4, characterized in that: Performing data preprocessing on the source domain dataset and the target domain dataset includes: Linear interpolation is used on the source domain dataset and the target domain dataset respectively to unify the data with different time resolutions into a predetermined time sampling interval to obtain resampled data; The moving average method is used to remove random fluctuations and outliers in the resampled data; and the missing data in the resampled data are supplemented; The processed resampled data were normalized using the Min-Max normalization method.
6. The distributed photovoltaic cluster prediction method according to claim 5, characterized in that: The missing data in the resampled data are supplemented by: For short-term missing data, linear interpolation is used to supplement it. For long-term missing data, it is filled based on historical similar day data, where the historical similar days are determined based on weather conditions, seasonal characteristics and date types.
7. The distributed photovoltaic cluster prediction method according to claim 1, characterized in that: Based on the source domain dataset and the transfer learning strategy, building a transfer learning model includes: constructing a source domain input feature vector according to the source domain data set, and forming an input sequence based on the source domain input feature vector; Performing restricted projection and position encoding on the input sequence to obtain encoding features; The encoded features are input into a multi-layer Transformer encoder based on a multi-head attention mechanism for transfer learning training, and the output of the Transformer encoder is converted into a prediction result through a fully connected layer to obtain a transfer learning model.
8. The distributed photovoltaic cluster prediction method according to claim 1, characterized in that: Fine-tuning the transfer learning model using the target domain dataset to construct a photovoltaic power prediction model includes: The feature extraction layer of the transfer learning model is frozen, and the target domain dataset is used to fine-tune the transfer learning model using a maximum mean difference loss function and a dynamic weight function to construct a photovoltaic power prediction model.
9. The distributed photovoltaic cluster prediction method according to claim 8, characterized in that: The formula of the maximum mean difference loss function is: Where MMD(s,t) represents the difference measure of feature distribution between source domain s and target domain t; φ(·) represents the feature mapping function, and Represent samples of the source domain and target domain respectively; n s and n t Represent the number of samples in the source domain and the target domain respectively, represents the reproducing kernel Hilbert space; i represents the index of the source domain data sample, ranging from 1 to ns, where ns is the total number of source domain samples; j represents the index of the target domain data sample, ranging from 1 to nt, where nt is the total number of target domain samples.
10. The distributed photovoltaic cluster prediction method according to claim 8, characterized in that: The formula of the dynamic weight function is: Where w t is the data weight of the target domain t; n t Indicates the number of samples of the current accumulated target domain t, N threshold is the preset target domain sample quantity threshold.
11. The distributed photovoltaic cluster prediction method according to claim 1, characterized in that: Based on the photovoltaic power prediction model, the photovoltaic power output of the distributed photovoltaic cluster is predicted, including: Dividing the historical data of the target domain into a validation set and a test set, wherein each set of the validation set and the test set includes input features and corresponding actually observed photovoltaic power output values; The photovoltaic power prediction model is verified using a validation set to obtain a predicted value of the validation set, and a deviation between the predicted value of the validation set and the actually observed photovoltaic power output value in the validation set is calculated to construct a conformal score; Calculating a quantile of the conformal score according to a predetermined confidence level; testing the photovoltaic power prediction model using a test set to obtain a point prediction value; Based on the obtained point prediction value and the quantile of the residual distribution of the conformal score, the interval prediction result of the photovoltaic output is constructed.
12. The distributed photovoltaic cluster prediction method according to claim 11, characterized in that: The calculation formula of the conformal score is: Where R i is the conformal score of sample i, Y i represents the true value of sample i in the validation set, Y i ′ represents the predicted value of sample i obtained through the regression model.
13. The distributed photovoltaic cluster prediction method according to claim 11, characterized in that: The calculation formula for the photovoltaic output range is: C(x)=[μ(x)-Q 1-α (R,L2),μ(x)+Q 1-α (R,L2)] Where x represents the sample input feature vector of the test set, including the time and meteorological variables that affect PV power, C(x) represents the interval prediction result of PV output; μ(x) represents the point prediction result obtained from the test set, α represents the significance level, representing the probability that the prediction interval may not contain the true value, (1-α) represents the confidence level, that is, the probability that the prediction interval contains the true value, and Q 1-α is the (1-α)th quantile of the conformal score R; L2 represents the validation set.
14. A distributed photovoltaic cluster prediction system, characterized in that: include: The data acquisition module is used to obtain photovoltaic data of the source domain and target domain in the distributed photovoltaic cluster, and construct the source domain dataset and the target domain dataset; A model building module is used to build a transfer learning model based on the source domain dataset and a transfer learning strategy, and to fine-tune the transfer learning model using the target domain dataset to build a photovoltaic power prediction model; The model prediction module is used to predict the photovoltaic power output of the distributed photovoltaic cluster based on the photovoltaic power prediction model.
15. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 13 are implemented.
16. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 13 are implemented.
Citation Information
Cited By
BERT and transfer learning-based CO2 storage prediction method
CN121601099A
A photovoltaic power conformal prediction method, device, equipment, medium and product
CN122456982A