Microgrid source load prediction matching method based on graph neural network and attention mechanism

By constructing dynamic heterogeneous graph and spatiotemporal graph attention networks, and combining multi-scale attention mechanisms and the Sinkhorn algorithm, the problems of insufficient utilization of topological information and poor dynamic adaptability in microgrid source-load matching prediction are solved. This achieves high-precision and fast source-load matching and control strategy generation, thereby improving the operation economy and stability of microgrids.

CN121981318APending Publication Date: 2026-05-05ZHONGYAODA DIGITAL ENERGY ECOLOGICAL TECH (ZHEJIANG) CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ZHONGYAODA DIGITAL ENERGY ECOLOGICAL TECH (ZHEJIANG) CO LTD
Filing Date
2025-12-22
Publication Date
2026-05-05

AI Technical Summary

Technical Problem

Existing microgrid source-load matching prediction methods fail to fully utilize topology information, struggle to process non-Euclidean data, exhibit poor dynamic adaptability, lack of local optimization capabilities, and fail to meet real-time requirements, resulting in insufficient prediction accuracy and control response speed.

Method used

A dynamic heterogeneous graph is constructed using a graph neural network and attention mechanism. The complex coupling relationship between source and load is deeply mined through a spatiotemporal graph attention network to achieve high-precision matching prediction and generate real-time, optimal control strategies. The optimal matching matrix is ​​calculated by combining a multi-scale attention mechanism and the Sinkhorn algorithm.

Benefits of technology

It significantly improves the economic efficiency, safety, and ability to absorb new energy sources in microgrids, with a 10-15% improvement in prediction accuracy, a 75% increase in dynamic adaptability, a 50% acceleration in system response speed, a 60% improvement in voltage/frequency stability, and a 15-20% reduction in overall operating costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121981318A_ABST
    Figure CN121981318A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of micro-grids, in particular to a micro-grid source load prediction matching method based on a graph neural network and an attention mechanism. The method comprises the following steps: acquiring multi-dimensional data of a micro-grid, and constructing a heterogeneous graph based on the multi-dimensional data; based on the heterogeneous graph, space graph convolution features and time sequence features are extracted, and unified space-time features are obtained through space-time graph attention network fusion; constructing a hierarchical attention network, and outputting the enhanced spatial-temporal characteristics of each node; respectively predicting an available power output sequence, a power demand sequence and a cost matrix through three decoders; calculating an optimal matching matrix with the minimum total transmission cost; and converting the optimal matching matrix into an equipment control instruction, issuing the equipment control instruction to an equipment controller, and taking an execution result and the newest state of the power grid as new multi-dimensional data. According to the method, high-precision matching prediction is realized, and a real-time and optimal control strategy is generated, so that the operation economy, safety and new energy consumption capability of the micro-grid are remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of microgrid technology, and specifically to a microgrid source-load prediction and matching method based on graph neural networks and attention mechanisms. Background Technology

[0002] Currently, the following technical solutions are mainly used for predictive control of source-load matching in microgrids:

[0003] Option 1: Time-series-based predictive control method: Traditional methods use time-series forecasting models such as ARIMA and LSTM to predict source-side power and load-side demand separately, and then use optimization algorithms to perform source-load matching. For example, patent CN108964103A discloses a microgrid load forecasting method based on LSTM neural network, which uses historical load data to train an LSTM model to achieve short-term load forecasting.

[0004] Option 2: Model Predictive Control (MPC) Based Method: Existing technologies employ the MPC framework to establish a state-space model of the microgrid and achieve source-load matching control through rolling optimization. Patent CN109921458A describes a multi-time-scale coordinated optimization scheduling method for microgrids, which uses a hierarchical optimization strategy to handle scheduling problems at different time scales.

[0005] The existing technology has the following drawbacks:

[0006] 1. Prediction models fail to fully utilize topology information: Traditional prediction methods are mostly based on time series models (such as ARIMA, LSTM, etc.), which treat each device in the microgrid as an independent time series for prediction, completely ignoring the electrical topology and mutual coupling relationships formed between devices through physical lines. This leads to a sharp drop in prediction accuracy when the network structure changes (such as line maintenance or switching from islanded operation mode).

[0007] 2. Machine learning methods have difficulty handling non-Euclidean data: Standard machine learning or deep learning models mainly deal with Euclidean spatial data, which cannot directly model the natural and complex graph structure data of microgrids. This limits the model's ability to learn complex power flow patterns and dynamic characteristics from the perspective of the entire network.

[0008] 3. Poor dynamic adaptability: When the microgrid topology changes (such as equipment switching or line reconfiguration), the existing prediction model needs to be retrained, which results in poor adaptability and an inability to achieve online learning and dynamic adjustment.

[0009] 4. Insufficient global optimization capability: Existing methods mostly adopt local optimization strategies and lack global optimality guarantees. Under complex constraints, they are prone to getting trapped in local optima, and the system's economy and reliability need to be improved.

[0010] 5. Real-time requirements are difficult to meet: Traditional optimization algorithms have high computational complexity and are difficult to meet the millisecond-level control response requirements of microgrids. The control delay is usually above the second level. Summary of the Invention

[0011] The purpose of this invention is to address the problems existing in the prior art and propose a microgrid source-load prediction and matching method based on graph neural networks and attention mechanisms. This invention can uniformly model the dynamic topology and time-varying characteristics of equipment in a microgrid, deeply mine the complex coupling relationships between sources and loads through a spatiotemporal graph attention network, achieve high-precision matching prediction, and generate real-time, optimal control strategies, thereby significantly improving the operational economy, safety, and renewable energy absorption capacity of the microgrid.

[0012] To achieve the above objectives, the technical solution provided by this invention is as follows:

[0013] A microgrid source-load prediction and matching method based on graph neural networks and attention mechanisms includes:

[0014] Acquire multi-dimensional data of the microgrid and construct a heterogeneous diagram for each time point based on the multi-dimensional data;

[0015] Spatial graph convolutional features and time series features are extracted based on the heterogeneous graph at each time step. The spatial graph convolutional features and time series features are then fused through a spatiotemporal graph attention network to obtain unified spatiotemporal features at each time step.

[0016] A hierarchical attention network is constructed, which outputs the enhanced spatiotemporal features of each node based on the unified spatiotemporal feature sequence of each node within the historical time window, and combined with the graph topology and node features of the heterogeneous graph.

[0017] Based on the enhanced spatiotemporal features, the available power output sequence, power demand sequence, and cost matrix are predicted by three decoders, respectively.

[0018] The optimal matching matrix that minimizes the total transmission cost is calculated based on the available power output sequence, the power demand sequence, and the cost matrix.

[0019] The optimal matching matrix is ​​converted into equipment control commands. After simulating the equipment control commands, they are sent to the equipment controller. The execution results and the latest state of the power grid are collected after the commands are executed, and the execution results and the latest state of the power grid are used as new multi-dimensional data.

[0020] Furthermore, the spatial graph convolutional features and temporal series features extracted based on the heterogeneous graph at each time step are fused with the spatial graph convolutional features and temporal series features through a spatiotemporal graph attention network to obtain unified spatiotemporal features at each time step, including:

[0021] Extracting spatial graph convolutional features using a multi-layer graph convolutional neural network;

[0022] The node output by the final layer of the graph convolutional neural network at each time step The weighted sum of all neighbor features for each node at time step Spatial graph convolution features;

[0023] The spatial graph convolutional features of each node at each time step are input into the gated recurrent unit of each node, and the time series features of each node at each time step are output.

[0024] The correlation scores between spatial graph convolutional features and time series features are calculated and weighted summation is performed to generate unified spatiotemporal features for each time step.

[0025] Furthermore, the hierarchical attention network includes a device-level attention layer, a region-level attention layer, and a network-wide attention layer;

[0026] The unified spatiotemporal features of each node within the historical time window are input into the device-level attention layer. The attention weight of each time step is calculated, and the unified spatiotemporal feature sequence is weighted and aggregated based on the attention weight of each time step to obtain the device-level time enhancement features.

[0027] Based on the weighted adjacency matrix, initial node features, and spatial graph convolution features in the heterogeneous graph, a region-level attention layer is used to obtain inter-region feature representations.

[0028] The unified spatiotemporal features of all nodes are aggregated to obtain a global context vector. The attention score between the global context vector and the unified spatiotemporal features of each node is calculated. A global attention weight is assigned to each node based on the attention score. The unified spatiotemporal features of each node are weighted and aggregated based on the global attention weight to obtain a network-wide feature representation.

[0029] The device-level temporal enhancement features, inter-regional feature representations, and network-wide feature representations are aligned at multiple scales, concatenated, and then input into the feature fusion layer. The fusion weights of each feature representation are calculated and weighted fusion is performed to output the enhanced spatiotemporal features.

[0030] Furthermore, the method of obtaining inter-region feature representations based on the weighted adjacency matrix, initial node features, and spatial graph convolution features in the heterogeneous graph, using a region-level attention layer, includes:

[0031] Based on the weighted adjacency matrix, initial node features, and spatial graph convolution features in the heterogeneous graph, the microgrid is divided into several regions;

[0032] Max pooling is performed on the unified spatiotemporal features of all nodes in the region to obtain the region overview vector. The dot product similarity between the region overview vector and the unified spatiotemporal features of each node in the region is calculated and normalized using the Softmax function to obtain the attention weight. Based on the attention weight, the unified spatiotemporal features of all nodes in the region are weighted and summed to obtain the region-level weighted feature representation.

[0033] A region map is constructed based on the region-level weighted feature representation of the target region and the region-level weighted feature representations of all other regions. The attention weights between the target region and all other regions are calculated, and the inter-region feature representations are obtained based on the inter-region attention weights.

[0034] Furthermore, the calculation of the optimal matching matrix that minimizes the total transmission cost based on the available power output sequence, the power demand sequence, and the cost matrix includes:

[0035] The available power output sequence, power demand sequence, and cost matrix are input into the Sinkhorn algorithm layer to calculate the optimal matching matrix that minimizes the total transmission cost.

[0036] Compared with the prior art, the significant advantages of this invention are:

[0037] 1. Significant improvement in prediction accuracy and dynamic adaptability:

[0038] This invention effectively solves the problem of traditional methods ignoring topological information by constructing a dynamic heterogeneous graph (step S101) and using a spatiotemporal graph attention network (step S102) for feature extraction, enabling the prediction model to deeply understand the physical laws and dynamic characteristics of microgrids.

[0039] Short-term power forecast accuracy is improved by approximately 10-15%. For highly uncertain power sources such as photovoltaics and wind power, the forecast accuracy of traditional time series models at the 15-minute to 1-hour level is typically between 80-85%. This invention combines the spatial adjacency relationships of nodes with temporal evolution patterns, enabling a stable improvement in short-term forecast accuracy to 92-95%. Similarly, for load forecasting, by learning the correlation of electricity consumption patterns among users, the mean absolute percentage error (MAPE) of load forecasting can be reduced by 3-5 percentage points.

[0040] The method exhibits strong topology adaptability, with prediction performance degradation reduced by over 70% under extreme conditions. In the event of topology changes such as line faults, equipment switching, or islanding / grid-connected mode switching, the prediction performance of traditional models drops sharply, with errors potentially increasing by 20-30%. The dynamic graph update mechanism of this invention (step S101.3) enables the model to perceive topology changes in real time, thus minimizing prediction performance degradation. Simulation tests show that in typical scenarios such as N-1 faults, the prediction accuracy of the method in this invention decreases by no more than 5%, compared to the over 20% performance degradation of traditional methods, demonstrating a robustness improvement of at least 75%.

[0041] 2. Comprehensive optimization of control performance and economic benefits:

[0042] This invention integrates the optimization objective into the model training through source-load matching prediction (step S104), achieving a leap from the separation of prediction and optimization stages to decision integration, thereby bringing significant performance and economic benefits.

[0043] The overall system operating cost is reduced by 15-20%. Traditional methods first perform power prediction and then perform economic dispatch based on the prediction values. Prediction errors directly lead to suboptimal dispatch schemes. The integrated prediction of this invention is directly guided by the generation of the optimal matching strategy, and its output dispatch scheme can better avoid the risks caused by prediction uncertainty. Through more precise energy storage charging and discharging management, reduced dependence on high-cost backup power sources, and minimized network losses, the daily overall operating cost of microgrids can be reduced by 15-20%.

[0044] The renewable energy integration rate is increased by 8-12%. Through the multi-scale attention mechanism (step S103) for precise feature extraction of regional source-load characteristics and the integrated prediction for early assessment of potential wind and solar curtailment risks, this system can generate more refined local integration and energy storage transfer strategies. For example, during the midday peak photovoltaic power generation period, the system can more accurately match and guide the integration of adjustable loads (such as charging piles and air conditioners) in the region, thereby increasing the local integration rate of renewable energy from about 80% to over 90%.

[0045] This invention achieves the direct generation of optimal matching strategies: existing technologies can only predict power values ​​but cannot directly provide the optimal matching relationship between source and load. This invention, through the differentiable Sinkhorn algorithm (step S104.2), is the first to achieve the function of directly generating the optimal source-load matching matrix end-to-end. This matrix not only satisfies power balance but also incorporates multiple optimization objectives such as network constraints and economic costs, significantly improving the intuitiveness and efficiency of scheduling decisions.

[0046] 3. Significantly enhanced system response speed and stability:

[0047] The end-to-end architecture and closed-loop control design of the present invention (step S105) greatly shortens the decision-making chain and improves the real-time response capability and overall stability of the system.

[0048] The control decision-making speed is accelerated by more than 50%, achieving near real-time response. Traditional chain-like decision-making processes involving sensing, prediction, optimization, and control typically take hundreds of milliseconds to several seconds. This invention's integrated model combines the prediction and optimization steps into one, reducing the entire process from data acquisition to final control command generation to within 200 milliseconds. This near real-time response speed enables the system to effectively cope with rapid power fluctuations in the power grid, improving the system's dynamic stability.

[0049] Enhanced ability to perceive key information improves system resilience. A multi-scale attention mechanism (step S103) enables the model to dynamically focus on key information from massive amounts of data. For example, when the voltage of a critical node is about to exceed its limit, the attention weights at the device and region levels rapidly increase, guiding the system to prioritize control measures to stabilize the voltage in that region. This rapid identification and response capability for critical events transforms the system from passively responding to faults to proactively preventing them, significantly improving the operational resilience of the microgrid.

[0050] With improved voltage / frequency stability, and thanks to faster control response and superior scheduling strategies, this invention can more effectively mitigate the impact of renewable energy fluctuations and load shocks on the power grid. Simulation results show that, under the same disturbance conditions, microgrids using the method of this invention can reduce the voltage over-limit probability of critical buses by approximately 60% and the maximum system frequency deviation by approximately 40%, significantly improving power quality and supply reliability. Attached Figure Description

[0051] Figure 1 The flowchart below shows a microgrid source-load prediction and matching method based on graph neural networks and attention mechanisms according to the present invention.

[0052] Figure 2 This is an architectural diagram of the heterogeneous graph of the present invention;

[0053] Figure 3 This is a cross-sectional view of the dynamic graph sequence of the weighted adjacency matrix of this invention;

[0054] Figure 4 This is a diagram of the unified spatiotemporal feature extraction architecture based on spatiotemporal graph attention network of the present invention;

[0055] Figure 5 This is a diagram of the hierarchical attention fusion architecture of the present invention;

[0056] Figure 6 This is a diagram of the integrated source-load matching prediction architecture of the present invention;

[0057] Figure 7 This is a diagram illustrating the closed-loop control strategy generation and distribution architecture of the present invention.

[0058] Figure 8 This is a schematic diagram of the architecture of the microgrid in an industrial park according to Embodiment 2 of the present invention;

[0059] Figure 9 This is a module execution architecture diagram of an industrial park microgrid in Embodiment 2 of the present invention. Detailed Implementation

[0060] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0061] Example 1:

[0062] like Figures 1-7 As shown, the present invention provides a microgrid source-load prediction and matching method based on graph neural networks and attention mechanisms, which specifically includes the following steps:

[0063] S101: Steps for constructing a heterogeneous diagram of a microgrid.

[0064] This step involves accurately mapping and constructing a machine-learnable, dynamic, heterogeneous graph model of the physical microgrid system and its complex operational information. This aims to provide a unified data foundation that comprehensively reflects the system topology, heterogeneous characteristics of equipment, and real-time dynamics for subsequent feature extraction and predictive control.

[0065] S101.1: Acquisition of real-time operation data of microgrids.

[0066] First, the system acquires multi-dimensional, heterogeneous multi-dimensional data in real time from multiple information sources within the microgrid through a data acquisition interface. The data sources include at least:

[0067] SCADA (Supervisory Control and Data Acquisition) system: provides key electrical quantity information across the entire network, with sampling periods typically ranging from seconds to minutes, such as voltage amplitude and frequency of each bus, active / reactive power flow of each line, and transformer load rate.

[0068] PMU (Phasor Measurement Unit): A phasor measurement unit is deployed at critical nodes to provide high-precision dynamic information such as voltage, current phasors, frequency, and rate of change of frequency at a high sampling rate of milliseconds, in order to capture the transient characteristics of the system.

[0069] EMS (Energy Management System): Provides information on the control status of equipment, operating mode (grid-connected / islanded mode), state of charge (SOC) of energy storage units, and load classification.

[0070] Equipment ledger database: Provides static parameters of equipment, rated capacity and gradeability limits of generator sets, rated power and energy of energy storage batteries, model, length and impedance parameters of lines, rated capacity and turns ratio of transformers, etc.

[0071] Weather forecasting system: Provides short-term (e.g., 15 minutes to 4 hours) environmental forecast data such as light intensity, wind speed, and temperature for renewable energy nodes such as photovoltaic and wind power.

[0072] Communication network management system: provides the status of information exchange links between nodes, communication latency, bandwidth, packet loss rate, etc.

[0073] S101.2: Construction of heterogeneous graph models.

[0074] After acquiring the data, a time-based model is constructed based on the physical structure and logical relationships of the microgrid. Snapshot of the image .in, express The feature matrix of all nodes at time 1000. express The weighted adjacency matrix at time step.

[0075] in, For nodes: The entities in the microgrid are abstracted into four types of heterogeneous nodes, and their characteristics are extracted and assigned from the acquired data, specifically including:

[0076] Power Node Each power generation / storage unit is modeled as a power node. Its feature vector includes: [rated capacity, real-time active power output, real-time reactive power output, available reserve capacity, upper / lower limit of ramp rate, operating cost factor, (for energy storage) SOC, maximum charge / discharge power].

[0077] Load Node Each load aggregation point is modeled as a load node. Its feature vector includes: [load priority (e.g., level 1-5), real-time active power consumption, real-time reactive power consumption, interruptibility flag, adjustable range upper / lower limit, demand response price].

[0078] Network Nodes Each busbar, transformer, circuit breaker, etc., is modeled as a network node. Its feature vector includes: [(for busbars) rated voltage level, real-time voltage amplitude, real-time phase angle; (for transformers) rated capacity, real-time load rate; (for circuit breakers) on / off state].

[0079] control node Each controller or smart terminal is modeled as a control node. Its feature vector includes: [Device ID, Control Mode (Local / Remote), Communication Protocol Type, Latest Command Execution Status].

[0080] Edges: The relationships between nodes are abstracted into various types of edges and assigned corresponding attributes:

[0081] Electrical connection edge: Connects nodes with a physical electrical path relationship. Its attribute vector includes: [line / equipment impedance, rated transmission capacity, real-time power flow, real-time loss].

[0082] Control / Information Edge: Connects nodes with control or data flow relationships. Its attribute vector includes: [communication latency, bandwidth, protocol type, link reliability].

[0083] for Weighted adjacency matrix at time step: Generate a weighted adjacency matrix based on the definitions of nodes and edges. Matrix elements The value is calculated based on the edge type and attributes. Represents a node To the node The weight of the edge. For example, for an electrical connection edge, the weight can be set as the reciprocal of the normalized impedance. ,in, Indicates the connection node and nodes The line impedance or equipment impedance, used to represent the node. and nodes The degree of electrical tightness between them. For the control / information edge, the weight can be associated with communication quality (such as 1 − packet loss rate).

[0084] S101.3: Dynamic graph update.

[0085] To ensure the model can respond to system changes, this step includes a dynamic update mechanism. The system continuously monitors preset event triggers, and once it detects events such as a circuit breaker status changing from 1 to 0, energy storage SOC falling below the alarm threshold, or a communication link interruption, it immediately performs a graph update operation to generate a new graph snapshot. This allows the dynamics of the microgrid to be fully encoded into the graph data stream.

[0086] S102: Spatiotemporal feature extraction steps based on spatiotemporal graph attention network.

[0087] This step constructs a spatiotemporal graph attention network model, processes the dynamic heterogeneous graph sequence output in step S101, extracts the spatial features of the microgrid topology and the temporal evolution features of the operating state, and performs feature fusion to obtain a unified spatiotemporal feature representation of the nodes.

[0088] S102.1: Spatial Graph Convolution Feature Extraction. Graph Convolutional Neural Networks (GCN) or Graph Attention Networks (GAT) are used to perform convolution operations on graph-structured data, aggregating the feature information of the target node and its neighboring nodes to extract the spatial association features of nodes in the network topology.

[0089] This invention employs a multi-layered (e.g., 3 to 5 layers) Graph Convolutional Neural Network (GCN) or a variant thereof, such as a Graph Attention Network (GAT). Each layer of graph convolutional operation performs an information aggregation and update.

[0090] In the Layer, for any node Its new features represent By aggregating all its neighbor nodes Feature representation at the next layer To calculate, among which, For nodes The set of neighboring nodes. Specifically, a Gaussian Attention (GAT) mechanism is used for each neighbor. Calculate an attention weight This weight represents the neighboring node's position in the current network state. For nodes The importance of the nodes. The new feature is the weighted sum of the features of all its neighbors:

[0091] ;

[0092] in, It is the first The learnable weight matrix of a layered graphical convolutional neural network. It is a non-linear activation function. It is a node neighboring nodes Attention weights It is a node neighboring nodes In the The output of a layered graph convolutional neural network, when hour, That is, a node The initial feature vector defined in step S101.2, It is a node In the The weighted sum of features from all neighbors in a layered graph convolutional neural network.

[0093] By using a single layer of graph convolution, a node can obtain information about its first-order neighbors. Through stacking... A layer, a node can perceive its All information within the order neighborhood is implicitly encoded in its final embedded representation, thus encoding its position and context information within the entire network topology.

[0094] S102.2: Time series feature extraction.

[0095] At each time step After completing the spatial graph convolution, for each node This yields an embedded representation that includes the topological information at that moment. (That is, the spatial graph convolutional features output in step S102.1). Arranged in chronological order, they constitute the spatiotemporal feature sequence of each node. .

[0096] To capture the temporal dependencies in this sequence, this invention deploys a gated recurrent unit (GRU) for each node. The GRU can effectively learn long-term dependencies in spatiotemporal feature sequences, such as the intraday periodicity of photovoltaic output, the weekly pattern of load, and the evolution trend of the system state from one stable point to another. The output of the GRU is the current state of each node. Hidden state that integrates historical time information (i.e., time series characteristics).

[0097] S102.3: Spatiotemporal Feature Fusion. This aims to achieve efficient and deep coupling of spatial and temporal information.

[0098] Convolve the spatial graph at each time step Output (Representing the spatial state at this moment) and the output of the time series module at the same time. (Representing the time memory up to this moment) is fused. This invention preferably employs a fusion strategy based on an attention mechanism, such as cross-attention. This mechanism calculates... and The correlation scores between them are calculated, and a weighted sum is performed to generate the final unified spatiotemporal feature representation. Unified spatiotemporal feature representation It includes nodes The location and neighborhood relationships within the overall network topology also contain their own historical evolution patterns, laying a solid foundation for subsequent accurate predictions.

[0099] S103: Multi-scale attention fusion step.

[0100] A hierarchical attention network is constructed to weight the unified spatiotemporal features from three dimensions: device level, region level, and network-wide level, in order to extract system state features at different granularities, and to achieve the fusion of multi-scale features through dynamic weight allocation.

[0101] S103.1: Device-level attention layer. This is the most microscopic scale, focusing on the key dynamics of each device itself. It provides unified spatiotemporal features for each node output from S102. It applies a self-attention mechanism, which analyzes nodes. In the historical time window Feature sequences within And assign a weight to each time step in the feature sequence. This allows the model to focus on the historical moments that are most important for the current prediction. Specifically, nodes... in the past arrive The unified spatiotemporal features between time points are input into the device-level attention layer. The device-level attention layer automatically learns from the input and then performs a weighted summation. The final output is a single, temporally enhanced feature vector with dimensions of [missing information]. This can be understood as the node past A summary of the behavior at each moment.

[0102] S103.2: Regional Attention Layer. This is a mesoscale layer that focuses on the collaborative behavior of functional clusters within the microgrid.

[0103] First, based on the real-time graph topology and node characteristics, the system dynamically divides the microgrid into several functional regions using an unsupervised graph clustering algorithm. The division can be based on factors such as electrical distance and functional complementarity. Here, the graph topology refers to the weighted adjacency matrix generated in step S101. Node features refer to: initial features (such as node type, capacity, load, priority, etc.) and spatial graph convolution features in S102. The purpose of graph clustering is to find relatively stable, physically meaningful sub-regions in a microgrid, and therefore it relies more on the network's structural information and static / quasi-static information.

[0104] For each region, the features of all nodes within it are first aggregated to form a region overview feature. Then, an attention mechanism is used to learn the contribution of devices within a region to the overall state of that region (such as power imbalance) and the mutual influence relationships between regions.

[0105] Specifically, based on the weighted adjacency matrix, initial node features, and spatial graph convolution features in the heterogeneous graph, the microgrid is divided into several regions. Max pooling is applied to the uniform spatiotemporal features of all nodes within each region to obtain a region overview vector. The dot product similarity between this vector and the uniform spatiotemporal features of each node within the region is calculated, and then normalized using the Softmax function to obtain attention weights. These attention weights are then used to apply attention to the uniform spatiotemporal features of all nodes within the region. (Value) is weighted and summed to obtain the regional weighted feature representation. The formula is:

[0106] ;

[0107] in, This represents the set of nodes contained in the region. For nodes Attention weights For nodes The unified spatiotemporal characteristics.

[0108] Based on the clustering results of heterogeneous graphs, each partitioned region is considered a node in the region graph. During feature update calculation, the specific region for which the enhanced feature representation is currently being calculated is defined as the target region, and all other regions are defined as neighboring regions. The correlation between the region-level weighted feature representation of the target region and the region-level weighted feature representations of all neighboring regions is calculated to obtain attention weights. Based on these attention weights, the region-level weighted feature representations of all neighboring regions are summed in a weighted manner to aggregate the inter-regional feature representation of the target region.

[0109] S103.3: Network-wide Attention Layer. This is the most macroscopic level, focusing on the impact of the global state of the entire system on local decisions.

[0110] Global Context Vector: This vector aggregates the unified spatiotemporal features of all nodes to generate a global context vector representing the current macroscopic state of the entire network. This vector may indicate whether the system as a whole is in a state of power surplus or deficit, or whether the voltage level is too high or too low, etc.

[0111] Global Information Guidance: The attention score between the global context vector and each unified spatiotemporal feature is calculated. Based on the attention score, a global attention weight is assigned to each node. The unified spatiotemporal features of each node are then weighted and aggregated based on this global attention weight to obtain a network-wide feature representation. The attention score determines the degree of influence of the global state on the decisions of each device. For example, when the global context is characterized as "severe power shortage across the network," the features of all energy storage nodes will be assigned a "discharge" tendency guidance.

[0112] S103.4: Dynamic weight allocation and fusion.

[0113] First, multi-scale feature alignment is performed: the network-wide feature representation is copied and expanded to a dimension consistent with the number of nodes; the regional feature representation is assigned to each node within a region according to the mapping relationship of the region to which the node belongs. At this point, for each node in the microgrid... All of them obtained three-dimensional feature vectors: device-level time augmentation features Regional characteristics and network-wide features .

[0114] Subsequently, the three feature vectors are concatenated and input into the feature fusion layer (composed of a multilayer perceptron and a softmax activation function) for each node. The three scalar fusion weights are dynamically calculated: (Device-level weights) (Regional weights) and (Network-wide weight).

[0115] Finally, the three feature vectors are summed based on these weights to output the node. Final enhanced spatiotemporal features The formula is as follows:

[0116] ;

[0117] Through this step, the model can adaptively adjust the degree of attention each node pays to features at different scales based on the current running state.

[0118] S104: Source-load matching integrated prediction steps.

[0119] This step utilizes a unified, end-to-end trainable framework to simultaneously complete two tasks: power prediction and matching policy optimization, ensuring that the prediction results and optimization objectives are highly coupled and consistent at the model level.

[0120] S104.1: Multi-step power prediction sequence generation. Based on the enhanced spatiotemporal features, the system performs multi-step power prediction using two parallel prediction heads (source-side power prediction head and load-side demand prediction head):

[0121] The source-side power prediction head is a dedicated decoder that takes the enhanced features of all power nodes as input and outputs a sequence of their available power outputs over multiple future time steps. The decoder can employ a multilayer perceptron or a sequence decoder with an attention mechanism.

[0122] The load-side demand forecasting head is similar in structure to the source-side power forecasting head. It takes the enhanced features of all load nodes as input and outputs their power demand sequence within the same future time step.

[0123] S104.2: Solving for the optimal source-load matching matrix. This transforms a classic operations research optimization problem (optimal matching) into a differentiable neural network layer, which can then be integrated into end-to-end deep learning training.

[0124] The system does not directly predict the matching matrix. Instead, it predicts a cost matrix by using a third prediction head (cost matrix prediction head) that runs in parallel with the source-side power prediction head and the load-side demand prediction head, taking into account the enhanced features of all source and load nodes. Matrix elements Indicates power supply Unit power distributed to load The generalized cost, which can be a comprehensive reflection of factors such as power loss, operating expenses, network congestion, and even carbon emissions, is automatically learned by the model during training.

[0125] Available power output sequence, power demand sequence, and cost matrix The input is fed into a differentiable Sinkhorn algorithm layer. This layer is built upon the Sinkhorn-Knopp iterative algorithm, which transforms the discrete optimal transport problem into a continuous differentiable operation by introducing an entropy regularization term. Specifically, it performs multiple rounds of row and column normalization iterations on the matching matrix until convergence.

[0126] By transforming it into a differentiable form, it is possible to satisfy the source-load power balance constraint (i.e. and ,in, This indicates the first power predicted by the source-side power prediction head. The total available power output of each power node within a future forecast period (e.g., the next 4 hours). This indicates the first forecast predicted by the load-side demand forecast head. Given the total power demand of each load node at a future time step, calculate the total transmission cost. Minimum optimal matching matrix ,in, Indicates the first The power node should supply the first The power value of each load node.

[0127] End-to-end optimization: Since the Sinkhorn algorithm layer is differentiable, the quality of the final matching strategy can be backpropagated. This not only updates the cost matrix prediction head but also propagates all the way to the front-end graph neural network, guiding the entire model to learn how to extract features that can generate better matching strategies. This effectively solves the problem of inconsistency between the prediction target and the optimization target in traditional prediction-then-optimization methods.

[0128] S105: Steps for generating and issuing closed-loop control strategies.

[0129] This step transforms the mathematically optimal solution output by the model into executable control actions and establishes a continuously feedback, dynamically updated closed-loop control system.

[0130] S105.1: Control command generation and safety constraint check

[0131] The final optimal matching matrix obtained from S104 optimization The system then translates these into specific device control commands. For example, for power nodes... Its target power setpoint is For interruptible load nodes If its predicted demand Greater than the allocated power Then a size of is generated. Load reduction command.

[0132] Before any instruction is issued, it must pass through a final safety verification module. This module uses an accurate power grid flow model to perform a rapid simulation verification of the instruction set to be issued, rigorously checking for violations of any hard constraints, such as line thermal limits, node voltage exceedances, and system frequency stability. This is a redundant safety safeguard, ensuring that even if the model outputs flawed strategies under extreme conditions, it will not harm the physical power grid.

[0133] S105.2: Command Issuance and Result Feedback

[0134] The instruction set that has passed the security check is encoded into a message that conforms to the field device communication protocol (such as IEC61850 GOOSE / MMS, ModbusTCP) and sent to the corresponding device controller for execution via industrial Ethernet or wireless network.

[0135] Execution result collection and feedback: Within a very short time window after the command is issued, the execution results of the equipment and the latest status of the power grid are immediately collected from systems such as SCADA and PMU.

[0136] S105.3: Dynamic Model Update and Closed Loop. The collected execution results and the latest power grid status will be sent back to step S101 as the latest real-time data to construct the dynamic heterogeneous graph for the next control cycle. Simultaneously, online parameter updates are performed based on the deviation between the actual execution results and the model predictions. Specific steps include:

[0137] 1. Construct an online loss function: Calculate the deviation between the predicted power at the previous time step and the measured power at the current time step, and construct an online loss function based on this deviation value;

[0138] 2. Gradient Calculation and Backpropagation: Based on this online loss function, the gradient of the model network parameters is calculated using the backpropagation algorithm;

[0139] 3. Parameter fine-tuning: An online optimization algorithm is adopted, and the weight parameters of the spatiotemporal graph attention network and the predictive decoder are updated incrementally according to the preset learning rate.

[0140] By continuously cycling through data acquisition, graph construction, prediction and optimization, control and feedback, a closed-loop control system that can continuously adapt to the time-varying characteristics of the power grid is constructed.

[0141] Example 2:

[0142] like Figures 8-9 As shown, the present invention provides a microgrid source-load prediction and matching method based on graph neural networks and attention mechanisms, which can be applied to smart industrial parks configured with various distributed energy sources and heterogeneous industrial loads.

[0143] The system hardware and microgrid configuration are as follows:

[0144] System hardware configuration:

[0145] Central Controller: As the core computing unit of the system, this is a high-performance server deployed in the campus data center. This server is equipped with an NVIDIA A100 GPU dedicated to massively parallel computing to meet the high-intensity training and inference requirements of deep graph neural network models; it also features a multi-core Intel Xeon CPU responsible for handling complex scheduling logic, data preprocessing, real-time database management, and overall system task scheduling. A large 64GB memory capacity ensures efficient caching and operation when processing long-term graph data, while a 2TB NVMe SSD provides sub-millisecond I / O access speeds for storing massive amounts of historical running data and model checkpoints.

[0146] Edge computing nodes: NVIDIA Jetson AGXXavier embedded GPU modules were deployed in areas requiring rapid response, such as near BESS and photovoltaic inverter clusters. These nodes act as extensions of the central controller, running lightweight versions of models or specific subsets of functions. They are capable of performing autonomous local control in the event of network latency or interruption, and uploading aggregated data to the central controller, greatly improving the system's robustness and responsiveness.

[0147] Communication System: The park is equipped with a dual-redundant 5G / industrial Ethernet communication network covering the entire area. Critical control commands and high-frequency PMU data are transmitted through a low-latency, high-reliability 5G private network, while high-bandwidth, non-strictly real-time data such as SCADA and BMS are transmitted through gigabit industrial Ethernet, ensuring that the average end-to-end data transmission latency is <50ms, meeting the requirements of near real-time control.

[0148] Data acquisition equipment: High-precision smart meters are installed on all key feeders and equipment outlets, supporting the uploading of RMS data such as voltage, current, and power at a rate of 0.1 seconds. PMU devices are installed at key locations such as the PCC, main bus, and BESS outlets, synchronously uploading phasor data at a sampling rate of 50Hz via GPS synchronization signals, providing the system with a high-resolution dynamic perspective.

[0149] Microgrid composition:

[0150] Distributed power generation includes a total of 2MW of photovoltaic arrays installed on the roofs of each factory building (divided into two independent monitoring and control units), a 1MW / 2MWh containerized energy storage system, and a 500kW backup diesel generator (activated only in emergency or isolated situations).

[0151] Load equipment: Based on its nature and importance, the total load is divided into 1.5MW of production load, 800kW of office and public area load, and 300kW of auxiliary load (such as charging piles, water pumps, etc.).

[0152] Network equipment includes two 10kV / 400V double-winding transformers, eight main 400V power distribution lines, and 15 smart switches that support remote control.

[0153] The specific implementation process is as follows:

[0154] The system operates as a continuous closed-loop process with a control cycle of 5 seconds. The implementation details of each core technical step will be broken down below.

[0155] Step S101: Construction of microgrid heterogeneous diagram.

[0156] This step accurately maps and constructs a machine-learnable dynamic heterogeneous graph model of the physical microgrid system and its complex operational information.

[0157] High-frequency synchronous data acquisition: At the beginning of each control cycle, the data acquisition module 10, through its integrated multi-protocol data gateway, initiates an acquisition command strictly synchronized with the GPS clock signal to all data acquisition points in the network. The acquired data includes:

[0158] Electrical quantity information: Three-phase voltage of each load unit and power outlet is collected from 15 smart meters. Current Active power reactive power and power factor Voltage / current phasors (amplitude and phase angle) and frequency from the PCC, main bus, and BESS outputs are collected from three PMU devices. and frequency change rate (Note: Among them) (Index representing discrete sampling time).

[0159] Equipment status information: Detailed status data across more than 50 dimensions, including real-time SOC, SOH, cell maximum / minimum / average temperature, and available charge / discharge power, are read from the BMS system. DC-side voltage / current, AC-side output, conversion efficiency, MPPT operating point, and fault codes are read from the photovoltaic inverter. The on / off status (0 or 1) of 15 smart switches and the diesel engine's operating status (standby / running) are read from the PLC (Programmable Logic Controller).

[0160] Environmental information: Real-time light intensity (GHI), wind speed, and ambient temperature are collected from the local weather station. Rolling weather forecast data for the next 4 hours is obtained from a third-party weather service API. The collected raw data is validated, aligned, and normalized to form a structured, clean dataset, which is then sent to the graph construction module 20.

[0161] Dynamic heterogeneous graph instantiation: The graph construction module receives the processed dataset and instantiates a graph snapshot of the current moment based on the pre-set campus topology template in the digital twin library. .

[0162] Instantiation of node set V: The system instantiates the entities within the park as 32 nodes:

[0163] Power nodes (4): 2 photovoltaic power generation unit nodes, 1 energy storage node, and 1 diesel engine node.

[0164] Load nodes (15): Represents the load aggregation points of 15 different production lines or functional areas.

[0165] Network nodes (10): including 2 transformers, PCC point, main bus and 6 critical line junction nodes.

[0166] Control nodes (3): Representing the MGCC itself, the BESS controller, and the photovoltaic inverter cluster controller.

[0167] Instantiation of edge set E: The system generates 45 edges based on the electrical wiring diagram and communication network topology. The weights of the electrical edges are normalized based on the admittance values ​​calculated from the R and X parameters of the lines. The weights of the information edges are calculated based on the measured communication delay and bandwidth.

[0168] Construction of the node feature matrix X: A 16-dimensional feature vector is constructed for each node, forming a 32×16 feature matrix X. These 16-dimensional features are carefully selected and engineered. For a photovoltaic node, its feature vector may include: [node type code, rated capacity, real-time active power, real-time reactive power, DC voltage, conversion efficiency, irradiance, temperature, irradiance prediction for the next 15 minutes, ..., irradiance prediction for the next 4 hours].

[0169] Construction of adjacency matrix A: Based on the edge connection relationships and weights, generate a 32*32 weighted adjacency matrix A.

[0170] Dynamic update mechanism: This module continuously monitors the event bus. If an event such as "smart switch #3 changes from 1 to 0" is detected, the module will immediately set the elements related to that switch in the adjacency matrix A to zero and update the characteristics of the affected nodes when building the graph in the next cycle, ensuring that the graph model responds to topology changes in real time.

[0171] Step S102: Spatiotemporal feature extraction based on spatiotemporal graph attention network.

[0172] A spatiotemporal feature extraction model is constructed based on deep neural networks. This model extracts the topological features and time-series evolution features of microgrids in parallel, and maps the two features into a unified high-dimensional feature representation through a fusion layer.

[0173] Spatial Graph Convolution Feature Extraction: Graph Convolutional Neural Networks (GCNs) are used to process the heterogeneous graph data at each time step. Feature information of the target node and its neighboring nodes is aggregated through graph convolution operations, and the feature vector of the node is updated according to the weight of the adjacent edges to quantify the influence of the neighboring node states on the target node, thereby extracting the spatial structural features of the node.

[0174] Multi-layer graph convolutional structure: This invention uses a stacked 3-layer graph convolutional neural network, with network parameters set as you have specified:

[0175] Layer 1 GCN (Input: 16-dimensional, Output: 64-dimensional): This layer performs preliminary feature aggregation and dimensionality enhancement. Each node aggregates information from its first-order neighbors (directly connected nodes).

[0176] Layer 2 GCN (Input: 64-dimensional, Output: 128-dimensional): Building upon Layer 1, this layer enables deeper feature interactions. Through this layer, each node can perceive information from its second-order neighborhood.

[0177] Layer 3 GCN (Input: 128-dimensional, Output: 64-dimensional): This layer integrates and refines higher-order features. Nodes can perceive information from their third-order neighborhood, forming a more macroscopic perspective. The output dimension is reduced to 64, aiming to extract the most critical and representative topology-aware features.

[0178] Auxiliary mechanisms: Batch normalization and residual connections are added after each layer to accelerate model convergence and effectively train deep networks.

[0179] Spatiotemporal feature fusion: The encoder of the prediction module 50 receives the spatiotemporal feature sequence output by the feature extraction module 30 at each time step.

[0180] Time series feature extraction: The temporal attention sublayer inside the encoder (a Transformer-based self-attention mechanism) is responsible for capturing the dependencies of each node in the time dimension. Compared to RNN, it can more effectively capture complex long-term and short-term patterns and supports parallel computation.

[0181] Unified Spatiotemporal Feature Representation Construction: Each layer of ST-GAT fuses the outputs of the graph convolutional sublayer (capturing spatial information) and the temporal attention sublayer (capturing temporal information) to generate a unified spatiotemporal feature representation. This interleaved spatiotemporal information processing method enables the model to consider both spatial and temporal dimensions of information at each processing stage, achieving deep coupling.

[0182] Step S103: Multi-scale attention fusion.

[0183] The core idea of ​​this step is to mimic the multi-perspective, hierarchical thinking patterns used by human experts when analyzing complex systems. This step is executed by the attention computation module, which receives the spatiotemporal features extracted by S102 and enhances them.

[0184] Device-level attention layer: A self-attention mechanism is applied to the feature sequence of each node, calculating a 32*32 internal attention weight matrix. This allows the model to pay attention to the key state changes of each device itself. For example, if the SOC feature value of an energy storage node drops rapidly over the past few time steps, the mechanism will give higher weights to the features of those time steps.

[0185] Regional Attention Layer: First, based on the electrical distance and load type of the nodes, the K-means clustering algorithm dynamically divides the 32 nodes into 6 regions: photovoltaic zone, energy storage zone, high-priority production zone, general production zone, office zone, and auxiliary zone. Then, the attention matrix between regions is calculated to learn the collaborative relationships between them. For example, the model might learn that when the power generation characteristics of the photovoltaic zone increase, the attention weights of the energy storage zone and the auxiliary zone (charging piles) should also increase accordingly.

[0186] Network-wide attention layer: By performing global average pooling on the features of all nodes, a vector representing the overall state of the entire network is obtained. Then, the correlation between this global vector and each unified spatiotemporal feature is calculated, and a global attention weight is assigned to each node.

[0187] Fusion Weights: Finally, the attention results from the three scales are weighted and fused. In this embodiment, after extensive offline training and tuning, the optimal fusion weights are set as follows: w_textdevice=0.5, w_textregion=0.3, w_textglobal=0.2. This indicates that for this industrial park scenario, the immediate state of a single device is the most important, followed by regional collaboration, and finally the global macroscopic state.

[0188] Step S104: Source-load matching integrated prediction.

[0189] The core idea of ​​this step is to utilize a unified, end-to-end trainable framework to simultaneously complete the two tasks of power prediction and matching policy optimization. This step is jointly performed by the decoder part of the prediction module and the optimization module.

[0190] Multi-step power prediction:

[0191] Encoder-decoder architecture: The prediction module 50 uses a deep encoder with 6 spatiotemporal attention layers and three parallel decoders (prediction heads) to predict the source-side power sequence, load-side demand sequence and cost matrix, respectively.

[0192] Predicted output: The decoder receives the context vector output by the encoder at the last time step and generates a sequence of predicted results for the next 48 time steps (4 hours, 5-minute intervals) autoregressively, including the available power of all source nodes and the required power of all load nodes.

[0193] Model Training and Loss Function Construction: To achieve end-to-end collaborative training of the overall model parameters, including the spatiotemporal graph attention network (feature extraction layer) and the encoder-decoder (prediction layer), a composite loss function was constructed. This composite loss function is calculated based on the deviation between the predicted output and the true value, and the weight parameters of all learnable network layers involved in the method are updated through the backpropagation algorithm. Its calculation formula is as follows:

[0194]

[0195] in: This represents the total loss value; Mean square error is used to measure the deviation between the predicted power value and the actual value. It represents the mean absolute percentage error and is used to assess the relative accuracy of predictions; This represents the smoothness loss, used to penalize drastic non-physical fluctuations in the prediction curve. and For balance coefficient, =0.1, =0.01.

[0196] Optimal source-load matching:

[0197] Cost matrix construction: Optimization module 60 constructs a 4x15 cost matrix. This corresponds to 4 power supply nodes and 15 load nodes. Matrix elements The calculation is a multi-objective optimization process, and its cost function integrates multiple factors: transmission loss, voltage deviation, frequency stability, economic cost, etc.

[0198] Differentiable Sinkhorn algorithm solution: The constructed cost matrix and the predicted source load power are used as inputs, and the Sinkhorn algorithm is used for iterative solution.

[0199] The temperature parameter lambda is set to 0.1. This is a hyperparameter used to control the smoothness of the solution.

[0200] The algorithm's maximum number of iterations is set to 10, and the convergence threshold is set to 1e-6 to ensure that a high-quality solution is found within a limited time.

[0201] The algorithm outputs a 4x15 optimal matching matrix. Its elements Indicates power supply Load to be supplied The power value.

[0202] Step S105: Generation and distribution of closed-loop control strategy.

[0203] The core idea of ​​this step is to transform the mathematically optimal solution output by the model into safe, reliable, and executable control actions in the physical world, and to establish a continuously feedback, dynamically updated closed-loop control system. This step is completed collaboratively by the control execution module and the feedback update module.

[0204] Control command generation and issuance:

[0205] Example of instruction generation:

[0206] Photovoltaic inverter power settings: P_pv=1.2tMWpm, 0.1MW.

[0207] Energy storage charging and discharging strategy: charging power 200kW, discharging power 300kW.

[0208] Load response strategy: Prioritize load reduction, with a maximum reduction ratio of 20%.

[0209] Command issuance: All control commands are refreshed and issued every 5 seconds. Issuance via both CAN bus and Ethernet channels ensures real-time control and reliability.

[0210] Feedback and model updates:

[0211] Deviation monitoring and model updates: The system continuously monitors the execution deviations of control commands. This deviation data is used to update the parameters of the device response in the digital twin model.

[0212] Online parameter adjustment: The system calculates the prediction error and uses this error as a loss signal to fine-tune the network parameters of the GCN model online using the gradient descent method.

[0213] Adaptive Learning Rate: To ensure the stability of online learning, the learning rate is set to adaptively adjust. The initial value is set to 0.001. When the loss decreases over several consecutive periods, the learning rate is appropriately increased to accelerate convergence; when the loss fluctuates or increases, the learning rate is decreased to seek a more stable solution.

[0214] The running effect of this embodiment is as follows:

[0215] Prediction accuracy: The prediction accuracy of source-side power (taking photovoltaic as an example) is stable at 94.3%, and the prediction accuracy of load-side demand reaches 96.1%, far exceeding that of traditional statistical models.

[0216] Economic benefits: The utilization rate of renewable energy has increased significantly from 78.5% before the upgrade to 91.2%, and the phenomenon of curtailment of solar power has been basically eliminated. Through precise peak shaving and valley filling and time-of-use pricing arbitrage, the overall operating cost of the system can be reduced by 17.8%, which is equivalent to annual electricity savings of about 250,000 yuan.

[0217] Reliability: Power supply reliability reaches 99.93%. It can successfully predict and respond to islanding switching caused by external power grid failures, ensuring continuous power supply to high-priority loads, and no failures have occurred due to prediction errors or inappropriate control strategies.

[0218] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the protection scope of the present invention. Therefore, the protection scope of this invention patent should be determined by the appended claims.

Claims

1. A microgrid source-load prediction and matching method based on graph neural networks and attention mechanisms, characterized in that, The microgrid source-load prediction and matching method based on graph neural networks and attention mechanisms includes: Acquire multi-dimensional data of the microgrid and construct a heterogeneous diagram for each time point based on the multi-dimensional data; Spatial graph convolutional features and time series features are extracted based on the heterogeneous graph at each time step. The spatial graph convolutional features and time series features are then fused through a spatiotemporal graph attention network to obtain unified spatiotemporal features at each time step. A hierarchical attention network is constructed, which outputs the enhanced spatiotemporal features of each node based on the unified spatiotemporal feature sequence of each node within the historical time window, and combined with the graph topology and node features of the heterogeneous graph. Based on the enhanced spatiotemporal features, the available power output sequence, power demand sequence, and cost matrix are predicted by three decoders, respectively. The optimal matching matrix that minimizes the total transmission cost is calculated based on the available power output sequence, the power demand sequence, and the cost matrix. The optimal matching matrix is ​​converted into equipment control commands. After simulating the equipment control commands, they are sent to the equipment controller. The execution results and the latest state of the power grid are collected after the commands are executed, and the execution results and the latest state of the power grid are used as new multi-dimensional data.

2. The microgrid source-load prediction and matching method based on graph neural networks and attention mechanisms according to claim 1, characterized in that, The process involves extracting spatial graph convolutional features and temporal series features from the heterogeneous graph at each time step, and then fusing these features with a spatiotemporal graph attention network to obtain unified spatiotemporal features for each time step, including: Extracting spatial graph convolutional features using a multi-layer graph convolutional neural network; The node output by the final layer of the graph convolutional neural network at each time step The weighted sum of all neighbor features for each node at time step Spatial graph convolution features; The spatial graph convolutional features of each node at each time step are input into the gated recurrent unit of each node, and the time series features of each node at each time step are output. The correlation scores between spatial graph convolutional features and time series features are calculated and weighted summed to generate unified spatiotemporal features for each time step.

3. The microgrid source-load prediction and matching method based on graph neural networks and attention mechanisms according to claim 1, characterized in that, The hierarchical attention network includes a device-level attention layer, a region-level attention layer, and a network-wide attention layer. The unified spatiotemporal features of each node within the historical time window are input into the device-level attention layer. The attention weight of each time step is calculated, and the unified spatiotemporal feature sequence is weighted and aggregated based on the attention weight of each time step to obtain the device-level time enhancement features. Based on the weighted adjacency matrix, initial node features, and spatial graph convolution features in the heterogeneous graph, a region-level attention layer is used to obtain inter-region feature representations. The unified spatiotemporal features of all nodes are aggregated to obtain a global context vector. The attention score between the global context vector and the unified spatiotemporal features of each node is calculated. A global attention weight is assigned to each node based on the attention score. The unified spatiotemporal features of each node are weighted and aggregated based on the global attention weight to obtain a network-wide feature representation. The device-level temporal enhancement features, inter-regional feature representations, and network-wide feature representations are aligned at multiple scales, concatenated, and then input into the feature fusion layer. The fusion weights of each feature representation are calculated and weighted fusion is performed to output the enhanced spatiotemporal features.

4. The microgrid source-load prediction and matching method based on graph neural networks and attention mechanisms according to claim 3, characterized in that, The method, based on the weighted adjacency matrix, initial node features, and spatial graph convolutional features in the heterogeneous graph, utilizes a region-level attention layer to obtain inter-region feature representations, including: Based on the weighted adjacency matrix, initial node features, and spatial graph convolution features in the heterogeneous graph, the microgrid is divided into several regions; Max pooling is performed on the unified spatiotemporal features of all nodes in the region to obtain the region overview vector. The dot product similarity between the region overview vector and the unified spatiotemporal features of each node in the region is calculated and normalized using the Softmax function to obtain the attention weight. Based on the attention weight, the unified spatiotemporal features of all nodes in the region are weighted and summed to obtain the region-level weighted feature representation. A region map is constructed based on the region-level weighted feature representation of the target region and the region-level weighted feature representations of all other regions. The attention weights between the target region and all other regions are calculated, and the inter-region feature representations are obtained based on the inter-region attention weights.

5. The microgrid source-load prediction and matching method based on graph neural networks and attention mechanisms according to claim 1, characterized in that, The calculation of the optimal matching matrix that minimizes the total transmission cost based on the available power output sequence, power demand sequence, and cost matrix includes: The available power output sequence, power demand sequence, and cost matrix are input into the Sinkhorn algorithm layer to calculate the optimal matching matrix that minimizes the total transmission cost.

Citation Information

Patent Citations

  • Microgrid energy storage configuration method considering schedulability of microgrid system

    CN108964103A

  • Method for evaluating small interference stability of power system based on new energy access

    CN109921458A

Cited By

  • An event-triggered microgrid energy scheduling method and system

    CN122178569A