A virtual power plant energy scheduling method and device based on demand prediction and a medium
By using a deep learning-based demand forecasting model, combined with real-time and periodic forecasting modules, and leveraging enhanced multi-graph convolutional gated recurrent units and attention mechanisms, an energy dispatching strategy for virtual power plants is generated. This solves the problem of dynamic energy supply and demand changes in virtual power plants under high-proportion renewable energy access, and improves the accuracy and efficiency of dispatching.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- STATE GRID ZHEJIANG ELECTRIC POWER CO MARKETING SERVICE CENT
- Filing Date
- 2026-04-30
- Publication Date
- 2026-06-02
AI Technical Summary
Virtual power plants face challenges in energy dispatching, particularly in terms of the accuracy and real-time nature of demand forecasting. Traditional dispatching methods struggle to adapt to the dynamic changes in energy supply and demand, especially when a high proportion of renewable energy is integrated into the grid.
A deep learning-based demand forecasting method is adopted. By constructing a demand forecasting model that includes a real-time demand forecasting module and a periodic demand forecasting module, and utilizing an enhanced multi-graph convolutional gated recurrent unit and attention mechanism, combined with a virtual power plant scheduling optimization model, an energy scheduling strategy is generated.
It improves the accuracy of demand forecasting and the precision and efficiency of virtual power plant energy dispatch, and solves the adaptability problem of traditional dispatching methods under dynamic changes.
Smart Images

Figure CN122136879A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of virtual power plant dispatching technology, specifically relating to a virtual power plant energy dispatching method, equipment, and medium based on demand forecasting. Background Technology
[0002] Virtual power plants integrate various distributed energy resources (DERs), such as renewable energy sources like wind and solar, along with energy storage systems and controllable loads, to achieve flexible energy dispatch and optimized allocation. However, virtual power plants face numerous challenges in energy dispatch, particularly in the accuracy of demand forecasting and the real-time nature of energy dispatch. Traditional energy dispatch methods often rely on static dispatch plans, which are ill-suited to the dynamic changes in energy supply and demand within virtual power plants. Especially with a high proportion of renewable energy integration, the output of intermittent power sources such as wind and solar power exhibits uncertainty and volatility, further increasing the difficulty of energy dispatch. Furthermore, user-side electricity consumption behavior is also influenced by various external factors, such as weather conditions and holiday schedules, making demand forecasting even more complex.
[0003] In recent years, with the rapid development of artificial intelligence and big data technologies, demand forecasting methods based on machine learning and deep learning have gradually become a research hotspot. However, single demand forecasting methods are still insufficient to comprehensively address all the challenges of energy dispatching in virtual power plants. How to dynamically adjust based on real-time demand and dispatching capabilities to achieve efficient energy allocation has become an urgent problem to be solved. Summary of the Invention
[0004] To address the shortcomings of existing technologies, this invention provides a virtual power plant energy dispatching method, equipment, and medium based on demand forecasting. The method effectively improves the accuracy of demand forecasting by deeply mining spatiotemporal dependencies, introducing external factors using an attention mechanism, and employing an adaptive fusion strategy to fuse real-time demand forecasting results with periodic demand forecasting. At the same time, the method closely integrates demand forecasting with virtual power plant energy dispatching, effectively solving the problem that traditional dispatching methods are difficult to adapt to the dynamic changes in energy supply and demand in virtual power plants, thereby improving the accuracy and efficiency of virtual power plant energy dispatching.
[0005] This invention provides the following technical solution: The primary objective of this invention is to provide a virtual power plant energy dispatching method based on demand forecasting, comprising: Construct a demand forecasting model that includes a real-time demand forecasting module and a periodic demand forecasting module; The real-time demand prediction module extracts spatiotemporal features from the real-time demand sequence to obtain real-time demand prediction results. The cyclical demand forecasting module models the relationship between external factors and cyclical demand through an attention mechanism to obtain cyclical demand forecasting results. Using a gating unit, the real-time demand forecast results and the periodic demand forecast results are adaptively weighted and fused to obtain the demand forecast result; A virtual power plant scheduling optimization model is constructed, which generates energy scheduling strategies based on demand forecasting results and historical energy scheduling information.
[0006] As a further improvement of the present invention, the real-time demand prediction module employs an enhanced multi-graph convolutional gated loop unit, which includes two parallel gated loop units, wherein: One gated recurrent unit uses a relational graph convolutional network to capture the explicit spatial correlations between virtual power plants, while another gated recurrent unit uses a graph attention network to mine the hidden spatial dependencies between virtual power plants. The outputs of the two gated recurrent units are concatenated and input into a fully connected layer to generate the final hidden state, which is then decoded through a graph convolutional layer to obtain the real-time demand prediction result.
[0007] As a further improvement of the present invention, the periodic demand forecasting module is used to obtain the periodic demand forecasting result, including: The high-dimensional external factor matrix is mapped to a low-dimensional feature matrix. The attention between the historical external factor matrix and the external factor matrix of the prediction time step is calculated through an attention mechanism. The normalized attention is then used to perform weighted fusion on the periodic demand sequence to obtain the periodic demand prediction result. The high-dimensional external factor matrix is formed by splicing the historical external factor matrix and the external factor matrix at the predicted time step, and the periodic demand sequence is extracted from the historical demand matrix.
[0008] As a further improvement of the present invention, the periodic demand forecasting module further includes a demand probability forecasting branch, which uses the Sigmoid activation function to output a probability matrix of whether demand exists or not, and multiplies the probability matrix with the periodic demand forecasting result to obtain the final periodic demand forecasting result.
[0009] As a further improvement of the present invention, the generation of energy dispatching strategies using a virtual power plant dispatching optimization model includes: A one-dimensional convolutional model is used to perform vector encoding on the features of each virtual power plant to obtain the embedded vector representation of each virtual power plant; wherein, the virtual power plant features include static features and dynamic features, the static features include the spatial location coordinates of the virtual power plant, and the dynamic features include demand forecasting results and energy dispatching capabilities; We use a long short-term memory network to learn historical energy dispatch information, and calculate the conditional probability of each optional dispatch action of each virtual power plant based on the embedded vector representation of each virtual power plant and the historical energy dispatch information. After correcting the conditional probabilities based on the preset invalid action blocking rules, the energy scheduling strategy is constructed by selecting the optional scheduling action with the highest conditional probability.
[0010] As a further improvement of the present invention, the step of calculating the conditional probability of each optional scheduling action of each virtual power plant based on the embedded vector representation of each virtual power plant and historical energy dispatch information includes: The correlation alignment vector between the embedded vector representation of each virtual power plant and historical energy dispatch information is calculated using an attention mechanism. Based on the correlation alignment vector, a global context vector is calculated using a global attention mechanism. Based on the global context vector and the embedded vector representation of each virtual power plant, the conditional probability of each optional dispatch action of each virtual power plant is calculated.
[0011] As a further improvement of the present invention, the preset invalid action shielding rule includes: when the energy configuration demand of a certain area is zero, or the current virtual power plant scheduling in the area can only recover energy while the area has an energy replenishment demand, or the current virtual power plant scheduling in the area can only replenish energy while the area only has redundant energy, the conditional probability of the virtual power plant scheduling action in that area is forcibly set to zero.
[0012] As a further improvement of the present invention, an A2C reinforcement learning model algorithm is used to train a virtual power plant scheduling optimization model with the goal of maximizing the long-term expected return of virtual power plant scheduling; wherein, the A2C reinforcement learning model algorithm includes a policy generation network and an evaluation network, wherein the policy generation network is used to predict the probability distribution of scheduling actions, and the evaluation network is used to estimate the long-term benefits of the scheduling process.
[0013] A second objective of this invention is to provide a computer device comprising at least one processing unit and at least one storage unit, wherein the storage unit stores a computer program, and when the program is executed by the processing unit, the processing unit performs the aforementioned method.
[0014] A third objective of this invention is to provide a computer-readable storage medium storing a computer program executable by an electronic device, which, when run on the electronic device, causes the electronic device to perform the above-described method.
[0015] Compared with the prior art, the beneficial effects of the present invention are as follows: The method provided by this invention deeply mines the spatiotemporal dependencies, introduces external factors using an attention mechanism, and adopts an adaptive fusion strategy to fuse real-time demand forecasting results with periodic demand forecasting to obtain demand forecasting results, effectively improving the accuracy of demand forecasting. Furthermore, it closely integrates demand forecasting with virtual power plant energy dispatching, effectively solving the problem that traditional dispatching methods are difficult to adapt to the dynamic changes in energy supply and demand in virtual power plants, and improving the accuracy and efficiency of virtual power plant energy dispatching.
[0016] The demand forecasting model employs an enhanced multi-graph convolutional gated recurrent unit (EMGC-GRU) to deeply mine the spatiotemporal dependencies of demand. The model uses an architecture that prioritizes real-time demand forecasting, supplemented by historical demand forecasting and external factor forecasting. In each forecasting step, the real-time demand forecasting results based on the real-time demand sequence are fine-tuned using periodic demand forecasting results, effectively preventing the continuous accumulation of forecasting errors.
[0017] The cyclical demand forecasting module assigns differentiated weights to different cyclical demand observation matrices by calculating the similarity between historical external factors and the forecast time step. This comprehensively considers the cyclical change patterns of demand and the interference caused by changes in external factors, effectively avoiding the influence of outliers and noise in cyclical demand data and external factor data, thus significantly improving the robustness of the forecast. Furthermore, a demand probability forecasting branch is added to the cyclical demand forecasting module. By first predicting whether transferred demand exists, matrix filtering is performed, greatly alleviating the sparse forecasting problem.
[0018] To address the problem of the curse of dimensionality in traditional mathematical programming for complex scheduling, this invention proposes a virtual power plant optimization scheduling model based on attention mechanisms and reinforcement learning theory. This model embeds static and dynamic features of the virtual power plant and combines them with historical scheduling information summarized by an LSTM network to generate energy scheduling strategies for the virtual power plant under extreme scenarios where total scheduling cost and the amount of energy available for scheduling at each step are limited. Attached Figure Description
[0019] Figure 1 This is a flowchart of the method. Detailed Implementation
[0020] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0021] The present invention will now be described in further detail with reference to the accompanying drawings: like Figure 1 As shown, this embodiment provides a virtual power plant energy dispatching method based on demand forecasting, including: Construct a demand forecasting model that includes a real-time demand forecasting module and a periodic demand forecasting module; The real-time demand prediction module extracts spatiotemporal features from the real-time demand sequence to obtain real-time demand prediction results. The cyclical demand forecasting module models the relationship between external factors and cyclical demand through an attention mechanism to obtain cyclical demand forecasting results. Using a gating unit, the real-time demand forecast results and the periodic demand forecast results are adaptively weighted and fused to obtain the demand forecast result; A virtual power plant scheduling optimization model is constructed, which generates energy scheduling strategies based on demand forecasting results and historical energy scheduling information.
[0022] To achieve accurate prediction of multi-step, fine-grained load region transfer demand, this application proposes an Adaptive Feature Fusion Network (AFFN) model. This model employs a recurrent neural network architecture as its basic framework, aiming to achieve multi-step demand prediction over time series. During the prediction process, the model uses a rolling prediction mechanism: it uses the prediction results output from the previous time step (t+1). This is then used as input for the network's prediction at the next time step (t+2), and this process is repeated to continuously obtain demand prediction results for multiple future time steps.
[0023] To more clearly illustrate the forecasting process at each step, we first introduce the single-step forecasting model. The single-step forecasting model includes a real-time demand forecasting module and a periodic demand forecasting module. First, the real-time demand forecasting module generates real-time demand forecasting results based on the real-time demand sequence. Then, the periodic demand forecasting module generates periodic demand forecasting results using the periodic demand sequence and the external factor sequence. Finally, the real-time forecasting results are fine-tuned based on the periodic forecasting results to obtain the final demand forecasting result.
[0024] The real-time demand forecasting module uses only historical time steps (e.g., from a specific past time to the present time) to predict regional transfer demands for future time steps. Since each element of the transfer demand matrix is highly dependent on historical load levels, the module employs a gated recurrent unit (GRU) to capture these time-series dependencies. Simultaneously, to address the complex spatial correlation modeling problem between virtual power plants, this module designs a dual-branch parallel structure: one branch uses a relational graph convolutional network (RGCN) to integrate explicit spatial correlations across regions from multiple perspectives; the other branch uses a graph attention network (GAT) to assist in mining implicit spatial dependencies that are difficult to capture directly from expert knowledge. These two graph convolutional networks are integrated with independent GRU units, forming two parallel graph convolutional gated recurrent branches. Subsequently, the hidden states output from these two parallel branches are concatenated, and the concatenated hidden state is input into a fully connected layer for feature fusion, thereby generating the final hidden state for the current time step. In this embodiment, the overall structure consisting of the dual branches and the fully connected layer is called the Enhanced Multi-Graph Convolutional Gated Recurrent Unit (EMGC-GRU). In actual processing, two layers of EMGC-GRU stacked are used as encoders to process real-time demand sequences, and another graph convolutional layer is used as a decoder to finally output the predicted transition demand matrix for each step.
[0025] Since traditional graph convolutional networks (GCNs) can only learn node representations based on a single graph, this embodiment employs relational graph convolutional networks (RGCNs) to integrate node dependency information contained in multi-view relational graphs, thereby learning a unified node feature representation. In relational graph convolutional networks, nodes aggregate neighboring nodes in each graph, and then fuse the aggregated node features and self-loop features from multiple graphs to obtain the updated features of each node. Unlike classic relational graph convolutional networks in knowledge graph tasks that use normalized constants to aggregate neighboring nodes, relational graph convolutional networks further consider the different weights of edges in multiple graphs to help the network converge faster.
[0026] Specifically, a multi-view relationship graph is introduced in each convolutional layer. Border weight information between regions Assign weights through weighted operations The influence of different neighboring nodes varies. It's worth noting that the edge weights of each node were normalized during the construction of the multi-view relationship graph. If edge weight normalization is not performed during graph construction, it must be manually processed before inputting into the network; otherwise, problems such as excessively large differences in edge weights between nodes, gradient explosion, or vanishing gradients will occur. Furthermore, to reduce noise interference in convolution operations, an edge weight filtering hyperparameter was set. In the relational graph, the edge weight is lower than... The edges will be removed, and the remaining edges will be re-normalized. After the update, the convolution formula for the relational graph convolutional network is as follows:
[0027] in, It is the first The nodes output by each convolutional layer (area Feature representation, Let G represent the Sigmoid activation function, and G represent the set of multi-view relationship graphs. Representing a multi-perspective relationship diagram Middle node The neighboring nodes (areas with close connections), Self-looping items are used to preserve the node's own characteristics. , Is a relationship diagram and convolutional layers The relevant trainable parameters.
[0028] To combine the spatial dependency of regions in the demand with the temporal dependency of the demand sequence, a gated cyclic unit (GRU) is further employed to iteratively update nodes. State representation GRU is a variant of Recurrent Neural Networks (RNNs) primarily used to address the vanishing and exploding gradient problems found in traditional RNNs. GRU simplifies its unit structure, containing only two gated units: a reset gate and an update gate, which collaboratively control the updating and resetting of information within the same unit. Due to this structural optimization, GRU has fewer parameters, which not only helps reduce the risk of overfitting but also speeds up model training. At each time step... In GRU, the first step is to determine how much of the old hidden state should be ignored. This is achieved by learning a value between 0 and 1 to adjust the weights between the old hidden state and the new input.
[0029] During the computation, the reset gate combines the hidden state from the previous time step with the input of the current time step into a vector through matrix multiplication. Then, the sigmoid function is applied to the combined vector to obtain the output vector of the reset gate. The specific calculation formula is as follows:
[0030] in, This indicates the hidden state of the cell at the previous time step. This represents the input at the current time step. This indicates resetting the trainable parameters in the gate. This indicates a reset of the bias. This indicates the sigmoid activation operation.
[0031] In the gated recurrent unit (ROU), the update gate determines how much new information should be added to the hidden state. It learns a value between 0 and 1 to control the weights between the new input and the old hidden state. The update gate is calculated similarly to the reset gate: it combines the hidden state from the previous time step and the input from the current time step into a vector using matrix multiplication. Then, the sigmoid function is applied to the combined vector to obtain the output vector of the update gate. The calculation formula is as follows:
[0032] in, and This indicates updating the trainable parameters in the gate. This indicates that the bias is being updated.
[0033] Then, GRU is based on the reset gate output vector and the input of the current time step Calculate the new candidate hidden state The calculation formula is as follows:
[0034] in, Indicates trainable parameters, This indicates the bias term.
[0035] The tanh activation function maps the hidden state to a specific interval. This process not only introduces a nonlinear transformation but also helps maintain the hidden state within a reasonable range, thereby reducing numerical instability during gradient updates. Furthermore, since the derivative of tanh remains smooth across most input ranges, this property effectively mitigates the vanishing and exploding gradient problems during backpropagation, significantly improving the stability of model training.
[0036] Finally, based on the updated gate output vector The hidden state of the previous step and the candidate hidden state of the current step The hidden state of the current step is calculated by comprehensive calculation. The calculation formula is as follows:
[0037] Graph Attention Networks (GATs) adaptively construct graph structures using features between nodes. Compared to traditional graph convolutional networks, GATs automatically learn weights between nodes based on their relationships and the importance of features, without relying on expert experience or predefined adjacency matrices. They can automatically capture dependencies between regions based on task requirements. This approach enables more accurate modeling of connections between regions, thereby improving the accuracy of demand prediction.
[0038] In practical applications, a network structure is adopted, assuming that there is an edge between every two nodes (regions), and the edge weights are automatically learned to capture hidden dependencies. In the Gated Recurrent Unit (RGCN-GRU) based on relational graph convolutional networks, RGCN is combined with GRU to capture spatiotemporal dependencies. Similarly, in the Gated Recurrent Unit (GAT-GRU) based on graph attention networks, the hidden state representation learned from GAT is iteratively updated using GRU at each time step. (GAT-GRU hidden state representation) The update formula is as follows:
[0039]
[0040]
[0041]
[0042] in, , , , This represents the trainable parameters of GAT-GRU. , , This represents the bias term of GAT-GRU. This represents the reset gate output vector of the GAT-GRU. This represents the update gate output vector of the GAT-GRU. This represents the candidate hidden state vector of GAT-GRU.
[0043] Gated recurrent units based on relational graph convolutional networks and graph attention networks are used respectively to fully mine the spatiotemporal dependencies contained in the real-time region transfer demand sequence. The hidden states returned by the gated recurrent unit of the relational graph convolutional network are then analyzed. And the hidden state returned by the gating recurrent unit of the graph attention network. Concatenate the data, input a fully convolutional layer, and obtain the time steps. The final hidden state The calculation formula is as follows:
[0044] in, Indicates a fully connected layer. This indicates a splicing operation.
[0045] Since the graph convolution gated recurrent unit with graph attention network gating is more comprehensive in its hidden state representation than the simple relational graph convolutional network gating recurrent unit, the overall structure consisting of a bi-branch gating recurrent unit and a fully connected layer is called the enhanced multi-graph convolutional gated recurrent unit.
[0046] Using multiple graph convolutional layers enables the propagation and aggregation of information from neighboring nodes layer by layer, thereby capturing multi-level information about the graph structure and significantly improving the representational capability of graph data. Therefore, when processing real-time transfer demand sequences, a two-layer stacked EMGC-GRU is employed to deeply learn and extract the spatiotemporal dependencies in the sequence. Simultaneously, a GCN graph convolutional layer is used as a predictor to generate preliminary prediction results based on the real-time sequence. Specifically, the first layer sequentially propagates and aggregates information from neighboring nodes at each time step... Transfer demand matrix The hidden state of the EMGC-GRU layer is used as input and passed to the second layer for higher-level feature extraction. To avoid over-smoothing and maintain low computational complexity, only two EMGC-GRU layers are stacked; in practical applications, the number of stacked layers can be flexibly adjusted according to the task difficulty. The GCN layer, which acts as the predictor, then increments the time step... Hidden features obtained from Initial prediction decoded into real-time demand sequence This prediction will be combined with the cyclical transfer demand matrix sequence and external factors to further calculate a preliminary prediction based on the cyclical sequence. .
[0047] When constructing the cyclical demand forecasting module, an attention mechanism is used to model the relationship between external factors and cyclical demand observations. Data analysis results show that the closer the time periods of external factors are, the more similar the demand is. Therefore, the core logic of this module lies in using the similarity of external factors to assess the confidence level of historical demand observation data. Specifically, if the external factors corresponding to historical demand observation data are generally similar to the external factors of the forecast period, then higher attention should be given to this observation data during the forecasting process.
[0048] To avoid processing excessively long historical observation sequences and to more efficiently capture periodic patterns, specific numbers of past days are used. Historical demand observation matrices for the same period within the same time frame are extracted and constructed into periodic demand sequences. ,in, , This represents the periodic span coefficient. Using the same method, a sequence of external factors corresponding to the periodic demand sequence can be constructed. In addition to obtaining the historical external factor sequence, it is also necessary to obtain the external factor matrix at the prediction time step. .
[0049] In the previous definition, an external factor matrix included information on four aspects: holidays, weekdays, weather conditions, and air quality. While holiday and weekday information at the forecast time step is relatively easy to obtain, weather conditions and air quality data are more difficult to acquire. Two methods can be used to obtain weather conditions and air quality data at the forecast time step. The first is the alternative model: because the forecast time granularity is small (minute level), the weather across multiple time steps usually does not change significantly. Therefore, the alternative model utilizes the external factor matrix at the current time step. To replace the external factor matrix for predicting time steps The second type is the external forecasting model: Current short-term weather forecasting technology is quite accurate, and an external weather forecasting model can be trained to predict short-term weather and air quality information, thereby constructing an external factor matrix at the forecast time step. Finally, the external factor matrix at the predicted time step is concatenated with the historical external factor sequence to form the external factor input sequence. .
[0050] The periodic demand forecasting module first maps the original high-dimensional external factor matrix into a low-dimensional feature matrix through a shared embedding representation layer. Then, based on an attention mechanism, it calculates the attention between historical external factors and the external factor matrix at the prediction time step, and uses the normalized attention value as the attention weight for each periodic observed demand matrix. The calculation formula is as follows:
[0051] in, Indicates shared embedding layer parameters. This indicates a splicing operation. Indicates the prediction time step External factor matrix on Indicates historical time step External factor matrix.
[0052] Subsequently, attention values are applied to each historical observation requirement matrix, and all weighted periodic observations are fused through a graph convolutional layer to finally output the fused features. The calculation formula is:
[0053] in, Represents the attention vector. This represents the input periodic demand sequence.
[0054] Finally, another graph convolutional layer is used as a predictor to output a preliminary cycle demand prediction matrix based on the cycle demand sequence and external factors.
[0055] In demand forecasting, the transition demand matrix is typically very sparse, increasing the difficulty of forecasting. For this type of sparse forecasting task, characterized by numerous zero values, small mean, and large variance, accurately predicting the demand value is challenging, while predicting the existence of demand is relatively easy. Therefore, a demand probability branch is added to the periodic demand forecasting module to improve the overall forecasting accuracy. The demand probability branch uses the periodic demand sequence and the preliminary forecast from the real-time demand forecasting module... As input, the original data is processed through a graph convolutional layer. The 3D feature maps are converted to 1D features, and then the Sigmoid activation function is applied to output values in the interval [missing information]. probability matrix on Finally, the demand probability matrix Multiplying this by the preliminary cyclical demand forecast matrix yields the final cyclical demand forecast result. The calculation formula is as follows:
[0056] in, This represents the Sigmoid activation function; Represents the input sequence. , ⊙ indicates the multiplication operation of corresponding elements.
[0057] After obtaining the real-time demand forecast results based on the real-time demand sequence and the periodic demand forecast results based on the periodic demand sequence, the two forecast results are merged to generate the final demand forecast result.
[0058] Using periodic demand data to calibrate real-time forecasts can improve the forecast accuracy of transfer demands with obvious periodic transformation patterns. However, for transfer demands that are more real-time and less periodic, directly using real-time demand sequences for forecasting may be more accurate. Considering the characteristics of different transfer demands, a gating unit is used to automatically adjust the demand forecast against the real-time demand forecast. Or cyclical demand forecasting The degree of dependence. The final prediction result. Using a trainable gated weight matrix The calculation formula is obtained by combining the two types of predictions:
[0059] Prior to integration, the demand probability matrix returned by the periodic demand forecasting module is used to perform preliminary forecasts based on real-time demand. Filtering was performed to improve the accuracy of real-time predictions.
[0060] Demand forecasting is a regression task, and the goal of model training is to make the model's output predictions as close as possible to the target values in the labels. To achieve this, this application proposes a customized loss function. The loss function mainly consists of two terms, the first of which... The demand forecasting result (transferred demand matrix) is used to measure the final forecast. And the target prediction results (target transfer demand matrix) The difference between them is calculated using the following formula:
[0061] Preliminary forecasts based on real-time demand It plays a dominant role in the final forecast and also affects the calculation process of demand probability; therefore, it is crucial for improving forecast accuracy. (Second item) It primarily measures the initial forecast based on real-time demand. And the target prediction results (target transfer demand matrix) The difference between them is calculated using the following formula:
[0062] The final loss function of an adaptive feature fusion network (i.e., a demand forecasting model) Defined as the above loss item and The weighted sum (via the weight hyperparameter) (Adjustments are made), the goal of network training is to improve the neural network parameters. Minimize loss function The calculation formula is:
[0063] The method provided in this embodiment aims to comprehensively mine the complex spatiotemporal dependencies inherent in real-time demand sequences. To this end, an adaptive feature fusion network is designed, which includes an enhanced multi-graph graph convolutional gated recurrent unit. This unit utilizes the gated recurrent unit to mine temporal dependencies while simultaneously using a multi-graph graph convolutional module to deeply mine spatial dependencies. To comprehensively mine spatial dependencies, the multi-graph graph convolutional module employs two independent branches for spatial relationship mining: the relationship graph convolutional module mines connections between regions based on the constructed multi-view relationship graph; the graph attention network module automatically supplements and mines hidden spatial connections based on regional demand information using a graph attention mechanism.
[0064] To fully utilize external factors and cyclical demand data, and to avoid interference from noise in multi-source input data, the adaptive feature fusion network introduces a cyclical demand prediction module based on external factor attention.
[0065] To comprehensively utilize real-time demand data, historical demand data, and external factor data, and to address the issues of sparse prediction and multi-step error accumulation in multi-step fine-grained demand transfer forecasting, the adaptive feature fusion network adopts an architecture that prioritizes real-time demand forecasting and supplements it with historical demand and external factor predictions. A gating mechanism is used to adaptively fuse the two prediction results. In each prediction step, the prediction result based on the real-time demand sequence is fine-tuned through a periodic demand forecasting module, thereby preventing the continuous accumulation of prediction errors. Furthermore, the network adds a demand probability prediction branch to the periodic demand forecasting module, which, by predicting the existence of transfer demand, alleviates the sparse prediction problem to some extent.
[0066] In summary, the adaptive feature fusion network achieves accurate prediction of real-time demand by deeply mining spatiotemporal dependencies, introducing external factors using attention mechanisms, and employing an adaptive fusion strategy to fuse real-time demand prediction results with periodic demand predictions.
[0067] Furthermore, based on the distribution characteristics of virtual power plant states under different spatiotemporal and constraint conditions, this embodiment proposes a virtual power plant scheduling optimization algorithm (Attention Layer Reinforcement Learning, ALRL) based on deep reinforcement learning and attention mechanisms. This algorithm integrates attention mechanisms to construct a scheduling policy generation network within reinforcement learning. Based on this network, the ALRL model can directly solve the dynamic energy allocation problem given a virtual power plant distribution and limited scheduling capabilities, thus eliminating the cost of retraining for each new energy scheduling scenario.
[0068] In this embodiment, the virtual power plant scheduling problem specifically refers to the dynamic allocation problem under scenarios where scheduling capacity is limited (i.e., the current system capacity cannot meet all energy allocation needs). Its core optimization objective is to maximize the effective scheduling amount of overall energy while satisfying all practical constraints, thereby generating the optimal energy scheduling strategy that best meets user needs. To accurately describe this scenario of limited scheduling capacity, the relevant basic concepts in the virtual power plant scheduling process are defined as follows: Virtual power plant distribution map: In the virtual power plant scheduling problem, it is assumed that the city is divided into several parts by virtual power plants. The set formed by virtual power plants is Virtual power plants exist Energy status at any moment It can be derived from a sequence of tuples. This indicates that in the tuple and It is a virtual power plant Spatial location coordinates, Is Real-time user interaction with virtual power plants The virtual power plants are connected by edges that allow for energy dispatch based on their topological relationships, thus all virtual power plants in the city can be represented by a virtual power plant distribution map. It means that, among them It is a vertex set, and each edge Represents the effective scheduling links between nodes, with the weights on the edges using... express.
[0069] Costs in energy dispatching: Assuming the dispatching process follows... The scheduling and access strategy in the energy distribution map In the process, Indicates the scheduling path, Indicates the scheduling node; then the cost of the scheduling process. The calculation formula is:
[0070] in, Represents the vertices in the graph and The weight values between them This represents the weighting adjustment coefficient. Indicates at the vertex Dispatch of energy dispatch volume Costs and expenses.
[0071] Assumption express The energy dispatch capability of the time system Indicates at node Place Real-time scheduling of energy demand, Indicate whether or not The energy is configured at the location. This indicates the actual location affected by constraints during energy dispatching. Energy dispatch volume at the location This represents the maximum cost budget during energy dispatching. This represents the maximum energy dispatch capacity under the current constraints. The optimization objective of the virtual power plant dispatch problem is to maximize the total energy dispatch volume that meets user demand, given both cost budget and dispatch capacity constraints. Therefore, the mathematical model of the virtual power plant dispatch optimization problem can be expressed as:
[0072]
[0073] The scheduling process of virtual power plants is essentially a sequential decision-making problem involving the rational allocation of energy across a virtual power plant distribution map based on dynamic user energy demand. To address this problem, the virtual power plant scheduling optimization model provided in this embodiment calculates the probability distribution function of the set of selectable scheduling actions for each virtual power plant at each time step, based on the virtual power plant distribution map and the current system's scheduling capacity. Based on the learned probability distribution of each action, a globally optimal scheduling strategy is finally generated. .
[0074] The virtual power plant scheduling optimization model constructed in this embodiment mainly includes the following parts: A Virtual Power Plant Feature Embedding Representation Model: This model designs a robust deep learning-based embedding vector representation for the static features (including spatial coordinates), dynamic features (including demand forecasting results and energy dispatching capabilities), and environmental changes caused by dispatching of virtual power plants. The aim is to bridge the gap between complex real-time urban dispatching scenarios and high-quality, computable energy state coding.
[0075] Attention-Based Policy Generation Network: For urban energy dispatching scenarios under different spatiotemporal and constraint conditions, a deep learning model based on an attention mechanism is designed. This network combines historical energy dispatching information learned from a Long Short-Term Memory (LSTM) network to calculate the conditional probability of each optional dispatching action for each virtual power plant at each step, thereby generating energy dispatching decisions.
[0076] A deep reinforcement learning-based network parameter optimization model is employed. The A2C reinforcement learning algorithm is used to optimize the parameters of the network generated by the aforementioned strategy in an unlabeled scenario, and a corresponding evaluation network is constructed. The model fits a reward function with the objective of maximizing the long-term expected return of virtual power plant scheduling, and uses gradient optimization to iterate the network parameters, thereby solving the optimal energy allocation problem under scenarios with limited scheduling capacity.
[0077] In scenarios with limited scheduling capabilities, the original feature state dimension is often too high. Therefore, it is necessary to design a suitable feature embedding representation model to significantly reduce the time and space complexity of subsequent solutions. To this end, this embodiment proposes a deep learning-based virtual power plant feature embedding representation model, which dynamically transforms the state information of the virtual power plant into a low-dimensional embedding vector representation, successfully converting the complex physical energy scheduling process into a standard sequential decision problem.
[0078] The state characteristics of the virtual power plant are divided into a set of static characteristics. And the dynamic feature set D. Static feature set Represents the set of spatial coordinates of the virtual power plant, where, Represents a virtual power plant Spatial location coordinates. Dynamic feature set. ,in, Represents a virtual power plant In the Energy demand during energy dispatching And energy dispatching capacity Therefore, the first The set of input features of a virtual power plant during the virtual power plant scheduling process can be represented as follows: in To extract useful feature information from the input feature set, a one-dimensional deep convolutional model is used to process the input feature set. Perform vector encoding operations to obtain its embedding vector representation. The calculation formula is as follows:
[0079] in, and These are the embedding vector representations of the static and dynamic features of the virtual power plant, respectively. Represents the linking operation of vectors.
[0080]
[0081]
[0082] in, Indicates the transition from energy 0 to energy static characteristics, Indicates the first From energy 0 to energy during the energy dispatch process The dynamic feature vector.
[0083] A one-dimensional convolution model can be represented as: Here, a containing Using a window of energy to generate new features, the convolution function forms of the static and dynamic features of the virtual power plant are as follows:
[0084]
[0085] in, For non-linear activation functions, the hyperbolic tangent function is used here. It is the offset term. The convolution operation is applied to each possible state coverage window in the static and dynamic features of urban energy. and This yields the embedding vector representations of static and dynamic features. and When representing the static and dynamic features of energy status using embedded feature vectors, to ensure the independence of each virtual power plant, the width of the one-dimensional convolutional layer is set to the length of the input vector, and the number of filters is... Window energy quantity .
[0086] Long Short-Term Memory (LSTM) network models can learn data features with long-term time dependencies. Therefore, this embodiment uses them to summarize the historical energy scheduling information that has been accessed before time t during the scheduling process.
[0087] The state output vector of the hidden layer of the LSTM network As a response This is a vector representation of the dispatched state information of a virtual power plant at each time step. The core idea is to use LSTM to read the input energy dispatch access sequence step by step, thereby obtaining a vector representation containing features of the previous dispatch strategy. This vector fully extracts and encodes the location information of dispatched events that have occurred in the dispatch decision sequence.
[0088] Each time step of the LSTM network All were input Information, network internal state updates and hidden states Calculated using the following formula:
[0089] in, It is the Gate of Oblivion. It's an input gate. It's an output gate; these three variables are determined by the input variables. and hidden state variables Obtained through the sigmoid activation function; The cell state update value is represented by the input variable. and hidden state The activation function of the neural network, calculated through a neural network, is the tanh function; the cell state... Depend on Controlled and Controlled Calculated; Hidden state According to the output gate and unit state Calculated; , , , , , , , These are trainable variables; , , , This is a bias term.
[0090] The sigmoid function and The formula for calculating the function is as follows:
[0091]
[0092] Attention mechanisms are network structures used to process different parts of an input sequence. Essentially, they can be described as mapping a query and a set of key-value pairs to an output, where the query, key, value, and output are all vectors. In generating the policy sequence for the t-th step of virtual power plant scheduling, the attention layer uses a variable-length alignment vector. Extract relevant information from the input vector. Specifically, the alignment vector. This is used to quantify the correlation between each input feature vector and the current scheduling context in the virtual power plant scheduling at time t. The formula for calculating the alignment vector of the attention layer is as follows:
[0093] in, Let represent the embedded feature input vector of the i-th virtual power plant node at time t. This represents the embedded feature input vector of the j-th virtual power plant node at time t. This represents the historical scheduling policy context state vector that has occurred before time t, summarized and extracted through a neural network (such as a Long Short-Term Memory network LSTM). and These are trainable variables.
[0094] The alignment vector obtained based on the above calculations The global context vector is calculated using a global attention mechanism. The calculation formula is as follows:
[0095] Finally, combined with the global context vector The conditional probability of each selectable scheduling action in the virtual power plant scheduling at the current moment is calculated using the following formula:
[0096] in, Indicates the first Virtual power plant distribution map during energy dispatching Embedded vector representation, and It is a trainable variable. This represents the set of invalid energy dispatch decision actions determined according to constraints (i.e. invalid action shielding rules).
[0097] To address the scheduling problem of virtual power plants in scenarios with limited scheduling capabilities, this embodiment designs a specific invalid action masking rule (Masking scheme). This rule can filter physically infeasible actions in advance during the generation of scheduling decisions. Specifically, it is implemented by forcibly setting the conditional probability of actions belonging to the invalid action set. This is to enable the algorithm to converge faster and generate a feasible solution.
[0098] The invalid action shielding rules specifically include: when the energy allocation demand of a certain area is zero, or the current virtual power plant scheduling in that area can only recover energy while the area has an energy replenishment demand, or the current virtual power plant scheduling in that area can only replenish energy while the area only has redundant energy, the conditional probability of the virtual power plant scheduling action in that area is forcibly set to zero.
[0099] This study employs the Advantage Actor-Critic (A2C) reinforcement learning model to train a virtual power plant scheduling optimization model with the objective of maximizing the long-term expected return of virtual power plant scheduling. The A2C algorithm comprises two core networks working collaboratively: an Actor Network (based on an attention mechanism) predicts the probability distribution of each possible decision action during scheduling; and a Critic Network (for estimating the long-term reward of the scheduling process). The model utilizes gradient optimization to iteratively optimize the network parameters of both the Actor and Critic Networks.
[0100] The ultimate goal of virtual power plant dispatch is to maximize its expected long-term returns, that is, to maximize the total number of energy dispatched to meet user needs in scenarios with limited dispatch capacity. Therefore, the optimal dynamic energy allocation and dispatch strategy is crucial. Defined as:
[0101] in, This represents the serialized scheduling policy output by the policy generation network (Actor Network); The reward function reflects the model's performance in embedding the state vector. Next action (i.e., select the node) The return value observed after energy dispatching.
[0102] The reward function guides the A2C algorithm to adjust its strategy. This maximizes the total reward during the scheduling process. In the... During the energy dispatching process, the reward function is as follows:
[0103] in, It is in the During the virtual power plant dispatching process, for The total amount of energy that is dispatched at a location.
[0104] make The formula for calculating its derivative is as follows:
[0105]
[0106]
[0107]
[0108] To improve the training stability of the model, the A2C algorithm sacrifices a small amount of bias to significantly reduce the variance of the policy gradient. This embodiment uses temporal difference error (TD-Error) to estimate the trajectory reward, thereby transforming the gradient of the scheduling policy objective function into an expression based on the advantage function. The calculation formula is as follows:
[0109]
[0110] in, It is an action value function. Steps The advantage function.
[0111] The dominance function is estimated using the TD-Error form, and the calculation formula is as follows:
[0112] Among them, the value function Used to estimate from the current time step and subsequent status Initially, determine the total expected reward obtained by executing the current strategy; then, evaluate the value of the current scheduling strategy using an evaluation network, expressed as:
[0113] Through iterative training of the A2C algorithm described above, the parameters of the policy generation network (Actor Network) are continuously optimized. After model training is complete and the application phase begins, the trained policy generation network is used to calculate the probability distribution of each possible energy scheduling action. Then, combined with the invalid action masking rule, the action with the highest probability in the action set is selected as the optimal scheduling action for the current scheduling state. By progressively executing this decision-making process, a sequence of optimized energy scheduling strategies for scenarios with limited scheduling capacity is ultimately generated. .
[0114] To address the complex resource allocation problem in scenarios with limited scheduling capabilities, this embodiment innovatively proposes an Virtual Power Plant Scheduling Optimization Algorithm (ALRL) that integrates attention mechanisms and deep reinforcement learning theory. This algorithm overcomes the limitations of traditional scheduling plans: on the one hand, it achieves highly robust embedding representations of the dynamic and static multidimensional state features of the virtual power plant through efficient one-dimensional convolutional and long short-term memory (LSTM) networks; on the other hand, it extracts global context based on attention mechanisms and drives adaptive policy generation through an A2C reinforcement learning network. Compared to existing conventional algorithms, the ALRL model exhibits superior performance when facing multiple stringent physical constraints, directly outputting energy scheduling strategies that maximize user needs and providing virtual power plant energy scheduling solutions under limited scheduling capabilities.
[0115] This embodiment provides a computer device, including at least one processing unit and at least one storage unit, wherein the storage unit stores a computer program, and when the program is executed by the processing unit, the processing unit performs the above-described method.
[0116] This embodiment provides a computer-readable storage medium storing a computer program executable by an electronic device, which, when run on the electronic device, causes the electronic device to perform the above-described method.
[0117] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A virtual power plant energy dispatching method based on demand forecasting, characterized in that, include: Construct a demand forecasting model that includes a real-time demand forecasting module and a periodic demand forecasting module; The real-time demand prediction module extracts spatiotemporal features from the real-time demand sequence to obtain real-time demand prediction results. The real-time demand prediction module adopts an enhanced multi-graph convolutional gated recurrent unit, which includes two parallel gated recurrent units. One gated recurrent unit uses a relational graph convolutional network to capture the explicit spatial correlation between virtual power plants, and the other gated recurrent unit uses a graph attention network to mine the hidden spatial dependencies between virtual power plants. The cyclical demand prediction module models the relationship between external factors and cyclical demand through an attention mechanism to obtain the cyclical demand prediction result. The cyclical demand prediction module includes a demand probability prediction branch, which uses the Sigmoid activation function to output a probability matrix of whether demand exists or not. The probability matrix is multiplied with the cyclical demand prediction result to obtain the final cyclical demand prediction result. Using a gating unit, the real-time demand forecast results and the periodic demand forecast results are adaptively weighted and fused to obtain the demand forecast result; A virtual power plant scheduling optimization model is constructed. The A2C reinforcement learning model algorithm is used to train the virtual power plant scheduling optimization model with the goal of maximizing the long-term expected return of virtual power plant scheduling. The trained model generates energy scheduling strategies based on demand forecasting results and historical energy scheduling information.
2. The method according to claim 1, characterized in that, In the enhanced multi-graph convolution gated recurrent unit: The outputs of the two gated recurrent units are concatenated and input into a fully connected layer to generate the final hidden state, which is then decoded through a graph convolutional layer to obtain the real-time demand prediction result.
3. The method according to claim 1, characterized in that, The cyclical demand forecasting module is used to obtain cyclical demand forecasting results, including: The high-dimensional external factor matrix is mapped to a low-dimensional feature matrix. The attention between the historical external factor matrix and the external factor matrix of the prediction time step is calculated through an attention mechanism. The normalized attention is then used to perform weighted fusion on the periodic demand sequence to obtain the periodic demand prediction result. The high-dimensional external factor matrix is formed by splicing the historical external factor matrix and the external factor matrix at the predicted time step, and the periodic demand sequence is extracted from the historical demand matrix.
4. The method according to claim 1, characterized in that, Generating energy dispatch strategies using virtual power plant dispatch optimization models includes: A one-dimensional convolutional model is used to perform vector encoding on the features of each virtual power plant to obtain the embedded vector representation of each virtual power plant; wherein, the virtual power plant features include static features and dynamic features, the static features include the spatial location coordinates of the virtual power plant, and the dynamic features include demand forecasting results and energy dispatching capabilities; We use a long short-term memory network to learn historical energy dispatch information, and calculate the conditional probability of each optional dispatch action of each virtual power plant based on the embedded vector representation of each virtual power plant and the historical energy dispatch information. After correcting the conditional probabilities based on the preset invalid action blocking rules, the energy scheduling strategy is constructed by selecting the optional scheduling action with the highest conditional probability.
5. The method according to claim 4, characterized in that, The calculation of the conditional probability of each optional scheduling action for each virtual power plant based on the embedded vector representation of each virtual power plant and historical energy dispatch information includes: The correlation alignment vector between the embedded vector representation of each virtual power plant and historical energy dispatch information is calculated using an attention mechanism. Based on the correlation alignment vector, a global context vector is calculated using a global attention mechanism. Based on the global context vector and the embedded vector representation of each virtual power plant, the conditional probability of each optional dispatch action of each virtual power plant is calculated.
6. The method according to claim 4 or 5, characterized in that, The preset invalid action blocking rules include: when the energy configuration demand of a certain area is zero, or the current virtual power plant scheduling in that area can only recover energy while the area has an energy replenishment demand, or the current virtual power plant scheduling in that area can only replenish energy while the area only has redundant energy, the conditional probability of the virtual power plant scheduling action in that area is forcibly set to zero.
7. The method according to claim 1, characterized in that, The A2C reinforcement learning model algorithm includes a policy generation network and an evaluation network. The policy generation network is used to predict the probability distribution of scheduling actions, and the evaluation network is used to estimate the long-term benefits of the scheduling process.
8. A computer device, characterized in that, It includes at least one processing unit and at least one storage unit, wherein the storage unit stores a computer program that, when executed by the processing unit, causes the processing unit to perform the method as described in any one of claims 1 to 7.
9. A computer-readable storage medium, characterized in that, It stores a computer program executable by an electronic device, which, when run on the electronic device, causes the electronic device to perform the method as described in any one of claims 1 to 7.