Physical mechanism embedded power system load flow analysis feature coding method and related equipment

By embedding physical mechanism feature encoding methods into the power flow analysis model, active power transmission and reactive power-voltage coupling are simulated, solving the adaptability problem of data-driven power flow analysis methods in topology changes and cross-grid scenarios, and achieving higher prediction accuracy and computational efficiency.

CN122052009APending Publication Date: 2026-05-15SOUTH CHINA UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SOUTH CHINA UNIV OF TECH
Filing Date
2026-01-19
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

Existing data-driven power flow analysis methods struggle to maintain stable analytical capabilities under grid topology changes or cross-grid scenarios. They lack an intrinsic understanding of active power transmission, reactive power, and voltage coupling, resulting in insufficient model generalization and adaptability.

Method used

By embedding physical mechanisms at the feature level, a feature coding method for power flow analysis is constructed by simulating active power transmission and Chebyshev polynomial approximation of reactive power-voltage coupling using random walk processes, and performing active power transmission coding and reactive power-voltage coding respectively.

Benefits of technology

It significantly improves the model's generalization ability and robustness, enhances prediction accuracy and adaptability under different topologies and grid sizes, reduces computational complexity, and strengthens the model's physical interpretability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122052009A_ABST
    Figure CN122052009A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an electric power system load flow analysis feature coding method embedded with a physical mechanism and related equipment, and belongs to the field of electric power system analysis. The method comprises the steps of simulating a diffusion behavior of unbalanced active power of a node along a power grid topology based on a random walk process, and forming an active transmission code; and carrying out local approximation on the node impedance matrix based on a Chebyshev polynomial, depicting a coupling relationship between reactive power and node voltage, and forming reactive-voltage coding. And performing fusion and dimension reduction on the two types of coding results and other features, and inputting into a downstream neural network for power flow prediction. According to the method, power flow transmission physical knowledge is embedded in a feature level, the adaptability of the model to an unknown power grid scale and a topological structure is remarkably improved, and experiments on a plurality of standard test systems and an actual power grid show that the average prediction error and the maximum prediction error of the method are remarkably reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of power system analysis, and in particular to a power system power flow analysis feature encoding method and related equipment that embeds physical mechanisms. Background Technology

[0002] Data-driven power flow analysis is a key technology for achieving rapid and precise operation of smart grids. With the development of artificial intelligence, models such as deep learning and graph neural networks have been introduced to improve analytical efficiency and accuracy. However, existing data-driven models generally suffer from a fundamental limitation: their effectiveness heavily relies on the grid's node size and topology remaining unchanged during the training and application phases. When the grid undergoes expansion or reconfiguration, or when joint analysis of multiple different grids is required, the performance of these models degrades significantly.

[0003] The root of the problem lies in the fact that existing methods primarily rely on learning the statistical mapping relationship between inputs and outputs from massive amounts of data, making the model essentially a "black box." Although some studies have attempted to incorporate physical constraints such as Kirchhoff's laws and power flow equations as penalty terms into the model's loss function, this is merely a posterior correction of the model's output and does not embed physical laws into the model's internal feature learning and representation process. Therefore, the model lacks an intrinsic understanding of core physical mechanisms such as active power transmission and reactive power coupling with voltage, making it difficult to adapt to topology changes and cross-grid scenarios.

[0004] Therefore, there is an urgent need for a method that can explicitly embed the physical laws of the power system at the feature level of a data-driven model, guiding the model to learn feature representations with physical interpretability, thereby fundamentally improving its generalization ability and adaptability. Summary of the Invention

[0005] The main objective of this application is to propose a power system power flow analysis feature encoding method, electronic device, storage medium, and program product that embeds physical mechanisms. Before the feature extraction stage of the model, parallel feature encoding channels based on physical mechanisms are designed to explicitly model the transmission characteristics of active power and the coupling characteristics of reactive power and voltage, respectively.

[0006] To achieve the above objectives, one aspect of this application proposes a power system flow analysis feature encoding method embedding physical mechanisms, the method comprising: The input data of the power system is acquired, and the input data includes at least the node input matrix, the adjacency matrix, and the node susceptance matrix; Based on the node input matrix and the adjacency matrix, active power transmission is encoded through the first encoding module to obtain the encoded active power characteristic representation. The first encoding module simulates the diffusion behavior of unbalanced active power along the power grid topology through a random walk process. Based on the node input matrix, the adjacency matrix, and the node susceptance matrix, reactive power-voltage encoding is performed by the second encoding module to obtain the encoded reactive power-voltage characteristic representation. The second encoding module approximates the node impedance matrix based on Chebyshev polynomials to characterize the local coupling relationship between reactive power and node voltage. The output is a power flow analysis feature that integrates the encoded active power feature representation and the encoded reactive power-voltage feature representation.

[0007] In some embodiments, the simulation of the diffusion behavior of node unbalanced active power along the grid topology based on the random walk process includes: A random walk matrix is ​​constructed based on the node susceptance matrix, wherein the element values ​​of the random walk matrix are determined based on the susceptance of the corresponding branch. Perform K random walk iterations, where K≥1, in the k-th iteration: Based on the random walk matrix, the active power characteristics of the current node are assigned to adjacent branches; Integrate the power characteristics allocated to both ends of the same branch; Based on the integrated branch power characteristics and branch electrical parameters, update the branch active power characteristics; Update the node active power characteristics based on the updated branch active power characteristics and the original node active power characteristics; The active power features of nodes and branches obtained in each iteration are summed to obtain the encoded active power feature representation.

[0008] In some embodiments, the approximation of the nodal impedance matrix based on Chebyshev polynomials includes: The nodal susceptance matrix is ​​normalized. Based on the normalized nodal susceptance matrix, an M-order approximation is performed using the recurrence relation of Chebyshev polynomials, where M≥1, and the recurrence relation is as follows:

[0009] in, Indicates the first The result of the order encoding, This represents the normalized nodal susceptance matrix. Indicates the first The eigentransformation matrix of order 1; By aggregating the coding results of each order, the coded reactive power-voltage characteristic representation is obtained.

[0010] In some embodiments, prior to performing active power transmission coding and reactive power-voltage coding, the method further includes: The node input matrix is ​​decomposed into an active power related part, a reactive power-voltage related part, and other parts; The active power related part is input to the first encoding module, and the reactive power-voltage related part is input to the second encoding module.

[0011] In some embodiments, the method further includes: The encoded active power characteristic representation, the encoded reactive power-voltage characteristic representation, and the other parts are spliced ​​together; The spliced ​​features are subjected to linear transformation and dimensionality reduction to generate the power flow analysis features.

[0012] In some embodiments, the input data further includes a prompt matrix for indicating whether the active power, reactive power, and voltage amplitude of each node in the node input matrix are known quantities.

[0013] In some embodiments, the power flow analysis features are input into a graph neural network model to predict the node power flow state and / or branch power flow state of the power system.

[0014] To achieve the above objectives, another aspect of this application provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the method described above.

[0015] To achieve the above objectives, another aspect of the embodiments of this application proposes a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method described above.

[0016] To achieve the above objectives, another aspect of this application provides a computer program product, including a computer program that, when executed by a processor, implements the method described above.

[0017] Compared with the prior art, this application has the following significant advantages: 1) Fundamentally improves the model's generalization ability: By pre-encoding the physical mechanisms of power flow transmission (active power diffusion, reactive power-voltage local coupling) into high-dimensional features, the model's learning objective shifts from "fitting a data mapping of a specific power grid" to "understanding and utilizing general physical laws." This enables the model to make reasonable inferences based on encoded physical knowledge even when faced with power grid sizes and topologies not seen during training, significantly improving cross-scenario adaptability and robustness.

[0018] 2) Enhanced physical interpretability and consistency of the model: The encoding process in this application has a clear physical meaning (random walk simulation of active power allocation, Chebyshev polynomial approximation of impedance matrix), making the model's feature representation and internal reasoning process more interpretable. At the same time, the encoding process itself follows physical laws, ensuring the physical rationality of the model's output results from the source.

[0019] 3) A balance between computational efficiency and accuracy is achieved: The reactive power-voltage encoding uses Chebyshev polynomial approximation, avoiding the direct inversion of large-scale node impedance matrices, reducing computational complexity, and making it more suitable for rapid analysis of large-scale power grids. At the same time, due to its locality, this approximation method precisely matches the physical nature of the reactive power-voltage relationship, ensuring the accuracy of the encoding.

[0020] 4) Provides a general model enhancement framework: The feature encoding module proposed in this application can be used as an independent preprocessing unit and can be flexibly embedded into various data-driven power flow analysis models based on graph structure or sequence structure (such as graph convolutional network, graph attention network, Transformer, etc.) to improve the performance of the original model and has wide applicability.

[0021] 5) After thorough verification, the effect is significant: As shown in the experiment in the specific implementation, in the joint training and testing of the IEEE standard system and the actual power grid, the model that introduces the feature coding method of this application has significantly reduced the average error and average maximum error of active and reactive power prediction, which proves its effectiveness. Attached Figure Description

[0022] Figure 1 This is a schematic diagram of the overall architecture of the feature encoding method provided in the embodiments of this application.

[0023] Figure 2 This is a schematic diagram illustrating the application framework of the feature encoding module provided in the embodiment of this application in the power flow analysis model.

[0024] Figure 3 This is a schematic diagram of the active transmission coding process based on random walk, provided for an embodiment of this application.

[0025] Figure 4 A schematic diagram of the reactive power-voltage encoding process based on Chebyshev polynomials provided in the embodiments of this application.

[0026] Figure 5 This diagram illustrates the comparison of the average maximum error of models using and not using the method described in this application on different testing systems.

[0027] Figure 6 This is a schematic diagram of the topology of the selected sample in the embodiments of this application.

[0028] Figure 7 A step diagram illustrating the power system flow analysis feature encoding method embedded with physical mechanisms provided in this application embodiment. Detailed Implementation

[0029] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit it. In the following description, when referring to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with those of this application; they are merely examples of apparatuses and methods consistent with some aspects of the embodiments of this application as detailed in the appended claims.

[0030] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.

[0031] Data-driven power flow analysis is a crucial technology supporting rapid, refined, and intelligent analysis of massive power grid operation scenarios in the future. With the continuous development of artificial intelligence (AI) technology, researchers have introduced various novel AI methods, such as deep neural networks and graph neural networks, into the field of power flow analysis, improving the efficiency, accuracy, and robustness of power flow analysis to some extent. However, existing data-driven power flow analysis methods still generally rely on an implicit assumption in practical applications: that the number of nodes and topology of the power grid remain consistent during the training and application phases. Models trained under this assumption are typically only applicable to specific power grids with a specific node size. When the power grid size changes, or when operating under a new topology not covered during model training, their analytical performance significantly degrades, making it difficult to meet the demands of frequent expansions, reconfigurations, and parallel analysis of multiple power grids in actual power grid operation. This is specifically manifested in the following two aspects.

[0032] 1) For a single power grid scenario, when the power grid undergoes node expansion, generator start-up and shutdown adjustments, or a topology not present in the training set appears, the prediction accuracy of the data-driven model decreases significantly. In particular, within the newly added node and its neighborhood, the model is insufficient in characterizing the power flow distribution and cannot accurately reflect the transmission and distribution characteristics of power in the network.

[0033] 2) In the scenario of joint training of multiple power grids, due to the significant differences in node size, topology and operating characteristics of different power grids, existing models often cannot simultaneously take into account the modeling needs of multiple power grids during the training process. This is manifested in the difficulty in reducing training loss, or the high accuracy only on some power grid samples, while the analysis effect on other power grid samples is significantly degraded. In other words, the model is difficult to extract the general power flow law applicable to different power grids.

[0034] The root cause of these problems lies in the lack of inherent representation capabilities of existing data-driven power flow analysis models regarding the mechanisms of power flow transmission. Although some studies attempt to embed physical constraints such as Kirchhoff's current law and power flow equations into the model's loss function to constrain the physical rationality of the model's output, these methods primarily function to correct results during the model training phase. The forward computation process of these models is essentially a black-box, nonlinear mapping from initial power flow conditions to the final power flow result. The models mainly rely on statistical regularities to fit the mapping relationship between input and output, failing to explicitly learn the transmission and distribution mechanisms of active and reactive power in the power grid at the feature level. Therefore, they struggle to maintain stable analytical capabilities under topology changes or cross-grid scenarios.

[0035] Based on this, to further improve the versatility and adaptability of data-driven power flow analysis models in the face of dynamic changes in power grid size and across different power grids, it is necessary to design and encode the model input features with more physical meaning, starting from the power transmission mechanism. Considering the different transmission and coupling characteristics of active and reactive power in the power grid, this application proposes a feature encoding method that embeds power flow transmission knowledge from the perspective of power transmission and distribution laws. It constructs active power transmission codes and reactive power-voltage codes respectively to explicitly model the power flow transmission laws at the feature level.

[0036] The aforementioned feature encoding method is typically used after the model input features have been upgraded to higher dimensionality and before the feature extraction network performs node correlation analysis. By pre-encoding the power flow transmission patterns, it guides the subsequent network to learn the correlation relationships between nodes more efficiently, thereby reducing the learning difficulty of the feature extraction network and improving the model's generalization ability under different power grid scales and topologies.

[0037] This application provides a power system power flow analysis feature encoding method, electronic device, storage medium, and program product that embeds physical mechanisms. The main technical points of this solution include the following aspects: 1) This application proposes a feature encoding strategy and its application framework for embedding power flow transmission knowledge to enhance the model's ability to represent and generalize power flow mechanisms. The modeling framework comprises three stages: model input and prompt information decomposition, power flow transmission feature encoding, and downstream feature aggregation and dimensionality reduction of the encoding results. Specifically, the input and prompt information decomposition divides the model input into active and reactive-voltage components based on the physical properties of electrical variables, and performs feature upscaling and encoding processes separately, enabling variables with different physical meanings to be modeled independently in their corresponding feature channels. Subsequently, for the different input features after decomposition, a feature encoding strategy based on physical mechanisms is introduced to simulate the transmission and distribution process of active power in the power grid, as well as the coupling relationship between reactive power and node voltage. This allows the model to move beyond relying solely on statistical mapping relationships for learning and instead possess an intrinsic ability to represent the laws of power flow transmission. After feature encoding, the high-dimensional features of nodes and branches embedded with power flow transmission knowledge are input into subsequent feature extraction and dimensionality reduction networks. Since the power flow transmission mechanism has been pre-encoded at the feature level, the learning complexity required for subsequent network node association modeling is significantly reduced, thereby enabling more stable and efficient accurate prediction of node voltage and branch power, and improving the model's adaptability under different topologies and even different grid sizes.

[0038] 2) This paper proposes an active power transmission coding method based on the random walk concept to guide the model in learning the network transmission patterns of active power. This application abstracts the active power transmission and distribution process in the power grid as a random walk process, constructing an active power transmission coding method by characterizing the diffusion behavior of unbalanced power from nodes to adjacent nodes along branches. This coding method includes calculations of the diffusion of unbalanced power from nodes to branches, integration of diffusion results at both ends of the branch, estimation of active power losses in branches, and updating of unbalanced power at nodes, thus reflecting the hierarchical transmission and distribution mechanism of active power in the power grid at the feature level. Through this coding method, the model can be effectively guided to learn the transmission paths and distribution characteristics of active power, improving the model's adaptability to changes in active power flow under different topologies.

[0039] 3) A reactive power-voltage encoding method based on Chebyshev polynomials is proposed to reduce computational complexity and conform to the local coupling characteristics of reactive power-voltage. Addressing the problem that reactive power-voltage sensitivity analysis typically involves inverting the node impedance matrix, resulting in high computational complexity and unsuitability for large-scale power grid applications, this application proposes a reactive power-voltage encoding method combining Chebyshev polynomials with graph convolution. By approximating the node impedance matrix using multi-order Chebyshev polynomials, explicit matrix inversion operations can be avoided, significantly reducing computational complexity. Simultaneously, multi-order polynomial encoding naturally possesses local propagation characteristics, concentrating reactive power-voltage sensitivity information primarily within the local neighborhood of the node. This aligns with the physical characteristics of local coupling between reactive power and voltage in the power grid, thereby improving the accuracy and physical consistency of the model in reactive power-voltage relationship modeling.

[0040] like Figure 7 As shown, this embodiment provides a power system power flow analysis feature encoding method embedding physical mechanisms, including the following steps: S1: Obtain the input data of the power system, wherein the input data includes at least the node input matrix, the adjacency matrix, and the node susceptance matrix; S2: Based on the node input matrix and the adjacency matrix, active power transmission is encoded through the first encoding module to obtain the encoded active power characteristic representation. The first encoding module simulates the diffusion behavior of unbalanced active power along the power grid topology through a random walk process. S3: Based on the node input matrix, the adjacency matrix and the node susceptance matrix, reactive power-voltage encoding is performed by the second encoding module to obtain the encoded reactive power-voltage characteristic representation. The second encoding module approximates the node impedance matrix based on Chebyshev polynomials to characterize the local coupling relationship between reactive power and node voltage. S4: Outputs a power flow analysis feature that integrates the encoded active power feature representation and the encoded reactive power-voltage feature representation.

[0041] The solutions of the embodiments of this application will be described in detail below with reference to the accompanying drawings and specific application examples.

[0042] (1) Feature encoding methods and their application framework 1.1) Feature Encoding Method Architecture The overall framework of feature encoding is as follows: Figure 1 As shown. The feature encoding method proposed in this embodiment includes two parts: active power transmission encoding based on random walk and reactive power-voltage encoding based on Chebyshev polynomials. These are used to characterize the transmission and distribution process of active power in the power grid, as well as the local coupling relationship between reactive power and node voltage.

[0043] In the active power transmission coding section, the module uses a high-dimensional representation of the node's active power. X P Adjacency matrix A and nodal susceptance matrix B For input, where X P for N OK E A matrix of columns N Represents the number of nodes in the power grid. E The dimension for high-dimensional representation; A for N×N×d e The matrix, d e The dimension of the branch attributes in the input; B for N×N The matrix is ​​used. The encoding module models the active power transmission and distribution behavior by simulating the diffusion of unbalanced active power from a node to adjacent nodes along a branch, combining the power transfer results at both ends of the branch with the estimation of active power loss in the branch. The simulation results are presented as high-dimensional features at the node and branch levels, thus obtaining the encoded active power feature representation. The module's output is the encoded node active power characterization. X encode-P The function of branch roads is characterized by their effectiveness. H encode-P ,in X encode-P Dimensions and X P same, H encode-P for N×N×E The matrix.

[0044] Building upon the active power transfer coding, this application further introduces a reactive power-voltage coding module to characterize the sensitivity relationship between node reactive power changes and voltage response within a local region. The module's input includes a high-dimensional representation of node reactive power-voltage. X QV (dimension is) N×E Adjacency matrix A and nodal susceptance matrix B This encoding module approximates the node impedance matrix by combining Chebyshev polynomial expansion with graph convolution, avoiding explicit matrix inversion. Based on this, it transmits reactive power-voltage characteristics within the local neighborhood of the node using the estimated impedance information, thus reflecting the impact of reactive power changes on node voltage. After encoding, the module's input is the encoded node reactive power-voltage characterization. X encode-QV (dimension is) N×E ) and reactive power characterization of coded branches Hencode-Q (dimension is) N×N×E ).

[0045] After completing the active power transmission coding and reactive power-voltage coding, the coding results of the above two parts are compared with other non-power flow related characteristics of the node. X other The data is then stitched together. Other non-power flow related features may include nodal self-admittance, nodal reactive power upper and lower limits, etc., whose dimensions after dimensionality upgrade are: N×E By performing linear transformations and dimensionality reduction on the concatenated node features and branch features respectively, the final encoded output can be obtained.

[0046]

[0047]

[0048] In the formula W node and W edge These are the node feature extraction matrix and the branch feature extraction matrix, respectively, used to reduce the dimension of the concatenated node features from 3... E Dimensional reduction E 2. Branch feature dimension E From dimensionality reduction to E After completing feature encoding and dimensionality reduction, A encoder It is directly used as an adjacency matrix in the subsequent feature extraction network.

[0049] 1.2) Application Framework of Feature Encoding Module An example of the application method of the feature encoding module proposed in this embodiment is as follows: Figure 2 As shown. In Figure 2 Under the modeling framework shown, the feature encoding module is used to perform physically consistent feature encoding processing on the input information before model feature extraction.

[0050] 1.2.1) Model Input Composition In the modeling framework, the input to the data-driven model includes the node input matrix. X Adjacency matrix A Node susceptance matrix B and hint matrix T Among them, the node input matrix X for N× A 5-dimensional matrix, whose five characteristic dimensions correspond to the active power, reactive power, voltage amplitude, real part of the node's parallel self-admittance, and imaginary part of the node's parallel self-admittance, respectively. The parallel self-admittance includes the parallel admittance information of the node itself and its connected branches. Adjacency matrix. AUsed to describe the power grid topology and branch attributes, where the branch attribute feature dimension d e = 3, the three-dimensional features include the real part of the branch admittance, the imaginary part of the branch admittance, and the turns ratio parameters of the transformer branch. Nodal susceptance matrix B for N×N A 3D matrix, where each element represents the electrical connection strength between nodes. In this embodiment, each non-zero element is the reciprocal of the reactance of the corresponding branch. Hint matrix T This indicates whether the active power, reactive power, and voltage magnitude of each node in the node input matrix are known. If the corresponding node characteristic is a known quantity, the element at the corresponding position in the prompt matrix is ​​set to 1; if the corresponding node characteristic is an unknown quantity, the value is 0. Specifically, the rules for setting the prompt matrix for different types of nodes are as follows: a) For node PQ, its voltage amplitude is an unknown quantity, and the element at the voltage amplitude position in the corresponding hint matrix is ​​0, while the rest are 1; b) For PV nodes, their reactive power is an unknown quantity. The element corresponding to the reactive power position in the hint matrix is ​​0, and the rest are 1. c) For a balanced node, its active and reactive power are unknowns. The corresponding elements in the prompt matrix where the active and reactive power are located are 0, and the rest are 1.

[0051] 1.2.2) Decomposition of Node Input and Prompt Information Based on the above input structure, this embodiment will input the node matrix. X Based on its physical meaning, it can be broken down into active input. X [P] Reactive power-voltage input X [QV] Other inputs X [other] The three parts have the following corresponding feature dimensions: N× 1. N× 2 and N× 2. Accordingly, the prompt matrix will be... T Disassembled into active power indicator T [P] Reactive power-voltage indication T [QV] The disassembly relationship is as follows:

[0052]

[0053] By breaking down the data as described above, features with different physical meanings can be entered into their respective feature encoding channels, thereby avoiding mutual interference between different power flow variables.

[0054] 1.2.3) Feature Upsizing and Encoding After decomposing the node inputs and prompts, active power inputs and prompts, reactive power-voltage inputs and prompts, and other inputs are respectively subjected to feature upsizing processing and mapped to... E A high-dimensional feature space is used as the input features for the feature encoding module.

[0055] Subsequently, the upgraded active power characteristics are input into the active power transmission coding module based on random walk, and the upgraded reactive power-voltage characteristics are input into the reactive power-voltage coding module based on Chebyshev polynomials, thus completing the coding of active power transmission characteristics and reactive power-voltage coupling characteristics.

[0056] 1.2.4) Downstream processing of encoding results After completing feature encoding, the encoded node features are obtained. X encode and the encoded adjacency matrix A encode These are also used as input to the subsequent feature extraction module. The feature extraction module further extracts the topological correlation characteristics and power flow characteristic correlations between nodes through information interaction between nodes. Finally, the high-dimensional representations of nodes and branches are subjected to dimensionality reduction processing, ultimately outputting the active power, reactive power, and voltage amplitude of all nodes, as well as the active power and reactive power of all branches.

[0057] Since there is a definite physical relationship between the node phase angle and the branch power, this embodiment calculates the phase angle difference between the nodes at both ends of the branch through the branch power prediction results and the node voltage prediction results, and uses the slack node as the reference node to calculate the phase angle value of each node step by step according to the power grid topology.

[0058] (2) Active transmission coding based on random walk In power systems, the transmission and distribution of active power are primarily influenced by the distribution of network reactance. For unbalanced active power generated at a node, its distribution on adjacent branches is typically inversely proportional to the branch reactance; that is, branches with smaller reactance (larger susceptance) tend to bear a greater share of active power transmission. Based on these physical laws, this embodiment abstracts the active power transmission process in the power grid as a random walk process and constructs an active power transmission coding method based on random walks.

[0059] 2.1) Construction of the random walk matrix To characterize the probabilistic relationship of active power diffusion from a node to its neighboring nodes, this embodiment defines a random walk matrix. R w , is used to represent the probability distribution of active power of nodes as it is transmitted along the network topology, and is defined as follows:

[0060] In the formula D B For nodal susceptance matrix B The degree matrix, whose diagonal elements are defined as:

[0061] Using the above construction method, the random walk matrix R w This ensures that the unbalanced active power at nodes is normalized and distributed according to the susceptance of the connected branches, thus conforming to the physical transmission characteristics of active power in the power grid.

[0062] 2.2) Definition of Random Walk Parameters and Variables Let the order of the random walk be . K P , k Indicates the first k This involves a random walk process. In each random walk, a node feature transformation matrix is ​​introduced. (Dimension 2) E × E ) and branch characteristic transformation matrix (Dimension 3) E × E ). Define the first k The active power characteristic matrix of the nodes obtained after the random walk is: The characteristic matrix of active power of the branch is Based on random walk matrix R w The overall process of active transmission coding is as follows: Figure 3 As shown, the specific steps are as follows.

[0063] 2.3) Specific process of active transmission coding a) Variable initialization. Initialize the node active power representation and branch active power representation of the 0th-order random walk, denoted as:

[0064] in W A This is the upgraded dimension matrix for branch features. Simultaneously, the cumulative random walk results are initialized:

[0065] b) Node power allocation. In the... k In the random walk, node features This represents the unbalanced active power of the current node. Based on the random walk matrix, the unbalanced active power of the node is distributed to adjacent branches according to the branch susceptance ratio, resulting in the power allocation from node to branch:

[0066] c) Branch Power Consolidation. Since each branch connects two nodes, when the injected power signs at both ends of the branch are the same, the power cancels out; when the signs are opposite, the power is superimposed. To reflect this physical characteristic, the power allocation results at both ends of the branch are consolidated to obtain the... k Power representation of branches in a random walk:

[0067] d) Branch update considering network loss. Since branch power suffers losses during transmission, and the random walk allocates the unbalanced power of the current node, branch power updates need to comprehensively consider the branch power characteristics of the previous random walk, the unbalanced power allocation results of the current round, and the branch's own electrical parameters. The branch power characteristics are updated as follows:

[0068] Where || represents the feature concatenation operation. This is the activation function.

[0069] e) Node power characteristic update. After obtaining the updated branch power characteristics, the node active power characteristics are updated based on the original active power characterization of the node and the power transfer results of its adjacent branches:

[0070] in, Represents a node i The set of neighboring nodes.

[0071] f) Accumulate the results of the random walk. k The node and branch power features obtained from the random walk are accumulated into the encoding result:

[0072] g) Termination condition determination. Let k = k +1, when k > K P If the random walk fails, the random walk process ends; otherwise, return to step b) to continue execution. After the random walk ends, the accumulated encoding results are activated to obtain the final active transmission encoded output:

[0073] (3) Reactive power-voltage coding based on Chebyshev polynomials In power systems, the coupling relationship between reactive power and voltage at nodes can typically be characterized by the imaginary part of the node impedance matrix. This node impedance matrix is ​​generally obtained by inverting the node susceptance matrix, a process involving large-scale matrix inversion operations, resulting in high computational complexity and making it unsuitable for direct embedding in data-driven models. Furthermore, considering the physical characteristics of power systems, reactive power-voltage sensitivity generally decreases gradually with increasing electrical distance between nodes, and its influence can be approximated as negligible at greater distances. Therefore, when modeling the reactive power-voltage relationship, it is not necessary to calculate all elements of the node impedance matrix precisely; it is sufficient to characterize the reactive power-voltage coupling characteristics within the local neighborhood of the node.

[0074] Based on the above understanding, this embodiment proposes a reactive power-voltage coding method based on Chebyshev polynomials. By approximating the inversion process of the node susceptance matrix through Chebyshev polynomials, the method avoids explicit matrix inversion operations and achieves feature coding with local propagation characteristics that can effectively characterize the reactive power-voltage coupling relationship.

[0075] The node input features of the reactive-voltage coding module include high-dimensional representations of node reactive-voltage and active power transfer coding results based on random walks, i.e. Based on this, a polynomial approximation expansion of the nodal susceptance matrix is ​​performed to complete the encoding of the reactive power-voltage characteristics.

[0076] The process of reactive power-voltage coding is as follows: Figure 4 As shown, the specific process is as follows: a) Characteristic normalization. To meet the numerical stability requirements of Chebyshev polynomials, the nodal susceptance matrix is ​​first normalized. B Normalization is performed to map its eigenvalues ​​to the interval [-1, 1]. The normalized nodal susceptance matrix is ​​denoted as... The calculation method is as follows:

[0077] In the formula The normalized nodal susceptance matrix, B max The maximum value of the nodal susceptance matrix is ​​. I This is the identity matrix. The above normalization process ensures the numerical stability of the subsequent Chebyshev polynomial expansion.

[0078] b) Initialization of Chebyshev polynomial coding. Define the order of the reactive power-voltage coding as... K Q ,in k Indicates the firstk The encoding process of order, C k Indicates the first k The feature encoding result matrix corresponding to the 0th order. Initialize the 0th order encoding result as the input features of the module:

[0079] The initial first-order encoding result is a first-order aggregation result based on the node susceptibility matrix:

[0080] in, and This is the characteristic transformation matrix of the corresponding order.

[0081] c) Higher-order coding computation. For the first... k The recurrence relation of the Chebyshev polynomial encoding result is expressed as follows:

[0082] This recursive formula, through a finite-order matrix polynomial expansion, achieves an approximate expression of the node impedance matrix without matrix inversion, and naturally restricts the propagation of information within the local neighborhood of the node.

[0083] d) Termination condition determination. Let k = k +1, when k > K Q If the condition is met, the encoding process ends; otherwise, return to step c) to continue. After encoding is complete, the encoding results of each order are summarized to obtain the encoded node reactive power-voltage characterization:

[0084] In the formula b VQ The bias is used for node encoding. Based on this, a reactive power characteristic representation at the branch level is constructed according to the node reactive power-voltage encoding results. For connected nodes... i and nodes j The reactive power characteristic encoding method for the branch is as follows:

[0085] In the formula W edgeQ This is the feature extraction matrix for the reactive power characteristics of the branch.

[0086] (4) Case Analysis To verify the effectiveness of the feature encoding method proposed in this embodiment and the calculation process of related technical points, the IEEE 39-node system, IEEE 118-node system, IEEE 300-node system and two actual power grids of different sizes in China were selected as test objects to carry out joint training and comparative verification experiments.

[0087] In the experiments, the number of training samples for each test system was set to 100,000, and the number of test samples was set to 20,000. Therefore, the total number of training samples in the joint training phase was 500,000, and the total number of test samples was 100,000. All experiments were conducted under the same model structure, training strategy, and hyperparameter settings. Comparisons were made only between the inclusion and exclusion of the feature encoding module proposed in this invention to ensure the fairness and comparability of the experimental results.

[0088] This embodiment evaluates the model prediction error from both active and reactive power perspectives. The electrical quantities involved in the active power error calculation include branch active power and node unbalanced active power; the electrical quantities involved in the reactive power error calculation include reactive power of PV nodes and balanced nodes, branch reactive power, and node unbalanced reactive power. The average error is defined as the arithmetic mean of the prediction errors of all samples, all relevant nodes, and branches in the test set; the average maximum error is defined as the average of the maximum errors of each sample in the test set, used to characterize the prediction deviation level of the model under extreme conditions.

[0089] Table 1 shows the average error statistics of the model on different systems, with and without the proposed feature encoding method. In the experiments, the proposed active and reactive power-voltage feature encoding orders... K P = K Q =3.

[0090] Table 1. Average error of the model in each system.

[0091] As can be seen from Table 1, in all test systems, after introducing the feature encoding method of this embodiment, the average error of the model in both active and reactive power is significantly reduced, and the error improvement effect is consistent in power grids of different scales and topologies, indicating that this application has good versatility and scale adaptability.

[0092] The average maximum error of the model on various test systems is compared to... Figure 5 As shown. From Figure 5As can be seen, compared to the case without feature encoding, the average maximum error of the model is significantly reduced after adopting the feature encoding method proposed in this application, and the improvement effect is particularly significant in large-scale systems and actual power grid systems. This indicates that this application can not only reduce the overall prediction error level, but also effectively suppress prediction deviations in extreme scenarios, and improve the reliability and safety margin of the model in engineering applications.

[0093] Combined Table 1 and Figure 5 Experimental results show that the feature encoding method embedding power flow transmission knowledge proposed in this embodiment can significantly improve the prediction accuracy of the data-driven power flow analysis model, especially in the key engineering indicator of mean maximum error. This advantage has been verified in multi-grid joint training and systems with different node sizes, fully demonstrating the applicability of the method in complex power grid scenarios.

[0094] To further illustrate the specific calculation process and physical meaning of the feature encoding method in this embodiment, typical samples will be selected from the test set of the IEEE 39-node system, and their feature encoding process will be listed and explained in detail.

[0095] 4.1) Overview of the selected sample The topology of the selected samples is as follows Figure 6 As shown, this sample is a 37-node sample considering the outage of two generators in the IEEE 39-bus system technology. Before power flow analysis, all unknown node active and reactive power inputs are filled with 0, and unknown node voltage inputs are filled with 1. The corresponding node input matrix... X The elements are shown in Table 2.

[0096] Table 2 Input features of selected samples

[0097] In addition, Table 3 presents the nodal susceptance matrix in COO sparse matrix format. B The actual branch locations and their corresponding values.

[0098] Table 3 Elements of the nodal susceptance matrix

[0099] 4.2) Active transmission coding process In active transmission coding, the random walk matrix must first be calculated. The calculation results of the random walk matrix are shown in Table 4.

[0100] Table 4 Elements of the Random Walk Matrix

[0101] After feature upscaling, the upscaling results of node active power are shown in Table 5, corresponding to the high-dimensional representation of node active power in the input of the encoding module. X P Due to space limitations, only the first 10 dimensions of the 512-dimensional representation of each node are shown here.

[0102] Table 5. Top 10 columns of elements representing the high-dimensional representation of node activity.

[0103] After starting the random walk, the result of the 0th-order random walk is followed by the node walk results. Results of the branch road walk As shown in Tables 6 and 7 respectively.

[0104] Table 6. Top 10 columns of the node walk results for the 0th-order random walk.

[0105] Table 7. Top 10 columns of results for the 0th-order random walk branch.

[0106] After completing the third-order random walk, the final activated node has an active representation. X encode-P The function of branch roads is characterized by their effectiveness. H encode-P As shown in Tables 8 and 9 respectively.

[0107] Table 8. Top 10 columns of the node active power characterization output results after active power transmission coding.

[0108] Table 9. Top 10 columns of active power characterization output results after active power transmission coding.

[0109] 4.3) Reactive power-voltage encoding process After active power transmission coding is completed, the model begins reactive power-voltage coding. The result of the 0th order reactive power-voltage coding is shown below. C 0 is shown in Table 10.

[0110] Table 10. Elements of the first 10 columns of the reactive power-voltage coding result at level 0.

[0111] Following the process in Section 2.3, after completing the third-order reactive-voltage coding, the resulting coded node reactive-voltage characterization is... Xencode-VQ Reactive power representation of branches after encoding H encode-Q As shown in Tables 11 and 12 respectively. Since the node features are highly sparse after reactive power-voltage encoding, Table 11 shows the elements from the 41st to the 50th dimension to highlight the differences in the features of each node.

[0112] Table 11 Elements of Columns 41 to 50 of the coded node reactive power-voltage characterization

[0113] Table 12. Top 10 columns of reactive power characterization for branches after coding.

[0114] 4.4) Final inference results of the selected samples After feeding the above encoding results into the subsequent feature encoding network to extract the inter-node correlations and reduce dimensionality, the comparison results of the actual and predicted values ​​of the power flow results for all nodes in this sample are shown in Table 13, and the comparison results of the actual and predicted values ​​of the power flow results for all branches are shown in Table 14. It can be seen that the model can achieve very accurate power flow analysis for this sample.

[0115] Table 13 Actual and Predicted Values ​​of Node Power Flow

[0116] Table 14 Actual and Predicted Values ​​of Branch Power

[0117] This application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the above-described method. This electronic device can be any smart terminal, including tablet computers, in-vehicle computers, etc.

[0118] It is understood that the content of the above method embodiments is applicable to this device embodiment. The specific functions implemented by this device embodiment are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0119] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method.

[0120] It is understood that the content of the above method embodiments is applicable to this storage medium embodiment. The specific functions implemented in this storage medium embodiment are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved in the above method embodiments.

[0121] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0122] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.

[0123] It is understood that the content of the above method embodiments is applicable to the embodiments of this program product. The specific functions implemented in the embodiments of this program product are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved in the above method embodiments. The executable computer program code or "code" used to perform the various embodiments can be written in high-level programming languages ​​such as C, C++, Python, Smalltalk, Java, JavaScript, Visual Basic, Structured Query Language (e.g., Transact-SQL), Perl, or in various other programming languages.

[0124] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.

Claims

1. A method for embedding physical mechanism into power system transient stability analysis feature encoding, characterized in that, The method includes the following steps: The input data of the power system is acquired, and the input data includes at least the node input matrix, the adjacency matrix, and the node susceptance matrix; Based on the node input matrix and the adjacency matrix, active power transmission is encoded through the first encoding module to obtain the encoded active power characteristic representation. The first encoding module simulates the diffusion behavior of unbalanced active power along the power grid topology through a random walk process. Based on the node input matrix, the adjacency matrix, and the node susceptance matrix, reactive power-voltage encoding is performed by the second encoding module to obtain the encoded reactive power-voltage characteristic representation. The second encoding module approximates the node impedance matrix based on Chebyshev polynomials to characterize the local coupling relationship between reactive power and node voltage. The output is a power flow analysis feature that integrates the encoded active power feature representation and the encoded reactive power-voltage feature representation.

2. The method of claim 1, wherein, The simulation of the diffusion behavior of unbalanced active power along the power grid topology based on random walk processes includes: A random walk matrix is ​​constructed based on the node susceptance matrix, wherein the element values ​​of the random walk matrix are determined based on the susceptance of the corresponding branch. Perform K random walk iterations, where K≥1, in the k-th iteration: Based on the random walk matrix, the active power characteristics of the current node are assigned to adjacent branches; Integrate the power characteristics allocated to both ends of the same branch; Based on the integrated branch power characteristics and branch electrical parameters, update the branch active power characteristics; Update the node active power characteristics based on the updated branch active power characteristics and the original node active power characteristics; The active power features of nodes and branches obtained in each iteration are summed to obtain the encoded active power feature representation.

3. The method of claim 1, wherein, The approximation of the nodal impedance matrix based on Chebyshev polynomials includes: The nodal susceptance matrix is ​​normalized. Based on the normalized nodal susceptance matrix, an M-order approximation is performed using the recurrence relation of Chebyshev polynomials, where M≥1, and the recurrence relation is as follows: in, Indicates the first The result of the order encoding, This represents the normalized nodal susceptance matrix. Indicates the first The eigentransformation matrix of order 1; By aggregating the coding results of each order, the coded reactive power-voltage characteristic representation is obtained.

4. The method of claim 1, wherein, Before performing active power transmission coding and reactive power-voltage coding, the method further includes: The node input matrix is ​​decomposed into an active power related part, a reactive power-voltage related part, and other parts; The active power related part is input to the first encoding module, and the reactive power-voltage related part is input to the second encoding module.

5. The method of claim 4, wherein, The method further includes: The encoded active power characteristic representation, the encoded reactive power-voltage characteristic representation, and the other parts are spliced ​​together; The spliced ​​features are subjected to linear transformation and dimensionality reduction to generate the power flow analysis features.

6. The method of claim 1, wherein, The input data also includes a prompt matrix, which indicates whether the active power, reactive power and voltage amplitude of each node in the node input matrix are known quantities.

7. The method of claim 1, wherein, The power flow analysis features are input into a graph neural network model to predict the node power flow state and / or branch power flow state of the power system.

8. An electronic device, comprising: The electronic device comprises a memory and a processor, the memory stores a computer program, and the processor implements the method in any one of claims 1 to 7 when executing the computer program.

9. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 8. The computer program is executed by the processor to implement the method in any one of claims 1 to 7.

10. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the method in any one of claims 1 to 7.