A method for detecting abnormal flow coloring in the power Internet of Things

By using a hierarchical protocol gating graph attention network and a dynamic temperature regulation mechanism, the problem of anomaly detection in the power Internet of Things under multi-protocol heterogeneity and dynamic network environment is solved, and high-precision communication link anomaly detection is achieved.

CN123122987APending Publication Date: 2026-11-17INFORMATION & COMMNUNICATION BRANCH STATE GRID JIANGXI ELECTRIC POWER CO
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611501269.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-24
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

Existing power Internet of Things communication link anomaly detection technologies suffer from problems such as feature aggregation distortion, high false alarm rate, and serious missed detection when facing multi-protocol heterogeneous and dynamic network environments, and cannot effectively distinguish between normal traffic mutations and abnormal attacks.

Method used

A hierarchical protocol-gated graph attention network is used to generate high-order graph embedding representations. By combining dynamic attribute graphs and dual-view embedding representations, temperature hyperparameters are dynamically adjusted, a contrastive loss function is constructed, and an anomaly detection model is trained through multiple batch optimizations. A protocol-gated space aggregation mechanism and an entropy-guided dynamic temperature adjustment mechanism are designed to improve the model's adaptive anti-perturbation ability and feature discrimination ability.

Benefits of technology

It achieves accurate alignment of data from different communication protocols in a unified semantic space, enhances the ability to represent network topology features, dynamically adapts to the complex environment of the power Internet of Things, reduces false alarm rate and false negative rate, and improves the accuracy of anomaly detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123122987A_ABST
    Figure CN123122987A_ABST
Patent Text Reader

Abstract

This invention provides a method for detecting anomalies in power IoT traffic coloring, comprising: collecting colored stream data to construct a dynamic attribute graph; constructing an anomaly detection model for calculating a higher-order graph embedding representation based on the dynamic attribute graph, and constructing a contrastive loss function; iteratively optimizing the anomaly detection model, including calculating the contrastive loss, updating model parameters using backpropagation based on the contrastive loss, and obtaining an optimized anomaly detection model by model convergence; calculating a semantic baseline center using the optimized anomaly detection model, and calculating the anomaly deviation score between the higher-order graph embedding representation of the real-time acquired colored stream data and the semantic baseline center; calculating a dynamic safety threshold, and determining that there is an anomaly in the communication link of the power IoT when the anomaly deviation score of the real-time acquired colored stream data is greater than the dynamic safety threshold. Applying this method can eliminate semantic conflicts between data from different communication protocols, enabling the anomaly detection model to have highly robust unsupervised anomaly recognition capabilities and achieving reliable early warning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of power Internet of Things (IoT) security monitoring technology, and in particular to a method for detecting abnormal flow coloring in the power IoT. Background Technology

[0002] With the large-scale deployment of power IoT terminals, their communication links face challenges from complex and dynamic environments such as multi-protocol heterogeneity, electromagnetic interference, and frequent switching between terrestrial and satellite networks. Existing active sensing technologies largely rely on static or fixed-period policy injection of probe packets for traffic coloring, combined with general graph attention networks (GAT) and contrastive learning (CL) models for cloud-based analysis. However, in practical power production applications, existing general-purpose combined technologies have revealed the following significant technical defects and shortcomings:

[0003] Standard GAT (Graph Attention Calculation) relies on a globally shared linear transformation matrix to map node features when calculating node attention weights. Its mathematical premise is the assumption that all graph nodes reside in the same feature dimension and semantic space. However, in the power Internet of Things (IoT), the underlying terminals widely employ various heterogeneous communication protocols such as Modbus, IEC104, and MQTT. These protocols exhibit significant differences in data distribution (i.e., heterogeneity) in message structure, communication frequency, and load characteristics. If standard GAT is used to forcibly concatenate and calculate attention for heterogeneous features, it not only fails to align the feature space but also causes interference between features from different protocols, resulting in severe distortion of the spatial feature aggregation of the network topology. Consequently, subsequent anomaly detection lacks accurate data support.

[0004] In conventional contrastive learning (such as models based on the InfoNCE loss function), a fixed temperature hyperparameter is typically used to control the model's penalty for difficult negative samples. However, in real-world power grid operation environments, service traffic exhibits strong tidal effects and dynamic bursts, leading to frequent high information entropy (high noise) states in local network conditions. When the power grid experiences normal high-load fluctuations (high noise), a fixed temperature hyperparameter causes the model to over-expose normal traffic spikes, misclassifying them as anomalies and resulting in an extremely high false alarm rate. Furthermore, when facing highly sophisticated man-in-the-middle tampering or weak attacks with extremely scarce anomalous samples, a fixed temperature hyperparameter lacks sufficient sensitivity to widen the contrastive penalty boundary, leading to severe missed detections.

[0005] Therefore, it is necessary to provide a method for detecting anomalies in power IoT traffic coloring to improve the accuracy of communication link anomaly detection in complex dynamic power grid scenarios. Summary of the Invention

[0006] The purpose of this invention is to provide a method for detecting abnormal traffic coloring in the power Internet of Things (IoT) to improve the accuracy of detecting abnormalities in the communication links of the power IoT.

[0007] The power IoT traffic coloring anomaly detection method provided by this invention includes: collecting colored stream data reported by various terminals of the power IoT from the cloud; extracting entities, physical links, traffic features, and protocol coding vectors of the power IoT from the colored stream data to construct a dynamic attribute graph; and constructing an anomaly detection model for: utilizing... A cascaded protocol-gated graph attention network generates a high-order graph embedding representation based on a dynamic attribute graph. This dynamic attribute graph is then used to generate a dual-view embedding representation and dynamically adjust temperature hyperparameters. A contrastive loss function is constructed by combining the dual-view embedding representation and temperature hyperparameters. The anomaly detection model is iteratively optimized using multiple batches of historical normal coloring stream data until convergence, resulting in an optimized model. Each iteration involves constructing a dynamic attribute graph from a batch of historical normal coloring stream data and inputting it into the anomaly detection model. The model processes this graph, outputs a high-order graph embedding representation, and calculates the contrastive loss. Backpropagation of the contrastive loss is then used to update the model parameters. Historical normal coloring stream data is input into the optimized anomaly detection model to obtain a high-order graph embedding representation and calculate the semantic baseline center. Real-time acquired coloring stream data is also input into the optimized anomaly detection model to obtain a high-order graph embedding representation. Anomaly deviation scores are calculated based on the high-order graph embedding representation and semantic baseline center of the real-time acquired coloring stream data. A dynamic safety threshold is calculated based on the historical average and standard deviation of the anomaly deviation scores of the coloring stream data samples. When the anomaly deviation score of the real-time acquired coloring stream data exceeds the dynamic safety threshold, an anomaly is determined in the communication link of the power IoT.

[0008] The beneficial effects of the power IoT traffic coloring anomaly detection method provided by this invention are as follows: it enables the precise alignment of data distributions from different communication protocols into a unified semantic space, improving the spatial feature representation capability of network topology. Dynamically adjusting temperature hyperparameters gives the anomaly detection model a high degree of adaptive anti-interference capability, balancing noise resistance and high sensitivity. A dynamic safety threshold is designed to adapt to baseline drift in the power IoT under unlabeled environments, shielding against confusion from routine services. Furthermore, this invention does not simply superimpose existing graph neural network methods and contrastive learning methods, but rather addresses the feature shift problem caused by protocol semantic differences and dynamic changes in network state in the multi-protocol heterogeneous communication environment of the power IoT by designing a collaborative optimization scheme of a protocol-gated spatial aggregation mechanism and an entropy-guided dynamic temperature adjustment mechanism. Specifically, the protocol-gated spatial aggregation mechanism generates corresponding gated features through protocol encoding and adaptively adjusts node features using these gated features, achieving effective fusion of data from different communication protocols in a unified semantic space; the entropy-guided dynamic temperature adjustment mechanism dynamically adjusts the temperature hyperparameters during the contrastive learning process based on the real-time information entropy of the nodes, enabling the model to adaptively adjust its anomaly feature discrimination capability according to changes in network state. By leveraging the synergistic effect of the two mechanisms mentioned above in the feature representation and model optimization stages, the adaptability of anomaly detection models to protocol heterogeneity and dynamic changes in network state under complex power Internet of Things environments can be improved.

[0009] In one possible embodiment, utilizing When a cascaded protocol-gated graph attention network generates a high-order graph embedding representation based on a dynamic attribute graph, each layer of the protocol-gated graph attention network performs a linear mapping on the traffic features of nodes to obtain linear mapping features, and a non-linear mapping on the protocol coding vectors of nodes to generate gating features. The gating features are then used to scale the linear mapping features using a Hadamard product to obtain modified features. For each node, an aggregate feature is calculated based on the modified features of the node itself and its neighboring nodes. The aggregate feature output from each layer of the protocol-gated graph attention network is used as the input to the next layer of the protocol-gated graph attention network to generate aggregate features. The aggregated features output by the layer protocol gated graph attention network are used as high-order graph embedding representations.

[0010] The aggregation feature of a node is calculated based on the modified features of the node itself and its neighboring nodes, including: determining the set of neighboring nodes of the node according to the adjacency relationship of the dynamic attribute graph; concatenating the modified features of the node with the modified features of each neighboring node, and obtaining the unnormalized attention score after attention mapping and LeakyReLU activation; performing Softmax normalization on the unnormalized attention score within the entire range of the node's neighboring nodes to obtain the attention weight coefficient; and using the attention weight coefficients to perform weighted aggregation of the modified features of the neighboring nodes to obtain the aggregation feature of the node.

[0011] In another possible embodiment, a dual-view embedding representation and a dynamically adjusted temperature hyperparameter are generated based on the dynamic property graph. A contrastive loss function is constructed by combining the dual-view embedding representation and the temperature hyperparameter, including: calculating the real-time information entropy of the dynamic property graph nodes within a set time window; and dynamically adjusting the temperature hyperparameter using the real-time information entropy. The adjustment calculation of the temperature hyperparameter satisfies the following formula: ,in, Represents a node Temperature overparameters Indicates the baseline temperature hyperparameter. This represents the Sigmoid activation function. Represents a node The real-time information entropy; two data augmentation perturbations are applied to the node features of the dynamic attribute graph to generate a dual-view embedding representation; the dual-view embedding representation and the temperature hyperparameter are combined to construct a contrastive loss function that satisfies the following formula: ,in, This represents the contrastive loss function. This represents the total number of nodes in the batch participating in the comparative learning. Represents a node The first type of view's embedded representation, Represents a node The second type of view is an embedded representation. Represents a node The second type of view embedding representation, nodes For the first batch of comparative learning to participate in the current batch 1 node This represents the cosine similarity function.

[0012] Other possible embodiments involve updating model parameters using contrastive loss backpropagation, including: calculating the partial derivative gradient of the contrastive loss with respect to all learnable parameters of the anomaly detection model; and iteratively updating the parameters of the anomaly detection model using the Adam optimizer along the gradient descent direction.

[0013] The calculation of the anomaly deviation score includes: calculating the Euclidean distance between the high-order graph embedding representation of the real-time acquired colorized stream data and the semantic baseline center, and using this Euclidean distance as the anomaly deviation score.

[0014] Calculating the dynamic safety threshold includes: calculating the historical average and standard deviation of the outlier deviation scores for the stained stream data samples; and calculating whether the dynamic safety threshold meets the following requirements. ,in, Indicates the dynamic security threshold. This represents the historical average of the outlier deviation scores for the colored stream data samples. The standard deviation of the outlier deviation score of the stained stream data sample represents the standard deviation of the score. express The coefficient.

[0015] The anomaly detection model includes a multimodal input layer, an encoder body, and a nonlinear projection head; the multimodal input layer receives dynamic property maps; the encoder body consists of... The system consists of cascaded protocol-gated graph attention networks. Each layer of the protocol-gated graph attention network is used to calculate aggregate features based on the traffic characteristics of dynamic attribute graph nodes and protocol coding vectors. A cascaded protocol-gated graph attention network is used to aggregate higher-order graph embedding representations; a nonlinear projection head is used to nonlinearly map the higher-order graph embedding representations to a contrastive learning feature space to generate dual-view embedding representations. Attached Figure Description

[0016] Figure 1 A flowchart illustrating a power Internet of Things (IoT) flow coloring anomaly detection method provided in an embodiment of the present invention;

[0017] Figure 2 The entropy-guided adaptive temperature contrastive loss training convergence curve provided in this embodiment of the invention;

[0018] Figure 3 The figure shows a comparison curve of the overall anomaly detection performance (F1-Score) between the power Internet of Things flow coloring anomaly detection method provided in this embodiment of the invention and the traditional baseline model.

[0019] Figure 4 This is a schematic diagram of an electronic device structure provided in an embodiment of the present invention. Detailed Implementation

[0020] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions in the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without inventive effort are within the scope of protection of this invention. Unless otherwise defined, the technical or scientific terms used herein should have the ordinary meaning understood by those skilled in the art. The terms "comprising" and similar expressions used herein mean that the element or object preceding the word covers the element or object listed following the word and its equivalents, but do not exclude other elements or objects.

[0021] This embodiment provides a method for detecting abnormal flow coloring in the power Internet of Things (IoT).

[0022] See Figure 1 The method includes:

[0023] S101: Collect colored stream data reported by various terminals of the power Internet of Things from the cloud, and extract the entities, physical links, traffic characteristics and protocol encoding vectors of the power Internet of Things from the colored stream data to construct a dynamic attribute graph.

[0024] In one specific embodiment, colored stream data reported by various terminals of the power Internet of Things are collected from the cloud, and the collected data is abstracted into a dynamic attribute graph. Among them, the node set Edge sets represent entities (terminals, gateways, etc.) in a power communication network. This represents the physical link. From the colored flow data, underlying physical traffic statistics such as packet length and latency are extracted as traffic features to construct a basic traffic feature matrix. , Indicates the total number of nodes. Represents traffic feature dimensions. Constructs a multi-protocol heterogeneous feature matrix. The high-dimensional encoding is used to define the types of power communication protocols (such as Modbus, IEC104, etc.) running on the nodes. Specifically, a set of protocol categories is established based on different communication protocol types in the power Internet of Things, and corresponding protocol identifiers are assigned to different communication protocols. The communication protocol type corresponding to the node is encoded based on the protocol identifier to generate an initial protocol encoding vector. Furthermore, a learnable protocol mapping matrix is ​​used to perform a nonlinear mapping on the initial protocol encoding vector to obtain a protocol encoding vector used to characterize the semantic features of the protocol. The design of abstracting colored flow data into a dynamic attribute graph decouples the traditional single-node features into physical flow features and protocol logic features, providing a structured data foundation for subsequently eliminating semantic biases between different protocols and resolving semantic conflicts.

[0025] S102: Construct an anomaly detection model for: utilizing The cascaded protocol-gated graph attention network generates a high-order graph embedding representation based on the dynamic attribute graph, generates a dual-view embedding representation and dynamically adjusts the temperature hyperparameter based on the dynamic attribute graph, and constructs a contrastive loss function by combining the dual-view embedding representation and the temperature hyperparameter.

[0026] In one possible embodiment, utilizing When a cascaded protocol-gated graph attention network generates a high-order graph embedding representation based on a dynamic attribute graph, each layer of the protocol-gated graph attention network performs a linear mapping on the traffic features of nodes to obtain linear mapping features, and a non-linear mapping on the protocol coding vectors of nodes to generate gating features. The gating features are then used to scale the linear mapping features using a Hadamard product to obtain modified features. For each node, an aggregate feature is calculated based on the modified features of the node itself and its neighboring nodes. The aggregate feature output from each layer of the protocol-gated graph attention network is used as the input to the next layer of the protocol-gated graph attention network to generate aggregate features. The aggregated features output by the layer protocol gated graph attention network are used as high-order graph embedding representations.

[0027] The aggregation feature of a node is calculated based on the modified features of the node itself and its neighboring nodes, including: determining the set of neighboring nodes of the node according to the adjacency relationship of the dynamic attribute graph; concatenating the modified features of the node with the modified features of each neighboring node, and obtaining the unnormalized attention score after attention mapping and LeakyReLU activation; performing Softmax normalization on the unnormalized attention score within the entire range of the node's neighboring nodes to obtain the attention weight coefficient; and using the attention weight coefficients to perform weighted aggregation of the modified features of the neighboring nodes to obtain the aggregation feature of the node.

[0028] Based on the dynamic attribute graph, a dual-view embedded representation and dynamically adjusted temperature hyperparameters are generated. A contrastive loss function is constructed by combining the dual-view embedded representation and the temperature hyperparameters, including: calculating the real-time information entropy of the dynamic attribute graph nodes within a set time window; and dynamically adjusting the temperature hyperparameters using the real-time information entropy. The adjustment calculation of the temperature hyperparameters satisfies the following formula: ,in, Represents a node Temperature overparameters Indicates the baseline temperature hyperparameter. This represents the Sigmoid activation function. Represents a node The real-time information entropy; two data augmentation perturbations are applied to the node features of the dynamic attribute graph to generate a dual-view embedding representation; the dual-view embedding representation and the temperature hyperparameter are combined to construct a contrastive loss function that satisfies the following formula: ,in, This represents the contrastive loss function. This represents the total number of nodes in the batch participating in the comparative learning. Represents a node The first type of view's embedded representation, Represents a node The second type of view is an embedded representation. Represents a node The second type of view embedding representation, nodes For the first batch of comparative learning to participate in the current batch 1 node This represents the cosine similarity function.

[0029] In a specific embodiment, the traffic fundamental feature matrix Linear mapping is performed on the traffic characteristics of the middle node to obtain the linear mapping characteristics. , Indicates the first The linear mapping characteristics of each node Represents a linear mapping matrix. Indicates the first Traffic characteristics of individual nodes; using gated neural networks to analyze the heterogeneous feature matrix of multiple protocols. Gated features are generated by nonlinear mapping of the protocol encoding vectors. , Indicates the first Gating features of each node, This represents the Sigmoid activation function. Represents a learnable protocol heterogeneous gate matrix. Indicates the first The protocol encoding vector of each node. The modified features are obtained by scaling the linear mapping features using the gated features through the Hadamard product. , Indicates the first Correction features of each node.

[0030] Calculate the attention weight coefficients among neighboring nodes based on modified features. : , Represents the natural exponential function; This represents a leaky linear rectified activation function used to preserve the weak feature gradients of the negative half-axis. This represents the transpose of the learnable shared attention weight vector; Indicates feature concatenation operation; , , Representing the central nodes respectively with neighboring nodes , Higher-order correction features; Represents a node The set of first-order neighbor nodes.

[0031] A higher-order graph embedding representation is obtained by weighting and aggregating the dynamic attribute graph using attention weight coefficients. Specifically, in the processing of each layer of the protocol-gated graph attention network, for any node in the dynamic attribute graph... First, determine the nodes based on the adjacency relationships in the dynamic attribute graph. First-order neighbor node set and obtain each neighbor node. Correction features The central node Correction features Each neighboring node Correction features Feature concatenation is performed, followed by attention mapping and LeakyReLU activation to obtain the corresponding unnormalized attention score, and then applied to the node. The attention weight coefficients are obtained by performing Softmax normalization over the entire range of neighboring nodes. Subsequently, the attention weight coefficients were... Corrected features of corresponding neighboring nodes Multiply and apply to the set of neighboring nodes. Summing all weighted features in the matrix yields the node. Aggregation characteristics: Traverse all nodes in the dynamic attribute graph to obtain the aggregated feature matrix of this layer's graph attention network. When a node... If no neighboring nodes exist, directly modify the feature of that node. This is the output of this layer for that node. The aggregated feature matrix obtained by the protocol-gated graph attention network of this layer is used as the input of the protocol-gated graph attention network of the next layer, and the above process is repeated. After multi-layer cascaded aggregation, a high-order graph embedding representation containing high-order topological neighborhood information is obtained.

[0032] By dynamically scaling the Hadamard product, the protocol-gated graph attention network can dynamically amplify the feature channels that are important to the current protocol and suppress the incompatible feature channels based on the protocol type provided by the heterogeneous feature matrix of multiple protocols. This effectively eliminates the semantic bias in the multi-protocol environment and forces the multi-protocol data to be normalized to a unified semantic space from a mathematical mechanism, eliminating the feature bias caused by protocol differences and outputting accurate high-order graph embedding representations.

[0033] The design incorporates an entropy-guided dynamic temperature regulation mechanism, including: calculating the real-time information entropy of each node to characterize the degree of chaos and disturbance in local network traffic. The calculation process for real-time information entropy involves: within a set time sliding window... Inside, definition For nodes The first in interactive traffic The system identifies various communication status events (e.g., message type, packet length range, or connection frequency status within a sliding window for specific heterogeneous protocols such as Modbus and IEC104) and statistically analyzes each type of status event. probability distribution of occurrence The technology of real-time information entropy satisfies the following formula: , Indicates a time sliding window internal nodes The total number of possible categories of different communication state events (i.e., the size of the discrete state space of traffic characteristics). The temperature hyperparameter is dynamically adjusted using real-time information entropy, and its calculation satisfies the following formula: , Indicates the baseline temperature hyperparameter. This refers to the Sigmoid activation function, used to convert real-time information entropy. Nonlinear smoothing is applied to the (0,1) interval. Real-time information entropy is used to dynamically adjust the temperature hyperparameter, resulting in dynamic temperature... This method can adaptively scale based on the ambient noise level, using a baseline temperature hyperparameter as a benchmark. Unlike traditional contrastive learning methods that use fixed temperature parameters, the temperature hyperparameter in this embodiment is not preset to a fixed value, but is dynamically determined by the local network state represented by the real-time information entropy of the nodes. By incorporating network state change information into the contrastive learning loss calculation process, the temperature parameter can adaptively change with the degree of communication state disturbance, thereby dynamically adjusting the similarity constraint strength between different samples and improving the ability to distinguish between abnormal and normal features in complex and dynamic power IoT environments.

[0034] Two sets of independent data augmentation perturbations are applied to the original features of the nodes in the dynamic attribute graph to form a first data augmentation view and a second data augmentation view, thus generating the nodes. Embedded representation of the corresponding first data augmentation view Embedded representation of the second data augmented view For example, both data augmented views are constructed by injecting independent Gaussian random noise with a standard deviation of 0.05 into the original features of the nodes.

[0035] The comparative loss function for constructing end-to-end optimization using joint dual-view embedding representation and temperature hyperparameter is as follows: , Represents a node The embedded representation of the second data augmentation view. This represents the cosine similarity function, used to measure the directional consistency of features in space; The temperature hyperparameter is used as the denominator to dynamically scale the steepness of the similarity penalty. A contrastive loss function design, jointly constructed with the dual-view embedding representation and the temperature hyperparameter, achieves a dynamic balance between noise robustness and sensitivity, even when the local network experiences normal high load fluctuations (information entropy). Increase), temperature overparameter Automatically increasing the loss function smooths out the penalty for negative samples, preventing normal fluctuations from being misjudged; when the network is stable ( (reduce) The contrast penalty boundary is reduced and increased to accurately capture weak anomalies. This mechanism design enables the anomaly detection model to ultimately output a feature representation with extremely high local robustness.

[0036] The protocol-gated spatial aggregation mechanism and the entropy-guided dynamic temperature regulation mechanism of this invention work together: the protocol-gated spatial aggregation mechanism suppresses feature biases introduced by different communication protocols through the Hadamard product, obtaining a protocol-aware high-order graph embedding representation; the entropy-guided dynamic temperature regulation mechanism dynamically adjusts the temperature hyperparameter in the contrast loss based on the real-time information entropy of node communication state events. Through the combined application of these two mechanisms, the anomaly detection model can simultaneously adapt to protocol heterogeneity and dynamic network state disturbances, improving feature representation and anomaly differentiation capabilities in complex power IoT environments.

[0037] S103: Iteratively optimize the anomaly detection model using multiple batches of historical normal staining stream data until the model converges to obtain the optimized anomaly detection model. Each round of iterative optimization includes constructing a dynamic attribute graph from a batch of historical normal staining stream data and inputting it into the anomaly detection model. The anomaly detection model processes the data and outputs a high-order graph embedding representation, and calculates the contrastive loss. The contrastive loss is then used for backpropagation to update the model parameters.

[0038] In one possible embodiment, the anomaly detection model includes a multimodal input layer, an encoder body, and a nonlinear projection head; the multimodal input layer receives a dynamic property map; the encoder body consists of... The system consists of cascaded protocol-gated graph attention networks. Each layer of the protocol-gated graph attention network is used to calculate aggregate features based on the traffic characteristics of dynamic attribute graph nodes and protocol coding vectors. A cascaded protocol-gated graph attention network is used to aggregate higher-order graph embedding representations; a nonlinear projection head is used to nonlinearly map the higher-order graph embedding representations to a contrastive learning feature space to generate dual-view embedding representations.

[0039] The model parameters are updated using backpropagation with contrastive loss, including: calculating the gradient of the partial derivative of the contrastive loss with respect to all learnable parameters of the anomaly detection model; and iteratively updating the parameters of the anomaly detection model along the gradient descent direction using the Adam optimizer.

[0040] In one specific embodiment, the anomaly detection model includes: a multimodal input layer responsible for receiving dynamic attribute maps constructed based on stained stream data; an encoder body consisting of cascaded protocol-gated graph attention networks (GatedGATConv), in which the graph attention network dynamically generates gated features using a multi-protocol heterogeneous feature matrix P, adaptively scales and aggregates the linear mapping features through Hadamard product, and finally outputs a high-order graph embedding representation that crosses the protocol gap; and a nonlinear projection head consisting of a multilayer perceptron (MLP) with hidden layers (i.e., a Linear-ReLU-Linear structure), used to nonlinearly map the high-order graph embedding representation output by the encoder to a lower-dimensional contrastive learning feature space, generating an embedding representation for calculating similarity. and To enhance the expressive power of the contrastive loss, the anomaly detection model underwent end-to-end optimization training using the following closed-loop optimization process: A dynamic attribute map was input into the anomaly detection model; two independent sets of data augmentation perturbations were applied to the original features of the nodes in the dynamic attribute map to form a first data augmented view and a second data augmented view; these were then processed by the encoder and projector to output a dual-view embedded representation; the real-time information entropy of the nodes was calculated based on the dynamic attribute map, and the temperature hyperparameter was adjusted using this real-time information entropy; the contrastive loss was calculated based on the contrastive loss function. Then, the partial derivative gradients of the contrastive loss with respect to all learnable parameters of the anomaly detection model (including the linear mapping matrix, protocol heterogeneous gating matrix, attention weight vector, and projector weights) were calculated; the Adam optimizer (with a set initial learning rate and weight decay regularization) was used to iteratively update the parameters of the entire network along the gradient descent direction. This closed-loop optimization process was repeated through multiple batches and rounds until the contrastive loss was calculated. Once the model stabilizes (or reaches the set maximum number of iterations), it has completed end-to-end optimization and is considered converged.

[0041] For example, the encoder of the anomaly detection model consists of two cascaded protocol-gated graph attention networks (GatedGATConv). Each GatedGATConv layer includes a node feature linear mapping unit, a protocol gating unit, and a neighborhood attention aggregation unit.

[0042] The node feature linear mapping unit is used to map the traffic features of a node to a defined hidden feature space, resulting in linearly mapped features. The protocol gating unit uses the protocol encoding vector corresponding to the node. As input, gated features with the same dimension as linear mapping features are generated using a learnable protocol mapping matrix and a sigmoid activation function. Subsequently, through the Hadama product... Channel-level adaptive scaling is performed on the linear mapping features to obtain protocol-aware corrected features.

[0043] The neighborhood attention aggregation unit takes the modified features as input, concatenates the modified features of the center node with the modified features of each neighboring node, calculates the attention scores of the neighboring nodes through a learnable attention mapping and LeakyReLU activation, performs Softmax normalization within the neighboring node range to obtain the attention weights, and then performs a weighted summation of the modified features of the neighboring nodes to obtain the output features of the current protocol gated graph attention network. The output of the first layer GatedGATConv is then input into the second layer GatedGATConv after ReLU activation. The second layer further aggregates neighborhood information and outputs a high-order graph embedding representation.

[0044] The protocol-gated graph attention network constructed in this invention differs from traditional graph attention networks in that: traditional graph attention networks only utilize a unified linear mapping matrix to transform the traffic features of different nodes and directly calculate attention weights based on the linearly mapped node features; this invention, however, designs protocol-gated branches corresponding to the node protocol codes before attention calculation. Gated features are dynamically generated by each node's own protocol code, and channel-by-channel Hadamard scaling is performed on the linearly mapped features before neighborhood attention calculation and weighted aggregation. This allows the shared graph attention network to selectively enhance feature channels related to the current protocol and suppress incompatible feature channels based on the communication protocol used by the nodes, thereby reducing semantic interference between heterogeneous protocol data.

[0045] When performing end-to-end optimization training on the anomaly detection model, a complete dynamic attribute graph is used as a training batch. That is, a training batch includes all nodes, node features, protocol encoding vectors, and edge connections between nodes in a single construction of the dynamic attribute graph, without further subdividing into sub-batches at the node level. Therefore, each training epoch corresponds to the forward computation, loss calculation, backpropagation, and model parameter update of a complete graph batch.

[0046] In each training round, the dynamic attribute map is processed by the anomaly detection model to obtain the corresponding high-order graph embedding representation; based on the original features of the nodes in the same training batch, two sets of Gaussian random perturbations with a standard deviation of 0.05 are applied to form the first data augmentation view and the second data augmentation view; the contrast loss is calculated by combining the embedding representations of the two views and the temperature hyperparameter; then, backpropagation is performed on the contrast loss obtained in this round, and the Adam optimizer is used to perform a model parameter update, thus completing one training round.

[0047] The above training process is repeated according to the training rounds. In this embodiment, the maximum number of training rounds is set to 80 rounds; when the contrast loss tends to stabilize or the maximum number of training rounds is reached, the anomaly detection model is determined to have converged, and the optimized anomaly detection model is obtained.

[0048] After the anomaly detection model converges, the model parameters of the trained encoder are fixed, and this encoder is used as the core component in the online inference phase. The converged anomaly detection model, in the initial deployment stage, inputs historical normal traffic into the encoder and stably outputs a compact high-order graph embedding representation, thereby accurately calculating the semantic baseline center representing the stable state of the power grid. In actual business operation, it directly receives real-time, unknown heterogeneous power grid traffic attribute maps, forcibly eliminates protocol semantic biases, and promptly outputs its real-time high-order graph embedding representation. This high-order graph embedding representation will be directly used for downstream dynamic threshold determination, serving as the absolute basis for calculating the Euclidean distance and the final anomaly deviation score.

[0049] S104: Input historical normal coloring stream data into the optimized anomaly detection model to obtain a higher-order graph embedding representation and calculate the semantic baseline center. Input real-time acquired coloring stream data into the optimized anomaly detection model to obtain a higher-order graph embedding representation. Calculate the anomaly deviation score based on the higher-order graph embedding representation of the real-time acquired coloring stream data and the semantic baseline center.

[0050] In one possible embodiment, calculating the anomaly deviation score includes: calculating the Euclidean distance between the high-order graph embedding representation of the real-time acquired colorized stream data and the semantic baseline center, and using the Euclidean distance as the anomaly deviation score.

[0051] In one specific embodiment, historical normal staining stream data is input into an optimized anomaly detection model to obtain a high-order graph embedding representation and to calculate the semantic baseline center. For real-time colored stream data, this real-time data is used as input, and the converged anomaly detection model calculates the higher-order graph embedding representation. And compute the higher-order graph embedding representation. With semantic baseline center The Euclidean distance between them is used as the outlier score, i.e., the outlier score. The Euclidean distance is directly used as the anomaly deviation score because, in the high-fidelity feature space obtained by the contrastive learning convergence based on the aforementioned processing, the Euclidean distance can most intuitively quantify the degree of physical and geometric deviation of real-time samples from the center of the normal semantic hypersphere. The larger the distance, the higher the probability of it being an anomalous attack.

[0052] In one specific embodiment, historical normal coloring stream data is predetermined before calculating the semantic baseline center. Specifically, the historical normal coloring stream data set is constructed from coloring stream data pre-collected and labeled as normal in the training set. In this embodiment, nodes with anomaly label Label 0 are identified as normal business samples, while nodes with anomaly label Label 1 are excluded from the calculation range of the semantic baseline center. During the pre-collection of coloring stream data, an index number is appended to the data, and the data corresponding to the 360 ​​nodes with index numbers from 0 to 359 are classified as normal coloring stream data.

[0053] After the anomaly detection model converges, the optimized model parameters are fixed, and the pre-determined normal staining flow data is input into the optimized anomaly detection model to obtain the high-order graph embedding representation of each normal staining flow data. ,in , representing the number of normal business samples. L2 normalization is performed on each higher-order graph embedding representation to obtain... ; then on The arithmetic mean of the normalized higher-order graph embeddings of normal colorimetric stream data is used to obtain the semantic baseline center. Therefore, the semantic baseline center represents the central position of a normal business sample in the optimized feature space. In actual operation, to adapt to changes in the normal traffic distribution caused by changes in the business status of the power IoT, the semantic baseline center is dynamically updated. Specifically, a sliding time window is used to acquire new normal business data samples. These new normal business data samples are input into the optimized anomaly detection model to obtain the corresponding high-order graph embedding representation, and then updated with a weighted average based on the historical semantic baseline center and the embedding representation of the new normal business samples. Only samples with anomaly deviation scores below a preset screening threshold are used as baseline update samples to avoid anomaly data participating in the update and causing a shift in the semantic baseline center.

[0054] For the real-time acquired color stream data, the optimized anomaly detection model calculates its real-time high-order graph embedding representation. And L2 normalization was performed in the same way as for normal business samples to obtain .calculate With semantic baseline center The Euclidean distance between them is used as the abnormal deviation score, i.e. The larger the deviation score, the greater the degree to which the real-time colored stream data deviates from the normal business semantic center.

[0055] S105: Calculate the dynamic safety threshold based on the historical average and standard deviation of the abnormal deviation score of the colored stream data sample. When the abnormal deviation score of the real-time acquired colored stream data is greater than the dynamic safety threshold, it is determined that there is an anomaly in the communication link of the power Internet of Things.

[0056] In one possible embodiment, calculating the dynamic security threshold includes: calculating the historical average and standard deviation of the abnormal deviation scores of the colorimetric stream data samples, using colorimetric stream data within a pre-constructed training set or colorimetric stream data within a set time sliding window range as colorimetric stream data samples for calculating the dynamic security threshold; calculating the dynamic security threshold to satisfy... ,in, Indicates the dynamic security threshold. This represents the historical average of the outlier deviation scores for the colored stream data samples. The standard deviation of the outlier deviation score of the stained stream data sample represents the standard deviation of the score. express An empirical coefficient is used to strike a trade-off between the false positive rate and the false negative rate in anomaly detection. , is the empirical coefficient selected in this embodiment; in practical applications, this coefficient can be adjusted according to the statistical distribution of historical coloring stream data and specific business scenarios.

[0057] In one specific embodiment, when When the output power IoT traffic coloring anomaly detection result is abnormal, it indicates that the communication link has been tampered with by a man in the middle or the state has changed abruptly, and a security warning is triggered immediately.

[0058] To verify the application effect of the power Internet of Things (IoT) flow coloring anomaly detection method provided by this invention, a set of comparative experiments were designed for comparative analysis. The specific experimental design is as follows:

[0059] 1. Basic Environment and Global Settings:

[0060] Deep learning framework: The simulation experiments are built based on the PyTorch deep learning framework.

[0061] Repeatability guarantee: To ensure absolute fairness in the comparative experiment, the global random seed was fixed at 42, and the random seed was fixed at 100 twice in the anomaly detection model simulation experiment process.

[0062] 2. Dataset and Graph Topology Construction:

[0063] Network Scale and Feature Dimensions: The experiment sets the total number of nodes in the power IoT graph structure to 400. The input physical traffic feature dimension of each node is 16-dimensional, and the protocol coding feature dimension is set to 8-dimensional. To simulate the huge semantic gap of heterogeneous protocols, the experiment divides network nodes into two protocol clusters and applies a distribution contamination offset of +2.5 to the orthogonal feature dimensions.

[0064] Network topology construction: The adjacency matrix is ​​generated randomly and binarized with a sparsity threshold of 0.85. It is then symmetricized and truncated to construct an undirected graph.

[0065] Anomaly (Attack) Injection: To verify the effectiveness of the model, nodes with index numbers from 360 to the end (40 nodes in total, accounting for 10%) in the pre-collected colored streams of the network are marked as anomaly labels (Label set to 1). On the feature plane, a huge offset of 4.5 is forcibly applied to the physical features of these anomaly nodes, and an offset of 1.0 is applied to their protocol encoding vectors to simulate real man-in-the-middle tampering or severe state mutation.

[0066] It should be noted that this simulation experiment is used to construct a robust stress test under conditions of strong contamination. Therefore, the 40 nodes with injected anomalies are retained in the complete dynamic attribute map for unsupervised comparative training. The anomaly labels of the nodes are not used in the calculation of the training loss; the anomaly labels are only used for performance evaluation during training and for screening normal samples. This setting is used to examine the robustness of the model under conditions of anomaly contamination in the training data.

[0067] Environmental noise simulation: This experiment simulates the generation of communication state event counts for each node, and obtains a discrete probability distribution based on the event count normalization. The system dynamically calculates the real-time information entropy of each node based on the real-time information entropy formula. Different simulated event count distributions are used for normal and abnormal nodes to characterize varying degrees of local network state chaos and disturbance.

[0068] 3. Training parameters and optimization mechanisms:

[0069] Training cycle and optimizer: The total number of training epochs is set to 80. Both the anomaly detection model and the baseline model use the Adam optimizer (torch.optim.Adam) for parameter updates.

[0070] Learning rate: The initial learning rate for both sets of comparison models was set to 0.01.

[0071] Contrastive learning dual-view construction: In each iteration, two different data augmentation views are generated to be input into the contrastive learning module by injecting Gaussian random noise with a standard deviation of 0.05 into the original node features.

[0072] Temperature hyperparameter: The base temperature parameter (base_tau) in the contrastive loss function (ATCL Loss) is set to 0.5. The base temperature parameter is used for initial scale control in the dynamic temperature adjustment process. In the actual training process, the temperature parameter is adaptively adjusted according to the real-time information entropy of the node, rather than always keeping a fixed value.

[0073] 4. Comparison of model network configurations:

[0074] The anomaly detection model of this invention (experimental group Proposed) adopts a network structure called IGATATTCLModel. On the feature extraction side, its main body consists of two cascaded graph attention networks (GatedGATConv) equipped with protocol-encoded vector gating mechanism, and the feature dimension of the hidden layer of the network is set to 32. On the model optimization side, end-to-end training is performed using entropy-guided adaptive temperature contrast loss (ATCL Loss).

[0075] Traditional baseline model (control group): A traditional network called StandardGATModel was used, consisting of two standard graph attention layers with a hidden layer dimension of 32. As a comparative experiment, the baseline model was optimized at a fixed temperature (0.5) using only the basic InfoNCE loss to verify the combined impact of the protocol gating mechanism and the adaptive temperature adjustment module on anomaly detection performance. Furthermore, to verify the effectiveness of the adaptive temperature adjustment strategy, while maintaining consistency in the IGATTATCLModel network structure, protocol gating mechanism, dataset partitioning, training parameters, and optimization strategy, only the temperature adjustment strategy in the contrastive loss function was changed, resulting in a fixed-temperature and dynamic-temperature comparison experiment. The fixed-temperature strategy used a preset temperature parameter τ=0.5, while the dynamic-temperature strategy adaptively adjusted the temperature parameter based on the real-time information entropy of the nodes.

[0076] The results of the ablation experiment using the dynamic temperature regulation mechanism are shown in Table 1:

[0077] Table 1. Results of ablation experiments using dynamic temperature regulation mechanism

[0078] method Temperature strategy Average F1 Fixed temperature scheme τ=0.5 8.55% Dynamic temperature scheme Entropy-guided dynamics τ 11.25%

[0079] Experimental results show that under the fixed temperature strategy, the average F1 score of the model is 8.55%; after adopting the entropy-guided dynamic temperature adjustment strategy, the average F1 score of the model increases to 11.25%. Compared with the fixed temperature scheme, the dynamic temperature strategy can adaptively adjust the contrastive learning constraint strength according to the network state changes reflected by the real-time information entropy of the nodes, enabling the model to have a stronger ability to distinguish abnormal features in complex dynamic communication environments.

[0080] By comparing the anomaly detection performance index (F1) of the models under two temperature strategies, the impact of the dynamic temperature regulation mechanism on anomaly detection performance is analyzed. Table 1 shows that, while maintaining the model structure, protocol gating mechanism, and training parameters, changing only the temperature regulation strategy and adopting the entropy-guided dynamic temperature mechanism can improve the average F1 score of the model, demonstrating the effectiveness of the dynamic temperature regulation mechanism in improving anomaly detection performance in complex dynamic communication environments.

[0081] 5. Evaluation, judgment, and visualization:

[0082] Adaptive threshold parameter: During the anomaly assessment phase, the mean and standard deviation of the Euclidean distance of normal sample features are extracted, and the final dynamic anomaly determination threshold is strictly set to [value missing]. .

[0083] Curve smoothing: To overcome the "all-normal trap" caused by class imbalance, a confusion matrix was introduced in the experiment, focusing on comparing the comprehensive anomaly detection index (F1-Score). The output charts used the exponential moving average smoothing function. The smoothing factor for the F1-Score curve was set to 0.6, and the smoothing factor for the loss curve was set to 0.5.

[0084] like Figure 2 The training loss convergence curve shown illustrates the variation process of the contrastive loss of the method of the present invention in the simulation experiment. During approximately 0 to 50 training rounds, the loss value generally remained at a high level with minimal changes; after approximately 50 rounds, the loss value began to decrease significantly and continued to decrease in subsequent training rounds, gradually stabilizing around 70 rounds and finally settling at a low loss level. This result indicates that, under the simulation conditions, the method of the present invention can effectively reduce the contrastive loss after continuous iterative optimization and ultimately reach a relatively stable convergence state.

[0085] from Figure 3 The anomaly detection F1 score comparison curves shown indicate that, under the simulation settings, the F1 score of traditional graph attention networks gradually decreases in the early stages of training, approaches zero in most training epochs in the later stages, and only experiences a brief rebound in a few epochs. The F1 score of the method presented in this invention is generally higher than that of traditional graph attention networks, exhibiting some fluctuations during training. Significant performance peaks occur around epochs 45-47, 60, 66, and towards the end of training, with the highest F1 score exceeding 30%. Simultaneously, the method of this invention also shows a significant decline in some training intervals, indicating that anomaly detection performance still experiences periodic fluctuations under conditions of strong data distribution contamination and class imbalance. Overall, the method of this invention demonstrates superior anomaly detection capability compared to traditional graph attention networks in this simulation experiment, demonstrating that the protocol gating mechanism and adaptive temperature mechanism play a positive role in improving anomaly detection performance in complex heterogeneous environments.

[0086] The power IoT traffic coloring anomaly detection method provided by this invention designs gated feature calculation and a dedicated gated neural network to address the underlying semantic differences caused by the interweaving of multiple heterogeneous communication protocols in the power IoT. By using the Hadamard product mechanism, the generated gated features are dynamically and adaptively scaled at the channel level to the node features after linear transformation, so that the data distribution of different communication protocols can be accurately aligned to a unified semantic space. This solves the problem of graph feature aggregation distortion caused by the homogenization assumption of feature space in existing technologies, and enables a qualitative leap in the spatial feature representation capability of network topology.

[0087] To address the challenges of severe tidal fluctuations, high background noise, and anomaly sample scarcity in power grid operations, this paper breaks away from the conventional comparative learning model's use of fixed temperature parameters. Instead, it constructs an entropy-guided adaptive temperature comparative learning model, which directly reflects the degree of chaos and disturbance in the local network state (node ​​real-time information entropy). The temperature hyperparameter is deeply coupled to the contrastive loss function. A dynamic temperature adjustment function is constructed through nonlinear mapping, enabling the model to possess high adaptive perturbation resistance: when the local network environment is in a high-entropy and highly perturbation state, the temperature hyperparameter... Increasing the temperature hyperparameter makes the similarity distribution in the contrastive loss smoother, thereby reducing the model's excessive penalty for local noise and normal business abrupt changes; when the network is in a low-entropy, relatively stable state, the temperature hyperparameter... This reduces the similarity difference between different samples, making the model more prominent and thus enhancing its ability to distinguish subtle abnormal deviations.

[0088] Unlike traditional detection schemes where fixed thresholds are easily affected by environmental fluctuations and can lead to judgment failures, this invention designs a dynamic adaptive safety threshold based on statistical distribution during the anomaly detection phase. After model convergence, the Euclidean distance between the high-order graph embedding representation of real-time colored stream data and the baseline center of normal business semantics is used to objectively score the deviation. This dynamic threshold mechanism can adapt to baseline drift in the power Internet of Things in a label-free environment, and can accurately trigger a safety warning once the real-time score exceeds the dynamic adaptive threshold. This mechanism exhibits extremely high stability in a simulation environment with strictly controlled variables, effectively shielding against confusion from routine business operations and comprehensively meeting the high-reliability operation and maintenance requirements of complex and dynamic power grids.

[0089] In other embodiments of this application, an electronic device is disclosed, such as... Figure 4 As shown, the electronic device 200 may include: one or more processors 201; a memory 202; a display 203; one or more application programs (not shown); and one or more computer programs 204. These devices can be connected via one or more communication buses 205. The one or more computer programs 204 are stored in the memory and configured to be executed by the one or more processors 201. The one or more computer programs 204 include instructions that can be used to perform actions such as... Figure 1 And the various steps in the corresponding embodiments.

[0090] Through the above description of the embodiments, those skilled in the art will clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device, and unit described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0091] In the embodiments of this application, the functional units can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0092] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, essentially, or the parts that contribute to the prior art, or all or part of the technical solutions, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as flash memory, portable hard disk, read-only memory, random access memory, magnetic disk, or optical disk.

[0093] The above description is merely a specific implementation of the embodiments of this application, but the protection scope of the embodiments of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the embodiments of this application should be covered within the protection scope of the embodiments of this application. Therefore, the protection scope of the embodiments of this application should be determined by the protection scope of the claims.

Claims

1. A method for detecting anomalies in flow coloring in the power Internet of Things, characterized in that, include: Colored stream data reported by various terminals of the power Internet of Things are collected from the cloud, and dynamic attribute graphs are constructed by extracting entities, physical links, traffic characteristics and protocol encoding vectors of the power Internet of Things from the colored stream data. Anomaly detection models are built for: utilizing The cascaded protocol-gated graph attention network generates a high-order graph embedding representation based on a dynamic attribute graph, generates a dual-view embedding representation and dynamically adjusts the temperature hyperparameter based on the dynamic attribute graph, and constructs a contrastive loss function by combining the dual-view embedding representation and the temperature hyperparameter. The anomaly detection model is iteratively optimized using multiple batches of historical normal staining stream data until the model converges to obtain the optimized anomaly detection model. Each round of iterative optimization includes constructing a dynamic attribute graph from a batch of historical normal staining stream data and inputting it into the anomaly detection model. The anomaly detection model processes the data to output a high-order graph embedding representation and calculates the contrast loss. The contrast loss is then used for backpropagation to update the model parameters. Historical normal coloring stream data is input into the optimized anomaly detection model to obtain a high-order graph embedding representation and to calculate the semantic baseline center. Real-time acquired coloring stream data is input into the optimized anomaly detection model to obtain a high-order graph embedding representation. Anomaly deviation score is calculated based on the high-order graph embedding representation of the real-time acquired coloring stream data and the semantic baseline center. A dynamic safety threshold is calculated based on the historical average and standard deviation of the abnormal deviation scores of the colored stream data samples. When the abnormal deviation score of the real-time acquired colored stream data is greater than the dynamic safety threshold, it is determined that there is an anomaly in the communication link of the power Internet of Things.

2. The method according to claim 1, characterized in that, use When the cascaded protocol-gated graph attention network generates a high-order graph embedding representation based on the dynamic attribute graph, each layer of the protocol-gated graph attention network performs a linear mapping on the traffic features of the nodes to obtain linear mapping features, performs a non-linear mapping on the protocol coding vectors of the nodes to generate gating features, and uses the gating features to scale the linear mapping features using the Hadamard product to obtain corrected features. For each node, the node's aggregated features are calculated based on the modified features of the node itself and its neighboring nodes. The aggregated features output by each layer of the protocol-gated graph attention network are used as input to the next layer of the protocol-gated graph attention network to generate aggregated features. The aggregated features output by the layer protocol gated graph attention network are used as high-order graph embedding representations.

3. The method according to claim 2, characterized in that, The aggregation features of a node are calculated based on the modified features of the node itself and its neighboring nodes, including: The set of neighboring nodes of a node is determined based on the adjacency relationship of the dynamic attribute graph; After concatenating the modified features of a node with the modified features of each of its neighboring nodes, the unnormalized attention score is obtained after attention mapping and LeakyReLU activation. The attention weight coefficient is obtained by performing Softmax normalization on the unnormalized attention score across all neighboring nodes of the node. The aggregated features of a node are obtained by weighting and aggregating the modified features of neighboring nodes using the attention weight coefficients.

4. The method according to claim 1, characterized in that, Based on the dynamic property map, a dual-view embedding representation and dynamically adjusted temperature hyperparameters are generated. A contrastive loss function is constructed by combining the dual-view embedding representation and the temperature hyperparameters, including: Within a set time window, the real-time information entropy of the dynamic attribute graph nodes is calculated. The temperature hyperparameter is then dynamically adjusted using this real-time information entropy. The adjustment calculation of the temperature hyperparameter satisfies the following formula: ,in, Represents a node Temperature overparameters Indicates the baseline temperature hyperparameter. This represents the Sigmoid activation function. Represents a node Real-time information entropy; Two data augmentation perturbations are applied to the node features of the dynamic attribute graph to generate a dual-view embedding representation. The contrastive loss function is constructed by combining the dual-view embedding representation and the temperature hyperparameter, satisfying the following formula: ,in, This represents the contrastive loss function. This represents the total number of nodes in the batch participating in the comparative learning. Represents a node The first type of view's embedded representation, Represents a node The second type of view is an embedded representation. Represents a node The second type of view embedding representation, nodes For the first batch of comparative learning to participate in the current batch 1 node This represents the cosine similarity function.

5. The method according to claim 1, characterized in that, Updating model parameters using backpropagation with the contrastive loss includes: Calculate the gradient of the partial derivatives of the contrastive loss with respect to all learnable parameters of the anomaly detection model; The parameters of the anomaly detection model are iteratively updated using the Adam optimizer along the gradient descent direction.

6. The method according to claim 1, characterized in that, The calculation of the abnormal deviation score includes: Calculate the Euclidean distance between the high-order graph embedding representation of the real-time acquired colorized stream data and the center of the semantic baseline, and use this Euclidean distance as the anomaly deviation score.

7. The method according to claim 1, characterized in that, Calculating the dynamic security threshold includes: Calculate the historical mean and standard deviation of the outlier deviation scores for the stained stream data samples; Calculate the dynamic security threshold to satisfy ,in, Indicates the dynamic security threshold. This represents the historical average of the outlier deviation scores for the colored stream data samples. The standard deviation of the outlier deviation score of the stained stream data sample represents the standard deviation of the score. express The coefficient.

8. The method according to claim 1, characterized in that, The anomaly detection model includes a multimodal input layer, an encoder body, and a nonlinear projection head; The multimodal input layer receives a dynamic attribute map; The encoder body is composed of The system consists of cascaded protocol-gated graph attention networks. Each layer of the protocol-gated graph attention network is used to calculate aggregate features based on the traffic characteristics of dynamic attribute graph nodes and protocol coding vectors. A high-order graph embedding representation is obtained by aggregating hierarchical protocol-gated graph attention networks; The nonlinear projection head is used to nonlinearly map the high-order graph embedding representation to the contrastive learning feature space to generate a dual-view embedding representation.