A power grid anomaly classification method, system, device and medium based on hierarchical time sequence causal graph

By constructing a hierarchical temporal causal graph-based power grid anomaly classification system, the problems of insufficient causal relationship mining and lack of contextual information in existing methods are solved. This achieves effective support for accurate classification and planning of power grid anomalies, and improves the economy and reliability of power grid operation.

CN122490239APending Publication Date: 2026-07-31GUIZHOU POWER GRID CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
GUIZHOU POWER GRID CO LTD
Filing Date
2026-03-16
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing methods for classifying power grid anomalies lack in-depth analysis of causal relationships, making it difficult to accurately identify the propagation paths and impacts of anomalies. Furthermore, they fail to effectively integrate multi-source contextual information, resulting in a lack of interpretability in the classification results and ineffective integration with power grid planning and decision-making.

Method used

A hierarchical temporal causal graph-based approach is adopted to construct a power grid anomaly classification system through causal relationship mining, temporal modeling, counterfactual reasoning, and contextual information fusion. This system includes data preprocessing, causal graph construction, temporal propagation module, planning impact assessment, and feedback mechanism, enabling a comprehensive evaluation of causal paths, propagation characteristics, and contextual features.

Benefits of technology

It enables accurate classification of power grid anomalies, improves the targeting and economy of planning, avoids over-investment, and enhances the reliability and environmental adaptability of planning decisions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122490239A_ABST
    Figure CN122490239A_ABST
Patent Text Reader

Abstract

This invention discloses a method, system, device, and medium for power grid anomaly classification based on hierarchical temporal causal graphs, belonging to the technical field of power grid anomaly classification. The method includes: collecting and preprocessing power grid operation data; discovering causal relationship structures from the power grid operation data using causal relationship mining to construct a causal graph; performing temporal modeling on the power grid operation data using temporal evolution modeling to identify anomalies and extract anomaly propagation features; constructing a counterfactual reasoning method to assess the impact of the anomalies on power grid planning results; integrating multi-source contextual information to generate contextual features; establishing a feedback mechanism; and determining the power grid anomaly classification result based on the impact level and the contextual features. This invention achieves accurate classification of power grid anomalies by constructing a hierarchical temporal causal graph, significantly improving the targeting and economy of power grid planning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of power grid anomaly classification technology, specifically to a power grid anomaly classification method, system, device, and medium based on hierarchical time-series causal graphs. Background Technology

[0002] With the deepening of smart grid construction and the large-scale integration of new energy sources, the operating environment of power systems is becoming increasingly complex. Power grid anomaly detection and classification have become key technologies for ensuring the safe and stable operation of the power grid. Power grid anomaly classification refers to the process of identifying, classifying, and assessing various abnormal events that occur during power grid operation, with the aim of providing decision support for power grid planning, dispatching, and operation and maintenance. Summary of the Invention

[0003] In view of the above-mentioned problems, the present invention provides a method, system, device and medium for classifying power grid anomalies based on hierarchical time-series causal graphs.

[0004] Therefore, the technical problem addressed by this invention is that, in the context of smart grids and the ubiquitous power Internet of Things, the understanding of power grid anomalies is constantly deepening. Traditional views consider anomalies as entirely negative events, while modern power grid management concepts hold that some anomalies are part of normal system fluctuations and do not necessarily have a substantial impact on power grid planning and operation.

[0005] To address the aforementioned technical problems, this invention provides the following technical solution: a power grid anomaly classification method based on hierarchical temporal causal graphs, comprising, The process involves collecting and preprocessing power grid operation data; discovering causal relationships from the data using causal relationship mining to construct a causal graph; performing time-series modeling on the data to identify anomalies and extract their propagation characteristics; constructing a counterfactual reasoning method to assess the impact of the anomalies on power grid planning results; integrating multi-source contextual information to generate contextual features; establishing a feedback mechanism to facilitate information exchange between the causal graph construction, time-series modeling, and impact assessment; and determining the power grid anomaly classification results based on the impact level and the contextual features.

[0006] As a preferred embodiment of the power grid anomaly classification method based on hierarchical time-series causal graphs described in this invention, the construction of the causal graph includes: establishing a prior distribution of the causal graph structure; calculating a data likelihood function based on the power grid operation data; obtaining a posterior distribution of the causal graph structure through Bayesian inference; and determining the causal relationship structure based on the posterior distribution.

[0007] As a preferred embodiment of the power grid anomaly classification method based on hierarchical time-series causal graphs described in this invention, the steps of identifying anomalies and extracting anomaly propagation features include: constructing a state evolution equation to describe the continuous evolution process of the system state of the power grid operation data over time; introducing a state memory mechanism to capture historical state information; identifying abnormal states based on the evolution results of the system state; and extracting the propagation features of the abnormal states.

[0008] As a preferred embodiment of the power grid anomaly classification method based on hierarchical temporal causal graph described in this invention, the evaluation of the impact of the anomaly on the power grid planning results includes: constructing a structural causal model to represent the causal relationship between the anomaly and the power grid planning results; setting comparison scenarios to simulate the power grid planning process under different anomaly states; calculating the power grid planning results under each comparison scenario; and determining the degree of impact by comparing the differences in planning results under each scenario.

[0009] The beneficial effects of this preferred technical solution are as follows: By constructing a structural causal model and setting comparative scenarios to evaluate the impact of planning, this solution overcomes the limitations of traditional methods that rely solely on statistical correlation, and quantifies the causal impact of anomalies on planning results. This is in contrast to traditional methods that cannot distinguish between actual impacts and overplanning problems caused by occasional anomalies.

[0010] As a preferred embodiment of the power grid anomaly classification method based on hierarchical temporal causal graph described in this invention, the generation of context features includes: acquiring context information of time factors, spatial factors, operation and maintenance factors, and social factors; representing and encoding various types of context information; determining the fusion weight of various types of context information using a weight allocation mechanism; and weightedly fusing various types of context information based on the fusion weight to generate the context features.

[0011] As a preferred embodiment of the power grid anomaly classification method based on hierarchical time-series causal graphs described in this invention, the establishment of the feedback mechanism includes: determining the focus of time-series modeling based on the degree of influence and updating the model parameters of the time-series evolution modeling method; identifying key causal paths based on the anomaly propagation characteristics and updating the model parameters of the causal relationship mining method.

[0012] As a preferred embodiment of the power grid anomaly classification method based on hierarchical time-series causal graphs described in this invention, the determination of the power grid anomaly classification result includes: obtaining causal path information related to the anomaly in the causal graph; obtaining propagation range and propagation duration information in the anomaly propagation characteristics; obtaining economic and reliability impact information on power grid planning in the impact degree; determining the current power grid operation scenario in combination with the context features; comprehensively evaluating the actual impact of the anomaly on power grid planning decisions based on the causal path information, the propagation range and duration, the economic and reliability impact, and the operation scenario; classifying anomalies whose actual impact exceeds the planning impact threshold as anomalies requiring targeted measures in power grid planning, and classifying anomalies whose actual impact does not exceed the planning impact threshold as anomalies that can be simplified in power grid planning.

[0013] The beneficial effects of this preferred technical solution are as follows: This solution integrates causal path, propagation characteristics, planning impact and operation scenario to achieve full-process anomaly classification, breaking through the problem that traditional methods only focus on a single dimension, resulting in a disconnect between classification results and planning requirements.

[0014] This invention provides a power grid anomaly classification system based on hierarchical temporal causal graphs.

[0015] To address the aforementioned technical problems, this invention provides the following technical solution: a power grid anomaly classification system based on a hierarchical temporal causal graph, comprising: a data preprocessing module for collecting and preprocessing power grid operation data; a causal discovery module for discovering causal relationship structures from the power grid operation data using causal relationship mining methods and constructing a causal graph; a temporal propagation module for performing temporal modeling on the power grid operation data using temporal evolution modeling methods, identifying anomalies, and extracting anomaly propagation features; a planning impact assessment module for constructing a counterfactual reasoning method to assess the degree of impact of the anomalies on power grid planning results; a context fusion module for integrating multi-source contextual information and generating contextual features; a feedback interaction module for establishing a feedback mechanism to realize information interaction between the causal graph construction, the temporal modeling, and the impact degree assessment; and an anomaly classification module for determining the power grid anomaly classification result based on the impact degree and the contextual features.

[0016] The present invention provides a computer device, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps of the power grid anomaly classification method based on hierarchical time-series causal graphs.

[0017] The present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the power grid anomaly classification method based on hierarchical time-series causal graphs.

[0018] The beneficial effects of this invention are as follows: First, by constructing a hierarchical temporal causal graph, accurate classification of power grid anomalies is achieved, which significantly improves the pertinence and economy of power grid planning.

[0019] Secondly, by conducting counterfactual impact assessments, over-planning caused by extreme outliers was avoided, significantly reducing unnecessary power grid investment.

[0020] Third, through causal reasoning and interpretable model design, the interpretability of the basis for anomaly classification is provided, which greatly enhances the reliability of planning decisions.

[0021] Fourth, through adaptive context fusion and variable structure modeling, the system effectively adapts to dynamic changes in power grid topology and load characteristics, thereby improving the environmental adaptability and robustness of the classification system. Attached Figure Description

[0022] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0023] Figure 1 The above is a flowchart of a power grid anomaly classification method based on hierarchical temporal causal graph, which is provided as an embodiment of the present invention.

[0024] Figure 2 This is a schematic diagram of a three-layer architecture for a power grid anomaly classification method based on hierarchical temporal causal graph, provided as an embodiment of the present invention, illustrating the relationship between the causal discovery layer, the temporal propagation layer, and the planning influence layer; Figure 3 A schematic diagram illustrating the construction process of a nonparametric Bayesian variable structure time-varying graph model in the causal discovery layer of a power grid anomaly classification method based on hierarchical time-series causal graphs, as provided in an embodiment of the present invention. Figure 4 A flowchart of memory-enhanced neural network constant differential equation modeling in the temporal propagation layer of a power grid anomaly classification method based on hierarchical temporal causal graphs, provided as an embodiment of the present invention; Figure 5 The diagram illustrates the working principle of the counterfactual reasoning mechanism in the planning influence layer of a power grid anomaly classification method based on hierarchical temporal causal graph, as provided in an embodiment of the present invention, showing the comparison process between two parallel scenarios with and without anomalies. Figure 6This is a structural diagram of an adaptive context fusion module for a power grid anomaly classification method based on hierarchical temporal causal graphs, provided as an embodiment of the present invention, demonstrating the dynamic integration mechanism of multi-source context information. Detailed Implementation

[0025] To make the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the protection scope of the present invention.

[0026] Example 1, referring to Figure 1 This is one embodiment of the present invention, which provides a power grid anomaly classification method based on hierarchical time-series causal graphs, including: Step 1: Collect and preprocess power grid operation data; Step 2: Discover causal relationship structures from the power grid operation data using causal relationship mining and construct a causal graph; Step 3: Perform time-series modeling on the power grid operation data using temporal evolution modeling to identify anomalies and extract anomaly propagation features; Step 4: Construct a counterfactual reasoning method to assess the impact of the anomalies on power grid planning results; Step 5: Integrate multi-source contextual information to generate contextual features; Step 6: Establish a feedback mechanism to achieve information interaction between the causal graph construction, the time-series modeling, and the impact assessment; Step 7: Determine the power grid anomaly classification results based on the impact and the contextual features.

[0027] Existing methods for classifying power grid anomalies generally lack in-depth exploration of causal relationships. A power grid is a typical complex physical system with intricate causal networks among its components. Traditional machine learning methods primarily focus on the statistical correlation of data, neglecting the underlying causal structure. This makes anomaly classification results uninterpretable and difficult to trace the propagation paths of anomalies. In actual power grid operation, accurately identifying the root causes of anomalies and their impact paths is crucial for taking effective countermeasures.

[0028] Existing technologies are insufficient for modeling the temporal dynamic characteristics of anomalies. Power grid anomalies are often a dynamic evolutionary process, with different types of anomalies exhibiting different propagation patterns and durations of impact over time. Most existing methods employ static analysis with fixed time windows, making it difficult to accurately capture the temporal dynamic characteristics of anomalies, especially for slowly developing potential anomalies, which are difficult to detect and classify in a timely manner.

[0029] Existing anomaly classification methods lack effective integration with power grid planning and decision-making. The ultimate goal of power grid anomaly classification is to provide decision support for power grid planning, but existing methods rarely consider the actual impact of anomalies on planning decisions. This leads to excessive attention being paid to some anomalies with minor impacts on planning, while some potential anomalies with significant impacts on planning are not given sufficient attention. Accurately assessing the impact of anomalies on power grid planning is a crucial step in optimizing resource allocation and improving investment efficiency.

[0030] Existing technologies struggle to effectively integrate multi-source contextual information. The occurrence and development of power grid anomalies are influenced by various external factors, such as weather conditions, load characteristics, and equipment operation and maintenance status. This contextual information is crucial for accurate anomaly classification, but existing methods often focus only on the power grid operation data itself, lacking effective fusion of multi-source contextual information, resulting in unstable classification performance in complex environments.

[0031] Example 2, an embodiment of the present invention, provides a power grid anomaly classification method based on hierarchical temporal causal graphs, based on the previous embodiment, including: Step 2: Using causal relationship mining to discover causal relationship structures from the power grid operation data and constructing a causal graph includes the following steps A1-A4: A1: Establish the prior distribution of the causal graph structure; A2: Calculate the data likelihood function based on the power grid operation data; A3: Obtain the posterior distribution of the causal graph structure through Bayesian inference; A4: Determine the causal relationship structure based on the posterior distribution.

[0032] In this embodiment of the application, Bayesian inference is implemented in step A3 through the following specific steps: First, an initial causal graph structure is established based on the power grid physical topology, and the physical connections between nodes in the power grid are represented as adjacency matrices as topological prior information. Second, the topological prior distribution is calculated, and the structural difference between the causal graph structure and the power grid topological prior is measured using Hamming distance. The Hamming distance is obtained by summing the differences between the causal graph adjacency matrix and the topological prior adjacency matrix element by element. An exponentially decaying topological prior distribution is constructed based on this Hamming distance. Third, the data likelihood function is calculated. For the observation value of each node in the causal graph at each time step, the conditional probability is calculated based on the set of parent nodes of that node. The product of the conditional probabilities of a node at all times is used as the data likelihood function. Then, the posterior distribution is calculated, and the data likelihood function is multiplied by the topological prior distribution to obtain the non-normalized form of the posterior distribution. Finally, a Markov chain Monte Carlo sampling method is used to perform random walks in the causal graph structure space. In each iteration, an edge is randomly selected for addition, deletion, or reversal. The ratio of the posterior distribution of the causal graph structure before and after the operation is calculated. If the ratio is greater than a value randomly drawn from a uniform distribution from 0 to 1, the operation is accepted; otherwise, the original structure is maintained. A high-probability posterior distribution of the causal graph structure is obtained through iterative convergence.

[0033] In an optional implementation, in step A3, Bayesian inference can be performed through: Without introducing prior constraints on the power grid topology, a non-informative prior distribution is directly used to learn the causal graph structure through a purely data-driven approach. This non-informative prior assigns equal initial probabilities to all possible graph structures. In another alternative implementation, in step A3, Bayesian inference can also be performed by: We use variational inference to replace Markov chain Monte Carlo sampling, approximating the posterior distribution as a parameterized family of distributions. By optimizing the variational lower bound to maximize the posterior probability, we reduce computational complexity and improve inference efficiency.

[0034] Step 3: Using time-series evolution modeling to perform time-series modeling on the power grid operation data, identifying anomalies and extracting anomaly propagation features includes the following steps B1-B4: B1: Construct a state evolution equation to describe the continuous evolution of the system state of the power grid operation data over time; B2: Introduce a state memory mechanism to capture historical state information; B3: Identify abnormal states based on the evolution results of the system state; B4: Extract the propagation characteristics of the abnormal states.

[0035] In this embodiment, in step B2, the state memory mechanism is implemented through the following specific steps: First, the memory unit state is initialized by setting the memory unit as a vector with the same dimension as the system state vector and assigning an initial value; second, the current system state and external event inputs are obtained, including power grid operation-related events such as equipment operation events, load change events, and environmental factor changes; third, update gate parameters are calculated by concatenating the current system state, external event inputs, and the previous memory unit state into vectors, and calculating the update gate weight value through linear transformation and sigmoid activation function, wherein the update gate is used to control the degree of retention of historical memory information; then, candidate memory states are calculated by concatenating the current system state, external event inputs, and historical memory weighted by the update gate into vectors, and generating candidate memory vectors through linear transformation and hyperbolic tangent activation function; finally, the memory unit state is updated by weighted summing of the update gate weight and the candidate memory state, and simultaneously weighted summing of 1 minus the update gate weight and the previous memory unit state, and adding the two together to obtain the current memory unit state, thereby realizing the dynamic fusion of historical information and current information.

[0036] In an optional implementation, in step B2, the state memory mechanism can be extended by introducing a multi-scale time attention mechanism to expand memory capacity, maintaining independent memory units for the short-term, medium-term and long-term time scales respectively, with the short-term memory unit capturing state changes from 5 minutes to 1 hour, the medium-term memory unit capturing state evolution from 1 to 24 hours, and the long-term memory unit capturing historical trends over 24 hours, and adaptively weighting and fusing the memory information of the three scales through an attention weight mechanism.

[0037] In another optional implementation, in step B2, the state memory mechanism can also update the memory state by: using a simplified exponential moving average method, weighting the current system state and the memory state at the previous moment according to a fixed attenuation coefficient, wherein the attenuation coefficient is preset according to the time scale characteristics of the power grid state change, thereby avoiding the parameter learning process of the gating mechanism and reducing computational complexity.

[0038] Step 4: Constructing a counterfactual reasoning method to assess the impact of the anomaly on the power grid planning results includes the following steps C1-C4: C1: Construct a structural causal model to represent the causal relationship between the anomaly and the power grid planning results; C2: Set up comparison scenarios to simulate the power grid planning process under different anomaly states; C3: Calculate the power grid planning results under each comparison scenario; C4: Determine the degree of influence by comparing the differences in planning results under each scenario.

[0039] In this embodiment, in step 4, the counterfactual reasoning method is implemented through the following specific steps: First, a structural causal model is constructed, defining a variable set including abnormal event variables, system state variables, planning decision variables, and planning result variables. A structural equation set of endogenous variables is established to describe the causal dependencies between variables. The structural equation set includes equations where the system state is jointly determined by abnormal events and random disturbances, equations where planning decisions are based on the system state, and equations where the planning result depends on the planning decision and the system state. Second, two contrasting scenarios are set: the presence of anomalies and the absence of anomalies. In the scenario where anomalies exist, an intervention operation is used to force the abnormal event variable to an abnormal state and sever the connection between the variable and its causal variable. In the scenario where anomalies do not exist, the abnormal event variable is forced to a normal state. Third, Monte Carlo simulation is used. The Lochte simulation method calculates planning results under two scenarios. In each simulation, the intervention value of the abnormal event variable is fixed, and random sampling is performed from the probability distribution of exogenous random disturbances. The values ​​of system state, planning decision, and planning result are calculated sequentially according to the structural equation set. The simulation is repeated multiple times, and all planning results are recorded. Then, multi-objective planning impact indicators are calculated. For the four planning dimensions of investment cost, power supply reliability, load satisfaction, and environmental impact, the expected values ​​of each indicator are statistically analyzed under the two scenarios. The differences in each indicator between the scenario with and without anomalies are calculated. Finally, the degree of impact is comprehensively evaluated. Weight coefficients are set according to the importance of each planning indicator. The differences in each indicator are multiplied by their corresponding weights and then summed to obtain the comprehensive impact value. The comprehensive impact value quantifies the magnitude of the causal impact of abnormal events on power grid planning decisions.

[0040] In an optional implementation, in step 4, the counterfactual reasoning approach can be achieved by: setting up multiple comparison scenarios with different levels of anomaly instead of just two scenarios; dividing the abnormal event variable into multiple levels from normal to severely abnormal states; performing intervention operations on each level and calculating the planning results; and obtaining a quantitative relationship curve between the degree of anomaly and the planning impact by analyzing the changing trends of the planning impact under different degrees of anomaly.

[0041] In another alternative implementation, in step 4, the counterfactual reasoning approach can also be achieved by: using an analytical method to replace Monte Carlo simulation to calculate the expected value of the planning result. When the structural equation is linear and the exogenous disturbance follows a Gaussian distribution, the expected value of each variable after intervention can be directly calculated using the expected propagation property of the linear system, avoiding repeated sampling simulation process, improving computational efficiency and ensuring the determinism of the calculation result.

[0042] Step 5: Integrating multi-source contextual information to generate contextual features includes the following steps D1-D2: D1: Obtain contextual information of time factors, spatial factors, operation and maintenance factors, and social factors; D2: Represent and encode various types of contextual information; D3: Determine the fusion weight of various types of contextual information using a weight allocation mechanism; D4: Perform weighted fusion of various types of contextual information based on the fusion weight to generate the contextual features.

[0043] Step 6: Establishing a feedback mechanism to achieve information exchange between the causal graph construction, the time series modeling, and the impact assessment includes the following steps E1-E2: E1: Determine the focus of time series modeling based on the degree of influence, and update the model parameters of the time series evolution modeling method; E2: Identify key causal paths based on the anomaly propagation characteristics, and update the model parameters of the causal relationship mining method.

[0044] In this embodiment of the application, the feedback mechanism in step 6 is implemented through the following specific steps: First, based on the impact assessment results, the focus of time-series modeling is determined, identifying high-impact anomalies whose impact on power grid planning exceeds a preset threshold. The time periods corresponding to these high-impact anomalies in the time-series data are marked as key areas of focus. Second, a weighted loss function is constructed for updating time-series modeling parameters. This weighted loss function consists of a reconstruction error term, a smoothing regularization term, and a sparsity regularization term. Higher loss weights are assigned to the time periods corresponding to high-impact anomalies, enabling the time-series evolution model to pay more attention to the propagation characteristics of anomalies that have a real impact on planning during training. Third, the gradient descent method is used to update the model parameters of the time-series evolution model. The gradient of the weighted loss function with respect to the model parameters is calculated, and the parameters are updated according to the product of the learning rate and the gradient. The parameter update process enables the model to more accurately capture the temporal evolution of high-impact anomalies. Then, based on anomaly propagation characteristics, key causal paths are identified. Features such as the anomaly propagation range, duration, and speed are analyzed to determine which causal paths in the causal graph carry the main anomaly propagation process, marking these paths as key causal paths. Finally, the model parameters for causal relationship mining are updated to strengthen key causal paths. In the posterior distribution calculation of causal graph structure learning, edges related to key causal paths are assigned higher prior probabilities. During Markov chain Monte Carlo sampling, a tendency to retain these key paths is increased, making the optimized causal graph more focused on causal relationship structures closely related to anomaly propagation.

[0045] In an optional implementation, in step 6, the feedback mechanism can achieve adaptive feedback by introducing an attention weight mechanism, dynamically adjusting the weight ratio of influence feedback and propagation feature feedback according to the performance index of the current classification task, increasing the weight of influence feedback when the classification accuracy is low to prioritize anomalies that are more critical to planning decisions, and increasing the weight of propagation feature feedback when causal path identification is inaccurate to improve causal structure learning, thereby achieving adaptive adjustment of feedback intensity.

[0046] In another alternative implementation, in step 6, the feedback mechanism can also be implemented by: using an intermittent feedback update strategy instead of continuous feedback, setting a fixed feedback period, triggering parameter updates only after a sufficient number of new classification samples have been accumulated, batch processing feedback information and performing a centralized adjustment of model parameters in each feedback period, avoiding the computational overhead and model instability caused by frequent updates, while maintaining the improvement effect of the feedback mechanism on classification performance.

[0047] Step 7: Based on the degree of impact and the contextual features, the power grid anomaly classification result includes the following steps F1-F6: F1: Obtain causal path information related to the anomaly in the causal graph; F2: Obtain the propagation range and duration information in the anomaly propagation characteristics; F3: Obtain the economic and reliability impact information on power grid planning in the impact degree; F4: Determine the current power grid operation scenario by combining the context features; F5: Based on the causal path information, the propagation range and duration, the economic and reliability impact, and the operation scenario, comprehensively evaluate the actual impact of the anomaly on power grid planning decisions; F6: Classify anomalies whose actual impact exceeds the planning impact threshold as anomalies that require targeted measures in power grid planning, and classify anomalies whose actual impact does not exceed the planning impact threshold as anomalies that can be simplified in power grid planning.

[0048] Example 3, referring to Figures 2-6 As an embodiment of the present invention, based on the previous embodiment, a power grid anomaly classification method based on hierarchical temporal causal graph is provided, including: S1: Acquire and preprocess power grid operation data. This embodiment takes a 220kV regional power grid as an example, collecting 5 minutes of sampled data including electrical quantities such as voltage, current, active power, and reactive power, as well as status quantities such as circuit breaker status and relay operation. First, the collected raw data is preprocessed, including handling missing values, identifying and correcting outliers, and standardizing data.

[0049] S1.1: Missing value handling employs an adaptive interpolation method based on temporal context. For short-term missing values ​​(less than 15 minutes), linear interpolation is used; for medium-term missing values ​​(15 minutes to 1 hour), similar daily pattern interpolation is used; for long-term missing values ​​(more than 1 hour), comprehensive interpolation is performed by combining historical data from the same period and data from adjacent measurement points. In the specific implementation, missing values... The interpolation formula is: ,in This is historical data from the same period. For data from adjacent measuring points, To predict the output value of the model, , , Let be the weight coefficient, and satisfy... .

[0050] S1.2: Outlier identification and correction employs a three-layer detection mechanism. The first layer, based on statistical characteristics, uses an improved Z-Score method to identify obvious outliers: ,in For the observed values, The sample mean. For the sample standard deviation, when Exceeding the threshold (In this embodiment) When the value is 0, it is considered an outlier. The second layer, based on the time series characteristics, uses a sliding window to calculate the time series rate of change. ,when Exceeding the threshold (In this embodiment) When a value is detected, it is considered an outlier. The third layer is based on physical constraints and utilizes power flow constraints. Detecting data that does not conform to the laws of physics.

[0051] S1.3: Data standardization employs an adaptive standardization method. Different standardization strategies are used for different types of electrical quantities: voltage quantities are standardized using rated values. The load is standardized using the maximum capacity. Phase angle quantity adopted Normalization This differentiated standardization strategy takes into account the physical characteristics and numerical distribution of different electrical quantities, avoiding the information loss that may result from unified standardization.

[0052] S2: Construct a causal graph of the power grid through a causal discovery layer. For example... Figure 3 As shown, a nonparametric Bayesian variable-structure time-varying graph model is first constructed to automatically discover the causal relationship network in the power grid operation data. This model can adapt to the dynamic changes in the power grid topology and continuously update the causal graph structure, laying the foundation for subsequent anomaly propagation analysis.

[0053] S2.1: Initialize the prior cause-effect graph structure. Based on the power grid physical topology, establish the initial cause-effect graph. The physical connections of the power grid provide prior knowledge of the potential causal relationships between variables. In this embodiment, the regional power grid includes 23 substations and 110 main nodes. The initialized causal graph contains the physical connections between these nodes, represented as an adjacency matrix. ,in Represents a node and nodes There must be a physical connection between them, otherwise .

[0054] S2.2: Construct a nonparametric Bayesian time-varying graphical model with varying structure. The core of the model is to establish the posterior distribution. , is represented as: ,in Represents a cause-effect graph structure. Represents observation data, Represents prior knowledge of the power grid topology. For graph structures based on topological constraints, This is the data likelihood function. The likelihood function uses a Gaussian Bayesian network model: ,in Represents a node At any moment The observed values, express In the figure The set of parent nodes in the table.

[0055] S2.3: Introducing prior knowledge of power grid topology to constrain cause-effect graph learning. Power grid topology priors. Defined as: ,in Cause-and-effect graph representing learning With topological priors Measure of structural differences between them To weigh parameters (in this embodiment) Structural differences are measured using Hamming distance. ,in and They are and The adjacency matrix elements. This constraint mechanism ensures that the learned causal structure has a certain consistency with the physical topology of the power grid, while allowing the data-driven causal discovery process to uncover causal relationships in indirect physical connections.

[0056] S2.4: A Markov chain Monte Carlo method is used for variable structure inference. Specifically, the MCMC algorithm is used, which explores high-probability graph structures through random walks in the graph space. In each iteration, the algorithm randomly selects an operation on an edge (addition, deletion, or reversal), and decides whether to accept the transformation based on the ratio of the posterior probabilities before and after the transformation. ,if If the transformation is not accepted, the original graph structure is preserved. Through a sufficient number of iterations (10,000 in this example), the algorithm converges to a high-probability graph structure distribution.

[0057] S2.5: Introducing a time window sliding mechanism to capture topological structure evolution. The time series data is divided into multiple overlapping windows (in this embodiment, the window length is 24 hours and the overlap rate is 50%), and causal structure learning is performed independently for each window to obtain a time-varying causal graph sequence. To smooth out changes in the graph structure, a time regularization term is introduced: ,in As a measure of structural differences, The smoothing coefficient (in this embodiment) ).

[0058] S2.6: Construct the final power grid causal graph. A comprehensive causal graph is constructed by integrating causal graphs learned from different time windows. The edge weights represent the frequency with which the causal relationship occurs in different windows: ,in This is an indicator function that takes the value 1 when the condition is met and 0 otherwise. Ultimately, only weights exceeding the threshold are retained. (In this embodiment) The edges of the graph form a stable causal graph, which is represented as a weighted directed graph.

[0059] S3: Model the propagation characteristics of anomalies in the time dimension through a time-series propagation layer. For example... Figure 4 As shown, the temporal dynamic characteristics of anomalies are modeled using memory-enhanced neural networks using frequent differential equations, which accurately characterizes the propagation pattern of anomalies in the time dimension.

[0060] S3.1: Constructing a memory-enhanced Neural ODE. The continuous-time evolution of the power grid state is modeled using Neural ODEs: ,in express 3D system state vector, express 3D memory cell state, For time, For parameterized neural networks. Employing a multilayer perceptron architecture: ,in This represents vector concatenation. The activation function is LeakyReLU in this embodiment. These are learnable parameters.

[0061] S3.2: Design the memory unit update mechanism. The memory unit is used to capture long-term dependencies, and its update mechanism is as follows: ,in Input for external events, This is a parameterized update function. Adopt a gating update mechanism: ,in To update the door, For candidate memories, Represents element-wise multiplication. For the sigmoid function, These are learnable parameters.

[0062] S3.3: Introduction of a multi-scale temporal attention mechanism. To capture important information at different time scales, a multi-scale temporal attention mechanism is introduced: , ,in For attention weights, For similarity function, This is the enhanced state representation. The similarity function uses a scaled dot product: ,in A learnable query and key mapping matrix. To hide dimensions, this embodiment considers three time scales: short-term (5 minutes to 1 hour), medium-term (1 to 24 hours), and long-term (>24 hours).

[0063] S3.4: Establish an anomaly propagation feature extractor. Based on the output of the neural network's constant differential equation, an anomaly propagation feature extractor is constructed to extract the propagation pattern features of anomalies. The feature extractor includes propagation speed features. Characteristics of the spread characteristics of propagation duration and characteristics of the propagation path ,in The abnormal threshold (in this embodiment) ), For indicator functions, This represents the total number of nodes. These characteristics collectively constitute the representation of anomaly propagation properties. .

[0064] S3.5: Solving the neural ordinary differential equation using numerical methods. Since neural ordinary differential equations typically lack analytical solutions, numerical methods are required. This embodiment employs the adaptive step-size Dormand-Prince method (DOPRI5), which combines 4th and 5th order Runge-Kutta methods to automatically adjust the step size to balance computational accuracy and efficiency. The numerical solution process can be represented as follows: The integral is approximated by numerical methods.

[0065] S3.6: Training the memory-enhanced neural network's frequent differential equation model. The model training employs a two-stage strategy: the first stage uses normal data for pre-training, with the optimization objective being to minimize prediction error; the second stage uses data containing labeled anomalies for fine-tuning, with the optimization objective being to maximize anomaly detection performance. The loss function combines reconstruction error and a regularization term: ,in For reconstruction error, To smooth the regularization term, For sparse regularization terms, These are the weighting parameters (in this embodiment, they are 1.0, 0.1, and 0.01, respectively).

[0066] S4: Assess the actual impact of anomalies on power grid planning through the planning impact layer. For example... Figure 5 As shown, a counterfactual reasoning mechanism is used to assess the actual impact of anomalies on planning, distinguishing between anomalies that have a substantial impact on planning and negligible occasional anomalies.

[0067] S4.1: Construct a structural causal model to represent the causal relationship between anomalies and planning. A structural causal model (SCM) consists of a set of variables. Structural equation set of endogenous variables Distribution of exogenous variables Composition. In this embodiment, the variable set includes abnormal events. System status Planning and decision-making and planning results Key variables, such as structural equation modeling, describe causal relationships between variables. This indicates that the system state is determined by both abnormal events and random factors. This indicates that planning decisions are based on the system's state. This indicates that the planning outcome depends on the planning decisions and the state of the system.

[0068] S4.2: Implement a counterfactual reasoning mechanism. This is achieved through intervention. Two parallel scenarios are constructed: one with anomalies and one without. The intervention operation represents the variable... Forced to a specific value At the same time cut off The connection to its parent node. Counterfactual effects are defined as the causal impact of anomalies on the planning outcome: ,in Indicates intervention Post-planning results The expected value.

[0069] S4.3: Estimate the expected value using the Monte Carlo method. Since the distribution of planning results is often complex and difficult to calculate directly, the expected value is estimated using Monte Carlo simulation. ,in For the number of simulations (in this embodiment) ), For the first Intervention in the simulation The subsequent planning results. The simulation process includes: ① fixing ; ② From the distribution of exogenous variables ③ Sampling; ④ Calculating the values ​​of all endogenous variables based on structural equation modeling; ⑤ Recording the planning results. .

[0070] S4.4: Introduce multi-objective programming impact assessment. Taking into account multiple dimensions such as economic efficiency, reliability, and environmental friendliness, the impact of multi-objective programming is defined as follows: ,in Indicates the first One planning indicator, The corresponding weights are used. The main planning indicators considered in this embodiment include: investment cost. (Unit: RMB 10,000) Power supply reliability (Reliability index SAIDI, unit: minutes / household / year), load sufficiency (Expressed as a percentage) Environmental impact (Expressed in carbon emissions, unit: tons). The weights of each indicator are as follows: This reflects the relative importance of different planning objectives.

[0071] S4.5: Set an impact threshold to determine the anomaly classification boundary. Based on the planned impact level. Set the impact threshold (In this embodiment) ), classifying anomalies into high-impact anomalies ( ) and low-impact anomalies ( There are two categories. High-impact anomalies need to be given special consideration in the planning and may require specific planning measures; low-impact anomalies have limited impact on the planning and can be handled in a simplified manner in the planning process.

[0072] S4.6: Implement impact propagation path identification based on sensitivity analysis. To better understand the impact mechanism of anomalies on planning, sensitivity analysis is performed to identify key impact propagation paths. Define variables. For variables The sensitivity is By calculating anomalies For each intermediate variable and the effect of each intermediate variable on the planning result The sensitivity is used to determine the propagation path with the greatest impact. The sensitivity calculation employs the finite difference method: ,in It represents a tiny change.

[0073] S5: Introduces an adaptive context fusion module to dynamically integrate multi-source context information. For example... Figure 6 As shown, this module can dynamically integrate multi-source contextual information such as time factors, spatial factors, operation and maintenance factors, and social factors, thereby improving the environmental adaptability of anomaly classification.

[0074] S5.1: Constructing a multi-source contextual information representation. Collecting and representing four key types of contextual information: time factor... (Including time period, date type, season, etc.) Spatial factors (Including geographical location, power grid topology area, etc.), operation and maintenance factors (Including equipment status, maintenance plans, etc.) and social factors (Including load characteristics, important events, etc.). Different representation methods are used for various contextual information: time factors are represented using periodic encoding. Spatial factors are represented using a graph embedding method to generate node representations. Maintenance factors use multi-hot coding to represent equipment status. Social factors are represented by vectors to indicate load characteristics. .

[0075] S5.2: Employs an attention mechanism to automatically adjust the weights of various types of contextual information. The formula for calculating attention weights is: The merged context is represented as follows: ,in For context type Attention weights and These are learnable parameters. This adaptive weight adjustment mechanism enables the system to automatically focus on the most relevant contextual information based on different anomaly types and scenarios.

[0076] S5.3: Implement context-aware anomaly feature enhancement. This involves fusing the context representation... and abnormal features Combined, this generates context-enhanced exception representations: Enhancement function Employing attention enhancement mechanisms: ,in For context control gates, For context modulation function, Represents element-wise multiplication. These are learnable parameters.

[0077] S5.4: Design a dynamic context importance assessment mechanism. To understand the influence of different contextual factors on anomaly classification, an importance assessment mechanism is introduced: ,in This indicates the removal of contextual factors. Post-enhancement features Indicator Factors Importance scores are used to assess anomaly classification. This evaluation mechanism helps analysts understand the contribution of different contextual factors to anomaly classification, providing more interpretive information for decision-making.

[0078] S5.5: Establish context-adaptive anomaly classification criteria. The anomaly classification criteria are dynamically adjusted based on different context conditions. For example, during high-load periods, the system has a lower tolerance for voltage fluctuations, and the corresponding thresholds should be more stringent; during equipment maintenance, the system has a higher tolerance for certain anomalies, and the corresponding thresholds can be appropriately relaxed. This adaptive classification criterion is implemented through a context condition adjustment function: ,in As the baseline threshold, For context-based The adjustment function.

[0079] S6: Integrate the results from each layer to achieve power grid anomaly classification based on hierarchical temporal causal graphs. By comprehensively considering the causal structure, temporal characteristics, planning effects, and contextual information, the final anomaly classification result is determined.

[0080] S6.1: Construct an integrated classification decision framework. Integrate the outputs of each layer (causal graph). Abnormal propagation characteristics Planning Impact Assessment and context information The input is an ensemble decision framework, which generates the final classification result. The decision framework uses a weighted ensemble method. ,in For each layer of features, (This refers to the transformation function.) For the corresponding weighting coefficients, The activation function is sigmoid. The classification threshold is set to 0.5, i.e., when... If an anomaly is identified as a planning-related anomaly requiring attention, it is considered a non-planning-related anomaly that can be ignored.

[0081] S6.2: Introduce a feedback loop mechanism to achieve bidirectional information flow between layers. For example... Figure 1 As shown, a feedback loop is established to enable bidirectional information flow between different levels: planning impact assessment results. Feedback is sent to the time-series propagation layer, guiding the system to pay more attention to the propagation characteristics of anomalies that have a significant impact on planning; time-series propagation characteristics Feedback is sent to the causal discovery layer to help optimize the causal graph structure, especially strengthening causal paths associated with high-impact anomalies; information from each level is simultaneously input into the context fusion module to achieve global optimization. This feedback mechanism is implemented by updating the model parameters at each layer: ,in Indicates model parameters, For learning rate, For loss function, and These are the true classification and the model prediction, respectively.

[0082] S6.3: Employing an active learning mechanism to improve the data efficiency of the classification model. In practical applications, labeled outliers are usually few in number; therefore, an active learning strategy is used to select the most valuable samples for labeling. An uncertainty sampling strategy selects the samples with the least model uncertainty. ,in For the sample Category The predicted probability. A diversity sampling strategy ensures that the selected samples are representative: ,in This serves as a distance metric between samples. This active learning mechanism maximizes model performance improvement with limited annotation resources.

[0083] S6.4: Implement interpretability analysis of classification results. To enhance the interpretability of classification results, a SHAP (SHapley Additive ex Planations)-based interpretation mechanism is introduced to quantify the contribution of different features to the classification decision: ,in Representation of features SHAP value, For the set of all features, For features not included a subset of This is the model function. By analyzing the SHAP value, we can determine which features in which layers play a decisive role in the final classification result, providing an interpretable basis for decision-making.

[0084] S6.5: Construct a visualization interface for anomaly classification results. Develop an interactive visualization interface to display the anomaly classification results and their basis. The interface includes modules such as causal graph visualization, dynamic display of anomaly propagation paths, quantitative display of the degree of planning impact, and contextual analysis. The visualization interface adopts a hierarchical design, supporting multi-level information browsing from overview to details, helping users understand the origin and significance of the classification results.

[0085] S7: Deploy and optimize the anomaly classification system in a real power grid environment. Deploy the developed anomaly classification system in a real power grid environment and improve system performance through continuous monitoring and optimization.

[0086] S7.1: Establish an incremental learning mechanism to achieve continuous model optimization. As new data accumulates, incremental learning is used to update model parameters, avoiding the computational overhead of complete retraining. The objective function for incremental learning is: ,in For the loss of new data, To preserve the regularization terms of old knowledge, For the balancing parameters (in this embodiment) In this way, the model can continuously adapt to new data distributions while retaining its memory of learned knowledge.

[0087] S7.2: Implement model performance monitoring and automatic tuning mechanisms. Deploy a performance monitoring module to continuously track model metrics such as classification accuracy, precision, and recall. When performance metrics fall below preset thresholds, trigger the automatic tuning process, including feature importance analysis, hyperparameter optimization, and model structure adjustment. Hyperparameter optimization employs the Bayesian optimization method. ,in To improve the function, This is a hyperparameter vector.

[0088] S7.3: Establish a feedback collection mechanism to improve model performance. Collect feedback from power grid planning experts on the system classification results for model improvement. Feedback includes aspects such as the accuracy of the classification results, the clarity of interpretability, and the practicality of the planning recommendations. Based on the collected feedback, adjust model parameters and decision thresholds to improve the system's practicality and user satisfaction.

[0089] Example 4 is an embodiment of the present invention, which provides a power grid anomaly classification method based on hierarchical time-series causal graph. In order to verify the beneficial effects of the present invention, scientific demonstration is carried out through experiments.

[0090] This embodiment utilizes ultra-high voltage AC / DC hybrid power grid data provided by a large power group, including 1-minute high-precision load, voltage, and current data sampled continuously for 8 months, covering 178 network nodes and a total of 6,137,856 data records. The hardware environment consists of a server cluster with dual AMD EPYC7763 processors, 256GB of memory, and 4 × NVIDIA A100 GPUs. The software environment uses Python 3.9, PyTorch 1.12, DGL 0.9, and NetworkX 2.8. Model training and testing are performed on a Kubernetes-based distributed computing framework, supporting multi-node parallel computing. A time-series data storage-optimized InfluxDB instance is specifically configured for efficient processing and querying of large-scale power grid time-series data.

[0091] Comparison with Scheme 1: Traditional statistical analysis-based power grid anomaly classification methods primarily employ Principal Component Analysis (PCA) for feature dimensionality reduction, combined with Support Vector Machine (SVM) for anomaly classification. This method uses sliding window statistical features as the classification basis, with a fixed window size of 30 minutes and a step size of 5 minutes. Feature extraction includes statistical measures such as mean, standard deviation, skewness, kurtosis, and autocorrelation coefficient. The SVM classifier uses a Gaussian kernel function, with parameters optimized through grid search. This method has high computational efficiency, but its ability to detect nonlinear anomaly patterns and long-term dependencies is limited, and it cannot model causal relationships and propagation characteristics between anomalies.

[0092] Comparison with Scheme 2: The power grid anomaly classification method based on graph neural networks: This method uses a spatiotemporal graph convolutional network (STGCN) to model the power grid topology and operational data. Spatial features are captured through the graph convolutional network, and temporal features are captured using gated recurrent units (GRUs). This method directly maps the physical topology of the power grid to a graph structure. Node features include physical quantities such as voltage, current, active power, and reactive power. The model contains 3 graph convolutional layers and 2 GRU layers, with a hidden layer dimension of 256. It is trained using the Adam optimizer with a learning rate of 0.0005. This method considers the fusion of spatial and temporal characteristics, but lacks a clear causal modeling mechanism, and the assessment of the impact on planning is relatively simple.

[0093] Experimental Procedure: First, comprehensive preprocessing was performed on eight months of UHV AC / DC hybrid power grid data, including outlier detection and handling, missing value imputation, and data standardization. Based on the data timestamp characteristics, a time series partitioning strategy was adopted to divide the data into training, validation, and test sets in a 75%:15%:10% ratio to ensure temporal continuity and distribution consistency. Specific data augmentation strategies were designed to address the characteristics of the UHV AC / DC hybrid power grid, including adding Gaussian noise (mean 0, standard deviation 0.01), random scaling (scale factor 0.95-1.05), and inserting synthetic outliers to increase model robustness.

[0094] For the scheme of this invention, the parameters of each layer of the hierarchical temporal causal graph framework are configured in detail. The causal discovery layer adopts a nonparametric Bayesian variable structure time-varying graph model, with a Markov chain Monte Carlo sampling step count of 10,000, a burn period of 2,000, and an acceptance rate maintained between 0.23 and 0.37. A power grid topology prior is introduced to constrain that there is no direct causal relationship between nodes more than 3 hops apart. In the temporal propagation layer, the state dimension of the memory-enhanced neural network's frequent differential equation is set to 384, the memory unit dimension is 192, the integrator adopts the adaptive step-size Dormand-Prince method, and the tolerance is set to 1e-6. The multi-scale temporal attention mechanism sets five different time scales (1 minute, 5 minutes, 30 minutes, 2 hours, and 12 hours) to capture anomalous patterns of different frequencies. In the planning impact layer, counterfactual reasoning employed 2000 Monte Carlo simulations. The multi-objective planning evaluation included four dimensions: economy, reliability, environmental friendliness, and flexibility, with weights of 0.35, 0.30, 0.20, and 0.15, respectively. The adaptive context fusion module integrated meteorological data (temperature, humidity, wind speed), load forecast data, equipment status data, and historical anomaly records. The temperature parameter for the attention mechanism was set to 0.1 to ensure clarity in weight allocation.

[0095] The model training employed a phased strategy, first training each layer individually, then performing joint fine-tuning. The causal discovery layer was trained for 800 epochs using variational inference with a learning rate of 0.001. The temporal propagation layer was trained for 1200 epochs using a learning rate decay strategy, with an initial learning rate of 0.0008, decreasing to 0.85 times the original rate every 300 epochs. The planning influence layer was trained based on 36 historical planning cases, iterating 2000 times using the Adam optimizer. Finally, joint fine-tuning of the entire network was performed with a learning rate of 0.0002 for 300 epochs. To avoid overfitting, regularization techniques were applied, including L2 regularization (coefficient 1e-5), weight decay (coefficient 5e-4), and an early stopping strategy (patience=30).

[0096] Testing Methods and Standards: This embodiment employs a comprehensive multi-dimensional and multi-scenario testing method to fully evaluate the performance differences between the proposed solution and two comparative solutions. Firstly, regarding basic classification performance evaluation, in addition to the conventional accuracy, precision, recall, and F1 score, the area under the ROC curve (AUC) and the area under the precision-recall curve (AUPR) are calculated to comprehensively measure classification performance. Simultaneously, the Matthews correlation coefficient (MCC) is introduced to provide a balanced evaluation of classification performance in imbalanced data. For the evaluation of temporal modeling capabilities, in addition to the mean squared error of prediction (MSE) and mean absolute percentage error (MAPE), dynamic time warping distance (DTW) and consecutive permutation distance (CPD) are used to more accurately measure the similarity of temporal predictions.

[0097] In terms of causal discovery performance evaluation, in addition to the Structural Hamming Distance (SHD) and F1 structural score, the Structural Intervention Distance (SID) for acyclic directed graphs and the Normalized Structural Intervention Distance (NSID) for complete partially directed acyclic graphs were also calculated to more accurately assess the consistency between the learned causal graph and the actual causal relationships. The planning impact assessment adopted a more comprehensive indicator system, including Return on Investment (ROI), Dynamic Programming Adaptability (DPA), System Reliability Index (SRI), and New Energy Recycling Capacity (NREAC). Contextual adaptability assessment tested performance under seven complex scenarios, including weekdays / holidays, seasonal changes, extreme weather (typhoons, heavy rain, extreme cold), significant fluctuations in new energy sources, sudden load changes, equipment maintenance, and network topology reconfiguration.

[0098] In addition, a special case test set was designed, containing 25 typical anomaly events that actually occurred in history, to evaluate the ability of each scheme to identify different types of anomalies. These anomalies include various types such as equipment failure, protection action, voltage instability, power oscillation, and network topology mutations. System performance evaluation included tests on computational latency, memory usage, and scalability. By gradually increasing the data size and the number of network nodes, the computational efficiency and scalability of the algorithms were tested. For interpretability evaluation, 15 power grid planning experts were invited to score the understandability and usability of the classification results using a Likert scale of 1-5. The experimental results are shown in Table 1. Table 1. Experimental Comparison Table

[0099] Example 5 is an embodiment of the present invention, which provides a power grid anomaly classification system based on hierarchical time-series causal graphs, including: The data preprocessing module is used to collect and preprocess power grid operation data; The causal discovery module is used to discover causal relationship structures from the power grid operation data using causal relationship mining methods, and to construct a causal graph. The time-series propagation module is used to perform time-series modeling on the power grid operation data using a time-series evolution modeling approach, identify anomalies, and extract anomaly propagation features; The planning impact assessment module is used to construct counterfactual reasoning methods to assess the degree of impact of the anomalies on the power grid planning results; The context fusion module is used to integrate multi-source context information and generate context features; The feedback interaction module is used to establish a feedback mechanism to realize information interaction between the causal graph construction, the time series modeling, and the impact assessment. An anomaly classification module is used to determine the power grid anomaly classification result based on the degree of impact and the contextual features.

[0100] The causal discovery layer uses a nonparametric Bayesian variable structure time-varying graphical model to automatically discover causal relationships in power grid operation data, represented as follows: in, Represents a cause-effect graph structure. Represents observation data, For the graph structure prior, Let P(G|D) be the likelihood function, which is the posterior probability distribution of the causal graph structure G given the observed data D. G represents the causal graph structure, i.e., the network structure describing the causal relationships between power grid components. D represents the observed power grid operation data. P(G|D) is the conditional probability of the graph structure G inferred after observing the data D. P(D|G) is the likelihood function, which represents the probability of observing the data D given the graph structure G. P(G) is the prior probability distribution of the graph structure, representing our belief in the graph structure before seeing any data.

[0101] The causal discovery layer introduces prior knowledge of the power grid topology to constrain causal graph learning, replacing the graph structure prior P(G) with a conditional prior P(G|T) based on prior knowledge of the power grid topology, as follows: in, Represents prior knowledge of the power grid topology. This is a priori for graph structures based on topological constraints.

[0102] The temporal propagation layer uses memory-enhanced neural frequent differential equations to model the propagation characteristics of anomalies in the time dimension, represented as: in, Indicates the system status. Indicates the state of the memory cell. For parameterized neural networks; The memory unit update mechanism is as follows: Where m(t−1) represents the memory cell state at the previous time step, m(t) is the memory cell state at the current time t, m(t−1) is the memory cell state at the previous time step t1, h(t) is the system state at the current time t, e(t) is the external event input at the current time t, and gϕ is a parameterized update function that determines how to update the memory cell based on the memory state at the previous time step, the current system state, and the external event.

[0103] The temporal propagation layer introduces a multi-scale temporal attention mechanism, represented as: Where αi represents the attention weight, which measures the relevance or importance between the current state ht and the historical state hti; s(ht,hti) represents the similarity function, used to calculate the similarity between the current state ht and the historical state hti; exp(s(ht,hti)) represents the exponential transformation of the similarity value, which is a common processing method in attention mechanisms to make the similarity more prominent; Σjexp(s(ht,htj)) represents the exponential sum of the similarities of all historical states, used to normalize the attention weight to ensure that the sum of all weights is 1; ĥt(h^t) represents the enhanced state representation, which is obtained by weighted averaging of historical states; and Σiαihti represents the result of weighted summation of all historical states according to the attention weight αi.

[0104] The planning impact layer constructs a counterfactual reasoning mechanism, which compares the differences in planning results under two parallel scenarios: "with anomalies" and "without anomalies," and is represented as follows: in, Indicates an abnormal event. Indicators representing planning outcomes Let ΔE represent the causal impact (effect difference) of the anomaly on the planning outcome. E[R|do(A=1)] represents the expected value of the planning outcome indicator R if the intervention causes the anomaly event A to occur (A=1, i.e., "anomaly exists"). E[R|do(A=0)] represents the expected value of the planning outcome indicator R if the intervention prevents the anomaly event A from occurring (A=0, i.e., "no anomaly"). do(A=a) represents the "intervention operation," a key concept in causal reasoning. It signifies forcibly setting variable A to a specific value a, while severing all causal connections between A and its parent nodes. This differs from simple conditional probability P(R|A=a); the intervention operation considers the true causal effect.

[0105] The planning impact layer introduces a multi-objective planning impact assessment, comprehensively considering economic, reliability, and environmental protection indicators, as expressed as: in, Indicates the first One planning indicator, For the corresponding weights.

[0106] An adaptive context fusion module is introduced to dynamically integrate four types of multi-source context information: time factors, space factors, operation and maintenance factors, and social factors, represented as follows: in, For the fused context representation, , , and These represent different types of contextual information: time factors include time period, date type, season, etc.; spatial factors include geographical location, power grid topology area, etc.; operation and maintenance factors include equipment status, maintenance plan, etc.; and social factors include load characteristics, important events, etc.

[0107] The adaptive context fusion module uses an attention mechanism to automatically adjust the weights of various types of contextual information, as shown below: Where βi represents the attention weight of context type i, i.e., the importance coefficient assigned to this type of context information; Wi represents the weight matrix associated with context type i, which is a learnable parameter; ci represents the feature representation of context type i (e.g., time factors, spatial factors, etc.); bi represents the bias term associated with context type i, which is also a learnable parameter; exp(Wici+bi) represents the exponential transformation of the linear transformation result, which is a common processing method in attention mechanisms; Σjexp(Wjcj+bj) represents the sum of the exponential transformations of all context types, used to normalize the attention weights and ensure that the sum of all weights is zero. 1; βi represents the attention weight of context type i, i.e., the importance coefficient assigned to this type of context information; Wi represents the weight matrix associated with context type i, which is a learnable parameter; ci represents the feature representation of context type i (e.g., time factors, spatial factors, etc.); bi represents the bias term associated with context type i, which is also a learnable parameter; exp(Wici+bi) represents the exponential transformation of the linear transformation result, which is a common processing method in attention mechanisms; Σjexp(Wjcj+bj) represents the sum of the exponential transformations of all context types, used to normalize the attention weights and ensure that the sum of all weights is 1.

[0108] A feedback loop mechanism is introduced between each layer to enable bidirectional information flow: The planning impact assessment results are fed back to the time-series propagation layer to adjust the propagation model parameters; The temporal propagation characteristics are fed back to the causal discovery layer to guide the optimization of the causal graph structure; Information from all levels is simultaneously input into the context fusion module to achieve global optimization.

[0109] With the development of the energy internet and distributed energy, the coordinated operation of multiple microgrids poses new challenges to grid stability, and traditional anomaly classification methods are insufficient to effectively address such complex scenarios. This embodiment extends and optimizes the aforementioned technical solution to address this scenario.

[0110] This embodiment uses real-world scenario data from a provincial smart distribution network and five microgrids operating in coordination, including operational data sampled at a 15-minute frequency over one year. This data covers key parameters of the smart distribution network's main network (such as bus voltage, line power flow, and frequency) and internal operational data of each microgrid (such as distributed energy output, energy storage charging and discharging status, and local load). In addition, relevant external environmental data (such as meteorological conditions and electricity market price fluctuations) and network topology change records (such as microgrid grid connection / disconnection operations and distribution network reconfiguration) were also collected.

[0111] In the causal discovery layer, this embodiment optimizes for multi-microgrid collaborative scenarios by introducing a hierarchical causal structure discovery algorithm. This algorithm divides grid causal relationships into three levels: intra-microgrid causal relationships, inter-microgrid causal relationships, and microgrid-main grid causal relationships. This hierarchical modeling reduces the complexity of causal discovery. Specifically, for each microgrid, a PC algorithm based on conditional independence testing is used for initial causal discovery; for causal relationships between microgrids and between a microgrid and the main grid, a Granger causality test-based method is used; finally, the causal relationships at these three levels are combined to form a complete causal graph. Its mathematical representation is as follows: in, Indicates the first Internal cause-effect diagram of a microgrid Indicates the causal relationship between microgrids. This indicates the causal relationship between the main grid and the microgrid.

[0112] To handle dynamic topology changes in multi-microgrid scenarios, this embodiment introduces a topology-aware adaptive causal relationship mechanism at the causal discovery layer. This mechanism adjusts the causal graph structure by monitoring the grid connection / off-grid status of the microgrid in real time. When a microgrid topology change is detected (e.g., from grid connection to off-grid or vice versa), the system automatically triggers a causal structure recalculation process. To improve computational efficiency, an incremental calculation method is adopted, updating only the causal subgraph affected by topology changes while keeping other parts unchanged. This adaptive mechanism can be represented as: in, Indicates time The cause-effect graph structure, Indicates time Topological changes, It is an adaptive function.

[0113] At the time-series propagation layer, this embodiment enhances the multi-timescale dynamic characteristics in multi-microgrid collaborative scenarios. Traditional memory-enhanced neural network ordinary differential equations have limitations when handling events at different timescales. Therefore, this embodiment introduces a multi-timescale decomposition and fusion mechanism, decomposing the original time-series data into fast dynamic components (second-level), medium-speed dynamic components (minute-level), and slow dynamic components (hour-level), modeling them separately, and then fusing them. Its mathematical expression is: in, , and These represent the fast, medium, and slow dynamic components, respectively. , and For the corresponding parameterized neural network, , and This represents the state of the corresponding memory unit.

[0114] Furthermore, this embodiment introduces an event-triggered dynamic sampling mechanism in the time-series propagation layer, adaptively adjusting the sampling frequency according to the rate of system state change. When the system state changes drastically (such as microgrid grid-connected / off-grid switching, sudden changes in distributed energy output, etc.), the system automatically increases the sampling frequency to capture rapidly changing characteristics; while when the system is in a relatively stable state, the sampling frequency decreases to save computational resources. Its mathematical expression is: in, Indicates the first The sampling time interval of the step, Based on the sampling interval, For sensitivity parameters, The norm represents the state change.

[0115] At the planning impact layer, this embodiment designs a more complex counterfactual reasoning mechanism for multi-microgrid collaborative scenarios. Since microgrids can operate in different modes (grid-connected / off-grid), the impact of anomalies on planning will vary depending on the operating mode. Therefore, this embodiment constructs a multi-mode counterfactual reasoning framework to evaluate the impact of anomalies under each possible combination of operating modes and perform a weighted aggregation. Its mathematical expression is as follows: in, This indicates the number of possible combinations of operating modes for the five microgrids. Indicates the first The probability of a combination of operating modes. Indicates the first Planning outcome indicators under various operating modes.

[0116] To more accurately assess the impact of anomalies on multi-microgrid collaborative planning, this embodiment introduces a reinforcement learning-based Monte Carlo Tree Search (MCTS) method at the planning impact layer for efficient evaluation of counterfactual scenarios in a large-scale state space. MCTS estimates the long-term impact of anomalies on planning by constructing a decision tree and simulating possible decision paths within the tree. In each simulation, the system selects an action (such as microgrid grid connection / disconnection decision, energy storage charging / discharging strategy, etc.) based on the current state, executes the action, observes the results, and then updates the value estimate of the decision tree based on the results. Its main steps include four stages: selection, expansion, simulation, and backpropagation. The selection stage uses the Upper Confidence Bound (UCT) algorithm to select the most valuable node. in, Indicates the state Next action The estimated value, Representing state Number of visits Indicates the state Next action Number of times, To explore parameters.

[0117] Regarding the adaptive context fusion module, this embodiment, considering the characteristics of multi-microgrid collaborative scenarios, adds specific contextual information such as microgrid operation modes, energy market price fluctuations, and user behavior patterns. To effectively process this heterogeneous contextual information, this embodiment employs a multi-source heterogeneous information fusion method based on Graph Attention Networks (GAT). This method represents different types of contextual information as different types of nodes in a graph structure and learns the relationships between nodes through a graph attention mechanism. Its mathematical expression is: in, Indicates the first Layer nodes Feature representation, Represents a node The neighborhood group, This is the weight matrix. For attention vectors, For activation function, This indicates a feature splicing operation.

[0118] This embodiment also introduces an uncertainty quantification mechanism based on Bayesian deep learning to address uncertainties in multi-microgrid collaborative scenarios. This mechanism not only outputs anomaly classification results but also provides an uncertainty estimate of the classification results, enabling planning decision-makers to adjust their decision-making strategies based on the level of uncertainty. Specifically, it uses the Monte Carlo random deactivation (MCDropout) method to approximate Bayesian inference, calculating the variance of the predicted distribution through multiple forward propagations as a measure of uncertainty. in, Indicates the first The prediction results of the second forward propagation, express The average of the predictions. This represents the number of forward propagations.

[0119] Finally, to optimize the overall system performance, this embodiment introduces a global feedback mechanism. This mechanism not only includes the feedback loops between the aforementioned layers but also incorporates an expert-knowledge-based correction mechanism, integrating feedback from power system experts into the system. Specifically, when experts propose corrections to the system's classification results, the system automatically adjusts the corresponding model parameters, including the prior probabilities of the causal graph structure, the parameters of the time-series propagation model, and the weights of the planning impact assessment. This human-machine collaborative learning mechanism significantly improves the system's adaptability and accuracy in complex multi-microgrid scenarios.

[0120] The anomaly classification system in this embodiment has been verified through comparative experiments with traditional methods, demonstrating significant performance advantages in complex multi-microgrid collaborative scenarios. Particularly in addressing the anomaly classification problem caused by microgrid topology changes, this method can effectively identify anomalies related to microgrid grid connection / disconnection operations and accurately assess the actual impact of these anomalies on grid planning, providing strong decision support for multi-microgrid collaborative planning.

[0121] This embodiment also provides an electronic device applicable to a power grid anomaly classification method based on hierarchical time-series causal graphs, comprising: a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the power grid anomaly classification method based on hierarchical time-series causal graphs as proposed in the above embodiment.

[0122] This embodiment also provides a storage medium storing a computer program that, when executed by a processor, implements a power grid anomaly classification method based on hierarchical temporal causal graphs as proposed in the above embodiments.

[0123] The storage medium proposed in this embodiment belongs to the same inventive concept as the method for classifying power grid anomalies based on hierarchical time-series causal graphs proposed in the above embodiments. Technical details not described in detail in this embodiment can be found in the above embodiments, and this embodiment has the same beneficial effects as the above embodiments.

[0124] Based on the above description of the implementation methods, those skilled in the art can clearly understand that the present invention can be implemented using software and necessary general-purpose hardware, and of course, it can also be implemented using hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk, or optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of the various embodiments of the present invention.

[0125] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.

Claims

1. A power grid anomaly classification method based on hierarchical temporal causal graphs, characterized in that: include, Collect and preprocess power grid operation data; Causal relationship mining is used to discover causal relationship structures from the power grid operation data and construct a causal graph; The power grid operation data is modeled in a time series using a time-series evolution modeling approach to identify anomalies and extract anomaly propagation characteristics; Construct a counterfactual reasoning approach to assess the impact of the anomaly on the power grid planning results; Integrate multi-source contextual information to generate contextual features; Establish a feedback mechanism to enable information exchange between the causal graph construction, the time series modeling, and the impact assessment. Based on the degree of impact and the contextual features, the power grid anomaly classification result is determined.

2. The power grid anomaly classification method based on hierarchical temporal causal graph as described in claim 1, characterized in that: The construction of the causal graph includes establishing the prior distribution of the causal graph structure; Calculate the data likelihood function based on the power grid operation data; The posterior distribution of the causal graph structure is obtained through Bayesian inference; The causal relationship structure is determined based on the posterior distribution.

3. The power grid anomaly classification method based on hierarchical temporal causal graph as described in claim 2, characterized in that: The process of identifying anomalies and extracting anomaly propagation features includes constructing a state evolution equation to describe the continuous evolution of the system state of the power grid operation data over time. Introduce a state memory mechanism to capture historical state information; Identify abnormal states based on the evolution of the system state; Extract the propagation characteristics of the abnormal state.

4. The power grid anomaly classification method based on hierarchical temporal causal graph as described in claim 3, characterized in that: The assessment of the impact of the anomaly on the power grid planning results includes constructing a structural causal model to represent the causal relationship between the anomaly and the power grid planning results; A comparative scenario is set up to simulate the power grid planning process under different abnormal conditions; Calculate the power grid planning results for each comparison scenario; The degree of impact is determined by comparing the differences in planning results under different scenarios.

5. The power grid anomaly classification method based on hierarchical temporal causal graph as described in claim 4, characterized in that: The generated context features include obtaining contextual information on time factors, spatial factors, operational factors, and social factors; Represent and encode various types of contextual information; A weighting allocation mechanism is used to determine the fusion weights of various types of contextual information; The contextual features are generated by weighting and fusing various types of contextual information based on the fusion weights.

6. The power grid anomaly classification method based on hierarchical temporal causal graph as described in claim 5, characterized in that: The establishment of the feedback mechanism includes determining the focus of time series modeling based on the degree of influence and updating the model parameters of the time series evolution modeling method; Based on the abnormal propagation characteristics, key causal paths are identified, and the model parameters of the causal relationship mining method are updated.

7. The power grid anomaly classification method based on hierarchical temporal causal graph as described in claim 6, characterized in that: The determination of the power grid anomaly classification result includes obtaining causal path information related to the anomaly in the causal graph; Obtain the propagation range and propagation duration information from the abnormal propagation characteristics; Obtain information on the economic and reliability impacts on power grid planning from the aforementioned level of impact; The current power grid operation scenario is determined by combining the aforementioned contextual features; Based on the causal path information, the propagation range and duration, the economic and reliability impacts, and the operational scenario, the actual impact of the anomaly on power grid planning decisions is comprehensively assessed. Anomalies whose actual impact exceeds the planned impact threshold are classified as anomalies requiring targeted measures in power grid planning, while anomalies whose actual impact does not exceed the planned impact threshold are classified as anomalies that can be simplified in power grid planning.

8. A power grid anomaly classification system based on hierarchical temporal causal graphs, employing the power grid anomaly classification method based on hierarchical temporal causal graphs as described in any one of claims 1 to 7, characterized in that, include: The data preprocessing module is used to collect and preprocess power grid operation data; The causal discovery module is used to discover causal relationship structures from the power grid operation data using causal relationship mining methods, and to construct a causal graph. The time-series propagation module is used to perform time-series modeling on the power grid operation data using a time-series evolution modeling approach, identify anomalies, and extract anomaly propagation features; The planning impact assessment module is used to construct counterfactual reasoning methods to assess the degree of impact of the anomalies on the power grid planning results; The context fusion module is used to integrate multi-source context information and generate context features; The feedback interaction module is used to establish a feedback mechanism to realize information interaction between the causal graph construction, the time series modeling, and the impact assessment. An anomaly classification module is used to determine the power grid anomaly classification result based on the degree of impact and the contextual features.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the power grid anomaly classification method based on hierarchical temporal causal graph as described in any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the power grid anomaly classification method based on hierarchical temporal causal graph as described in any one of claims 1 to 7.