Photovoltaic power prediction method and device, electronic equipment, storage medium and chip
By acquiring and processing historical photovoltaic power data and using LSTM model for prediction, the power system scheduling and stability challenges after distributed photovoltaic power generation equipment is solved, and high-precision photovoltaic power prediction is achieved, supporting grid balance and scheduling.
Patent Information
- Application Number
- CN202510008825.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-03
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2045-01-03
AI Technical Summary
After large-scale distributed photovoltaic power generation equipment is connected to the power grid, it faces severe challenges such as reasonable scheduling of the power system, safe and stable operation and power quality, mainly because photovoltaic power generation is random, intermittent and volatile, making it difficult to achieve high-precision short-term power prediction.
By obtaining the photovoltaic power truth values of multiple historical moments, extracting time characteristics, and inputting these data into the pre-trained long-term memory network (LSTM) model, and making predictions to obtain the photovoltaic power prediction values and change trend prediction values at the predicted moment.
High-precision prediction of photovoltaic power data in various environments is realized. By integrating data characteristics and improved prediction models, the accuracy of photovoltaic power prediction is improved, and the auxiliary power grid is able to achieve power balance and reasonable planning and scheduling.
Smart Images

Figure CN119944637A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of photovoltaic power generation technology, and in particular to a photovoltaic power prediction method, device, electronic device, storage medium, and chip. Background Art
[0002] With the access of large-scale distributed photovoltaic power generation equipment, the current power system is undergoing disruptive changes in the fields of generation, transmission, distribution and use. Specifically in the field of power distribution, distributed power sources mainly based on the development of photovoltaic power on the roofs of the entire county will grow explosively. The access of large-scale distributed photovoltaic power generation equipment to the power grid, while meeting the needs of areas with relatively short power supply, also brings many adverse effects to the operation of the power system. Due to the randomness, intermittency and volatility of photovoltaic power generation, the large-scale access of distributed photovoltaic power generation equipment poses severe challenges to the reasonable scheduling, safe and stable operation and power quality of the power system. Therefore, in order to reduce the adverse effects of the access of distributed photovoltaic equipment on the power system and assist the power grid to achieve power balance and reasonable planning and scheduling, there is an urgent need for a solution that can perform high-precision short-term prediction of power generation. Summary of the invention
[0003] In order to solve the problems in the related art, the embodiments of the present disclosure provide a photovoltaic power prediction method, device, electronic device, storage medium, and chip.
[0004] In a first aspect, an embodiment of the present disclosure provides a photovoltaic power prediction method, comprising:
[0005] Obtain the true value of photovoltaic power at multiple historical moments before the prediction moment;
[0006] Extracting the time characteristics corresponding to the photovoltaic power true values from the photovoltaic power true values at the plurality of historical moments;
[0007] The photovoltaic power true values at the multiple historical moments and their corresponding time characteristics are input into a pre-trained prediction model, and the prediction model is executed to obtain the photovoltaic power prediction value and the change trend prediction value at the prediction moment output by the prediction model.
[0008] In a possible implementation, the obtaining of the photovoltaic power true values at multiple historical moments before the prediction moment includes: if a true value is missing when obtaining the photovoltaic power true values at multiple historical moments before the prediction moment, determining a missing moment at which the photovoltaic power true value is missing;
[0009] The photovoltaic power true value at the missing moment is filled in based on the photovoltaic power true value at the sampling moment before the missing moment.
[0010] In a possible implementation manner, filling the photovoltaic power true value at the missing moment based on the photovoltaic power true value at the sampling moment before the missing moment includes:
[0011] Obtaining the photovoltaic power true value at k consecutive sampling moments before the missing moment;
[0012] Obtaining the true value of photovoltaic power at each sampling time in multiple days before the missing time;
[0013] From the photovoltaic power true values at each sampling time of each day in multiple days before the missing time, obtain the photovoltaic power true values at k consecutive sampling times that are most similar to the photovoltaic power true values at k consecutive sampling times before the missing time;
[0014] Determine the photovoltaic power true value at the first sampling moment after the photovoltaic power true values at the most similar k consecutive sampling moments as the photovoltaic power true value at the missing moment;
[0015] Wherein, k is a positive integer.
[0016] In a possible implementation manner, extracting the time characteristics corresponding to the photovoltaic power true values from the photovoltaic power true values at the plurality of historical moments includes:
[0017] Based on m historical moments, the first time feature T corresponding to the photovoltaic power true value is obtained according to the following formula: cos and the second time characteristic T sin :
[0018]
[0019] in, is the hour value of the mth historical moment, It is the minute value of the mth historical moment. The hour value adopts the 24-hour system. The m is a positive integer.
[0020] In a possible implementation, the method further includes:
[0021] Acquire multiple training samples, where the input variables in each training sample include the photovoltaic power true values at multiple sample moments and their corresponding time features, and the label data in each training sample include the photovoltaic power true value and the change trend true value at the next moment of the multiple sample moments;
[0022] The prediction model is trained using the multiple training samples.
[0023] In a possible implementation, the prediction model includes a long short-term memory network LSTM model, and the loss function L of the prediction model is:
[0024]
[0025] Where N is the total number of training samples, Y[i][0] is the true value of the PV power in the i-th training sample, Y[i][1] is the true value of the change trend in the i-th training sample, y[i][0] is the predicted value of the PV power corresponding to the i-th training sample, and y[i][1] is the predicted value of the change trend corresponding to the i-th training sample.
[0026] In a second aspect, an embodiment of the present disclosure provides a method for training a prediction model, the training method comprising:
[0027] Acquire multiple training samples, where the input variables in each training sample include the photovoltaic power true values at multiple sample moments and their corresponding time features, and the label data in each training sample include the photovoltaic power true value and the change trend true value at the next moment of the multiple sample moments;
[0028] The prediction model is trained using the multiple training samples.
[0029] In a possible implementation, the obtaining a plurality of training samples includes:
[0030] Get the photovoltaic power true value p1, p2, ····p at n sample moments n ;
[0031] Based on the photovoltaic power true values p1, p2, . . . p at the n sample moments n , get the photovoltaic power variable P of group nm train and its corresponding nm group label data Y label :
[0032] P train =[[p1,…,p m ],[p2,…,p m+1 ]…,[p n-m ,…,p n-1 ]];
[0033]
[0034] Based on the n sample moments, the nm group of photovoltaic power variables P are obtained according to the following formula: train The corresponding nm group first time characteristics and the second time characteristic
[0035]
[0036] in, is the hour value at the mth sample moment, is the minute value of the mth sample moment, and the hour value adopts the 24-hour system;
[0037] A set of photovoltaic power variables and their corresponding set of first time features, a set of second time features and a set of label data are obtained as a training sample;
[0038] Both m and n are positive integers.
[0039] In a possible implementation manner, obtaining the photovoltaic power true value at n sample moments includes:
[0040] If the true value is missing when obtaining the true value of the photovoltaic power at n sample moments, the sample missing moment at which the true value of the photovoltaic power is missing is determined;
[0041] The photovoltaic power true value at the sample missing moment is filled in based on the photovoltaic power true value at the sampling moment before the sample missing moment.
[0042] In a possible implementation manner, filling the photovoltaic power true value at the sample missing time based on the photovoltaic power true value at the sampling time before the sample missing time includes:
[0043] Obtaining the photovoltaic power true value at s consecutive sampling moments before the sample missing moment;
[0044] Obtaining the true value of photovoltaic power at each sampling time in multiple days before the sample missing time;
[0045] From the photovoltaic power true values at each sampling moment of each day in the multiple days before the sample missing moment, obtain the photovoltaic power true values at the s consecutive sampling moments that are most similar to the photovoltaic power true values at the s consecutive sampling moments before the sample missing moment; determine the photovoltaic power true value at the first sampling moment after the photovoltaic power true values at the s most similar consecutive sampling moments as the photovoltaic power true value at the sample missing moment;
[0046] Wherein, the s is a positive integer.
[0047] In a possible implementation, the prediction model includes a long short-term memory network LSTM model, and the loss function L of the prediction model is:
[0048]
[0049] Where N is the total number of training samples, Y[i][0] is the true value of the PV power in the i-th training sample, Y[i][1] is the true value of the change trend in the i-th training sample, y[i][0] is the predicted value of the PV power corresponding to the i-th training sample, and y[i][1] is the predicted value of the change trend corresponding to the i-th training sample.
[0050] In a third aspect, an embodiment of the present disclosure provides a photovoltaic power prediction device, comprising:
[0051] A true value acquisition module is configured to acquire the true value of photovoltaic power at multiple historical moments before the prediction moment;
[0052] A feature extraction module is configured to extract a time feature corresponding to the photovoltaic power true value from the photovoltaic power true values at the plurality of historical moments;
[0053] The prediction module is configured to input the photovoltaic power true values and their corresponding time characteristics at the multiple historical moments into a pre-trained prediction model, execute the prediction model, and obtain the photovoltaic power prediction value and change trend prediction value at the prediction moment output by the prediction model.
[0054] In a possible implementation, the truth value acquisition module is configured as follows:
[0055] If the true value is missing when obtaining the true value of the photovoltaic power at multiple historical moments before the prediction moment, the missing moment at which the true value of the photovoltaic power is missing is determined;
[0056] The photovoltaic power true value at the missing moment is filled in based on the photovoltaic power true value at the sampling moment before the missing moment.
[0057] In a possible implementation manner, the part of the true value acquisition module that fills in the photovoltaic power true value at the missing moment based on the photovoltaic power true value at the sampling moment before the missing moment is configured as follows:
[0058] Obtaining the photovoltaic power true value at k consecutive sampling moments before the missing moment;
[0059] Obtaining the true value of photovoltaic power at each sampling time in multiple days before the missing time;
[0060] From the photovoltaic power true values at each sampling time of each day in multiple days before the missing time, obtain the photovoltaic power true values at k consecutive sampling times that are most similar to the photovoltaic power true values at k consecutive sampling times before the missing time;
[0061] Determine the photovoltaic power true value at the first sampling moment after the photovoltaic power true values at the most similar k consecutive sampling moments as the photovoltaic power true value at the missing moment;
[0062] Wherein, k is a positive integer.
[0063] In a possible implementation, the feature extraction module is configured as follows:
[0064] Based on m historical moments, the first time feature T corresponding to the photovoltaic power true value is obtained according to the following formula: cos and the second time characteristic T sin :
[0065]
[0066] in, is the hour value of the mth historical moment, It is the minute value of the mth historical moment. The hour value adopts the 24-hour system. The m is a positive integer.
[0067] In a possible implementation, the device further includes:
[0068] The model training module is configured to obtain multiple training samples, wherein the input variables in each training sample include the true value of photovoltaic power at multiple sample moments and its corresponding time characteristics, and the label data includes the true value of photovoltaic power at the next moment of the multiple sample moments and the true value of the change trend; the prediction model is trained using the training samples.
[0069] In a possible implementation, the prediction model includes a long short-term memory network LSTM model, and the loss function L of the prediction model is:
[0070]
[0071] Where N is the total number of training samples, Y[i][0] is the true value of the PV power in the i-th training sample, Y[i][1] is the true value of the change trend in the i-th training sample, y[i][0] is the predicted value of the PV power corresponding to the i-th training sample, and y[i][1] is the predicted value of the change trend corresponding to the i-th training sample.
[0072] In a fourth aspect, an embodiment of the present disclosure provides a training device for a prediction model, the training device comprising:
[0073] A sample acquisition module is configured to acquire a plurality of training samples, wherein the input variables in each training sample include the photovoltaic power true values at a plurality of sample moments and their corresponding time features, and the label data in each training sample include the photovoltaic power true value and the change trend true value at the next moment of the plurality of sample moments;
[0074] The training module is configured to use the multiple training samples to train and obtain the prediction model.
[0075] In a possible implementation, the sample acquisition module is configured as follows:
[0076] Get the photovoltaic power true value p1, p2, ····p at n sample momentsn ;
[0077] Based on the photovoltaic power true values p1, p2, . . . p at the n sample moments n , get the photovoltaic power variable P of group nm train and its corresponding nm group label data Y label :
[0078] P train =[[p1,…,p m ],[p2,…,p m+1 ]…,[p n-m ,…,p n-1 ]];
[0079]
[0080] Based on the n sample moments, the nm group of photovoltaic power variables P are obtained according to the following formula: train The corresponding nm group first time characteristics and the second time characteristic
[0081]
[0082] in, is the hour value at the mth sample moment, is the minute value of the mth sample moment, and the hour value adopts the 24-hour system;
[0083] A set of photovoltaic power variables and their corresponding set of first time features, a set of second time features and a set of label data are obtained as a training sample;
[0084] Both m and n are positive integers.
[0085] In a possible implementation manner, the part of the sample acquisition module that acquires the photovoltaic power true value at n sample moments is configured as follows:
[0086] If the true value is missing when obtaining the true value of the photovoltaic power at n sample moments, the sample missing moment at which the true value of the photovoltaic power is missing is determined;
[0087] The photovoltaic power true value at the sample missing moment is filled in based on the photovoltaic power true value at the sampling moment before the sample missing moment.
[0088] In a possible implementation manner, the part of the sample acquisition module that fills the photovoltaic power true value at the sample missing moment based on the photovoltaic power true value at the sampling moment before the sample missing moment is configured as follows:
[0089] Obtaining the photovoltaic power true value at s consecutive sampling moments before the sample missing moment;
[0090] Obtaining the true value of photovoltaic power at each sampling time in multiple days before the sample missing time;
[0091] From the photovoltaic power true values at each sampling moment of each day in the multiple days before the sample missing moment, obtain the photovoltaic power true values at the s consecutive sampling moments that are most similar to the photovoltaic power true values at the s consecutive sampling moments before the sample missing moment; determine the photovoltaic power true value at the first sampling moment after the photovoltaic power true values at the s most similar consecutive sampling moments as the photovoltaic power true value at the sample missing moment;
[0092] Wherein, the s is a positive integer.
[0093] In a possible implementation, the prediction model includes a long short-term memory network LSTM model, and the loss function L of the prediction model is:
[0094]
[0095] Where N is the total number of training samples, Y[i][0] is the true value of the PV power in the i-th training sample, Y[i][1] is the true value of the change trend in the i-th training sample, y[i][0] is the predicted value of the PV power corresponding to the i-th training sample, and y[i][1] is the predicted value of the change trend corresponding to the i-th training sample.
[0096] In a fifth aspect, an embodiment of the present disclosure provides an electronic device, comprising a memory and a processor, wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement the method described in any one of the first aspect or the second aspect.
[0097] In a sixth aspect, an embodiment of the present disclosure provides a readable storage medium on which computer instructions are stored. When the computer instructions are executed by a processor, the method steps described in any one of the first aspect or the second aspect are implemented.
[0098] In a seventh aspect, a chip is provided in an embodiment of the present disclosure, and the chip includes the device as described in any one of the third aspect or the fourth aspect.
[0099] According to the technical solution provided by the embodiment of the present disclosure, the true values of photovoltaic power at multiple historical moments before the prediction moment can be obtained; based on the true values of photovoltaic power at the multiple historical moments, the photovoltaic power characteristics and time characteristics are obtained; the photovoltaic power characteristics and time characteristics are input into a pre-trained prediction model, and the prediction model is executed to obtain the photovoltaic power prediction value and the change trend prediction value at the prediction moment output by the prediction model, so that the characteristic information of the photovoltaic power data itself is fused with the time characteristic information, and a dual-label prediction model is proposed to realize double loss correction during data training, and the model prediction accuracy of photovoltaic power data in various environments is effectively improved by combining the fused data characteristics with the improved prediction model.
[0100] 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 present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0101] Other features, objectives and advantages of the present disclosure will become more apparent through the following detailed description of non-limiting embodiments in conjunction with the accompanying drawings. In the accompanying drawings:
[0102] Figure 1 A flow chart of a photovoltaic power prediction method according to an embodiment of the present disclosure is shown.
[0103] Figure 2 A flowchart of a method for training a prediction model according to an embodiment of the present disclosure is shown.
[0104] Figure 3 A structural block diagram of a photovoltaic power prediction device according to an embodiment of the present disclosure is shown.
[0105] Figure 4 A structural block diagram of a training device for a prediction model according to an embodiment of the present disclosure is shown.
[0106] Figure 5 A structural block diagram of an electronic device according to an embodiment of the present disclosure is shown.
[0107] Figure 6 A schematic diagram showing the structure of a computer system suitable for implementing the method of the embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0108] Hereinafter, exemplary embodiments of the present disclosure will be described in detail with reference to the accompanying drawings so that those skilled in the art can easily implement them. In addition, for the sake of clarity, parts not related to the description of the exemplary embodiments are omitted in the accompanying drawings.
[0109] In the present disclosure, it should be understood that terms such as "include" or "have" are intended to indicate the presence of features, numbers, steps, behaviors, components, parts, or a combination thereof disclosed in the present specification, and are not intended to exclude the possibility that one or more other features, numbers, steps, behaviors, components, parts, or a combination thereof exist or are added.
[0110] It should also be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present disclosure may be combined with each other. The present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0111] Figure 1 FIG. 1 is a flow chart showing a photovoltaic power prediction method according to an embodiment of the present disclosure. Figure 1 As shown, the photovoltaic power prediction method includes the following steps S101-S103:
[0112] In step S101, the photovoltaic power true value at multiple historical moments before the prediction moment is obtained;
[0113] In step S102, extracting the time characteristics corresponding to the photovoltaic power true values from the photovoltaic power true values at the plurality of historical moments;
[0114] In step S103, the photovoltaic power true values at the multiple historical moments and their corresponding time characteristics are input into a pre-trained prediction model, and the prediction model is executed to obtain the photovoltaic power prediction value and the change trend prediction value at the prediction moment output by the prediction model.
[0115] In a possible implementation, the photovoltaic power prediction method is applicable to various electronic devices that can perform photovoltaic power prediction. In a possible implementation, the prediction moment refers to the moment when photovoltaic power prediction needs to be performed. For example, the prediction moment can be a future moment after the current moment, such as a future moment 20 minutes or half an hour later, etc.; the interval between adjacent historical moments in multiple historical moments before the prediction moment can be tens of minutes.
[0116] In a possible implementation, the photovoltaic power true values at the multiple historical moments may be power values of photovoltaic power generation of a certain photovoltaic power generation site collected by relevant collection equipment at the historical moments.
[0117] In a possible implementation, a time feature may be extracted from the true value of photovoltaic power at multiple historical moments, where the time feature refers to a feature that can reflect the collection moment of the photovoltaic power.
[0118] In a possible implementation, the prediction model can be an improved LSTM (Long Short-Term Memory) network model. The input of the prediction model is the true value of photovoltaic power at multiple historical moments and its corresponding time characteristics. The prediction model has two outputs, namely the photovoltaic power prediction value at the prediction moment and the change trend prediction value. The prediction model is a pre-trained model. Since there are two output labels, double loss correction can be performed on these two output labels during model training to improve the accuracy of model prediction.
[0119] In one possible implementation, when performing photovoltaic power prediction, the photovoltaic power true values at the multiple historical moments and their corresponding time characteristics can be input into a pre-trained prediction model, and the prediction model is executed to obtain two prediction results output by the prediction model, namely, the photovoltaic power prediction value at the prediction moment and the change trend prediction value.
[0120] This implementation method obtains the photovoltaic power true values at multiple historical moments before the prediction moment; obtains photovoltaic power characteristics and time characteristics based on the photovoltaic power true values at the multiple historical moments; inputs the photovoltaic power characteristics and time characteristics into a pre-trained prediction model, executes the prediction model, and obtains the photovoltaic power prediction value and the change trend prediction value at the prediction moment output by the prediction model. In this way, the characteristic information of the photovoltaic power data itself is fused with the time characteristic information, and a dual-label prediction model is proposed to achieve double loss correction during data training. By combining the fused data features with the improved prediction model, the model prediction accuracy of photovoltaic power data in various environments is effectively improved.
[0121] In a possible implementation, the obtaining of the photovoltaic power true values at multiple historical moments before the prediction moment includes: if a true value is missing when obtaining the photovoltaic power true values at multiple historical moments before the prediction moment, determining a missing moment at which the photovoltaic power true value is missing;
[0122] Based on the photovoltaic power true value at the sampling moment before the missing moment, the photovoltaic power true value at the missing moment is filled. In some cases, such as when the collection equipment fails, the photovoltaic power true value at the sampling moment cannot be collected, resulting in data missing problems, especially for distributed photovoltaics. Due to the small capacity of each photovoltaic power generation site, scattered installation, and small investment, high-precision photovoltaic meters are not specially equipped, resulting in serious data missing problems in historical power data. In order to solve the data missing problem, when the photovoltaic power true value at multiple historical moments before the prediction moment is missing, the photovoltaic power true value at the missing moment can be filled based on the photovoltaic power true value at the sampling moment before the missing moment. For example, a curve function of photovoltaic power changing with time can be fitted based on the photovoltaic power true values at multiple sampling moments before the missing moment, and the photovoltaic power true value at the missing moment can be determined based on the curve function, and so on.
[0123] In a possible implementation manner, filling the photovoltaic power true value at the missing moment based on the photovoltaic power true value at the historical moment before the missing moment includes:
[0124] Get the true value of the photovoltaic power at k consecutive sampling moments before the missing moment;
[0125] Obtain the true value of photovoltaic power at each sampling time in multiple days before the missing time;
[0126] From the photovoltaic power true values at each sampling time of each day in multiple days before the missing time, obtain the photovoltaic power true values at k consecutive sampling times that are most similar to the photovoltaic power true values at k consecutive sampling times before the missing time;
[0127] The photovoltaic power true value at the first sampling moment after the photovoltaic power true values at the most similar k consecutive sampling moments is determined as the photovoltaic power true value at the missing moment.
[0128] In this embodiment, assuming that the missing time is 18:10 before the predicted time, when k is 50, the photovoltaic power true value at k=50 consecutive sampling times before the missing time can be recorded as The true value of photovoltaic power at each sampling time within 20 days before the missing time Where d is the number of days before the missing moment, which can be 1, 2, ... 20; t is the t-th sampling moment of each day, which can be 1, 2, ... q, where q is the total number of sampling moments per day. The photovoltaic power true value at the t-th sampling moment on the d-th day before the missing moment. The photovoltaic power true value at k = 50 consecutive sampling moments every day in the 20 days can be traversed. calculate and The similarity between, for example, can be calculated and The Euclidean distance between and The similarity between them; thus, we can find The Euclidean distance between them is the smallest, that is, the photovoltaic power true value at the most similar k = 50 consecutive sampling moments Assume that the most similar k = 50 consecutive sampling moments of the photovoltaic power true value are found The photovoltaic power true value at 50 consecutive sampling times between 7:00 and 15:20 on the second day before the missing time can be obtained as the photovoltaic power true value at the missing time 18:10 at the first sampling time 15:30.
[0129] This embodiment determines the photovoltaic power true value at the first sampling moment after the k consecutive sampling moments that are most similar to the photovoltaic power true values at the k consecutive sampling moments before the missing moment as the photovoltaic power true value at the missing moment, so that the photovoltaic power true value at the missing moment can be filled in more accurately, thereby making the subsequent photovoltaic power prediction more accurate.
[0130] In a possible implementation manner, extracting the time characteristics corresponding to the photovoltaic power true values from the photovoltaic power true values at the multiple historical moments may be implemented as the following steps:
[0131] Based on m historical moments, the first time feature T corresponding to the photovoltaic power true value is obtained according to the following formula: cos and the second time characteristic T sin :
[0132]
[0133] in, is the hour value of the mth historical moment, is the minute value of the mth historical moment, the hour value adopts the 24-hour system, and m is a positive integer. In this embodiment, assuming that the m=20th historical moment is 15:30, then
[0134] The sin and cos coding features corresponding to the true values of photovoltaic power at multiple historical moments extracted by this implementation can accurately reflect the time characteristics of the historical moments, and can effectively reduce the situation where a sudden decrease in photovoltaic power generation on a cloudy day is misjudged as darkness, and the situation where photovoltaic power generation power has glitches at night. In this way, the true values of photovoltaic power at multiple historical moments can be better integrated to perform accurate photovoltaic power prediction.
[0135] In a possible implementation, the method may further include the following steps:
[0136] Acquire multiple training samples, where the input variables in each training sample include the photovoltaic power true values at multiple sample moments and their corresponding time features, and the label data in each training sample include the photovoltaic power true value and the change trend true value at the next moment of the multiple sample moments;
[0137] The prediction model is trained using the training samples.
[0138] In this embodiment, the input variable in the i-th training sample can be recorded as in, Including the true value of photovoltaic power at multiple sample moments in the i-th training sample, Including the time characteristics corresponding to the true value of photovoltaic power at multiple sample moments in the i-th training sample; the label data in the training sample can be recorded as Y label [i],Y label [i]=[Y[i][0],Y[i][1]] wherein Y[i][0] is the photovoltaic power true value at the next moment corresponding to the i-th training sample, and Y[i][1] is the change trend true value of the photovoltaic power true value at the next moment corresponding to the i-th training sample, that is, the change trend true value corresponding to the i-th training sample, which can be set such that when the photovoltaic power true value at the next moment increases, the change trend true value Y[i][1]=0, and when the photovoltaic power true value at the next moment decreases, the change trend true value Y[i][1]_1.
[0139] In this embodiment, the input variable of the i-th training sample can be Input to the prediction model to be trained, and obtain the prediction data y[i]=[y[i][0], y[i][1]] corresponding to the i-th training sample predicted by the prediction model, where y[i][0] is the photovoltaic power prediction value at the next moment corresponding to the i-th training sample, and y[i][1] is the change trend prediction value of the photovoltaic power true value at the next moment corresponding to the i-th training sample; compare the label data Y label [i]=[Y[i][0],Y[i][1]] and the predicted data y[i]=[y[i][0],y[i][1]] of the i-th training sample, in this way, the gap between the label data and the predicted data of all training samples can be obtained, and then the prediction accuracy of the prediction model can be calculated, and the model parameters of the prediction model can be continuously adjusted until the accuracy of the predicted data predicted by the prediction model (the predicted value of photovoltaic power and the predicted value of the change trend at the next moment) reaches the predetermined value, and the trained prediction model can be obtained.
[0140] In a possible implementation, the prediction model includes a long short-term memory network LSTM model, and the loss function L of the prediction model is:
[0141]
[0142] Where N is the total number of training samples, Y[i][0] is the true value of the PV power in the i-th training sample, Y[i][1] is the true value of the change trend in the i-th training sample, y[i][0] is the predicted value of the PV power corresponding to the i-th training sample, and y[i][1] is the predicted value of the change trend corresponding to the i-th training sample.
[0143] In this embodiment, the prediction model may be an LSTM model having m neurons (cells), and the specific structure of the neurons may be a neuron structure in an existing LSTM model, which is well known to those skilled in the art and will not be described in detail here.
[0144] In this embodiment, the input variable of the i-th training sample can be Input to the prediction model to be trained, and obtain the prediction data y[i]=[y[i][0], y[i][1]] corresponding to the i-th training sample predicted by the prediction model, where y[i][0] is the predicted value of the photovoltaic power at the next moment corresponding to the i-th training sample, and y[i][1] is the predicted value of the change trend of the photovoltaic power true value at the next moment corresponding to the i-th training sample; for each training sample, the prediction data corresponding to the training sample can be obtained, and the label data Y of the i-th training sample can be compared. label [i]=[Y[i][0],Y[i][1]], and the predicted data y[i]=[y[i][0],y[i][1] of the i-th training sample, calculate the mean square error between the label data and the predicted data as the loss function L of the prediction model, and continuously adjust the model parameters of the prediction model until the loss function L is minimized, and the trained prediction model can be obtained.
[0145] The present disclosure also provides a training method for the above prediction model, Figure 2 A flow chart of a method for training a prediction model according to an embodiment of the present disclosure is shown as follows: Figure 2 As shown, the method comprises the following steps:
[0146] In step S201, a plurality of training samples are obtained, wherein the input variables in each training sample include the photovoltaic power true values at a plurality of sample moments and their corresponding time characteristics, and the label data in each training sample include the photovoltaic power true value at the next moment of the plurality of sample moments and the change trend true value;
[0147] In step S202, the plurality of training samples are used to train a prediction model.
[0148] In a possible implementation, the prediction model training method is applicable to various electronic devices that can perform prediction model training, which may be the electronic device that performs photovoltaic power prediction as mentioned above, or other electronic devices that train the prediction model and then upload it to the electronic device that performs photovoltaic power prediction for use.
[0149] In a possible implementation, the input variable in the i-th training sample can be written as in, Including the true value of photovoltaic power at multiple sample moments in the i-th training sample, Including the time characteristics corresponding to the true value of photovoltaic power at multiple sample moments in the i-th training sample; the label data in the training sample can be recorded as Y lael [i],Y label [i] = [Y[i][0], Y[i][1]], where Y[i][0] is the photovoltaic power true value at the next moment corresponding to the i-th training sample, and Y[i][1] is the change trend true value of the photovoltaic power true value at the next moment corresponding to the i-th training sample, that is, the change trend true value corresponding to the i-th training sample can be set to when the photovoltaic power true value at the next moment increases, the change trend true value Y[i][1] = 0, and when the photovoltaic power true value at the next moment decreases, the change trend true value Y[i][1] = 1. In a possible implementation, the input variable of the i-th training sample can be Input to the prediction model to be trained, and obtain the prediction data y[i]=[y[i][0], y[i][1]] corresponding to the i-th training sample predicted by the prediction model, where y[i][0] is the photovoltaic power prediction value at the next moment corresponding to the i-th training sample, and y[i][1] is the change trend prediction value of the photovoltaic power true value at the next moment corresponding to the i-th training sample; compare the label data Y label [i]=[Y[i][0],Y[i][1] and the predicted data y[i]=[y[i][0],y[i][1] of the i-th training sample, in this way, the gap between the label data and the predicted data of all training samples can be obtained, and then the prediction accuracy of the prediction model can be calculated, and the model parameters of the prediction model can be continuously adjusted until the accuracy of the predicted data predicted by the prediction model (the predicted value of photovoltaic power and the predicted value of the change trend at the next moment) reaches the predetermined value, and the trained prediction model can be obtained.
[0150] This implementation can fuse the characteristic information of photovoltaic power data itself with the time characteristic information, and propose a dual-label prediction model to achieve double loss correction during data training. By combining the fused data features with the improved prediction model, the trained prediction model can effectively improve the accuracy of photovoltaic power prediction.
[0151] In a possible implementation, the obtaining a plurality of training samples includes:
[0152] Get the photovoltaic power true value p1, p2, ····p at n sample moments n ;
[0153] Based on the photovoltaic power true values p1, p2, . . . p at the n sample moments n , get the photovoltaic power variable P of group nm train and its corresponding nm group label data Y label :
[0154] P train =[[p1,…,p m ],[p2,…,p m+1 ]…,[p n-m ,…,p n-1 ]];
[0155]
[0156] Based on the n sample moments, the nm group of photovoltaic power variables P are obtained according to the following formula: train The corresponding nm group first time characteristics and the second time characteristic
[0157]
[0158] in, is the hour value at the mth sample moment, is the minute value of the mth sample moment, and the hour value adopts the 24-hour system;
[0159] A set of photovoltaic power variables and their corresponding set of first time features, a set of second time features and a set of label data are obtained as a training sample;
[0160] Both m and n are positive integers.
[0161] In this embodiment, based on the photovoltaic power true value at n sample moments, nm groups of photovoltaic power variables P can be obtained. train and its corresponding nm group label data Y label , nm group first time characteristics and the second time characteristic Each set of photovoltaic power variables and its corresponding set of label data, a set of first time features and a set of second time features can form a training sample.
[0162] In this embodiment, the input variable in the i-th training sample In in, That is, the input variable The label data corresponding to the i-th training sample Thus, the i-th training sample is:
[0163]
[0164] In this way, based on the photovoltaic power true values p1, p2, ... p at the n sample moments n , we can get nm training samples. Assuming n=1000 and m=20, we can get nm=980 training samples, where the i=1 training sample is: Assume that the m=20th sample time is 16:50, then
[0165] This implementation method can effectively reduce the situation where a sudden decrease in photovoltaic power generation on cloudy days is misjudged as darkness and the occurrence of glitches in photovoltaic power generation at night by adding sin and cos coding features at the sample time, thereby improving the ability of the network model to cope with data mutations and effectively improving the accuracy of data prediction.
[0166] In a possible implementation manner, obtaining the photovoltaic power true value at n sample moments includes:
[0167] If the true value is missing when obtaining the true value of the photovoltaic power at n sample moments, the sample missing moment at which the true value of the photovoltaic power is missing is determined;
[0168] The photovoltaic power true value at the sample missing moment is filled in based on the photovoltaic power true value at the sampling moment before the sample missing moment.
[0169] In some cases, such as when the collection equipment fails, the photovoltaic power true value at the sampling moment cannot be collected, resulting in data missing problems. In particular, for distributed photovoltaics, due to the small individual capacity, scattered installation, and small investment of photovoltaic power generation sites, there is no special high-precision photovoltaic metering meter, resulting in serious data missing problems in historical power data. In order to solve the problem of missing data, if the photovoltaic power true value at n sample moments is missing, the photovoltaic power true value at the sample missing moment is filled based on the photovoltaic power true value at the sampling moment before the sample missing moment. For example, a curve function of photovoltaic power variation over time can be fitted based on the photovoltaic power true values at multiple sampling moments before the sample missing moment, and the photovoltaic power true value at the sample missing moment is determined based on the curve function, and so on. In a possible implementation, the photovoltaic power true value at the sample missing moment is filled based on the photovoltaic power true value at the historical moment before the sample missing moment, which may include the following steps:
[0170] Get the true value of the photovoltaic power at s consecutive sampling moments before the moment when the sample is missing;
[0171] Obtaining the true value of photovoltaic power at each sampling time in multiple days before the sample missing time;
[0172] From the photovoltaic power true values at each sampling moment of each day in the multiple days before the sample missing moment, obtain the photovoltaic power true values at the s consecutive sampling moments that are most similar to the photovoltaic power true values at the s consecutive sampling moments before the sample missing moment; determine the photovoltaic power true value at the first sampling moment after the photovoltaic power true values at the s most similar consecutive sampling moments as the photovoltaic power true value at the sample missing moment;
[0173] Wherein, the s is a positive integer.
[0174] In this embodiment, assuming that the sample missing time is 18:30 on the XX day, and s is 40, the photovoltaic power true value at s=40 consecutive sampling times before the sample missing time can be recorded as The true value of photovoltaic power at each sampling time within 15 days before the sample is missing Where d is the number of days before XX day, which can be 1, 2, ... 15; t is the t-th sampling time of each day, which can be 1, 2, ... q, and q is the total number of sampling times per day. The photovoltaic power true value at the t-th sampling moment on the d-th day before XX day. The photovoltaic power true value at s = 40 consecutive sampling moments every day within the 15 days can be traversed. calculate and The similarity between, for example, can be calculated and The Euclidean distance between and The similarity between them; thus, we can find The Euclidean distance between them is the smallest, that is, the most similar s = 40 consecutive sampling moments of the photovoltaic power true value Assume that the most similar s = 40 consecutive sampling moments of the photovoltaic power true value are found is the photovoltaic power true value of 40 consecutive sampling moments between 12:00 and 18:40 on the second day before the missing moment, then the photovoltaic power true value of 18:50, the first sampling moment after 18:40 on the second day, can be obtained as the photovoltaic power true value at the missing moment 18:30.
[0175] This embodiment determines the photovoltaic power true value at the first sampling moment after s consecutive sampling moments that are most similar to the photovoltaic power true values at s consecutive sampling moments before the sample missing moment as the photovoltaic power true value at the sample missing moment, so that the photovoltaic power true value at the sample missing moment can be filled in more accurately, thereby making the catenary samples used for model training more accurate, and thus making the prediction performance of the trained prediction model better.
[0176] In a possible implementation, the prediction model includes a long short-term memory network LSTM model, and the loss function L of the prediction model is:
[0177]
[0178] Where N is the total number of training samples, Y[i][0] is the true value of the PV power in the i-th training sample, Y[i][1] is the true value of the change trend in the i-th training sample, y[i][0] is the predicted value of the PV power corresponding to the i-th training sample, and y[i][1] is the predicted value of the change trend corresponding to the i-th training sample.
[0179] In this embodiment, the input variable of the i-th training sample can be Input to the prediction model to be trained, and obtain the prediction data y[i]=[y[i][0], y[i][1]] corresponding to the i-th training sample predicted by the prediction model, where y[i][0] is the predicted value of the photovoltaic power at the next moment corresponding to the i-th training sample, and y[i][1] is the predicted value of the change trend of the photovoltaic power true value at the next moment corresponding to the i-th training sample; for each training sample, the prediction data corresponding to the training sample can be obtained, and the label data Y of the i-th training sample can be compared. label[i]=[Y[i][0],Y[i][1]],and the predicted data y[i]=[y[i][0],y[i][1]] of the i-th training sample, calculate the mean square error between the label data and the predicted data as the loss function L of the prediction model, and continuously adjust the model parameters of the prediction model until the loss function L is minimized, and the trained prediction model can be obtained.
[0180] The present disclosure also provides a photovoltaic power prediction device, Figure 3 The structure block diagram of the photovoltaic power prediction device according to the embodiment of the present disclosure is shown, and the device can be implemented as part or all of the electronic device through software, hardware or a combination of both. Figure 3 As shown, the photovoltaic power prediction device comprises:
[0181] The true value acquisition module 301 is configured to acquire the true value of the photovoltaic power at multiple historical moments before the prediction moment;
[0182] The feature extraction module 302 is configured to extract the time feature corresponding to the photovoltaic power true value from the photovoltaic power true values at the plurality of historical moments;
[0183] The prediction module 303 is configured to input the photovoltaic power true values and their corresponding time characteristics at the multiple historical moments into a pre-trained prediction model, execute the prediction model, and obtain the photovoltaic power prediction value and change trend prediction value at the prediction moment output by the prediction model.
[0184] In a possible implementation, the photovoltaic power prediction device is applicable to various electronic devices that can perform photovoltaic power prediction. In a possible implementation, the prediction moment refers to the moment when photovoltaic power prediction is required. For example, the prediction moment may be a future moment after the current moment, such as a future moment 20 minutes or half an hour later, etc.; the interval between adjacent historical moments in multiple historical moments before the prediction moment may be tens of minutes.
[0185] In a possible implementation, the photovoltaic power true values at the multiple historical moments may be power values of photovoltaic power generation of a certain photovoltaic power generation site collected by relevant collection equipment at the historical moments.
[0186] In a possible implementation, the feature extraction module 302 may extract a time feature from the photovoltaic power true value at multiple historical moments, where the time feature refers to a feature that can reflect the collection moment of the photovoltaic power.
[0187] In a possible implementation, the prediction model can be an improved LSTM (Long Short-Term Memory) network model. The input of the prediction model is the true value of photovoltaic power at multiple historical moments and its corresponding time characteristics. The prediction model has two outputs, namely the photovoltaic power prediction value at the prediction moment and the change trend prediction value. The prediction model is a pre-trained model. Since there are two output labels, double loss correction can be performed on these two output labels during model training to improve the accuracy of model prediction.
[0188] In a possible implementation, when predicting photovoltaic power, the prediction module 303 may input the photovoltaic power true values of the multiple historical moments and their corresponding time features into a pre-trained prediction model, execute the prediction model, and obtain two prediction results output by the prediction model, namely, the photovoltaic power prediction value and the change trend prediction value at the prediction moment. This implementation obtains the photovoltaic power true values of multiple historical moments before the prediction moment; based on the photovoltaic power true values of the multiple historical moments, obtains photovoltaic power features and time features; inputs the photovoltaic power features and time features into a pre-trained prediction model, executes the prediction model, and obtains the photovoltaic power prediction value and the change trend prediction value at the prediction moment output by the prediction model, thereby fusing the feature information of the photovoltaic power data itself with the time feature information, and proposing a dual-label prediction model to achieve double loss correction during data training. By combining the fused data features with the improved prediction model, the model prediction accuracy of photovoltaic power data in various environments is effectively improved.
[0189] In a possible implementation, the truth value acquisition module 301 is configured as follows:
[0190] If the true value is missing when obtaining the true value of the photovoltaic power at multiple historical moments before the prediction moment, the missing moment at which the true value of the photovoltaic power is missing is determined;
[0191] Based on the photovoltaic power true value at the sampling moment before the missing moment, the photovoltaic power true value at the missing moment is filled. In some cases, such as when the collection equipment fails, the photovoltaic power true value at the sampling moment cannot be collected, resulting in data missing problems, especially for distributed photovoltaics. Due to the small capacity of each photovoltaic power generation site, scattered installation, and small investment, high-precision photovoltaic meters are not specially equipped, resulting in serious data missing problems in historical power data. In order to solve the data missing problem, when the photovoltaic power true value at multiple historical moments before the prediction moment is missing, the photovoltaic power true value at the missing moment can be filled based on the photovoltaic power true value at the sampling moment before the missing moment. For example, a curve function of photovoltaic power changing with time can be fitted based on the photovoltaic power true values at multiple sampling moments before the missing moment, and the photovoltaic power true value at the missing moment can be determined based on the curve function, and so on.
[0192] In a possible implementation manner, the part of the true value acquisition module that fills in the photovoltaic power true value at the missing moment based on the photovoltaic power true value at the sampling moment before the missing moment is configured as follows:
[0193] Obtaining the photovoltaic power true value at k consecutive sampling moments before the missing moment;
[0194] Obtaining the true value of photovoltaic power at each sampling time in multiple days before the missing time;
[0195] From the photovoltaic power true values at each sampling time of each day in multiple days before the missing time, obtain the photovoltaic power true values at k consecutive sampling times that are most similar to the photovoltaic power true values at k consecutive sampling times before the missing time;
[0196] Determine the photovoltaic power true value at the first sampling moment after the photovoltaic power true values at the most similar k consecutive sampling moments as the photovoltaic power true value at the missing moment;
[0197] Wherein, k is a positive integer.
[0198] In this embodiment, assuming that the missing time is 18:10 before the predicted time, when k is 50, the photovoltaic power true value at k=50 consecutive sampling times before the missing time can be recorded as The true value of photovoltaic power at each sampling time within 20 days before the missing time Where d is the number of days before the missing moment, which can be 1, 2, ... 20; t is the t-th sampling moment of each day, which can be 1, 2, ... q, where q is the total number of sampling moments per day. The photovoltaic power true value at the t-th sampling moment on the d-th day before the missing moment. The photovoltaic power true value at k = 50 consecutive sampling moments every day in the 20 days can be traversed. calculate and The similarity between, for example, can be calculated and The Euclidean distance between and The similarity between them; thus, we can find The Euclidean distance between them is the smallest, that is, the photovoltaic power true value at the most similar k = 50 consecutive sampling moments Assume that the most similar k = 50 consecutive sampling moments of the photovoltaic power true value are found The photovoltaic power true value at 50 consecutive sampling times between 7:00 and 15:20 on the second day before the missing time can be obtained as the photovoltaic power true value at the missing time 18:10 at the first sampling time 15:30.
[0199] This embodiment determines the photovoltaic power true value at the first sampling moment after the k consecutive sampling moments that are most similar to the photovoltaic power true values at the k consecutive sampling moments before the missing moment as the photovoltaic power true value at the missing moment, so that the photovoltaic power true value at the missing moment can be filled in more accurately, thereby making the subsequent photovoltaic power prediction more accurate.
[0200] In a possible implementation, the feature extraction module 302 is configured to:
[0201] Based on m historical moments, the first time feature T corresponding to the photovoltaic power true value is obtained according to the following formula: cos and the second time characteristic T sin :
[0202]
[0203] in, is the hour value of the mth historical moment, is the minute value of the mth historical moment, the hour value is measured in 24-hour format, and m is a positive integer. In this embodiment, assuming that the m=20th historical moment is 15:30, then
[0204] The sin and cos coding features corresponding to the true values of photovoltaic power at multiple historical moments extracted by this implementation can accurately reflect the time characteristics of the historical moments, and can effectively reduce the situation where a sudden decrease in photovoltaic power generation on a cloudy day is misjudged as darkness, and the situation where photovoltaic power generation power has glitches at night. In this way, the true values of photovoltaic power at multiple historical moments can be better integrated to perform accurate photovoltaic power prediction.
[0205] In a possible implementation, the method may further include the following steps:
[0206] Acquire multiple training samples, where the input variables in each training sample include the photovoltaic power true values at multiple sample moments and their corresponding time features, and the label data in each training sample include the photovoltaic power true value and the change trend true value at the next moment of the multiple sample moments;
[0207] The prediction model is trained using the training samples.
[0208] In this embodiment, the input variable in the i-th training sample can be recorded as in, Including the true value of photovoltaic power at multiple sample moments in the i-th training sample, Including the time characteristics corresponding to the true value of photovoltaic power at multiple sample moments in the i-th training sample; the label data in the training sample can be recorded as Y label [i],Y label [i]=[Y[i][0],Y[i][1]] wherein Y[i][0] is the photovoltaic power true value at the next moment corresponding to the i-th training sample, and Y[i][1] is the change trend true value of the photovoltaic power true value at the next moment corresponding to the i-th training sample, that is, the change trend true value corresponding to the i-th training sample, which can be set such that when the photovoltaic power true value at the next moment increases, the change trend true value Y[i][1]=0, and when the photovoltaic power true value at the next moment decreases, the change trend true value Y[i][1]_1.
[0209] In this embodiment, the input variable of the i-th training sample can be Input to the prediction model to be trained, and obtain the prediction data y[i]=[y[i][0], y[i][1]] corresponding to the i-th training sample predicted by the prediction model, where y[i][0] is the photovoltaic power prediction value at the next moment corresponding to the i-th training sample, and y[i][1] is the change trend prediction value of the photovoltaic power true value at the next moment corresponding to the i-th training sample; compare the label data Y label[i]=[Y[i][0],Y[i][1]] and the predicted data y[i]=[y[i][0],y[i][1]] of the i-th training sample, in this way, the gap between the label data and the predicted data of all training samples can be obtained, and then the prediction accuracy of the prediction model can be calculated, and the model parameters of the prediction model can be continuously adjusted until the accuracy of the predicted data predicted by the prediction model (the predicted value of photovoltaic power and the predicted value of the change trend at the next moment) reaches the predetermined value, and the trained prediction model can be obtained.
[0210] In a possible implementation, the prediction model includes a long short-term memory network LSTM model, and the loss function L of the prediction model is:
[0211]
[0212] Where N is the total number of training samples, Y[i][0] is the true value of the PV power in the i-th training sample, Y[i][1] is the true value of the change trend in the i-th training sample, y[i][0] is the predicted value of the PV power corresponding to the i-th training sample, and y[i][1] is the predicted value of the change trend corresponding to the i-th training sample.
[0213] In this embodiment, the prediction model can be an LSTM model with m neurons (cel]), and the specific structure of the neuron can be the neuron structure in the existing LSTM model, which is well known to those skilled in the art and will not be described in detail here.
[0214] In this embodiment, the input variable of the i-th training sample can be Input to the prediction model to be trained, and obtain the prediction data y[i]=[y[i][0], y[i][1]] corresponding to the i-th training sample predicted by the prediction model, where y[i][0] is the predicted value of the photovoltaic power at the next moment corresponding to the i-th training sample, and y[i][1] is the predicted value of the change trend of the photovoltaic power true value at the next moment corresponding to the i-th training sample; for each training sample, the prediction data corresponding to the training sample can be obtained, and the label data Y of the i-th training sample can be compared. label [i]=[Y[i][0],Y[i][1]],and the predicted data y[i]=[y[i][0],y[i][1]] of the i-th training sample, calculate the mean square error between the label data and the predicted data as the loss function L of the prediction model, and continuously adjust the model parameters of the prediction model until the loss function L is minimized, and the trained prediction model can be obtained.
[0215] The present disclosure also provides a training device for a prediction model. Figure 4The structure block diagram of the training device of the prediction model according to the embodiment of the present disclosure is shown, and the device can be implemented as part or all of the electronic device through software, hardware or a combination of both. Figure 4 As shown, the training device of the prediction model includes:
[0216] The sample acquisition module 401 is configured to acquire a plurality of training samples, wherein the input variables in each training sample include the photovoltaic power true values at a plurality of sample moments and their corresponding time characteristics, and the label data in each training sample include the photovoltaic power true value and the change trend true value at the next moment of the plurality of sample moments;
[0217] The training module 402 is configured to use the multiple training samples to train and obtain the prediction model.
[0218] In a possible implementation, the prediction model training device is applicable to various electronic devices that can perform prediction model training, which may be the electronic device for photovoltaic power prediction mentioned above, or other electronic devices that train the prediction model and then upload it to the electronic device for photovoltaic power prediction for use.
[0219] In a possible implementation, the input variable in the i-th training sample can be written as in, Including the true value of photovoltaic power at multiple sample moments in the i-th training sample, Including the time characteristics corresponding to the true value of photovoltaic power at multiple sample moments in the i-th training sample; the label data in the training sample can be recorded as Y label [i],Y label [i] = [Y[i][0], Y[i][1]], where Y[i][0] is the photovoltaic power true value at the next moment corresponding to the i-th training sample, and Y[i][1] is the change trend true value of the photovoltaic power true value at the next moment corresponding to the i-th training sample, that is, the change trend true value corresponding to the i-th training sample can be set to when the photovoltaic power true value at the next moment increases, the change trend true value Y[i][1] = 0, and when the photovoltaic power true value at the next moment decreases, the change trend true value Y[i][1] = 1. In a possible implementation, the input variable of the i-th training sample can be Input to the prediction model to be trained, and obtain the prediction data y[i]=[y[i][0], y[i][1]] corresponding to the i-th training sample predicted by the prediction model, where y[i][0] is the photovoltaic power prediction value at the next moment corresponding to the i-th training sample, and y[i][1] is the change trend prediction value of the photovoltaic power true value at the next moment corresponding to the i-th training sample; compare the label data Y label[i]=[Y[i][0],Y[i][1]] and the predicted data y[i]=[y[i][0],y[i][1]] of the i-th training sample, in this way, the gap between the label data and the predicted data of all training samples can be obtained, and then the prediction accuracy of the prediction model can be calculated, and the model parameters of the prediction model can be continuously adjusted until the accuracy of the predicted data predicted by the prediction model (the predicted value of photovoltaic power and the predicted value of the change trend at the next moment) reaches the predetermined value, and the trained prediction model can be obtained.
[0220] This implementation can fuse the characteristic information of photovoltaic power data itself with the time characteristic information, and propose a dual-label prediction model to achieve double loss correction during data training. By combining the fused data features with the improved prediction model, the trained prediction model can effectively improve the accuracy of photovoltaic power prediction.
[0221] In a possible implementation, the sample acquisition module is configured as follows:
[0222] Get the photovoltaic power true value p1, p2, ····p at n sample moments n ;
[0223] Based on the photovoltaic power true values p1, p2, . . . p at the n sample moments n , get the photovoltaic power variable P of group nm train and its corresponding nm group label data Y label :
[0224] P train =[[p1,…,p m ],[p2,…,p m+1 ]…,[p n-m ,…,p n-1 ]];
[0225]
[0226] Based on the n sample moments, the nm group of photovoltaic power variables P are obtained according to the following formula: train The corresponding nm group first time characteristics and the second time characteristic
[0227]
[0228] in, is the hour value at the mth sample moment, is the minute value of the mth sample moment, and the hour value adopts the 24-hour system;
[0229] A set of photovoltaic power variables and their corresponding set of first time features, a set of second time features and a set of label data are obtained as a training sample;
[0230] Both m and n are positive integers.
[0231] In this embodiment, based on the photovoltaic power true value at n sample moments, nm groups of photovoltaic power variables P can be obtained. train and its corresponding nm group label data Y label , nm group first time characteristics and the second time characteristic Each set of photovoltaic power variables and its corresponding set of label data, a set of first time features and a set of second time features can form a training sample.
[0232] In this embodiment, the input variable in the i-th training sample In in, That is, the input variable The label data corresponding to the i-th training sample Thus, the i-th training sample is:
[0233]
[0234] In this way, based on the photovoltaic power true values p1, p2, ... p at the n sample moments n , we can get nm training samples. Assuming n=1000 and m=20, we can get nm=980 training samples, where the i=1 training sample is: Assume that the m=20th sample time is 16:50, then
[0235] This implementation method can effectively reduce the situation where a sudden decrease in photovoltaic power generation on cloudy days is misjudged as darkness and the occurrence of glitches in photovoltaic power generation at night by adding sin and cos coding features at the sample time, thereby improving the ability of the network model to cope with data mutations and effectively improving the accuracy of data prediction.
[0236] In a possible implementation manner, the part of the sample acquisition module that acquires the photovoltaic power true value at n sample moments is configured as follows:
[0237] If the true value is missing when obtaining the true value of the photovoltaic power at n sample moments, the sample missing moment at which the true value of the photovoltaic power is missing is determined;
[0238] The photovoltaic power true value at the sample missing moment is filled in based on the photovoltaic power true value at the sampling moment before the sample missing moment.
[0239] In some cases, such as when the collection equipment fails, the photovoltaic power true value at the sampling moment cannot be collected, resulting in data missing problems. In particular, for distributed photovoltaics, due to the small individual capacity, scattered installation, and small investment of photovoltaic power generation sites, there is no special high-precision photovoltaic metering meter, resulting in serious data missing problems in historical power data. In order to solve the problem of missing data, if the photovoltaic power true value at n sample moments is missing, the photovoltaic power true value at the sample missing moment is filled based on the photovoltaic power true value at the sampling moment before the sample missing moment. For example, a curve function of photovoltaic power variation over time can be fitted based on the photovoltaic power true values at multiple sampling moments before the sample missing moment, and the photovoltaic power true value at the sample missing moment is determined based on the curve function, and so on. In a possible implementation, the photovoltaic power true value at the sample missing moment is filled based on the photovoltaic power true value at the historical moment before the sample missing moment, which may include the following steps:
[0240] Get the true value of the photovoltaic power at s consecutive sampling moments before the moment when the sample is missing;
[0241] Obtaining the true value of photovoltaic power at each sampling time in multiple days before the sample missing time;
[0242] From the photovoltaic power true values at each sampling moment of each day in the multiple days before the sample missing moment, obtain the photovoltaic power true values at the s consecutive sampling moments that are most similar to the photovoltaic power true values at the s consecutive sampling moments before the sample missing moment; determine the photovoltaic power true value at the first sampling moment after the photovoltaic power true values at the s most similar consecutive sampling moments as the photovoltaic power true value at the sample missing moment;
[0243] Wherein, the s is a positive integer.
[0244] In this embodiment, assuming that the sample missing time is 18:30 on the XX day, and s is 40, the photovoltaic power true value at s=40 consecutive sampling times before the sample missing time can be recorded as The true value of photovoltaic power at each sampling time within 15 days before the sample is missing Where d is the number of days before XX day, which can be 1, 2, ... 15; t is the t-th sampling time of each day, which can be 1, 2, ... q, and q is the total number of sampling times per day. The photovoltaic power true value at the t-th sampling moment on the d-th day before XX day. The photovoltaic power true value at s = 40 consecutive sampling moments every day within the 15 days can be traversed. calculate and The similarity between, for example, can be calculated and The Euclidean distance between and The similarity between them; thus, we can find The Euclidean distance between them is the smallest, that is, the most similar s = 40 consecutive sampling moments of the photovoltaic power true value Assume that the most similar s = 40 consecutive sampling moments of the photovoltaic power true value are found is the photovoltaic power true value of 40 consecutive sampling moments between 12:00 and 18:40 on the second day before the missing moment, then the photovoltaic power true value of 18:50, the first sampling moment after 18:40 on the second day, can be obtained as the photovoltaic power true value at the missing moment 18:30.
[0245] This embodiment determines the photovoltaic power true value at the first sampling moment after s consecutive sampling moments that are most similar to the photovoltaic power true values at s consecutive sampling moments before the sample missing moment as the photovoltaic power true value at the sample missing moment, so that the photovoltaic power true value at the sample missing moment can be filled in more accurately, thereby making the catenary samples used for model training more accurate, and thus making the prediction performance of the trained prediction model better.
[0246] In a possible implementation, the prediction model includes a long short-term memory network LSTM model, and the loss function L of the prediction model is:
[0247]
[0248] Where N is the total number of training samples, Y[i][0] is the true value of the PV power in the i-th training sample, Y[i][1] is the true value of the change trend in the i-th training sample, y[i][0] is the predicted value of the PV power corresponding to the i-th training sample, and y[i][1] is the predicted value of the change trend corresponding to the i-th training sample.
[0249] In this embodiment, the input variable of the i-th training sample can be Input to the prediction model to be trained, and obtain the prediction data y[i]=[y[i][0], y[i][1]] corresponding to the i-th training sample predicted by the prediction model, where y[i][0] is the predicted value of the photovoltaic power at the next moment corresponding to the i-th training sample, and y[i][1] is the predicted value of the change trend of the photovoltaic power true value at the next moment corresponding to the i-th training sample; for each training sample, the prediction data corresponding to the training sample can be obtained, and the label data Y of the i-th training sample can be compared.label [i]=[Y[Y[i][0],Y[i][1]], and the predicted data y[i]=[y[i][0],y[i][1]] of the i-th training sample, calculate the mean square error between the label data and the predicted data as the loss function L of the prediction model, and continuously adjust the model parameters of the prediction model until the loss function L is minimized, and the trained prediction model can be obtained.
[0250] This implementation can fuse the characteristic information of photovoltaic power data itself with the time characteristic information, and propose a dual-label prediction model to achieve double loss correction during data training. By combining the fused data features with the improved prediction model, the trained prediction model can effectively improve the accuracy of photovoltaic power prediction.
[0251] The present disclosure also discloses an electronic device, Figure 5 FIG. 1 shows a structural block diagram of an electronic device according to an embodiment of the present disclosure. Figure 5 As shown, the electronic device 500 includes a memory 501 and a processor 502, wherein the memory 501 is used to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor 502 to implement the method according to an embodiment of the present disclosure.
[0252] The present disclosure provides a photovoltaic power prediction method, comprising:
[0253] Obtain the true value of photovoltaic power at multiple historical moments before the prediction moment;
[0254] Extracting the time characteristics corresponding to the photovoltaic power true values from the photovoltaic power true values at the plurality of historical moments;
[0255] The photovoltaic power true values at the multiple historical moments and their corresponding time characteristics are input into a pre-trained prediction model, and the prediction model is executed to obtain the photovoltaic power prediction value and the change trend prediction value at the prediction moment output by the prediction model.
[0256] In a possible implementation, the obtaining of the photovoltaic power true values at multiple historical moments before the prediction moment includes: if a true value is missing when obtaining the photovoltaic power true values at multiple historical moments before the prediction moment, determining a missing moment at which the photovoltaic power true value is missing;
[0257] The photovoltaic power true value at the missing moment is filled in based on the photovoltaic power true value at the sampling moment before the missing moment.
[0258] In a possible implementation manner, filling the photovoltaic power true value at the missing moment based on the photovoltaic power true value at the sampling moment before the missing moment includes:
[0259] Obtaining the photovoltaic power true value at k consecutive sampling moments before the missing moment;
[0260] Obtaining the true value of photovoltaic power at each sampling time in multiple days before the missing time;
[0261] From the photovoltaic power true values at each sampling time of each day in multiple days before the missing time, obtain the photovoltaic power true values at k consecutive sampling times that are most similar to the photovoltaic power true values at k consecutive sampling times before the missing time;
[0262] Determine the photovoltaic power true value at the first sampling moment after the photovoltaic power true values at the most similar k consecutive sampling moments as the photovoltaic power true value at the missing moment;
[0263] Wherein, k is a positive integer.
[0264] In a possible implementation manner, extracting the time characteristics corresponding to the photovoltaic power true values from the photovoltaic power true values at the plurality of historical moments includes:
[0265] Based on m historical moments, the first time feature T corresponding to the photovoltaic power true value is obtained according to the following formula: cos and the second time characteristic T sin :
[0266]
[0267] in, is the hour value of the mth historical moment, It is the minute value of the mth historical moment. The hour value adopts the 24-hour system. The m is a positive integer.
[0268] In a possible implementation, the method further includes:
[0269] Acquire multiple training samples, where the input variables in each training sample include the photovoltaic power true values at multiple sample moments and their corresponding time features, and the label data in each training sample include the photovoltaic power true value and the change trend true value at the next moment of the multiple sample moments;
[0270] The prediction model is trained using the multiple training samples.
[0271] In a possible implementation, the prediction model includes a long short-term memory network LSTM model, and the loss function L of the prediction model is:
[0272]
[0273] Where N is the total number of training samples, Y[i][0] is the true value of the PV power in the i-th training sample, Y[i][1] is the true value of the change trend in the i-th training sample, y[i][0] is the predicted value of the PV power corresponding to the i-th training sample, and y[i][1] is the predicted value of the change trend corresponding to the i-th training sample.
[0274] The present disclosure also provides a prediction model training method, the training method comprising:
[0275] Acquire multiple training samples, where the input variables in each training sample include the photovoltaic power true values at multiple sample moments and their corresponding time features, and the label data in each training sample include the photovoltaic power true value and the change trend true value at the next moment of the multiple sample moments;
[0276] The prediction model is trained using the multiple training samples.
[0277] In a possible implementation, the obtaining a plurality of training samples includes:
[0278] Get the photovoltaic power true value p1, p2, ····p at n sample moments n ;
[0279] Based on the photovoltaic power true values p1, p2, . . . p at the n sample moments n , get the photovoltaic power variable P of group nm train and its corresponding nm group label data Ylabel :
[0280] P train =[[p1,…,p m ],[p2,…,p m+1 ]…,[p n-m ,…,p n-1 ]];
[0281]
[0282] Based on the n sample moments, the nm group of photovoltaic power variables P are obtained according to the following formula: train The corresponding nm group first time characteristics and the second time characteristic
[0283]
[0284] in, is the hour value at the mth sample moment, is the minute value of the mth sample moment, and the hour value adopts the 24-hour system;
[0285] A set of photovoltaic power variables and their corresponding set of first time features, a set of second time features and a set of label data are obtained as a training sample;
[0286] Both m and n are positive integers.
[0287] In a possible implementation manner, obtaining the photovoltaic power true value at n sample moments includes:
[0288] If the true value is missing when obtaining the true value of the photovoltaic power at n sample moments, the sample missing moment at which the true value of the photovoltaic power is missing is determined;
[0289] The photovoltaic power true value at the sample missing moment is filled in based on the photovoltaic power true value at the sampling moment before the sample missing moment.
[0290] In a possible implementation manner, filling the photovoltaic power true value at the sample missing time based on the photovoltaic power true value at the sampling time before the sample missing time includes:
[0291] Obtaining the photovoltaic power true value at s consecutive sampling moments before the sample missing moment;
[0292] Obtaining the true value of photovoltaic power at each sampling time in multiple days before the sample missing time;
[0293] From the photovoltaic power true values at each sampling moment of each day in the multiple days before the sample missing moment, obtain the photovoltaic power true values at the s consecutive sampling moments that are most similar to the photovoltaic power true values at the s consecutive sampling moments before the sample missing moment; determine the photovoltaic power true value at the first sampling moment after the photovoltaic power true values at the s most similar consecutive sampling moments as the photovoltaic power true value at the sample missing moment;
[0294] Wherein, the s is a positive integer.
[0295] In a possible implementation, the prediction model includes a long short-term memory network LSTM model, and the loss function L of the prediction model is:
[0296]
[0297] Where N is the total number of training samples, Y[i][0] is the true value of the PV power in the i-th training sample, Y[i][1] is the true value of the change trend in the i-th training sample, y[i][0] is the predicted value of the PV power corresponding to the i-th training sample, and y[i][1] is the predicted value of the change trend corresponding to the i-th training sample.
[0298] In one possible implementation, the one or more computer instructions are executed by the processor 502 to implement a photovoltaic power prediction method according to an embodiment of the present disclosure, the photovoltaic power prediction method comprising:
[0299] In a possible implementation, the electronic device may be a distribution network device, such as FTU (Feeder Terminal Unit, distribution switch monitoring terminal), DTU (Distribution Terminal Unit, switchgear terminal equipment), intelligent fusion terminal, etc., or the electronic device may be a device on a distribution master station or a distribution substation.
[0300] The disclosed embodiments also provide a chip, which includes the photovoltaic power prediction device mentioned above. The chip can be any chip that can implement the photovoltaic power prediction device. Alternatively, the chip includes the training device of the prediction model mentioned above. The chip can be a chip of the training device of the prediction model. The device can be implemented as part or all of the chip through software, hardware or a combination of both.
[0301] Figure 6 A schematic diagram showing the structure of a computer system suitable for implementing the method of the embodiment of the present disclosure is shown.
[0302] like Figure 6 As shown, the computer system 600 includes a processing unit 601, which can perform various processes in the above-mentioned embodiments according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the computer system 600 are also stored. The processing unit 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0303] The following components are connected to the I / O interface 605: an input part 606 including keys, etc.; an output part 607 including a display, etc.; a storage part 608 including a hard disk, etc.; and a communication part 609 including a network interface card such as a LAN card, a modem, etc. The communication part 609 performs communication processing via a network such as the Internet. The drive 610 is also connected to the I / O interface 605 as needed. Removable media 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., are installed on the drive 610 as needed, so that the computer program read therefrom is installed into the storage part 608 as needed. Among them, the processing unit 601 can be implemented as a processing unit such as a CPU, a GPU, a TPU, an FPGA, an NPU, etc.
[0304] In particular, according to an embodiment of the present disclosure, the method described above can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes computer instructions, and the computer instructions are executed by a processor to implement the method steps described above. In such an embodiment, the computer program product can be downloaded and installed from a network through the communication part 609, and / or installed from a removable medium 611.
[0305] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram may represent a module, a program segment or a part of a code, and the module, program segment or a part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box may also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they may sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system that performs the specified function or operation, or can be implemented by a combination of dedicated hardware and computer instructions. The units or modules involved in the embodiments described in the present disclosure can be implemented by software or by programmable hardware. The described units or modules can also be set in a processor, and the names of these units or modules do not constitute a limitation on the units or modules themselves in some cases.
[0306] As another aspect, the present disclosure further provides a computer-readable storage medium, which may be a computer-readable storage medium included in the electronic device or computer system in the above embodiment; or a computer-readable storage medium that exists independently and is not assembled into a device. The computer-readable storage medium stores one or more programs, and the programs are used by one or more processors to execute the method described in the present disclosure.
[0307] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the present disclosure is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the inventive concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other.
Claims
1. A photovoltaic power prediction method, characterized in that: include: Obtain the true value of photovoltaic power at multiple historical moments before the prediction moment; Extracting the time characteristics corresponding to the photovoltaic power true values from the photovoltaic power true values at the plurality of historical moments; The photovoltaic power true values at the multiple historical moments and their corresponding time characteristics are input into a pre-trained prediction model, and the prediction model is executed to obtain the photovoltaic power prediction value and the change trend prediction value at the prediction moment output by the prediction model.
2. The method according to claim 1, characterized in that The obtaining of the photovoltaic power true value at multiple historical moments before the prediction moment includes: If the true value is missing when obtaining the true value of the photovoltaic power at multiple historical moments before the prediction moment, the missing moment at which the true value of the photovoltaic power is missing is determined; The photovoltaic power true value at the missing moment is filled in based on the photovoltaic power true value at the sampling moment before the missing moment.
3. The method according to claim 2, characterized in that The step of filling the photovoltaic power true value at the missing moment based on the photovoltaic power true value at the sampling moment before the missing moment comprises: Obtaining the photovoltaic power true value at k consecutive sampling moments before the missing moment; Obtaining the true value of photovoltaic power at each sampling time in multiple days before the missing time; From the photovoltaic power true values at each sampling time of each day in multiple days before the missing time, obtain the photovoltaic power true values at k consecutive sampling times that are most similar to the photovoltaic power true values at k consecutive sampling times before the missing time; Determine the photovoltaic power true value at the first sampling moment after the photovoltaic power true values at the most similar k consecutive sampling moments as the photovoltaic power true value at the missing moment; Wherein, k is a positive integer.
4. The method according to claim 1, characterized in that: The step of extracting the time characteristics corresponding to the photovoltaic power true values from the photovoltaic power true values at the plurality of historical moments includes: Based on m historical moments, the first time feature T corresponding to the photovoltaic power true value is obtained according to the following formula: cos and the second time characteristic T sin : in, is the hour value of the mth historical moment, It is the minute value of the mth historical moment. The hour value adopts the 24-hour system. The m is a positive integer.
5. The method according to claim 1, characterized in that The method further comprises: Acquire multiple training samples, where the input variables in each training sample include the photovoltaic power true values at multiple sample moments and their corresponding time features, and the label data in each training sample include the photovoltaic power true value and the change trend true value at the next moment of the multiple sample moments; The prediction model is trained using the multiple training samples.
6. The method according to claim 5, characterized in that The prediction model includes a long short-term memory network LSTM model, and the loss function L of the prediction model is: Where N is the total number of training samples, Y[i][0] is the true value of the PV power in the i-th training sample, Y[i][1] is the true value of the change trend in the i-th training sample, Y[i][0] is the predicted value of the PV power corresponding to the i-th training sample, and Y[i][1] is the predicted value of the change trend corresponding to the i-th training sample.
7. A method for training a prediction model, characterized in that: The training method comprises: Acquire multiple training samples, where the input variables in each training sample include the photovoltaic power true values at multiple sample moments and their corresponding time features, and the label data in each training sample include the photovoltaic power true value and the change trend true value at the next moment of the multiple sample moments; The prediction model is trained using the multiple training samples.
8. The training method according to claim 7, characterized in that: The obtaining of multiple training samples comprises: Get the photovoltaic power true value p1, p2, ... p at n sample moments n ; Based on the photovoltaic power true values p1, p2, ... p at the n sample moments n , get the photovoltaic power variable P of group nm train and its corresponding nm group label data Y label : P train =[[p1,...,p m ],[p2,...,p m+1 ]...,[p n-m ,...,p n-1 ]]; Based on the n sample moments, the nm group of photovoltaic power variables P are obtained according to the following formula: train The corresponding nm group first time characteristics and the second time characteristic in, is the hour value at the mth sample moment, is the minute value of the mth sample moment, and the hour value adopts the 24-hour system; A set of photovoltaic power variables and their corresponding set of first time features, a set of second time features and a set of label data are obtained as a training sample; Both m and n are positive integers.
9. The training method according to claim 8, characterized in that: The step of obtaining the photovoltaic power true value at n sample moments includes: If the true value is missing when obtaining the true value of the photovoltaic power at n sample moments, the sample missing moment at which the true value of the photovoltaic power is missing is determined; The photovoltaic power true value at the sample missing moment is filled in based on the photovoltaic power true value at the sampling moment before the sample missing moment.
10. The training method according to claim 9, characterized in that: The step of filling the photovoltaic power true value at the sample missing moment based on the photovoltaic power true value at the sampling moment before the sample missing moment comprises: Obtaining the photovoltaic power true value at s consecutive sampling moments before the sample missing moment; Obtaining the true value of photovoltaic power at each sampling time in multiple days before the sample missing time; From the photovoltaic power true values at each sampling time of each day in multiple days before the sample missing time, obtain the photovoltaic power true values at s consecutive sampling times that are most similar to the photovoltaic power true values at s consecutive sampling times before the sample missing time; Determine the photovoltaic power true value at the first sampling moment after the photovoltaic power true values at the most similar s consecutive sampling moments as the photovoltaic power true value at the sample missing moment; Wherein, the s is a positive integer.
11. The training method according to claim 7, characterized in that: The prediction model includes a long short-term memory network LSTM model, and the loss function L of the prediction model is: Where N is the total number of training samples, Y[i][0] is the true value of the PV power in the i-th training sample, Y[i][1] is the true value of the change trend in the i-th training sample, y[i][0] is the predicted value of the PV power corresponding to the i-th training sample, and y[i][1] is the predicted value of the change trend corresponding to the i-th training sample.
12. A photovoltaic power prediction device, characterized in that: include: A true value acquisition module is configured to acquire the true value of photovoltaic power at multiple historical moments before the prediction moment; A feature extraction module is configured to extract a time feature corresponding to the photovoltaic power true value from the photovoltaic power true values at the plurality of historical moments; The prediction module is configured to input the photovoltaic power true values and their corresponding time characteristics at the multiple historical moments into a pre-trained prediction model, execute the prediction model, and obtain the photovoltaic power prediction value and change trend prediction value at the prediction moment output by the prediction model.
13. The device according to claim 12, characterized in that The truth value acquisition module is configured as follows: If the true value is missing when obtaining the true value of the photovoltaic power at multiple historical moments before the prediction moment, the missing moment at which the true value of the photovoltaic power is missing is determined; The photovoltaic power true value at the missing moment is filled in based on the photovoltaic power true value at the sampling moment before the missing moment.
14. The device according to claim 13, characterized in that The part of the true value acquisition module that fills the photovoltaic power true value at the missing moment based on the photovoltaic power true value at the sampling moment before the missing moment is configured as follows: Obtaining the photovoltaic power true value at k consecutive sampling moments before the missing moment; Obtaining the true value of photovoltaic power at each sampling time in multiple days before the missing time; From the photovoltaic power true values at each sampling time of each day in multiple days before the missing time, obtain the photovoltaic power true values at k consecutive sampling times that are most similar to the photovoltaic power true values at k consecutive sampling times before the missing time; Determine the photovoltaic power true value at the first sampling moment after the photovoltaic power true values at the most similar k consecutive sampling moments as the photovoltaic power true value at the missing moment; Wherein, k is a positive integer.
15. The device according to claim 14, characterized in that The feature extraction module is configured to: based on m historical moments, obtain the first time feature T corresponding to the photovoltaic power true value according to the following formula: cos and the second time characteristic T sin : in, is the hour value of the mth historical moment, It is the minute value of the mth historical moment. The hour value adopts the 24-hour system. The m is a positive integer.
16. The device according to claim 12, characterized in that The device also includes: The model training module is configured to obtain multiple training samples, wherein the input variables in each training sample include the true value of photovoltaic power at multiple sample moments and its corresponding time characteristics, and the label data includes the true value of photovoltaic power at the next moment of the multiple sample moments and the true value of the change trend; the prediction model is trained using the training samples.
17. The device according to claim 16, characterized in that The prediction model includes a long short-term memory network LSTM model, and the loss function L of the prediction model is: Where N is the total number of training samples, Y[i][0] is the true value of the PV power in the i-th training sample, Y[i][1] is the true value of the change trend in the i-th training sample, y[i][0] is the predicted value of the PV power corresponding to the i-th training sample, and y[i][1] is the predicted value of the change trend corresponding to the i-th training sample.
18. A training device for a prediction model, characterized in that: The training device comprises: A sample acquisition module is configured to acquire a plurality of training samples, wherein the input variables in each training sample include the photovoltaic power true values at a plurality of sample moments and their corresponding time features, and the label data in each training sample include the photovoltaic power true value and the change trend true value at the next moment of the plurality of sample moments; The training module is configured to use the multiple training samples to train and obtain the prediction model.
19. The training device according to claim 18, characterized in that The sample acquisition module is configured as follows: Get the photovoltaic power true value p1, p2, .... p at n sample moments n ; Based on the photovoltaic power true values p1, p2, .... p at the n sample moments n , get the photovoltaic power variable P of group nm train and its corresponding nm group label data Y label : P train =[[p1,...,p m ],[p2,...,p m+1 ]...,[p n-m ,...,p n-1 ]]; Based on the n sample moments, the nm group of photovoltaic power variables P are obtained according to the following formula: train The corresponding nm group first time characteristics and the second time characteristic in, is the hour value at the mth sample moment, is the minute value of the mth sample moment, and the hour value adopts the 24-hour system; A set of photovoltaic power variables and their corresponding set of first time features, a set of second time features and a set of label data are obtained as a training sample; Both m and n are positive integers.
20. The training device according to claim 19, characterized in that The part of the sample acquisition module that acquires the photovoltaic power true value at n sample moments is configured as follows: If the true value is missing when obtaining the true value of the photovoltaic power at n sample moments, the sample missing moment at which the true value of the photovoltaic power is missing is determined; The photovoltaic power true value at the sample missing moment is filled in based on the photovoltaic power true value at the sampling moment before the sample missing moment.
21. The training device according to claim 20, characterized in that The part of the sample acquisition module that fills the photovoltaic power true value at the sample missing moment based on the photovoltaic power true value at the sampling moment before the sample missing moment is configured as follows: Obtaining the photovoltaic power true value at s consecutive sampling moments before the sample missing moment; Obtaining the true value of photovoltaic power at each sampling time in multiple days before the sample missing time; From the photovoltaic power true values at each sampling time of each day in multiple days before the sample missing time, obtain the photovoltaic power true values at s consecutive sampling times that are most similar to the photovoltaic power true values at s consecutive sampling times before the sample missing time; Determine the photovoltaic power true value at the first sampling moment after the photovoltaic power true values at the most similar s consecutive sampling moments as the photovoltaic power true value at the sample missing moment; Wherein, the s is a positive integer.
22. The training device according to claim 18, characterized in that The prediction model includes a long short-term memory network LSTM model, and the loss function L of the prediction model is: Where N is the total number of training samples, Y[i][0] is the true value of the PV power in the i-th training sample, Y[i][1] is the true value of the change trend in the i-th training sample, y[i][0] is the predicted value of the PV power corresponding to the i-th training sample, and y[i][1] is the predicted value of the change trend corresponding to the i-th training sample.
23. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement the method according to any one of claims 1 to 11.
24. A readable storage medium, characterized in that: Computer instructions are stored thereon, and when the computer instructions are executed by a processor, the method described in any one of claims 1 to 11 is implemented.
25. A chip, characterized in that: The chip comprises the device according to any one of claims 12-22.
Citation Information
Patent Citations
Short-term fine-grained photovoltaic power station power probability prediction method
CN114330660A
Photovoltaic power prediction method, device, feeder terminal, system, medium and chip
CN118659360A
Distributed photovoltaic power station reverse power control system and method
CN119030022A
Distributed photovoltaic short-term power prediction method and system based on data relevance
CN119134321A
Hybrid photovoltaic power prediction method and system based on multi-source data fusion
US20220373984A1