Distributed photovoltaic load data determination method and device, storage medium and terminal
The Q-Learning reinforcement learning algorithm dynamically adjusts grid-connected capacity to maintain accurate load data predictions in photovoltaic systems, overcoming the limitations of rapid capacity expansion and equipment changes in existing technologies.
Patent Information
- Application Number
- CN202411075965.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-07
- Publication Date
- 2024-12-06
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing photovoltaic prediction technologies lack foresight for the rapid expansion of distributed photovoltaic capacity and fail to account for changes in photovoltaic equipment characteristics, leading to inaccurate load data predictions that affect the safe and stable operation of power grids.
A method using the Q-Learning reinforcement learning algorithm to dynamically adjust grid-connected capacity, incorporating historical data and weather data to maintain prediction accuracy by adjusting the grid-connected capacity in real-time, and refining the prediction model with a preset model like Xgboost to handle non-linear relationships.
The method ensures high prediction accuracy of load data by continuously adjusting grid-connected capacity to align with actual output, addressing the challenges of rapid capacity expansion and equipment changes in photovoltaic systems.
Smart Images

Figure CN119093329A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of photovoltaic technology, and in particular to a method and device for determining load data of distributed photovoltaics, a storage medium, and a terminal. Background Art
[0002] With the rapid development of new energy technologies, new energy electricity has become an important form of energy for power grids. Among them, photovoltaics have developed particularly rapidly. Its clean energy characteristics are highly consistent with the concept of sustainable development and are gradually becoming a key force in the transformation of energy structure. In particular, with the rapid growth of distributed photovoltaics, accurate determination of distributed photovoltaic load data is particularly important. In related technologies, load data is calculated based on the existing total photovoltaic volume, which lacks foresight for the rapidly expanding photovoltaic growth and makes it difficult to accurately predict the output of future photovoltaic power stations. As the scale of grid connection expands, the accuracy gradually decreases, affecting the safe and stable operation of the power grid.
[0003] How to accurately determine the load data of distributed photovoltaics in the context of the rapid expansion of photovoltaics has become a technical problem that needs to be urgently solved by technical personnel in this field. Summary of the invention
[0004] In view of this, the present invention provides a method and device for determining load data of distributed photovoltaics, a storage medium, and a terminal. In this method, the first grid-connected capacity and the first load data present a similar linear relationship in the short term, but are not a purely linear relationship in the long term. Affected by other factors such as equipment, as the first grid-connected capacity increases, the prediction model will inevitably deviate. The Q-Learning reinforcement learning algorithm is used to dynamically adjust the first grid-connected capacity. When the first load data deviates, it is adjusted back in time to avoid a larger deviation in the later period. In the continuous adjustment, the preset model can always maintain a relatively high prediction accuracy.
[0005] According to one aspect of the present invention, a method for determining load data of distributed photovoltaic is provided, comprising:
[0006] Acquire a first grid-connected capacity, first weather data, and a grid-connected capacity variable, wherein the grid-connected capacity variable is determined based on historical data using a Q-Learning reinforcement learning algorithm;
[0007] Using the grid-connected capacity variable, adjusting the first grid-connected capacity;
[0008] The first weather data and the adjusted first grid-connected capacity are input into a preset model to output first load data.
[0009] In some embodiments, the process of determining the grid-connected capacity variable includes:
[0010] Acquire a historical data set, where the historical data set includes historical data of each day in the previous N days, where the historical data includes second weather data, second load data, and second grid-connected capacity;
[0011] Based on the historical data set, a grid-connected capacity variable is determined according to a Q-Learning reinforcement learning algorithm.
[0012] In some embodiments, the step of determining the grid-connected capacity variable based on the historical data set according to the Q-Learning reinforcement learning algorithm includes:
[0013] Determine the incremental range of grid-connected capacity based on the second grid-connected capacity in historical data;
[0014] Decomposing the grid-connected capacity increment range into a plurality of states separated by preset actions, and determining actions between the plurality of states;
[0015] According to the state, a Q-table of a Q-learning algorithm is formed, wherein the rows and columns in the Q-table both represent states, the state represented by the row is the row state, the state represented by the column is the column state, and the value at the intersection of the row and the column in the Q-table is the Q value, and the Q value represents the weight of the action of transforming from the row state to the column state;
[0016] Initialize the Q value in the Q table to 0;
[0017] Randomly select a column state from all column states corresponding to the row state 0 in the Q table;
[0018] determining a target action for changing from the row state to the selected column state, and changing a second grid-connected capacity in the historical data according to the target action;
[0019] Inputting historical data including the changed second grid-connected capacity data into the preset model to obtain third load data; calculating a result of a loss function according to the second load data and the third load data;
[0020] Calculate the result of the reward function according to the result of the loss function;
[0021] Based on the result of the reward function, solve the Q value according to the Bellman equation and update the Q table;
[0022] Determining whether the result of the reward function is within a preset convergence range, and determining whether the number of updates of the Q table exceeds a preset number;
[0023] If the result of the reward function is within a preset convergence range or the number of updates exceeds a preset number, the target action corresponding to the Q value solved for the last time is determined to be the grid-connected capacity variable.
[0024] If the result of the reward function is not within the preset convergence range and the number of updates does not exceed the preset value, the target action determined last time is executed based on the last selected row state to determine the current row state; the column state corresponding to the maximum Q value is selected from all column states corresponding to the current row state; the current target action of converting the current row state to the column state corresponding to the maximum Q value is determined, the current target action is replaced by the target action, and the change of the second grid-connected capacity in the historical data is re-executed until the result of the reward function is within the preset convergence range or the number of updates exceeds the preset number, and the target action corresponding to the last solved Q value is determined to be the grid-connected capacity variable.
[0025] In some embodiments, the process of determining the preset model includes:
[0026] A preset model is obtained by training with the first sample set, wherein the first sample set is an adjusted second sample set, wherein the second sample set includes multiple second samples, wherein the second samples include a third grid-connected capacity, third weather data and fourth load data, and the third weather data includes multiple weather types; the adjustment process of the second sample set includes adjusting the weather type in the third weather data in the second samples according to the correlation calculated based on the weather type of the third weather data in all second samples and the fourth load data to obtain an adjusted second sample set; the weather type in the third weather data in the adjusted second sample set is the same as that in the first weather data.
[0027] In some embodiments, the specific steps of the adjustment process of the second sample set include:
[0028] calculating a first correlation between the weather type and the load data according to the weather type of the third weather data and the fourth load data in all the second samples;
[0029] Deleting the weather type whose first correlation is lower than the first target correlation from the third weather data of the second sample, and updating the third weather data;
[0030] taking any two weather types in the updated third weather data as a weather type group, and calculating a second correlation between the two weather types in each weather type group;
[0031] If the first correlations between two weather types in the weather type group whose second correlation in the third weather data is higher than the second target correlation and the load data are both within the same preset correlation range, then one of the weather types in the weather type group is removed;
[0032] If the first correlations between two weather types in the weather type group whose second correlation in the third weather data is higher than the second target correlation and the load data are within different preset correlation ranges, retaining the two weather types in the weather type group;
[0033] The second sample set currently composed of the second samples is determined as the adjusted second sample set.
[0034] In some embodiments, the process of determining the second sample set includes:
[0035] Acquire a third sample set, the third sample set comprising a plurality of third samples, the third samples comprising fifth load data, fourth grid-connected capacity and fourth weather data, the fourth weather data comprising weather description;
[0036] Counting the number of occurrences of each weather description in the fourth weather data, and determining an extreme weather description based on the weather descriptions whose number of occurrences is less than a preset number;
[0037] Get the fifth weather data of the surrounding area including description of extreme weather;
[0038] Determine a fourth grid-connected capacity on the same day as the fifth weather data, and a surrounding grid-connected capacity in a surrounding area on the same day as the fifth weather data;
[0039] Calculating a ratio of the fourth grid-connected capacity to the surrounding grid-connected capacity;
[0040] scaling the surrounding load data of the surrounding area on the same day as the fifth weather data according to the ratio;
[0041] The scaled peripheral load data, the fourth grid-connected capacity and the fifth weather data are determined as the expanded samples;
[0042] The expanded sample is added as a third sample to the third sample set, and the current third sample set is determined as the second sample set.
[0043] In some embodiments, before the step of determining the current third sample set as the second sample set, the method further includes:
[0044] The current third sample set is normalized and processed for outliers, and the current third sample set is updated.
[0045] According to another aspect of the present invention, a device for determining load data of distributed photovoltaic is provided, comprising:
[0046] an acquisition unit, configured to acquire a first grid-connected capacity, first weather data, and a grid-connected capacity variable, wherein the grid-connected capacity variable is determined based on historical data using a Q-Learning reinforcement learning algorithm;
[0047] An input unit is used to input the first weather data and the adjusted first grid-connected capacity into a preset model to output the first load data
[0048] According to another aspect of the present invention, a storage medium is provided, wherein the storage medium stores at least one executable instruction, wherein the executable instruction enables a processor to execute the method for determining load data of distributed photovoltaics as described above.
[0049] According to another aspect of the present invention, there is provided a terminal, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus;
[0050] The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute the method for determining load data of distributed photovoltaics as described above.
[0051] The present invention provides a method and device for determining load data of distributed photovoltaics, a storage medium, and a terminal. In this method, the first grid-connected capacity and the first load data present a similar linear relationship in the short term, but not a pure linear relationship in the long term. Affected by other factors such as equipment, as the first grid-connected capacity increases, the prediction model will inevitably deviate. The Q-Learning reinforcement learning algorithm is used to dynamically adjust the first grid-connected capacity. When the first load data deviates, it is adjusted back in time to avoid a larger deviation in the later period. In the continuous adjustment, the preset model can always maintain a relatively high prediction accuracy.
[0052] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0054] Figure 1 A flow chart of a method for determining load data of distributed photovoltaic provided by an embodiment of the present invention is shown;
[0055] Figure 2 A block diagram of a distributed photovoltaic load data determination device provided by an embodiment of the present invention is shown;
[0056] Figure 3 A schematic diagram of the structure of a terminal provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0057] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0058] With the rapid development of new energy technologies, new energy power has become an important energy form for power grids. Among them, photovoltaic power has developed particularly rapidly. Its clean energy characteristics are highly consistent with the concept of sustainable development and are gradually becoming a key force in the transformation of energy structure. In particular, with the rapid growth of distributed photovoltaic power, accurate determination of distributed photovoltaic load data is particularly important.
[0059] How to accurately determine the load data of distributed photovoltaics in the case of rapid expansion of photovoltaics has become a technical problem that technicians in this field need to solve urgently. Photovoltaic prediction technology in related technologies predicts the power generation of photovoltaic power stations by means of data analysis, model construction, etc. After analysis, it was found that there may be two reasons why the current model cannot be used in the future. The first is that the expansion speed of the grid-connected capacity of distributed photovoltaics is beyond imagination. Most of the photovoltaic prediction technologies in related technologies are limited to the analysis and modeling of existing photovoltaic capacity, and lack sufficient foresight for the rapid growth of photovoltaic power station capacity. This makes the prediction results often relatively conservative and difficult to accurately reflect the actual output of distributed photovoltaics in the future. The second is that the characteristics of mainstream photovoltaic equipment have changed. Photovoltaic technology is now in its rising period, and many new technologies and new equipment are emerging in an endless stream. The main reason for photovoltaic power generation is weather data, but the degree of influence of weather data on photovoltaic equipment cannot be determined at the current stage. The weather type in the weather data that has little influence on photovoltaic equipment at this stage may become an important factor affecting the output of distributed photovoltaics in the future with the emergence of new equipment and new technologies. Based on this, a more accurate distributed photovoltaic determination technology is needed to cope with the increasing trend of new energy power in the power grid and the rapid changes in photovoltaic equipment in technological development.
[0060] In order to solve the above technical problems, an embodiment of the present application provides a method for determining load data of distributed photovoltaics. In this method, the first grid-connected capacity and the first load data present a similar linear relationship in the short term, but not a purely linear relationship in the long term. Affected by other factors such as equipment, as the first grid-connected capacity increases, the prediction model will inevitably deviate. The Q-Learning reinforcement learning algorithm is used to dynamically adjust the first grid-connected capacity. When the first load data deviates, it is adjusted back in time to avoid a larger deviation in the later stage. During continuous adjustment, the preset model can always maintain a relatively high prediction accuracy.
[0061] Figure 1 A method for determining load data of distributed photovoltaics provided according to some embodiments is exemplarily shown, and the method includes S100-S300.
[0062] S100: Obtain a first grid-connected capacity, first weather data, and a grid-connected capacity variable, wherein the grid-connected capacity variable is determined based on historical data using a Q-Learning reinforcement learning algorithm.
[0063] In the embodiment of the present application, distributed photovoltaic is divided into two types, one is self-generated and self-used type, and the other is fully grid-connected type. The electricity generated by self-generated and self-used photovoltaic is first used by itself and then connected to the grid. The electricity generated by fully grid-connected photovoltaic is fully connected to the grid. The first grid-connected capacity is the sum of the grid-connected capacities of the two types of distributed photovoltaic.
[0064] The first weather data is refined weather data, which may include different weather types and other information. For example, the weather type may be one or more of sunrise time, sunset time, dew point, humidity, temperature, real-time temperature, ultraviolet rays, precipitation probability, air pressure, weather description, whether it is a working day, week, visibility, cloud cover, precipitation probability, 10-minute precipitation probability, snowfall probability, 10-minute snowfall probability, precipitation amount, and snowfall amount. The weather type included in the first weather data needs to be the same as the weather type in the third weather data in the adjusted second sample set below. The determination of the weather type in the third weather data in the adjusted second sample set is described below. Other information may be date and time.
[0065] In this embodiment, the Q-learning algorithm can be used to control the grid-connected capacity variable to achieve dynamic correction of the preset model and optimize the prediction effect. The Q-learning reinforcement learning is used to introduce the grid-connected capacity variable, and the preset model is adjusted as a whole through the grid-connected capacity variable. By adjusting the grid-connected capacity variable, the prediction result of the preset model can be adjusted while other data remain unchanged, so that the prediction result is closer to the true value.
[0066] In some embodiments, the process of determining the grid-connected capacity variable includes:
[0067] A historical data set is obtained, where the historical data set includes historical data of each day in the previous N days, where the historical data includes second weather data, second load data, and second grid-connected capacity.
[0068] In some embodiments, the second weather data may be the same weather type as the third weather data in the adjusted second sample set above, but the specific content of the weather type is different. The fourth load data and the second grid-connected capacity may refer to the description of the first load data and the first grid-connected capacity.
[0069] In one example, the first N days may be the first 5 days.
[0070] Based on the historical data set, a grid-connected capacity variable is determined according to a Q-Learning reinforcement learning algorithm.
[0071] In some embodiments, the step of determining the grid-connected capacity variable based on the historical data set according to the Q-Learning reinforcement learning algorithm includes:
[0072] The incremental range of grid-connected capacity is determined based on the second grid-connected capacity in historical data.
[0073] In an example, the grid-connected capacity increment range is [-M, +M], the average value of the second grid-connected capacity is 50,000 kWh, and M can be set to 1,000.
[0074] The grid-connected capacity increment range is decomposed into a plurality of states separated by preset actions.
[0075] In this embodiment, the preset action is T, and T can be M / 100. The grid-connected capacity increment range is decomposed into a plurality of states with intervals of preset actions, and the plurality of states are -M, -M+T, -M+2T, ..., M-2T, MT, M.
[0076] According to the state, a Q-table of the Q-learning algorithm is formed, wherein the rows and columns in the Q-table represent states, the state represented by the row is the row state, the state represented by the column is the column state, and the value at the intersection of the row and the column in the Q-table is the Q value, and the Q value represents the weight of the action of transforming from the row state to the column state. Exemplarily, as shown in Table 2, Table 2 is a Q-table.
[0077] Table 2
[0078]
[0079]
[0080] Initialize the Q value in the Q table to 0;
[0081] Randomly select a column state from all column states corresponding to the row state of 0 in the Q table.
[0082] Exemplarily, referring to Table 2, when the row state is 0, a column state can be randomly selected from all column states, such as 20.
[0083] Determine the target action for changing from the row state to the selected column state, and change the second grid connection capacity in the historical data according to the target action.
[0084] Exemplarily, when the row state is 0 and the column state is 20, the target action for changing from the row state to the column state is determined to be +20. Change the second grid connection capacity in the historical data according to this target action. For example, the original second grid connection capacity on April 28, 2024 is 200, and after executing the target action, it becomes 220. Another example, the original second grid connection capacity on April 29, 2024 is 210, and after executing the target action, it becomes 230.
[0085] Input the historical data including the changed second grid connection capacity data into the preset model to obtain the third load data; calculate the result of the loss function according to the second load data and the third load data.
[0086] Use the preset model to predict the third load data, which is the second function mentioned above, that is, to assist in determining the grid connection capacity variable.
[0087] In this embodiment, the result of the loss function can be based on the loss function where n is the number of data for the previous N days, p(i) is the third load data for the i-th day, and r(i) is the second load data for the i-th day.
[0088] Calculate the result of the reward function according to the result of the loss function.
[0089] In this embodiment, the result of the reward function can be calculated according to the following reward function. The reward function is:
[0090]
[0091] where L is the result of the loss function, R is the result of the reward function, and Lj+1 < Lj represents that the third load data predicted next time is closer to the actual value than the third load data predicted last time, then there is a reward.
[0092] Based on the result of the reward function, solve for the Q value according to the Bellman equation and update the Q table.
[0093] In this embodiment, the Bellman equation is
[0094] Q(S k+1 ,W k+1 )=Q(S k ,W k )+τ[R(S k ,W k )+μMax(Q(S k+1 ,W random ))-Q(S k ,W k )];
[0095] Among them, Q(sk+1, wk+1) is the Q value of the target action corresponding to the transformation of the column state from k to the row state k+1. Q(Sk, wk) is the Q value of the previous target action corresponding to the transformation of the column state from k to the row state k+1; τ = learning rate, generally 0.01; μ represents the decay rate, which can be 0.8. The essence of the Q-learning algorithm is to take into account the impact of the next step on this step. The impact of the next step on this step is not a complete impact, so there must be decay, generally 0.8; Max(Q(sk+1, Wrandom)) The next target action can be to any column state, so max is to select the largest Q value in the column state corresponding to the row state Sk+1 in the Q table; R(Sk, Wk) represents the reward function calculated after the execution of the previous target action corresponding to the transformation of the column state from k to the row state k+1.
[0096] Determine whether the result of the reward function is within a preset convergence range, and determine whether the number of updates of the Q table exceeds a preset number.
[0097] Exemplarily, the preset convergence range is greater than or equal to 1 and less than 2. The preset number of times is 10 times.
[0098] If the result of the reward function is within a preset convergence range or the number of updates exceeds a preset number, the target action corresponding to the Q value solved for the last time is determined to be the grid-connected capacity variable.
[0099] In this embodiment, if the result of the reward function is within the preset convergence range or the number of updates exceeds the preset number, the Q table is determined to be converged, and the target action corresponding to the Q value solved for the last time is determined to be the grid-connected capacity variable. For example, if the row state is 0 and the column state is 20, the target action for changing from the row state to the column state is determined to be +20, and the target action +20 is used to change the second grid-connected capacity in the historical data, and then input into the preset model to obtain the third load data, and the result of the loss function is calculated according to the third load data and the second load data, and the result of the reward function is continued to be calculated. After solving the Q value, the Q value at the intersection of the row state 0 and the column state 20 is updated to update the Q table. It is judged whether the reward function result is within the preset convergence range. For example, if the calculated reward function result is 1.3, within the preset convergence range, the target action +20 corresponding to the Q value at the intersection of the row state 0 and the column state 20 is determined to be the grid-connected capacity variable.
[0100] If the result of the reward function is not within the preset convergence range and the number of updates does not exceed the preset value, the target action determined last time is executed based on the last selected row state to determine the current row state; the column state corresponding to the maximum Q value is selected from all column states corresponding to the current row state; the current target action of converting the current row state to the column state corresponding to the maximum Q value is determined, the current target action is replaced by the target action, and the change of the second grid-connected capacity in the historical data is re-executed until the result of the reward function is within the preset convergence range or the number of updates exceeds the preset number, and the target action corresponding to the last solved Q value is determined to be the grid-connected capacity variable.
[0101] Exemplarily, the row state selected last time is 0, and the target action determined last time is executed + 20, and the row state 20 is determined this time. Then, the column state corresponding to the maximum Q value is selected from all the column states corresponding to the row state 20 this time. Since the Q value is only calculated once in the previous text based on the example in the previous text, all the column states corresponding to the row state 20 this time are still 0. Here, the column state corresponding to the maximum Q value needs to be selected randomly. If in other examples, the Q value has been calculated many times, and the Q value of all column states may not be the initial value 0 at this time, the column state corresponding to the maximum Q value is selected at this time. Following the example description in this paragraph, the column state corresponding to the maximum Q value selected from all the column states corresponding to the row state 20 this time may be + 30, and the target action for converting the row state 20 to the column state 30 this time is determined to be + 10, and the target action in the above text is replaced by this target action + 10, and the second grid-connected capacity in the historical data is changed according to the target action. The historical data including the changed second grid-connected capacity data is input into the preset model to obtain the third load data. According to the second load data and the third load data, the result of the loss function is calculated. According to the result of the loss function, the result of the reward function is calculated. Based on the result of the reward function, the Q value is solved according to the Bellman equation, and the Q table is updated. At this time, the Q value of the intersection between the row state 20 and the column state 30 is updated. It is judged whether the result of the reward function is within the preset convergence range, and whether the number of updates to the Q table exceeds the preset number. If the result of the reward function is within the preset convergence range or the number of updates exceeds the preset number, the target action corresponding to the Q value solved last time is determined to be the grid-connected capacity variable. If the result of the reward function is not within the preset convergence range and the number of updates does not exceed the preset value, the target action determined last time + 10 is executed based on the row state 20 selected last time, and the row state 30 is determined this time; the column state corresponding to the maximum Q value is selected from all the column states corresponding to the row state 30 this time; the target action of converting the row state this time to the column state corresponding to the maximum Q value is determined, and the target action of replacing the target action with the target action this time is replaced, and the second grid-connected capacity in the historical data is changed again. The change is performed until the result of the reward function is within the preset convergence range or the number of updates exceeds the preset number, and the target action corresponding to the Q value solved last time is determined to be the grid-connected capacity variable.
[0102] S200: Utilize the grid-connected capacity variable to adjust the first grid-connected capacity.
[0103] In this embodiment, adjusting the first grid-connected capacity by using the grid-connected capacity variable includes adding the grid-connected capacity variable and the first grid-connected capacity to obtain the adjusted first grid-connected capacity.
[0104] S300: Input the first weather data and the adjusted first grid-connected capacity into a preset model to output first load data.
[0105] In the embodiment of the present application, the first load data is the data of actual power generation of distributed photovoltaics. The first grid-connected capacity is the total capacity of distributed photovoltaics. It can be understood that the first load data is generally not greater than the first grid-connected capacity.
[0106] In some embodiments, the process of determining the preset model includes:
[0107] A preset model is obtained by training with the first sample set, wherein the first sample set is an adjusted second sample set, wherein the second sample set includes multiple second samples, wherein the second samples include a third grid-connected capacity, third weather data and fourth load data, and the third weather data includes multiple weather types; the adjustment process of the second sample set includes adjusting the weather type in the third weather data in the second samples according to the correlation calculated based on the weather type of the third weather data in all second samples and the fourth load data to obtain an adjusted second sample set; the weather type in the third weather data in the adjusted second sample set is the same as that in the first weather data.
[0108] In this embodiment, taking into account the diversity of weather types in weather data, the relationship between weather types and load data, as well as the relationship between different weather types are clarified by calculating the correlation between weather types and load data. This helps to construct a more reasonable first sample set for training the preset model, provide more targeted data support for the preset model, improve data availability, and further improve the accuracy of the preset model in determining the load data of distributed photovoltaics.
[0109] In an embodiment of the present application, the preset model may be an Xgboost model, and the Xgboost model may use a deep learning Xgboost algorithm to more accurately model the load data of distributed photovoltaics.
[0110] The core of the Xgboost model is the deep learning Xgboost algorithm, which is an efficient gradient boosting decision tree algorithm. The core is to use the integration idea to integrate multiple weak learners into a strong learner through a certain method. That is, multiple trees are used to make decisions together, and the result of each tree is the difference between the target value and the prediction results of all previous trees. All the results are accumulated to get the final result, so as to improve the effect of the entire model.
[0111] The preset model in the embodiment of the present application has two functions. The first function is to determine the load data of distributed photovoltaics and provide load forecasting function. The second function is to subsequently assist in determining the grid-connected capacity variable.
[0112] The preset model can also be a machine learning model, such as LSTM, RNN, GBDT, etc.
[0113] The first sample set used to train the preset model is the adjusted second sample set. The second sample set, that is, the second sample in the second sample set before adjustment, is real data and can be obtained through historical statistics. The second sample includes the third grid-connected capacity, the third weather data and the fourth load data. The third grid-connected capacity here is different from the first grid-connected capacity in the above text in specific content but in the same form, which is the sum of the grid-connected capacities of distributed photovoltaics. The second grid-connected capacity is statistically measured in days. For example, the second grid-connected capacity is xx on May 1, 2024.
[0114] The third weather data is different from the first weather data in the above text in specific content but in the same form. The third weather data can be counted in 15 minutes, that is, once every 15 minutes. The weather type in the third weather data can refer to the weather type in the first weather data.
[0115] The fourth load data is different from the first load data in specific content but in the same form as the first load data. The fourth load data may be counted in 15-minute units, that is, counted every 15 minutes.
[0116] In one example, a second sample in the second sample set includes a third grid-connected capacity on May 1, 2024, third weather data at 00:15 on May 1, 2024, and fourth load data at 00:15 on May 1, 2024. Another second sample includes a third grid-connected capacity on May 1, 2024, third weather data at 00:30 on May 1, 2024, and fourth load data at 00:30 on May 1, 2024.
[0117] In an embodiment of the present application, the adjustment process of the second sample set includes adjusting the weather type in the third weather data in the second sample according to the correlation calculated between the weather type of the third weather data in all the second samples and the fourth load data, to obtain an adjusted second sample set. In this way, the third weather data is subjected to correlation analysis, the weather types in the third weather data are appropriately deleted, useless and repeated weather types are deleted, the relative independence of the weather types in the third weather data is improved, and the weather types in the third weather data are optimized to prevent the accuracy of the trained preset model from being affected by the inclusion of a large number of redundant weather types in the third weather data, resulting in the output result of the preset model being offset when the preset model is used. If new technologies for distributed photovoltaics appear in the future, weather types that have little impact on photovoltaic equipment at this stage may have a greater impact on the new technologies for distributed photovoltaics. The correlation analysis can change the second sample set according to the changes to adapt to the optimization.
[0118] In one example, a second sample in the second sample set includes the third grid-connected capacity on May 1, 2024, the third weather data at 00:30 on May 1, 2024, and the fourth load data at 00:30 on May 1, 2024, wherein the third weather data includes sunrise time, sunset time, dew point, humidity, temperature, real-time temperature, ultraviolet rays, precipitation probability, air pressure, weather description, whether it is a working day, week, visibility, cloud cover, precipitation probability, 10-minute precipitation probability, snowfall probability, 10-minute snowfall probability, precipitation amount and snowfall amount, date and time. The second sample in the adjusted second sample set includes the third grid-connected capacity on May 1, 2024, the third weather data at 00:30 on May 1, 2024, and the fourth load data at 00:30 on May 1, 2024. It should be noted that the third weather data in the second sample in the adjusted second sample set may only include humidity, temperature, date and time. By comparison, it can be seen that the number of weather types in the third weather data in the adjusted second sample set is less than the number of weather types in the third weather data in the second sample set before adjustment. In this way, using the adjusted second sample set as the first sample set can construct a more reasonable first sample set for training the preset model.
[0119] In some embodiments, the specific steps of the adjustment process of the second sample set include:
[0120] A first correlation between the weather type and the load data is calculated based on the weather type of the third weather data and the fourth load data in all the second samples.
[0121] In this embodiment, the first correlation between each weather type in the third weather data and the load data is first calculated. Exemplarily, the third weather data includes sunrise time, sunset time, dew point, humidity, temperature, real-time temperature, ultraviolet rays, precipitation probability, air pressure, and weather description. Calculating the first correlation between each weather type in the third weather data and the load data includes calculating the first correlation between sunrise time, sunset time, dew point, humidity, temperature, real-time temperature, ultraviolet rays, precipitation probability, air pressure, and weather description, respectively, and the load data.
[0122] In some embodiments, the Pearson coefficient may be used for correlation analysis. According to the weather type of the third weather data and the fourth load data in all second samples, the first correlation between the weather type and the load data is calculated using the following formula:
[0123]
[0124] Among them, r is the first correlation between weather type and load data, Xi is the specific data of weather type in the i-th second sample, is the average value of the specific data of the weather type in all the second samples, Yi is the fourth load data in the i-th second sample, is the average value of the fourth load data in all the second samples, and n is the total number of the second samples.
[0125] The weather type whose first correlation is lower than the first target correlation is deleted from the third weather data of the second sample, and the third weather data is updated.
[0126] In this example, if the first correlation is lower than the first target correlation, it means that the corresponding weather type has little to do with the fourth load data. In order to avoid the weather type from affecting the accuracy of the subsequent preset model, the weather type is deleted from the third weather data.
[0127] Exemplarily, the second target correlation may be 0.2. When the first correlation is lower than 0.2, the weather type corresponding to the first correlation is deleted from the third weather data.
[0128] Any two weather types in the updated third weather data are taken as a weather type group, and the second correlation between the two weather types in each weather type group is calculated. The second correlation and the first correlation can be calculated using the same formula, except that the meanings of the parameters are modified accordingly.
[0129] Exemplarily, the updated third weather data includes multiple weather types, specifically dew point, humidity and temperature. At this time, any two weather types are taken as a weather type group to form three weather type groups, specifically including dew point and humidity, humidity and temperature, and dew point and temperature. The second correlation between two weather types in the three weather type groups is calculated respectively, for example, the second correlation between dew point and humidity is calculated, the second correlation between humidity and temperature is calculated, and the second correlation between dew point and temperature is calculated.
[0130] If the first correlation between two weather types in the weather type group whose second correlation in the third weather data is higher than the second target correlation and the load data are both within the same preset correlation range, one of the weather types in the weather type group is removed.
[0131] In this embodiment, there are multiple preset correlation ranges. Exemplarily, as shown in Table 1, there are five preset correlation ranges.
[0132] Table 1
[0133] Preset relevance range Correlation strength 0.8-1.0 Very strong correlation 0.6-0.8 Strong correlation 0.4-0.6 Moderately related 0.2-0.4 Weak correlation 0.0-0.2 Very weak or no correlation
[0134] In one example, the second target correlation may be 0.8, and if the second correlation between the dew point and the humidity is higher than 0.8, the first correlation between the dew point and the load data is determined to be, for example, 0.5, and the first correlation between the humidity and the load data is determined to be, for example, 0.5. Since the first correlation between the dew point and the load data and the first correlation between the humidity and the load data are both within the preset correlation range of 0.4-0.6, one of the weather types of the dew point and the humidity may be removed.
[0135] If the first correlation between two weather types in the weather type group whose second correlation in the third weather data is higher than the second target correlation and the load data is within different preset correlation ranges, the two weather types in the weather type group are retained.
[0136] In this way, the weather types whose correlation with the load data is in different preset correlation ranges can be understood, and then used to train the preset model, so that the accuracy of the preset model is improved.
[0137] In one example, the second target correlation may be 0.8, and the second correlation between the dew point and the humidity is higher than 0.8, then the first correlation between the dew point and the load data is determined to be, for example, 0.9, and the first correlation between the humidity and the load data is determined to be, for example, 0.5. Since the first correlation between the dew point and the load data and the first correlation between the humidity and the load data are both in different preset correlation ranges, one is in 0.4-0.6 and the other is in 0.8-1.0, the dew point and the humidity are retained.
[0138] The second sample set composed of the current second samples is determined as the adjusted second sample set. Before this step, the weather types in the second samples in the second sample set are simplified, and the simplified second sample set is used as the adjusted second sample set.
[0139] In some embodiments, the process of determining the second sample set includes:
[0140] A third sample set is obtained, where the third sample set includes a plurality of third samples, where the third samples include fifth load data, fourth grid-connected capacity, and fourth weather data, where the fourth weather data includes a weather description.
[0141] In this embodiment, the fifth load data may refer to the description of the first load data above. The fourth grid-connected capacity may refer to the description of the first grid-connected capacity above. The fourth weather data may refer to the description of the first weather data above. It should be noted that the fourth weather data needs to include a weather description, which may be sunny, cloudy, typhoon, etc.
[0142] The number of occurrences of each weather description in the fourth weather data is counted, and an extreme weather description is determined based on the weather descriptions whose number of occurrences is less than a preset number.
[0143] Exemplarily, the number of occurrences of each weather description such as sunny, cloudy and typhoon is counted. The preset number can be set according to actual conditions and is not limited here. For example, the preset number can be 5 times. For example, if the number of occurrences of typhoon is 4 times, typhoon is determined to be an extreme weather description.
[0144] Get fifth weather data for surrounding area including extreme weather descriptions.
[0145] A fourth grid-connected capacity on the same day as the fifth weather data and a surrounding grid-connected capacity of a surrounding area on the same day as the fifth weather data are determined.
[0146] Exemplarily, if the fifth weather data appears on April 29, 2024, the fourth grid-connected capacity of the area with the first load data and the surrounding grid-connected capacity of the surrounding areas are obtained.
[0147] Calculating a ratio of the fourth grid-connected capacity to the surrounding grid-connected capacity;
[0148] According to the ratio, the surrounding load data of the surrounding area on the same day as the fifth weather data is scaled. For example, if the ratio is 2 and the surrounding load data is A, the scaled surrounding load data is 2A.
[0149] The scaled peripheral load data, the fourth grid-connected capacity and the fifth weather data are determined as the expanded sample. It should be noted that the fifth weather data of the expanded sample needs to be the same as the weather type in the first sample. If the weather description does not exist in the first sample, the weather description in the fifth weather data is removed before determining the expanded sample.
[0150] The expanded sample is added as a third sample to the third sample set, and the current third sample set is determined as the second sample set.
[0151] In the embodiment of the present application, in order to improve the prediction effect of the preset model when encountering rare weather and extreme weather such as heavy rain, heavy snow, and haze, the second sample set is expanded to improve the prediction ability of extreme weather.
[0152] In some embodiments, before the step of determining the current third sample set as the second sample set, the method further includes: performing normalization processing and outlier processing on the current third sample set to update the current third sample set.
[0153] In this embodiment, the sample data is normalized to facilitate learning and reading of the preset model.
[0154] An embodiment of the present application provides a method for determining load data of distributed photovoltaics. In this method, the first grid-connected capacity and the first load data present a similar linear relationship in the short term, but are not a purely linear relationship in the long term. Affected by other factors such as equipment, as the first grid-connected capacity increases, the prediction model will inevitably deviate. The Q-Learning reinforcement learning algorithm is used to dynamically adjust the first grid-connected capacity. When the first load data deviates, it is adjusted back in time to avoid a larger deviation in the later period. During continuous adjustment, the preset model can always maintain a relatively high prediction accuracy.
[0155] Furthermore, as a response to the above Figure 1 The implementation of the method shown in the figure, the embodiment of the present invention provides a distributed photovoltaic load data determination device, such as Figure 2 As shown, the device comprises:
[0156] An acquisition unit 201 is used to acquire a first grid-connected capacity, first weather data and a grid-connected capacity variable, wherein the grid-connected capacity variable is determined based on historical data using a Q-Learning reinforcement learning algorithm;
[0157] An adjusting unit 202, configured to adjust the first grid-connected capacity using the grid-connected capacity variable;
[0158] The input unit 203 is used to input the first weather data and the adjusted first grid-connected capacity into a preset model to output first load data.
[0159] According to an embodiment of the present invention, a storage medium is provided, wherein the storage medium stores at least one executable instruction, and the computer executable instruction can execute the power transmission line fault monitoring method in any of the above method embodiments.
[0160] Figure 3 A schematic diagram of the structure of a terminal provided according to an embodiment of the present invention is shown. The specific embodiment of the present invention does not limit the specific implementation of the terminal.
[0161] like Figure 3 As shown, the terminal may include: a processor (processor) 402 , a communication interface (Communications Interface) 404 , a memory (memory) 406 , and a communication bus 408 .
[0162] The processor 402 , the communication interface 404 , and the memory 406 communicate with each other via a communication bus 408 .
[0163] The communication interface 404 is used to communicate with other devices such as clients or other servers.
[0164] The processor 402 is used to execute the program 410, and specifically can execute the relevant steps in the above-mentioned power transmission line fault monitoring method embodiment.
[0165] Specifically, the program 410 may include program codes, which include computer operation instructions.
[0166] The processor 402 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiment of the present invention. The one or more processors included in the terminal may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.
[0167] The memory 406 is used to store the program 410. The memory 406 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0168] The program 410 may be specifically configured to enable the processor 402 to perform the following operations:
[0169] Acquire a first grid-connected capacity, first weather data, and a grid-connected capacity variable, wherein the grid-connected capacity variable is determined based on historical data using a Q-Learning reinforcement learning algorithm;
[0170] Using the grid-connected capacity variable, adjusting the first grid-connected capacity;
[0171] The first weather data and the adjusted first grid-connected capacity are input into a preset model to output first load data.
[0172] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0173] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for determining load data of distributed photovoltaics, characterized in that: include: Acquire a first grid-connected capacity, first weather data, and a grid-connected capacity variable, wherein the grid-connected capacity variable is determined based on historical data using a Q-Learning reinforcement learning algorithm; Using the grid-connected capacity variable, adjusting the first grid-connected capacity; The first weather data and the adjusted first grid-connected capacity are input into a preset model to output first load data.
2. The method according to claim 1, characterized in that: The process of determining the grid-connected capacity variable includes: Acquire a historical data set, where the historical data set includes historical data of each day in the previous N days, where the historical data includes second weather data, second load data, and second grid-connected capacity; Based on the historical data set, a grid-connected capacity variable is determined according to a Q-Learning reinforcement learning algorithm.
3. The method according to claim 2, characterized in that The step of determining the grid-connected capacity variable based on the historical data set and according to the Q-Learning reinforcement learning algorithm comprises: Determine the incremental range of grid-connected capacity based on the second grid-connected capacity in historical data; Decomposing the grid-connected capacity increment range into a plurality of states separated by preset actions, and determining actions between the plurality of states; According to the state, a Q-table of a Q-learning algorithm is formed, wherein the rows and columns in the Q-table both represent states, the state represented by the row is the row state, the state represented by the column is the column state, and the value at the intersection of the row and the column in the Q-table is the Q value, and the Q value represents the weight of the action of transforming from the row state to the column state; Initialize the Q value in the Q table to 0; Randomly select a column state from all column states corresponding to the row state 0 in the Q table; determining a target action for changing from the row state to the selected column state, and changing a second grid-connected capacity in the historical data according to the target action; Inputting historical data including the changed second grid-connected capacity data into the preset model to obtain third load data; calculating a result of a loss function according to the second load data and the third load data; Calculate the result of the reward function according to the result of the loss function; Based on the result of the reward function, solve the Q value according to the Bellman equation and update the Q table; Determining whether the result of the reward function is within a preset convergence range, and determining whether the number of updates of the Q table exceeds a preset number; If the result of the reward function is within a preset convergence range or the number of updates exceeds a preset number, the target action corresponding to the Q value solved for the last time is determined to be the grid-connected capacity variable. If the result of the reward function is not within the preset convergence range and the number of updates does not exceed the preset value, the target action determined last time is executed based on the last selected row state to determine the current row state; the column state corresponding to the maximum Q value is selected from all column states corresponding to the current row state; the current target action of converting the current row state to the column state corresponding to the maximum Q value is determined, the current target action is replaced by the target action, and the change of the second grid-connected capacity in the historical data is re-executed until the result of the reward function is within the preset convergence range or the number of updates exceeds the preset number, and the target action corresponding to the last solved Q value is determined to be the grid-connected capacity variable.
4. The method according to claim 1, characterized in that: The process of determining the preset model includes: A preset model is obtained by training with the first sample set, wherein the first sample set is an adjusted second sample set, wherein the second sample set includes multiple second samples, wherein the second samples include a third grid-connected capacity, third weather data and fourth load data, and the third weather data includes multiple weather types; the adjustment process of the second sample set includes adjusting the weather type in the third weather data in the second samples according to the correlation calculated based on the weather type of the third weather data in all second samples and the fourth load data to obtain an adjusted second sample set; the weather type in the third weather data in the adjusted second sample set is the same as that in the first weather data.
5. The method according to claim 4, characterized in that The specific steps of the adjustment process of the second sample set include: calculating a first correlation between the weather type and the load data according to the weather type of the third weather data and the fourth load data in all the second samples; Deleting the weather type whose first correlation is lower than the first target correlation from the third weather data of the second sample, and updating the third weather data; taking any two weather types in the updated third weather data as a weather type group, and calculating a second correlation between the two weather types in each weather type group; If the first correlations between two weather types in the weather type group whose second correlation in the third weather data is higher than the second target correlation and the load data are both within the same preset correlation range, then one of the weather types in the weather type group is removed; If the first correlations between two weather types in the weather type group whose second correlation in the third weather data is higher than the second target correlation and the load data are within different preset correlation ranges, then the two weather types in the weather type group are retained; The second sample set currently composed of the second samples is determined as the adjusted second sample set.
6. The method according to claim 4, characterized in that The process of determining the second sample set includes: Acquire a third sample set, the third sample set comprising a plurality of third samples, the third samples comprising fifth load data, fourth grid-connected capacity and fourth weather data, the fourth weather data comprising weather description; Counting the number of occurrences of each weather description in the fourth weather data, and determining an extreme weather description based on the weather descriptions whose number of occurrences is less than a preset number; Get the fifth weather data of the surrounding area including description of extreme weather; Determine a fourth grid-connected capacity on the same day as the fifth weather data, and a surrounding grid-connected capacity in a surrounding area on the same day as the fifth weather data; Calculating a ratio of the fourth grid-connected capacity to the surrounding grid-connected capacity; scaling the surrounding load data of the surrounding area on the same day as the fifth weather data according to the ratio; The scaled peripheral load data, the fourth grid-connected capacity and the fifth weather data are determined as the expanded samples; The expanded sample is added as a third sample to the third sample set, and the current third sample set is determined as the second sample set.
7. The method according to claim 6, characterized in that Before the step of determining the current third sample set as the second sample set, the method further includes: The current third sample set is normalized and processed for outliers, and the current third sample set is updated.
8. A distributed photovoltaic load data determination device, characterized in that: include: an acquisition unit, configured to acquire a first grid-connected capacity, first weather data, and a grid-connected capacity variable, wherein the grid-connected capacity variable is determined based on historical data using a Q-Learning reinforcement learning algorithm; An adjusting unit, configured to adjust the first grid-connected capacity by using the grid-connected capacity variable; The input unit is used to input the first weather data and the adjusted first grid-connected capacity into a preset model to output first load data.
9. A storage medium, wherein at least one executable instruction is stored in the storage medium, and the executable instruction enables a processor to execute the method for determining load data of distributed photovoltaic according to any one of claims 1 to 7.
10. A terminal, comprising: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute the method for determining load data of distributed photovoltaic according to any one of claims 1-7.
