Electricity consumption anomaly detection method based on graph structure
By constructing a causal perception heterogeneous graph and a dynamic hypergraph structure, and combining graph contrast learning and environmental adaptive threshold determination, the problem of insufficient causal relationship identification in existing electricity consumption anomaly detection methods is solved, and high generalization and accurate anomaly detection are achieved.
Patent Information
- Application Number
- CN202511674733.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-14
- Publication Date
- 2026-02-10
AI Technical Summary
Existing methods for detecting abnormal electricity consumption rely on statistical correlation or simple threshold judgments, which leads to environmental variables that are highly correlated but have no causal relationship being misjudged as abnormal. Furthermore, the fixed physical topology cannot be dynamically adjusted, resulting in poor generalization ability of the model in different seasons or scenarios.
By constructing a causal perception heterogeneous graph, introducing a dynamic hypergraph structure, combining graph contrastive learning and unsupervised pre-training, and using a causal discovery algorithm to identify the causal relationship between electricity consumption and environmental variables, dynamically adjusting the relationship between nodes, and adopting environmental adaptive threshold judgment and causal path verification, high-generalization anomaly detection is achieved.
It effectively distinguishes between real causal influences and spurious correlations, reduces false alarm rates, improves the ability to capture abnormal patterns under complex interference, and ensures the accuracy and interpretability of anomaly localization.
Smart Images

Figure CN121502423A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of power consumption anomaly detection technology, and in particular to a power consumption anomaly detection method based on graph structure. Background Technology
[0002] Electricity consumption anomaly detection technology refers to a technical means of automatically identifying electricity consumption states that deviate from normal patterns by analyzing electricity consumption behavior data of various areas or users in the power grid, combined with auxiliary information such as environment and topology. Its core objective is to promptly, accurately, and robustly detect potential anomalies in massive amounts of time-series data, providing support for power grid safe operation, theft prevention and violation detection, and operation and maintenance decisions. Therefore, how to utilize advanced technologies to improve the intelligence level and security of electricity consumption anomaly detection has become one of the urgent problems to be solved.
[0003] Existing methods are mostly based on statistical correlation or simple threshold judgment, which misclassifies highly correlated but causally unrelated environmental variables as abnormal causes. This leads to a large number of false anomalies caused by normal environmental responses being falsely alarmed. In addition, most methods use fixed physical topology or preset association graphs, which cannot dynamically adjust the strength of relationships between nodes according to external conditions such as weather and holidays, resulting in poor generalization ability of the model in different seasons or scenarios. Summary of the Invention
[0004] In view of the aforementioned existing problems, the present invention is proposed.
[0005] Therefore, this invention provides a graph-based method for detecting abnormal electricity consumption. This addresses the problem that existing methods often rely on statistical correlation or simple threshold judgments, misjudging highly correlated but causally unrelated environmental variables as abnormal causes. This leads to a large number of false alarms caused by normal environmental responses. Furthermore, most methods use fixed physical topologies or preset association graphs, which cannot dynamically adjust the strength of relationships between nodes according to external conditions such as weather and holidays, resulting in poor generalization ability of the model in different seasons or scenarios.
[0006] To solve the above-mentioned technical problems, the present invention provides the following technical solution: In a first aspect, the present invention provides a graph-based method for detecting abnormal electricity consumption, comprising: Historical electricity consumption data, environmental variable data, and power grid physical topology information of the power grid area are obtained, and the historical electricity consumption data, environmental variable data, and power grid physical topology information are standardized to obtain a standardized time-series-environment dataset. Based on a standardized time-series-environment dataset, a causal relationship between electricity consumption and environmental variables is identified through a causal discovery algorithm, and a causal perception heterogeneous graph containing regional nodes and environmental factor nodes is constructed. Based on the causal perception heterogeneous graph, a hyperedge is introduced to connect multiple region nodes affected by the same environmental event, forming a dynamic hypergraph structure to represent many-to-many environment-region coupling relationships. Based on the dynamic hypergraph structure, a graph contrast learning task is constructed. Positive and negative sample pairs are generated by applying perturbations to node features and graph structure respectively, and unsupervised pre-training is completed to obtain a node representation model. The current electricity consumption observation value and environmental variables are input into the node representation model, and inference is performed in combination with the dynamic hypergraph structure to output the electricity consumption reconstruction result; Based on the deviation between the reconstructed electricity consumption results and the actual observed values, and combined with the degree of environmental deviation of each region on the causal path, the anomaly score of each region node is calculated. The abnormal score is compared with a judgment threshold dynamically set based on historical normal data. If the abnormal score exceeds the judgment threshold, the corresponding area is determined to be an abnormal power consumption area, and the abnormal location result is output.
[0007] As a preferred embodiment of the graph-based electricity consumption anomaly detection method of the present invention, the specific steps for constructing the causal perception heterogeneous graph containing regional nodes and environmental factor nodes are as follows: Time-delay cross-correlation analysis was performed on the historical electricity consumption series and environmental variable series for each power grid regional unit; If two region nodes and The residual fluctuation series has the maximum correlation coefficient at a certain time lag. Furthermore, by passing the Granger causality test, a directed wave propagation edge is established. Its weight is calculated as follows: ; in, , Representing regions The original residual sequence and region In time lag The residual sequence below, The time-delay decay coefficient; Calculate the environmental feature similarity between any two region nodes. If the cosine similarity exceeds an adaptive threshold... Then establish environmental similarity edges Its weight is: ; in, , For the region , Environment encoding vector, For cosine similarity, The standard deviation of historical environmental similarity; Spatial correlation edges are constructed based on the physical topology of the power grid, and their weights are obtained by normalizing the inverse of the line impedance. Construct adjacency matrices for the three types of edges respectively. , , And through a gating mechanism, they are merged into a unified adjacency matrix. The expression is: ; Among them, the gating coefficient , , The current environmental state vector is dynamically generated by an LSTM network to form a causal perception heterogeneous graph.
[0008] As a preferred embodiment of the graph-based power consumption anomaly detection method of the present invention, the specific steps for constructing the dynamic hypergraph structure are as follows: Based on the causal perception heterogeneous graph, virtual environment supernodes of temperature and holiday types are added; Aggregate all region nodes that have causal connections with the same environment supernode into a single superedge; The activation state of a superedge is determined by the real-time state of the environment's supernodes. When the environmental state changes, the weights of similar edges in the environment are recalculated. With fluctuation propagation edge weight And update the adjacency matrix. This enables the dynamic evolution of graph structures.
[0009] 4. The graph-based power consumption anomaly detection method as described in claim 3, characterized in that: the specific steps for obtaining the node representation model are as follows: The high-frequency residual components of the regional nodes are input into the attention network channel of the environment enhancement graph; The environment-enhanced graph attention network channel calculates region nodes through a cross-modal attention mechanism. With environmental supernodes Association weight between The expression is: ; in, Features of regional nodes For environmental supernode features, , For learnable parameter matrix, This is the scaling factor; Based on association weight The features of neighboring nodes are weighted and aggregated to generate an environment-sensitive residual embedding representation; The low-frequency trend component is input into the T-GCN channel for periodic modeling. The dual-channel outputs are dynamically fused using LSTM to construct a node representation model.
[0010] As a preferred embodiment of the graph-based power consumption anomaly detection method of the present invention, the specific steps for calculating the anomaly score of each regional node are as follows: The current electricity consumption is reconstructed using a node representation model to obtain the reconstructed value. ; Calculate residual reconstruction error ; Based on the historical normal residual sequence within the sliding window, a probability density function sensitive to environmental state is constructed using kernel density estimation. The bandwidth parameter of the probability density function is dynamically adjusted according to the current environmental state, and the optimal bandwidth is calculated using the following formula: ; in, The standard deviation of the data within the window. Interquartile range, The number of samples; By combining the environmental sensitivity coefficients learned by LSTM with the topology propagation state, a dynamic anomaly threshold is generated, expressed as: ; in, This represents the residual value corresponding to the 95th percentile under kernel density estimation. This is the current environment vector. For topological propagation state vectors, and These are the environmental factor weight matrix and the propagation sensitivity vector, respectively. , These are learnable hyperparameters.
[0011] As a preferred embodiment of the graph-based power consumption anomaly detection method of the present invention, the specific steps of comparing the anomaly score with the judgment threshold are as follows: The residual value of each region node is compared with the dynamic threshold under the corresponding environmental condition. Compare; If the absolute value of the residual is greater than If so, it is initially marked as an abnormal candidate; Further calculate the attention weight distribution of this node in the EA-GAT channel. If its attention to the abnormal environment supernode is higher than the normal historical average, it is confirmed as a real anomaly. Otherwise, it is considered a pseudo-anomaly caused by environmental disturbance and is removed.
[0012] As a preferred embodiment of the graph-based power consumption anomaly detection method of the present invention, the specific steps for outputting the anomaly location result are as follows: For all region nodes identified as anomalous, the criteria are based on whether their residuals exceed the dynamic threshold. Sort by amplitude; Combining the physical topology adjacency matrix of the power grid Determine whether the anomaly propagates along the electrical path; If multiple adjacent regions are simultaneously abnormal and the fluctuation propagation edge weight If the magnitude is large, it is determined to be a regional abnormal event; Output a list of abnormal areas and label their types, including local equipment failures, regional load changes, and environmentally induced anomalies.
[0013] As a preferred embodiment of the graph-based power consumption anomaly detection method of the present invention, the anomaly location results include: For each anomalous region, backtrack its attention weight in EA-GAT. Identify the environmental supernodes that have the greatest impact on it; Check whether its wave propagation edge points to the upstream region of a known anomaly; An attribution report is generated by combining the environmental attention score with the intensity of fluctuation propagation.
[0014] In a second aspect, the present invention provides a computer device, including a memory and a processor, wherein the memory stores a computer program, wherein when the computer program is executed by the processor, it implements any step of the graph-based power consumption anomaly detection method described in the first aspect of the present invention.
[0015] Thirdly, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program is executed by a processor, it implements any step of the graph-based power consumption anomaly detection method described in the first aspect of the present invention.
[0016] The beneficial effects of this invention are as follows: By constructing a graph structure using a causal discovery mechanism, it effectively distinguishes between real causal influences and false correlations, effectively reducing the false alarm rate; by introducing a dynamic hypergraph to model the relationship between multiple regions coupled with the same environmental event, it improves the ability to capture abnormal patterns under complex interference; by integrating the multidimensional correlation of physical topology, environmental semantics, and power fluctuation propagation, and combining unsupervised graph comparative learning for representation pre-training, it achieves high-generalization anomaly detection in scenarios lacking labeled data; and by using an environment-adaptive threshold determination and causal path verification mechanism, it ensures the accuracy of anomaly localization and the interpretability of the results. Attached Figure Description
[0017] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the 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.
[0018] Figure 1 This is a flowchart of the graph-based power consumption anomaly detection method in Example 1.
[0019] Figure 2 This is a flowchart of the dynamic hypergraph structure in Example 1.
[0020] Figure 3 This is a flowchart of the anomaly detection and localization process in Example 1. Detailed Implementation
[0021] To make the above-mentioned objects, features and advantages of 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.
[0022] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.
[0023] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in one embodiment" appearing in different places in this specification does not necessarily refer to the same embodiment, nor is it a single or selective embodiment that is mutually exclusive with other embodiments.
[0024] Example, refer to Figure 1 , Figure 2 and Figure 3 This embodiment of the invention provides a graph-based method for detecting abnormal power consumption, comprising the following steps: S1. Obtain historical electricity consumption data, environmental variable data, and power grid physical topology information for the power grid area, and standardize the historical electricity consumption data, environmental variable data, and power grid physical topology information to obtain a standardized time-series-environment dataset. Furthermore, the readings of smart meters in each power grid area unit are collected over multiple consecutive time periods to form the original electricity consumption time series. Simultaneously acquire meteorological station observation data for the corresponding time period, including temperature, humidity, wind speed, and Boolean indicators for whether it is a statutory holiday, to form an environmental variable sequence; Simultaneously, the bus-feeder connection relationship in the power grid SCADA system is extracted, and a physical topology graph with regions as nodes and electrical connections as edges is constructed. Z-score standardization was performed on the electricity consumption time series, and Min-Max normalization was performed on continuous variables and one-hot encoding was performed on discrete variables in the environmental variable series. The standardized electricity consumption is aligned with environmental variables by timestamp and mapped to the node index of the physical topology graph to form a standardized time-series-environment dataset with unified structure and aligned dimensions. It should be noted that by standardizing and aligning the electricity consumption, environmental variables, and physical topology respectively, the differences in dimensions and temporal misalignment among multi-source data are effectively eliminated, ensuring the consistency and reliability of the input for subsequent causal modeling and graph learning, and effectively improving the data foundation quality of the entire anomaly detection system.
[0025] S2. Based on the standardized time-series-environment dataset, the causal relationship between electricity consumption and environmental variables is identified through the causal discovery algorithm, and a causal perception heterogeneous graph containing regional nodes and environmental factor nodes is constructed. Furthermore, a time-delay cross-correlation analysis was performed on the historical electricity consumption series and environmental variable series for each power grid regional unit; If two region nodes and The residual fluctuation series has the maximum correlation coefficient at a certain time lag. Furthermore, by passing the Granger causality test, a directed wave propagation edge is established. Its weight is calculated as follows: ; in, , Representing regions The original residual sequence and region In time lag The residual sequence below, The time-delay decay coefficient; Calculate the environmental feature similarity between any two region nodes. If the cosine similarity exceeds an adaptive threshold... Then establish environmental similarity edges Its weight is: ; in, , For the region , Environment encoding vector, For cosine similarity, The standard deviation of historical environmental similarity; Spatial correlation edges are constructed based on the physical topology of the power grid, and their weights are obtained by normalizing the inverse of the line impedance. Construct adjacency matrices for the three types of edges respectively. , , And through a gating mechanism, they are merged into a unified adjacency matrix. The expression is: ; Among them, the gating coefficient , , The current environment state vector is dynamically generated by an LSTM network to form a causal sensing heterogeneous graph. It should be noted that by integrating three types of edges—physical connectivity, environmental similarity, and wave propagation—and dynamically weighting them, the constructed heterogeneous graph can truly reflect the complex coupling relationships of electrical interconnection, environmental similarity, and load interference in the power grid. This avoids model bias caused by single topology or static association, thereby improving the accuracy of causal relationship identification.
[0026] S3. Based on the causal perception heterogeneous graph, a hyperedge is introduced to connect multiple region nodes affected by the same environmental event, forming a dynamic hypergraph structure to represent many-to-many environment-region coupling relationships. Furthermore, the specific steps for constructing a dynamic hypergraph structure are as follows: Based on the causal perception heterogeneous graph, virtual environment supernodes of temperature and holiday types are added; Aggregate all region nodes that have causal connections with the same environment supernode into a single superedge; The activation state of a superedge is determined by the real-time state of the environment's supernodes. When the environmental state changes, the weights of similar edges in the environment are recalculated. With fluctuation propagation edge weight And update the adjacency matrix. This enables the dynamic evolution of graph structures; It should be noted that the introduction of the hyperedge mechanism to explicitly model the environment-region influence pattern of one cause and multiple effects overcomes the limitation of traditional graph structures that only support point-to-point relationships. This enables the system to effectively capture group power consumption anomalies caused by global events such as extreme weather or holidays, and enhances the perception capability of complex interference scenarios.
[0027] S4. Based on the dynamic hypergraph structure, construct a graph contrast learning task. By applying perturbations to the node features and graph structure respectively, positive and negative sample pairs are generated to complete unsupervised pre-training and obtain the node representation model. Furthermore, the high-frequency residual components of the regional nodes are input into the attention network channel of the environment enhancement graph; Environment Augmented Graph Attention Network channels compute region nodes through a cross-modal attention mechanism. With environmental supernodes Association weight between The expression is: ; in, Features of regional nodes For environmental supernode features, , For learnable parameter matrix, This is the scaling factor; Based on association weight The features of neighboring nodes are weighted and aggregated to generate an environment-sensitive residual embedding representation; The low-frequency trend component is input into the T-GCN channel for periodic modeling. The dual-channel outputs are dynamically fused using LSTM to construct a node representation model; It should be noted that by using graph contrastive learning to perform self-supervised pre-training of node representations under unlabeled conditions, the model can still learn deep feature representations that are robust to environmental disturbances and sensitive to anomalies without relying on manual annotation. This significantly reduces the annotation cost in actual deployment and improves generalization performance.
[0028] S5. Input the current electricity consumption observation value and environmental variables into the node representation model, and combine the dynamic hypergraph structure for inference to output the electricity consumption reconstruction result; Furthermore, the measured electricity consumption values of each region at the current moment are used as high-frequency residual components and input into the attention network branch of the environment enhancement graph, while its low-frequency trend components are input into the convolutional network branch of the time series graph. In the Environment Augmented Graph Attention Network branch, the relationship between region nodes and environment supernodes in the dynamic hypergraph is utilized to aggregate environmental context information through a cross-modal attention mechanism; In the temporal graph convolutional network branch, spatiotemporal features are propagated along the power grid physical topology and wave propagation edges; The output vectors of the two branches are concatenated and fed into the shared LSTM fusion module to generate a joint embedding representation that includes environmental awareness and temporal dependence; The joint embedding is mapped back to the original power consumption space by the fully connected decoder, and the reconstructed power consumption value of each region under the current environment and topology constraints is output as a benchmark reference for anomaly detection. It should be noted that the dual-channel reconstruction strategy of high-frequency residual and low-frequency trend takes into account both the sensitive detection of sudden anomalies and the stable modeling of periodic loads. Combined with the environmental context information provided by the dynamic hypergraph, it effectively improves the accuracy of power consumption reconstruction and provides a more reliable benchmark for subsequent anomaly judgment.
[0029] S6. Based on the deviation between the reconstructed electricity consumption results and the actual observed values, and combined with the degree of environmental deviation of each region on the causal path, calculate the anomaly score of each region node. Furthermore, the current electricity consumption is reconstructed using a node representation model to obtain the reconstructed value. ; Calculate residual reconstruction error ; Based on the historical normal residual sequence within the sliding window, a probability density function sensitive to environmental state is constructed using kernel density estimation. The bandwidth parameter of the probability density function is dynamically adjusted according to the current environmental state, and the optimal bandwidth is calculated using the following formula: ; in, The standard deviation of the data within the window. Interquartile range, The number of samples; By combining the environmental sensitivity coefficients learned by LSTM with the topology propagation state, a dynamic anomaly threshold is generated, expressed as: ; in, This represents the residual value corresponding to the 95th percentile under kernel density estimation. This is the current environment vector. For topological propagation state vectors, and These are the environmental factor weight matrix and the propagation sensitivity vector, respectively. , For learnable hyperparameters; It should be noted that by adaptively adjusting the kernel density estimation bandwidth based on environmental conditions and integrating the sensitivity coefficients learned by LSTM to generate dynamic thresholds, the anomaly judgment criteria can evolve in real time with external conditions such as temperature and holidays, effectively avoiding the problem of high false alarm rates or serious missed detections when fixed thresholds are used in different seasons or scenarios.
[0030] S7. Compare the abnormal score with the judgment threshold dynamically set based on historical normal data. If the abnormal score exceeds the judgment threshold, the corresponding area is judged as an abnormal power consumption area, and the abnormal location result is output. Furthermore, the residual value of each regional node is compared with the dynamic threshold under the corresponding environmental condition. Compare; If the absolute value of the residual is greater than If so, it is initially marked as an abnormal candidate; Further calculate the attention weight distribution of this node in the EA-GAT channel. If its attention to the abnormal environment supernode is higher than the normal historical average, it is confirmed as a real anomaly. Otherwise, they are considered pseudo-anomalies caused by environmental disturbances and are removed. For all region nodes identified as anomalous, the criteria are based on whether their residuals exceed the dynamic threshold. Sort by amplitude; Combining the physical topology adjacency matrix of the power grid Determine whether the anomaly propagates along the electrical path; If multiple adjacent regions are simultaneously abnormal and the fluctuation propagation edge weight If the magnitude is large, it is determined to be a regional abnormal event; Output a list of abnormal areas and label their types, including local equipment failures, regional load changes, and environmentally induced anomalies; Anomaly localization results include: For each anomalous region, backtrack its attention weight in EA-GAT. Identify the environmental supernodes that have the greatest impact on it; Check whether its wave propagation edge points to the upstream region of a known anomaly; An attribution report is generated by combining the environmental attention score with the intensity of fluctuation propagation. It should be noted that the three-level discrimination mechanism of threshold screening, attention verification, and topology propagation analysis not only achieves accurate location of abnormal areas, but also effectively distinguishes between real equipment failures and pseudo-anomalies caused by environmental disturbances, and further identifies anomaly types and propagation paths, effectively improving the credibility of anomaly detection results and the value of operation and maintenance guidance.
[0031] This embodiment also provides a computer device applicable to the graph-based power consumption anomaly detection method, 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 graph-based power consumption anomaly detection method proposed in the above embodiment.
[0032] The computer device can be a terminal, comprising a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, carrier networks, NFC (Near Field Communication), or other technologies. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad on the computer device's casing, or an external keyboard, touchpad, or mouse.
[0033] This embodiment also provides a storage medium storing a computer program, which, when executed by a processor, implements the graph-based power consumption anomaly detection method proposed in the above embodiments. The storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Red-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0034] In summary, this invention effectively distinguishes between genuine causal influences and spurious correlations by constructing a graph structure using a causal discovery mechanism, thus significantly reducing the false alarm rate. By introducing a dynamic hypergraph to model the relationship between multiple regions coupled with the same environmental event, it enhances the ability to capture abnormal patterns under complex interference. By integrating the multidimensional correlations of physical topology, environmental semantics, and power fluctuation propagation, and combining unsupervised graph comparative learning for representation pre-training, it achieves high-generalization anomaly detection in scenarios lacking labeled data. Through environmental adaptive threshold determination and causal path verification mechanisms, it ensures the accuracy of anomaly localization and the interpretability of the results.
[0035] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended 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 method for detecting abnormal power consumption based on graph structure, characterized in that: include: Historical electricity consumption data, environmental variable data, and power grid physical topology information of the power grid area are obtained, and the historical electricity consumption data, environmental variable data, and power grid physical topology information are standardized to obtain a standardized time-series-environment dataset. Based on a standardized time-series-environment dataset, a causal relationship between electricity consumption and environmental variables is identified through a causal discovery algorithm, and a causal perception heterogeneous graph containing regional nodes and environmental factor nodes is constructed. Based on the causal perception heterogeneous graph, a hyperedge is introduced to connect multiple region nodes affected by the same environmental event, forming a dynamic hypergraph structure to represent many-to-many environment-region coupling relationships. Based on the dynamic hypergraph structure, a graph contrast learning task is constructed. Positive and negative sample pairs are generated by applying perturbations to node features and graph structure respectively, and unsupervised pre-training is completed to obtain a node representation model. The current electricity consumption observation value and environmental variables are input into the node representation model, and inference is performed in combination with the dynamic hypergraph structure to output the electricity consumption reconstruction result; Based on the deviation between the reconstructed electricity consumption results and the actual observed values, and combined with the degree of environmental deviation of each region on the causal path, the anomaly score of each region node is calculated. The abnormal score is compared with a judgment threshold dynamically set based on historical normal data. If the abnormal score exceeds the judgment threshold, the corresponding area is determined to be an abnormal power consumption area, and the abnormal location result is output.
2. The graph-based power consumption anomaly detection method as described in claim 1, characterized in that: The specific steps for constructing the causal perception heterogeneous graph containing regional nodes and environmental factor nodes are as follows: Time-delay cross-correlation analysis was performed on the historical electricity consumption series and environmental variable series for each power grid regional unit; If two region nodes and The residual fluctuation series has the maximum correlation coefficient at a certain time lag. Furthermore, by passing the Granger causality test, a directed wave propagation edge is established. Its weight is calculated as follows: ; in, , Representing regions The original residual sequence and region In time lag The residual sequence below, The time-delay decay coefficient; Calculate the environmental feature similarity between any two region nodes. If the cosine similarity exceeds an adaptive threshold... Then establish environmental similarity edges Its weight is: ; in, , For the region , Environment encoding vector, For cosine similarity, The standard deviation of historical environmental similarity; Spatial correlation edges are constructed based on the physical topology of the power grid, and their weights are obtained by normalizing the inverse of the line impedance. Construct adjacency matrices for the three types of edges respectively. , , And through a gating mechanism, they are merged into a unified adjacency matrix. The expression is: ; Among them, the gating coefficient , , The current environmental state vector is dynamically generated by an LSTM network to form a causal perception heterogeneous graph.
3. The graph-based power consumption anomaly detection method as described in claim 2, characterized in that: The specific steps for constructing the dynamic hypergraph structure are as follows: Based on the causal perception heterogeneous graph, virtual environment supernodes of temperature and holiday types are added; Aggregate all region nodes that have causal connections with the same environment supernode into a single superedge; The activation state of a superedge is determined by the real-time state of the environment's supernodes. When the environmental state changes, the weights of similar edges in the environment are recalculated. With fluctuation propagation edge weight And update the adjacency matrix. This enables the dynamic evolution of graph structures.
4. The graph-based power consumption anomaly detection method as described in claim 3, characterized in that: The specific steps for obtaining the node representation model are as follows: The high-frequency residual components of the regional nodes are input into the attention network channel of the environment enhancement graph; The environment-enhanced graph attention network channel calculates region nodes through a cross-modal attention mechanism. With environmental supernodes Association weight between The expression is: ; in, Features of regional nodes For environmental supernode features, , For learnable parameter matrix, This is the scaling factor; Based on association weight The features of neighboring nodes are weighted and aggregated to generate an environment-sensitive residual embedding representation; The low-frequency trend component is input into the T-GCN channel for periodic modeling. The dual-channel outputs are dynamically fused using LSTM to construct a node representation model.
5. The graph-based power consumption anomaly detection method as described in claim 4, characterized in that: The specific steps for calculating the anomaly score for each region node are as follows: The current electricity consumption is reconstructed using a node representation model to obtain the reconstructed value. ; Calculate residual reconstruction error ; Based on the historical normal residual sequence within the sliding window, a probability density function sensitive to environmental state is constructed using kernel density estimation. The bandwidth parameter of the probability density function is dynamically adjusted according to the current environmental state, and the optimal bandwidth is calculated using the following formula: ; in, The standard deviation of the data within the window. Interquartile range, The number of samples; By combining the environmental sensitivity coefficients learned by LSTM with the topology propagation state, a dynamic anomaly threshold is generated, expressed as: ; in, This represents the residual value corresponding to the 95th percentile under kernel density estimation. This is the current environment vector. For topological propagation state vectors, and These are the environmental factor weight matrix and the propagation sensitivity vector, respectively. , These are learnable hyperparameters.
6. The graph-based power consumption anomaly detection method as described in claim 5, characterized in that: The comparison between the anomaly score and the judgment threshold involves the following steps: The residual value of each region node is compared with the dynamic threshold under the corresponding environmental condition. Compare; If the absolute value of the residual is greater than If so, it is initially marked as an abnormal candidate; Further calculate the attention weight distribution of this node in the EA-GAT channel. If its attention to the abnormal environment supernode is higher than the normal historical average, it is confirmed as a real anomaly. Otherwise, it is considered a pseudo-anomaly caused by environmental disturbance and is removed.
7. The graph-based power consumption anomaly detection method as described in claim 6, characterized in that: The specific steps for outputting the anomaly location result are as follows: For all region nodes identified as anomalous, the criteria are based on whether their residuals exceed the dynamic threshold. Sort by amplitude; Combining the physical topology adjacency matrix of the power grid Determine whether the anomaly propagates along the electrical path; If multiple adjacent regions are simultaneously abnormal and the fluctuation propagation edge weight If the magnitude is large, it is determined to be a regional abnormal event; Output a list of abnormal areas and label their types, including local equipment failures, regional load changes, and environmentally induced anomalies.
8. The graph-based power consumption anomaly detection method as described in claim 7, characterized in that: The anomaly localization results include: For each anomalous region, backtrack its attention weight in EA-GAT. Identify the environmental supernodes that have the greatest impact on it; Check whether its wave propagation edge points to the upstream region of a known anomaly; An attribution report is generated by combining the environmental attention score with the intensity of fluctuation propagation.
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 graph-based power consumption anomaly detection method according to any one of claims 1 to 8.
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 graph-based power consumption anomaly detection method according to any one of claims 1 to 8.
Citation Information
Cited By
Electrical load analysis method and device based on big data, and medium
CN121980207A
Small sample cold source system anomaly detection method and device based on graph neural network
CN122020261A
A method and apparatus for anomaly detection in small-sample cold source systems based on graph neural networks
CN122020261B
