A method and device for predicting harmonics in distribution network based on cascaded space-time graph network

Through the cascading spatio-temporal graph network architecture, combined with Transformer and graph neural network, high-precision prediction of the harmonic voltage content rate and total harmonic distortion rate of the full node of the distribution network is achieved, solving the problem of time dimension prediction and high-cost deployment in the existing technology, and providing accurate harmonic governance support.

CN120222367BActive Publication Date: 2025-08-26ZHEJIANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510690087.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-27
Publication Date
2025-08-26
Estimated Expiration
2045-05-27

AI Technical Summary

Technical Problem

The prior art cannot realize the time-dimensional prediction of harmonics in distribution networks, and relying on high-density measurement devices leads to high deployment costs. It is impossible to use grid topology information to estimate harmonic parameters of unmeasured nodes. Spatial-temporal decoupling modeling leads to distortion of harmonic phase information, and the neural network is not embedded with physical constraints and is prone to incorrect predictions.

Method used

The cascading space-time graph network architecture is adopted, and through single-point timing prediction, spatial estimation and index fusion calculation, combined with Transformer, graph neural network and artificial neural network, high-precision prediction of the full-node harmonic voltage content rate and total harmonic distortion rate is achieved, supporting dynamic topological changes and sparse measurement scenarios.

Benefits of technology

It realizes accurate estimation of the harmonic voltage content rate and total harmonic distortion rate of the unmeasured node, reduces the cost of the monitoring system, improves prediction accuracy and real-time response capabilities, and provides an accurate regulation benchmark for harmonic governance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120222367B_ABST
    Figure CN120222367B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for predicting harmonics in a distribution network based on a cascaded spatiotemporal graph network, which belongs to the field of power quality monitoring in distribution networks. The method takes the historical harmonic voltage content rate and injected power data of the measurement node as input, and outputs the HRU prediction value of the measurement node through a single-point time series prediction module based on the Transformer architecture; integrates the distribution network topology, power prediction data and the HRU prediction value of the measurement node, and models the harmonic propagation path between nodes through a spatial estimation module based on a graph neural network, estimates the HRU value of the unmeasured node and obtains the THD prediction value based on the indicator fusion calculation. The present invention applies time-space joint modeling to harmonic analysis, and through the network cascade of multifunctional modules, effectively improves the node harmonic THD prediction accuracy in dynamic topology and sparse measurement scenarios, and can be integrated into the power grid energy management system to provide real-time decision support for harmonic governance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of power quality monitoring of distribution networks, and in particular to a method and device for predicting harmonics in distribution networks based on a cascaded space-time graph network. Background Art

[0002] In recent years, with the large-scale access of distributed new energy and nonlinear loads, the problem of harmonic pollution in distribution networks has become increasingly serious. Excessive harmonic content can lead to safety hazards such as transformer overheating, relay protection malfunction, and reduced energy efficiency, which in turn causes serious economic and safety losses. Therefore, accurate prediction of the propagation distribution of harmonics is the key to optimizing harmonic suppression strategies and ensuring safe and stable operation of power grids. However, existing technical solutions have significant limitations: traditional power system harmonic analysis mainly relies on harmonic state estimation, which is essentially a static fitting inversion of the harmonic parameters of the grid nodes. It can only evaluate the harmonic distribution state at the same time based on redundant measurement data, and can neither achieve the prediction function in the time dimension nor rely on high-density measurement devices, resulting in high deployment costs in actual projects. Although neural network technology has been introduced in recent years to break through the static analysis bottleneck of traditional methods, existing research has mostly focused on harmonic signal feature recognition, or harmonic time series prediction for single nodes and single nonlinear loads, and its model architecture has not taken into account The spatiotemporal coupling characteristics of harmonic propagation at multiple nodes in distribution networks make it impossible for models to use grid topology information to estimate harmonic parameters at unmeasured nodes in practical applications. This necessitates the deployment of additional interpolation algorithms with limited accuracy. Simultaneously, due to the lack of a collaborative learning mechanism between harmonic timing characteristics and spatial propagation laws, spatiotemporal decoupling modeling results in distortion of harmonic phase information during cross-module transmission. Furthermore, existing neural networks generally employ an end-to-end black box structure, without embedding physical constraints such as harmonic energy conservation and fundamental-harmonic power coupling. Consequently, insufficient training data or sudden changes in grid operating conditions can easily lead to erroneous predictions that violate electrical laws. Summary of the Invention

[0003] To address these issues, the present invention proposes a method for predicting harmonics in distribution networks based on a cascaded spatiotemporal graph network. This method utilizes a cascaded architecture combining single-point time-series prediction, spatial estimation, and fusion-based index calculation to achieve high-precision prediction of the 2nd-25th harmonic voltage content (HRU) for all nodes in the distribution network and automatic calculation of total harmonic distortion (THD). This method applies joint time-series and spatial modeling to harmonic analysis. By cascading a network of multifunctional modules, the method effectively improves the accuracy of node-level harmonic THD prediction in dynamic topologies and sparse measurement scenarios. This method can be integrated into power grid energy management systems to provide real-time decision support for harmonic mitigation.

[0004] One of the objectives of the present invention is achieved by the following technical solution: a method for predicting harmonics in a distribution network based on a cascaded space-time graph network, the method comprising the following steps:

[0005] Step 1: Collect historical time series data of injected active power, reactive power, and 2nd-25th harmonic voltage content from deployed measurement nodes in the distribution network, perform single-point time series forecasting, and obtain the predicted value of the 2nd-25th harmonic voltage content corresponding to each measurement node;

[0006] Step 2: Based on the predicted values ​​of the harmonic voltage content of the deployed measurement nodes obtained in Step 1, combined with the distribution network topology information and the predicted values ​​of the active power and reactive power injected by all nodes, a mapping relationship between the harmonic voltages of the existing measurement nodes and the harmonic voltages of the unmeasured nodes is established through spatial estimation, thereby obtaining the predicted values ​​of the harmonic voltage content of the unmeasured nodes.

[0007] Step 3: Based on the predicted values ​​of the harmonic voltage content rate of all nodes obtained in steps 1 and 2, perform indicator fusion calculation to obtain the predicted value of the total harmonic voltage distortion rate of each node.

[0008] Furthermore, the single-point time series prediction in step 1 is implemented based on the Transformer architecture, and the historical time series data of the distribution network measurement nodes are collected to form a feature vector, which is divided into multiple local time blocks according to the time dimension to form a block sequence. Each feature channel of the feature vector is independently linearly projected to generate a channel-specific block embedding representation, which is then spliced ​​and superimposed with a learnable position code to form an initial embedding representation. The encoder composed of independent channel-independent multi-head self-attention layers is input, and the multi-head attention weight is calculated at each layer. The output of each attention head is weightedly aggregated, and the multi-head attention feature is generated by linear transformation after splicing. After splicing into a complete vector, it is used as the input of the next layer until the final output of the encoder is obtained. Based on the decoder prediction head, the future is generated through the channel-independent linear projection layer. The HRU predicted value of each harmonic in minutes.

[0009] Furthermore, the spatial estimation in step 2 is implemented based on a graph neural network architecture. The specific architecture and operation process include the following steps:

[0010] Step 2.1: Construct an undirected weighted graph based on the electrical connection relationship and node admittance matrix of the distribution network , where the node set Contains all measured nodes and unmeasured nodes in the distribution network topology; edge set Represents pairs of nodes that are directly electrically connected; adjacency matrix The edge weight Obtained by normalizing the inverse of the inter-node harmonic impedance amplitude;

[0011] Step 2.2: The measurement node output of the single-point timing prediction will be The minute-by-minute predicted values ​​of each harmonic voltage content and the predicted values ​​of active power and reactive power injected into all nodes are used as initial node features;

[0012] Step 2.3: Adoption The graph-hopping attention mechanism transmits messages to neighboring nodes, completes message aggregation, fuses the previous hop state of the current node with the aggregated message, updates the node state, performs channel-sensitive weighting on the K-hop output, completes adaptive fusion, and generates the final predicted value of the harmonic voltage content rate of the unmeasured node.

[0013] Furthermore, the indicator fusion calculation in step 3 is implemented based on the artificial neural network ANN architecture. The specific architecture and operation process include the following steps:

[0014] Step 3.1: The predicted values ​​of the harmonic voltage content rate of each measurement node obtained by single-point time series prediction , and the predicted values ​​of harmonic voltage content rate of unmeasured nodes obtained by spatial estimation , spliced ​​into a full-node harmonic data matrix according to the node dimension For each node-time step combination , extract the feature vector and input it into the artificial neural network ANN:

[0015] Step 3.2: For each node-time step combination Extract feature vectors Perform adaptive normalization calculations and dynamically adjust the scaling factor of each harmonic channel to achieve enhanced perception of each harmonic:

[0016]

[0017] in, is the enhanced feature vector, and is the mean and standard deviation, updated every 5 minutes based on historical data; is the Hadamard product; and are learnable scaling and offset parameters, initialized to 、 ; is a numerical stability constant, h represents the hth harmonic, and represents the learnable scaling and offset parameters of the hth harmonic;

[0018] Step 3.3: Input the enhanced feature vector into a fully connected network containing L layers of residual blocks. The structure of each residual block is as follows:

[0019]

[0020] in, and Respectively The weight matrix and bias vector in the layer residual block, GELU is the activation function, Dropout represents random inactivation, and LayerNorm represents layer normalization; the initial input of the fully connected network is ,satisfy: ;in, is a linear transformation, and the enhanced eigenvector Mapped to the hidden space of the network to make it fit the input dimension of the residual block, Indicates the The output of the layer residual block;

[0021] After passing through the L-layer residual block, the network finally outputs the predicted value of the total harmonic voltage distortion rate of each node.

[0022] Furthermore, the construction of the undirected weighted graph supports dynamic topology updating. When the distribution network topology changes, the harmonic propagation path information of the input network is adaptively adjusted by updating the spatially estimated adjacency matrix and edge weights in real time.

[0023] Furthermore, the cascaded spatiotemporal graph network includes three parts: a single-point time series prediction module, a spatial estimation module, and an indicator fusion calculation module. The training method adopts a phased training strategy, which specifically includes the following steps:

[0024] Step A: Based on the training data set, a sliding time window is used to intercept the historical time series data of each node, and the single-point time series prediction part is independently pre-trained; at this stage, a phase-sensitive loss function is designed to combine the dynamic time warping DTW term with the harmonic voltage amplitude error to constrain the phase alignment accuracy of the harmonic waveform; the loss function The complete expression is:

[0025]

[0026] in, Respectively represent Node No. The actual and predicted values ​​of subharmonic voltages, is a hyperparameter, represents dynamic time warping calculation;

[0027] Step B: Jointly optimize the spatial topology features and harmonic voltage prediction values ​​based on spatial estimation, where N represents the total number of nodes; model the harmonic coupling between nodes through the graph attention mechanism, and the loss function Defined as:

[0028]

[0029] Where E represents the edge set of the network topology; is the predicted value of the hth harmonic voltage content rate at node i; is the predicted value of the hth harmonic voltage content rate at node j; is the predicted value of harmonic current of line ij. If some lines have no relevant predicted value, it is taken as 0; is the hth impedance of line ij, is a hyperparameter used to balance the weights of the impedance relationship term and the topology constraint term. KLD represents the KL divergence. for The dynamic graph attention weight distribution calculated by the skip-graph attention mechanism learning, is the prior knowledge distribution of network topology, satisfying:

[0030]

[0031] in, represents the topological prior knowledge of line ij, is the line weight of line ij, The weight of the edge kl in the network topology, is the line impedance of line ij; the first term in the above loss function forces the inter-node harmonic voltage-current impedance relationship to be satisfied; the second term KL divergence constrains the graph attention weight distribution and topological prior knowledge consistency; when the spatial estimation error changes are stable at Complete parameter solidification during the interval;

[0032] Step C: Freeze the time-space module parameters and construct the fusion loss function for:

[0033]

[0034] in, and is the weight hyperparameter; and are the predicted value and true value of the total harmonic voltage distortion THD of node i respectively; is the total number of nodes; For Haddam; is the predicted value of the 2nd to 25th harmonic voltage content rate at node i; is the weight vector of each node; the first term in the above function is the main loss term of the mean square error; the second term is the harmonic order weighted correction term; when the error of the validation set decreases by less than 0.5% for 5 consecutive training cycles, it is determined to have converged and its network parameters are frozen.

[0035] Furthermore, the distribution of the measurement nodes satisfies the connectivity constraints of the distribution network topology.

[0036] In the second aspect, the present invention also provides a distribution network harmonic prediction device based on a cascaded space-time graph network, which includes a processor, a storage medium and a computer program. The computer program is stored in the storage medium, and when the computer program is executed by the processor, it implements the distribution network harmonic prediction method based on the cascaded space-time graph network.

[0037] In a third aspect, the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the distribution network harmonic prediction method based on the cascaded spatiotemporal graph network.

[0038] In a fourth aspect, the present invention further provides a computer program product, comprising a computer program, which, when executed by a processor, implements the distribution network harmonic prediction method based on a cascaded spatiotemporal graph network.

[0039] Beneficial effects of the present invention:

[0040] (1) The present invention uses a cascaded spatiotemporal graph network architecture to collaboratively model temporal and spatial features, breaking through the limitations of traditional harmonic prediction and analysis methods that rely on steady-state assumptions, ignore topological correlations, and cannot cover unmeasured nodes. It achieves accurate estimation of the 2nd to 25th harmonic voltage content and total harmonic voltage distortion rate of unmeasured nodes, and supports real-time response to dynamic changes in power grid topology, which can effectively reduce the cost of the monitoring system.

[0041] (2) The present invention integrates the physical constraints of harmonic energy conservation and the online fine-tuning mechanism through an artificial neural network module, breaking through the limitation of traditional THD calculation that relies on the linear superposition formula and causes phase error, reducing the calculation error of the total harmonic distortion rate, and providing a precise control benchmark for harmonic control equipment. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 This is an architecture diagram of a distribution network harmonic prediction method based on a cascaded space-time graph network in Example 1.

[0043] Figure 2 This is a diagram of the architecture of the single-point timing prediction module of Example 1.

[0044] Figure 3 FIG. 4 is an architecture diagram of a space estimation module according to the first embodiment.

[0045] Figure 4 This is the indicator fusion calculation module architecture diagram of Example 1.

[0046] Figure 5 This is a flow chart of the staged training strategy of the cascaded spatiotemporal graph network in Example 2.

[0047] Figure 6This is the grid topology diagram of the IEEE33 node calculation example of Example 3.

[0048] Figure 7 It is the electrical model of the new energy photovoltaic injection node power generation unit and some subharmonic current output values ​​of Example 3.

[0049] Figure 8 This is a diagram of the Norton equivalent model adopted by the nonlinear load access node in the third embodiment.

[0050] Figure 9 These are the actual value and predicted value of the subharmonic voltage content rate of the existing measurement node 33 in the third embodiment.

[0051] Figure 10 These are the actual value and predicted value of the subharmonic voltage content rate of the unmeasured node 28 in the third embodiment.

[0052] Figure 11 These are the actual value and predicted value of the total harmonic voltage distortion rate of each node in Example 3 at a certain predicted time section.

[0053] Figure 12 This is a structural block diagram of a distribution network harmonic prediction device based on a cascaded space-time graph network in Example 4. DETAILED DESCRIPTION

[0054] The present invention will be described in more detail below with reference to the accompanying drawings. It should be noted that the following description of the present invention with reference to the accompanying drawings is merely illustrative and non-limiting. Various embodiments may be combined with each other to form other embodiments not shown in the following description.

[0055] Example 1: Example 1 provides a distribution network harmonic prediction method based on a cascaded space-time graph network, which aims to utilize the harmonic voltage content rate of limited nodes in the distribution network and the historical data of injected power of all nodes, and realize high-precision prediction of the 2nd to 25th harmonic voltage content rate (HRU) of all nodes in the distribution network and automatic calculation of the total harmonic distortion rate (THD) through a cascaded space-time graph network composed of a single-point time series prediction module, a spatial estimation module and an indicator fusion calculation module.

[0056] like Figure 1 As shown, a distribution network harmonic prediction method based on a cascaded space-time graph network includes the following steps:

[0057] Step 1: Collect the historical time series data of the injected active power, reactive power, and 2-25 harmonic voltage content of the deployed measurement nodes in the distribution network, input them into the single-point time series prediction module, and obtain the predicted value of the 2-25 harmonic voltage content corresponding to each measurement node. Among them, the single-point time series prediction module is implemented based on the Transformer architecture as follows Figure 2As shown, the specific architecture and operation include the following steps:

[0058] Step 1.1: Define the historical event window length as Minutes, time resolution is 1 minute. Collect historical time series data of distribution network measurement nodes, including 2-25 harmonic voltage content rate , inject active power and reactive power , which constitutes the feature dimension The eigenvector of :

[0059]

[0060] Will continue Character vector of minutes Divide into multiple local time blocks according to the time dimension to form a block sequence :

[0061]

[0062] in, The length of a single block (16 minutes by default), Indicates the The feature vector of each block; is the sliding step between adjacent blocks (the default is 8 minutes); is the total number of blocks, .

[0063] Step 1.2: Eigenvector Each feature channel Perform linear projection independently to generate channel-specific block embedding representations :

[0064]

[0065] in, is the input block sequence The cth feature channel blocks; is the learnable projection matrix of the cth channel, by default The value is 64; is the bias vector for the cth channel in the encoder.

[0066] Concatenate the embedding vectors of all channels and superimpose the learnable positional encoding to form the initial embedding representation :

[0067]

[0068] in, is the block-level position encoding matrix. This step assigns absolute temporal position information to each block through position encoding while maintaining the independence of different harmonic features.

[0069] Step 1.3: Represent the generated embedding Input by The encoder consists of a stack of channel-independent multi-head self-attention sub-layers. Each layer splits the input into Independent sub-tensors:

[0070]

[0071] in, For the The feature channel is The block embedding sequence corresponding to the layer; Represents a tensor slicing operation, which means that the shape is The three-dimensional tensor of Slice along the channel dimension to obtain all blocks and embedding dimension data corresponding to the cth channel;

[0072] For each feature channel, a learnable parameter matrix 、 、 , generate the corresponding query vector , key vector , value vector Vector, calculate the multi-head attention weight , and perform weighted aggregation on the output of each attention head, and generate multi-head attention features after splicing and linear transformation , update the embedded representation through residual connection Concat and layer normalization LayerNorm :

[0073]

[0074]

[0075]

[0076]

[0077]

[0078] in, is the number of attention heads; is the channel-specific output projection matrix;

[0079] Reconstruct the updated embeddings of each channel into a complete tensor as the input of the next layer :

[0080]

[0081] Follow the above method in turn Layer attention sublayer to obtain the final output of the encoder .

[0082] Step 1.4: Output the encoder Input decoder prediction head, generate future HRU prediction value of each harmonic in minutes :

[0083]

[0084] in, For channel The projection matrix, Predicting the header channel for the decoder The bias vector of .

[0085] Step 2: Based on the predicted values ​​of the harmonic voltage content rate of the deployed measurement nodes obtained in step 1, combined with the distribution network topology information and the predicted values ​​of the active power and reactive power injected by all nodes, a mapping relationship between the harmonic voltage of the existing measurement nodes and the harmonic voltage of the unmeasured nodes is established through the spatial estimation module, thereby obtaining the predicted values ​​of the harmonic voltage content rate of the unmeasured nodes. Among them, the spatial estimation module is implemented based on the graph neural network architecture. Figure 3 As shown, the specific architecture and operation process include the following steps:

[0086] Step 2.1: Construct an undirected weighted graph based on the electrical connection relationship and node admittance matrix of the distribution network , where the node set Contains all measured nodes and unmeasured nodes in the distribution network topology; edge set Represents pairs of nodes that are directly electrically connected; adjacency matrix The edge weight It is obtained by normalizing the inverse of the inter-node harmonic impedance amplitude and the calculation formula is:

[0087]

[0088] in, For nodes and between Impedance value under subharmonics.

[0089] The construction of the undirected weighted graph supports dynamic topology updating. When the distribution network topology changes, the harmonic propagation path information of the input network is adaptively adjusted by updating the adjacency matrix and edge weights of the spatial estimation module in real time.

[0090] Step 2.2: The measurement node output by the single-point timing prediction module will be Predicted value of each harmonic voltage content rate in minutes The predicted values ​​of active power and reactive power injected by all nodes are used as initial node features ,in is the number of measurement nodes, is the predicted harmonic order, Indicates the minute:

[0091]

[0092] in, Respectively represent The predicted values ​​of each harmonic voltage content rate, injected active power and reactive power per minute;

[0093] Step 2.3: Adoption The hop-graph attention mechanism transmits neighbor node messages. Repeat the following steps:

[0094] For Node Neighbor nodes Perform aggregation and calculate weighted messages :

[0095]

[0096] in, is the learnable message transformation matrix, represents the node characteristics of the k-1th hop neighbor node j; is the dynamic attention weight, and the calculation formula is:

[0097]

[0098] in, is a learnable parameter vector, LeakyReLU represents a linear rectification function;

[0099] After message aggregation is completed, the node status is updated by integrating the previous hop status of the node with the aggregated message:

[0100]

[0101] in, is a learnable matrix.

[0102] Step 2.4: Perform channel-sensitive weighting on the K-hop output to complete adaptive fusion and generate the predicted value of each harmonic voltage content rate of the final unmeasured node :

[0103]

[0104] in, For the Subharmonic The weight coefficient of the jump; is the harmonic output matrix.

[0105] Step 3: According to the predicted values ​​of the harmonic voltage content rate of each node obtained in steps 1 and 2, input them into the indicator fusion calculation module to obtain the predicted value of the total harmonic voltage distortion rate of each node. Among them, the spatial estimation module is implemented based on the artificial neural network ANN architecture. Figure 4 As shown, the specific architecture and operation process include the following steps:

[0106] Step 3.1: The predicted value of each harmonic voltage content rate of the measurement node output by the single-point timing prediction module , and the predicted value of each harmonic voltage content rate of the unmeasured node output by the spatial estimation module , spliced ​​into a full-node harmonic data matrix according to the node dimension For each node-time step combination , extract the following feature vectors Enter the Artificial Neural Network ANN:

[0107]

[0108] in, It represents the hth harmonic content rate of the i-th node in the t-th time step; the whole radical represents the harmonic THD calculated by using the 2-25th harmonic content rate of the i-th node in the t-th time step;

[0109] Step 3.2: Perform adaptive normalization calculation on the above eigenvectors and dynamically adjust the scaling coefficients of each harmonic channel to achieve enhanced perception of each harmonic:

[0110]

[0111] in, is the enhanced feature vector, and is the mean and standard deviation, updated every 5 minutes based on historical data; is the Hadamard product; and are learnable scaling and offset parameters, initialized to 、 ; is a numerical stability constant, h represents the hth harmonic, and represents the learnable scaling and offset parameters of the hth harmonic.

[0112] Step 3.3: Input the enhanced feature vector into a fully connected network containing L layers of residual blocks. The structure of each residual block is as follows:

[0113]

[0114] in, and Respectively The weight matrix and bias vector in the layer residual block, GELU is the activation function, Dropout represents random inactivation, and LayerNorm represents layer normalization; the initial input of the fully connected network is ,satisfy: ;in, is a linear transformation, and the enhanced eigenvector Mapped to the hidden space of the network to make it fit the input dimension of the residual block, Indicates the The output of the layer residual block;

[0115] After passing through the L-layer residual block, the network finally outputs the predicted value of the total harmonic voltage distortion rate of each node as follows:

[0116]

[0117] in, and are the learnable weight matrix and bias term of the output layer respectively, and Sigmoid represents the nonlinear activation function.

[0118] In summary, the method of this embodiment can obtain the future predicted values ​​of the harmonic voltage content rate and total distortion rate of all nodes, including unmeasured nodes, through the cascaded spatiotemporal graph network in a data-driven manner, without the need for network-wide monitoring, through the historical harmonic time series data of a limited number of measured nodes, combined with the predicted value of the injected power of all nodes, and can provide real-time decision support for harmonic management.

[0119] Example 2: Example 2 is based on Example 1 and aims to train the cascaded spatiotemporal graph network using a phased training strategy to improve the model convergence efficiency and enhance the prediction accuracy and stability.

[0120] The existing end-to-end joint training approach leads to conflicts between the gradient directions of spatiotemporal features and the index fusion parameters, making the model prone to falling into local optimal solutions. Furthermore, the joint update of multi-module parameters can lead to overfitting due to excessive parameter coupling, which in turn affects the model's generalization ability under complex power grid conditions. Therefore, a phased, progressive optimization strategy is necessary.

[0121] Please refer to Figure 5 As shown in Figure 2, the cascaded spatiotemporal graph network is trained in stages, which specifically includes the following steps:

[0122] Step 1.1: Based on the training dataset, a sliding time window is used to intercept the historical time series data of each node, and the single-point time series prediction module is independently pre-trained. In this stage, a phase-sensitive loss function is designed to combine the dynamic time warping (DTW) term with the harmonic voltage amplitude error to constrain the phase alignment accuracy of the harmonic waveform. Loss function The complete expression is:

[0123]

[0124] in, Respectively represent Node No. The actual value and predicted value of subharmonic voltage, N represents the total number of nodes, and the dynamic time warping (DTW) calculation is defined as:

[0125]

[0126] in, For sequence The set of all alignment paths, is the a-th data point in sequence A, is the b-th data point in sequence B; is a hyperparameter (the default value is 0.7). When the time series prediction error of the validation set decreases by less than 0.5% for five consecutive training cycles, the time series module is considered to have converged and its network parameters are frozen.

[0127] Step 1.2: Connect the spatial estimation module to the network and jointly optimize the spatial topological features and harmonic voltage prediction values. The graph attention mechanism is used to model the harmonic coupling between nodes, and the loss function Defined as:

[0128]

[0129] Where E represents the edge set of the network topology; is the predicted value of the hth harmonic voltage content rate at node i; is the predicted value of the hth harmonic voltage content rate at node j; is the predicted value of harmonic current of line ij. If some lines have no relevant predicted value, it is taken as 0; is the hth impedance of line ij, is a hyperparameter used to balance the weights of the impedance relationship term and the topology constraint term. KLD represents the KL divergence. for The dynamic graph attention weight distribution calculated by the skip-graph attention mechanism learning, is the prior knowledge distribution of network topology, satisfying:

[0130]

[0131] in, represents the topological prior knowledge of line ij, is the line weight of line ij, The weight of the edge kl in the network topology, is the line impedance of line ij; the first term in the above loss function forces the inter-node harmonic voltage-current impedance relationship to be satisfied; the second term KL divergence constrains the graph attention weight distribution and topological prior knowledge consistency; when the spatial estimation error changes are stable at Complete parameter solidification during the interval;

[0132] Step 1.3: Freeze the time-space module parameters and construct the fusion loss function for:

[0133]

[0134] in, and is the weight hyperparameter; and are the predicted value and true value of the total harmonic voltage distortion THD of node i respectively; is the total number of nodes; For Haddam; is the predicted value of the 2nd to 25th harmonic voltage content rate at node i; is the weight vector of each node; the first term in the above function is the main loss term of the mean square error; the second term is the harmonic order weighted correction term. When the error of the validation set decreases by less than 0.5% for five consecutive training cycles, the module is judged to have converged and its network parameters are frozen.

[0135] Example 3: Example 3 is an experimental simulation performed according to the methods described in Example 1 and Example 2.

[0136] In this embodiment, in order to fully demonstrate the actual effect of the distribution network harmonic prediction method based on the cascaded space-time graph network, the IEEE 33-node distribution network standard calculation example is used as a basis.

[0137] In this embodiment, the IEEE 33-node distribution network topology includes 33 nodes, 32 lines and 5 tie switches, the system voltage level is 12.66kV, and the system base capacity is 1MVA. Figure 6 In the distribution network model shown, all five tie switches are disconnected. Node 1 is selected as the balancing node, and the remaining 32 nodes are PQ nodes. Nodes 18, 22, 25, 33, 12, 15, 21, 24, 28, and 31 are new energy photovoltaic injection nodes; nodes 4, 7, 8, 9, 13, 19, 23, 27, 29, and 32 are nonlinear load access nodes; nodes 2, 3, 5, 6, 10, 11, 14, 16, 17, 20, 26, and 30 are linear load access nodes; and nodes 2, 6, 9, 12, 13, 15, 18, 20, 22, 23, 25, 29, 31, and 33 are harmonic measurement nodes. The new energy photovoltaic injection node is equivalent to a large photovoltaic power station. Harmonic domain modeling is used, and two 500kW photovoltaic inverters and a double-split transformer are modeled as a single power generation unit. Multiple groups of power generation units are connected in parallel to achieve equivalent modeling of a large photovoltaic power station, as shown in the following example. Figure 7 The nonlinear load access node simulates the typical harmonic source in the industrial load and is modeled as an independent harmonic current source using the Norton equivalent method, as shown in Figure 8 As shown in the figure, linear load access nodes simulate typical non-harmonic sources such as residential or commercial loads and are modeled using equivalent impedance. Harmonic measurement nodes simulate nodes in actual power grids equipped with measurement equipment such as PMUs. These nodes can obtain accurate and real-time measurements of the 2nd-25th harmonic voltage content. The distribution of harmonic measurement nodes meets the connectivity constraints of the distribution network topology. In addition, power data for all nodes is fully accessible by default through metering and dispatching systems.

[0138] Based on real-world sunlight and temperature curves, as well as linear and nonlinear load operating curves for a region in southern China, the model generates a massive amount of historical data, including information about the injected power at all nodes and the 2nd-25th harmonic voltage content at measurement nodes. The predicted injected power at all nodes is obtained using a traditional LSTM neural network. This historical data, combined with model topology information and line parameters, is input into a cascaded spatiotemporal graph network to calculate the predicted 2nd-25th harmonic voltage content at all nodes and the total harmonic voltage distortion rate at each node. Figure 9 The actual and predicted values ​​of the subharmonic voltage content rate of the existing measurement nodes 33; Figure 10 are the actual and predicted values ​​of the subharmonic voltage content rate of the unmeasured node 28; Figure 11The actual value and predicted value of the total harmonic voltage distortion rate of each node at a certain prediction time section. It can be seen that the method described in the present invention can accurately obtain the predicted values ​​of the harmonic voltage content rate and the total harmonic voltage distortion rate of all nodes.

[0139] Example 4: Figure 12 A schematic diagram of the structure of a distribution network harmonic prediction device based on a cascaded space-time graph network provided in the fourth embodiment of the present invention is shown in FIG. Figure 12 As shown, the device includes a processor 310, a memory 320, an input device 330, and an output device 340; the number of processors 310 in the computer device can be one or more. Figure 12 In the figure, a processor 310 is used as an example; the processor 310, memory 320, input device 330 and output device 340 in the electronic device can be connected via a bus or other means. Figure 12 The bus connection is taken as an example.

[0140] Memory 320, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and modules, such as the program instructions / modules corresponding to the method for predicting harmonics in a distribution network based on a cascaded space-time graph network in the embodiments of the present invention. Processor 310 executes the software programs, instructions, and modules stored in memory 320 to perform various functional applications and data processing of the device, thereby implementing the method for predicting harmonics in a distribution network based on a cascaded space-time graph network in the first through third embodiments described above.

[0141] The memory 320 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and applications required for at least one function; the data storage area may store data created based on the use of the terminal, etc. In addition, the memory 320 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 320 may further include a memory remotely located relative to the processor 310, and these remote memories may be connected to the power distribution network harmonic prediction device based on the cascaded spatiotemporal graph network via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0142] The input device 330 may be used to receive input user identity information, system status parameter historical data, etc. The output device 340 may include a display device such as a display screen.

[0143] Embodiment 5: Embodiment 5 of the present invention further provides a storage medium containing computer-executable instructions, which can be used by a computer to execute a distribution network harmonic prediction method based on a cascaded spatiotemporal graph network, the method comprising:

[0144] Obtain historical time series data such as active power, reactive power, and 2nd-25th harmonic voltage content of the measurement node, input it into the single-point time series prediction module, and obtain the predicted values ​​of active power, reactive power, and 2nd-25th harmonic voltage content of the measurement node;

[0145] The obtained prediction values ​​are combined with the distribution network topology connection relationship, line parameters, and power prediction data of unmeasured nodes, and input into the spatial estimation module to obtain the predicted values ​​of the 2nd to 25th harmonic voltage content rate of the unmeasured nodes;

[0146] The predicted value of the 2nd to 25th harmonic voltage content rate of all nodes is input into the indicator fusion module to obtain the predicted value of the total harmonic voltage distortion rate of all nodes.

[0147] Of course, the storage medium containing computer-executable instructions provided in an embodiment of the present invention is not limited to the method operations described above, and can also execute related operations in the distribution network harmonic prediction method based on the cascaded space-time graph network provided in any embodiment of the present invention.

[0148] Those skilled in the art can make various other corresponding changes and deformations based on the technical solutions and concepts described above, and all of these changes and deformations should fall within the scope of protection of the claims of the present invention.

Claims

1. A method for predicting harmonics in distribution networks based on a cascaded spatiotemporal graph network, characterized in that: The method comprises the following steps: Step 1: Collect historical time series data of injected active power, reactive power, and 2nd-25th harmonic voltage content from deployed measurement nodes in the distribution network, perform single-point time series forecasting, and obtain the predicted value of the 2nd-25th harmonic voltage content corresponding to each measurement node; Step 2: Based on the predicted values ​​of the harmonic voltage content of the deployed measurement nodes obtained in Step 1, combined with the distribution network topology information and the predicted values ​​of the active power and reactive power injected by all nodes, a mapping relationship between the harmonic voltages of the existing measurement nodes and the harmonic voltages of the unmeasured nodes is established through spatial estimation, thereby obtaining the predicted values ​​of the harmonic voltage content of the unmeasured nodes. Spatial estimation is implemented based on a graph neural network architecture. It jointly optimizes spatial topological features and harmonic voltage prediction values ​​based on spatial estimation. It also models inter-node harmonic coupling through a graph attention mechanism. The specific architecture and operation process include the following steps: Step 2.1: Construct an undirected weighted graph based on the electrical connection relationship and node admittance matrix of the distribution network , where the node set Contains all measured nodes and unmeasured nodes in the distribution network topology; edge set Represents pairs of nodes that are directly electrically connected; adjacency matrix The edge weight Obtained by normalizing the inverse of the inter-node harmonic impedance amplitude; Step 2.2: The measurement node output of the single-point timing prediction will be The minute-by-minute predicted values ​​of each harmonic voltage content and the predicted values ​​of active power and reactive power injected into all nodes are used as initial node features; Step 2.3: Adoption The graph-hopping attention mechanism transmits messages to neighbor nodes, completes message aggregation, fuses the previous hop state of the current node with the aggregated message, updates the node state, performs channel-sensitive weighting on the K-hop output, completes adaptive fusion, and generates the final predicted value of the harmonic voltage content rate of the unmeasured node; Step 3: Based on the predicted values ​​of the harmonic voltage content rate of all nodes obtained in Steps 1 and 2, perform indicator fusion calculation to obtain the predicted value of the total harmonic voltage distortion rate of each node.

2. A method for predicting harmonics in a distribution network based on a cascaded space-time graph network according to claim 1, characterized in that: The single-point time series prediction in step 1 is implemented based on the Transformer architecture. The historical time series data of the distribution network measurement nodes are collected to form a feature vector, which is divided into multiple local time blocks according to the time dimension to form a block sequence. Each feature channel of the feature vector is independently linearly projected to generate a channel-specific block embedding representation. After splicing, the learnable position encoding is superimposed to form an initial embedding representation. The encoder composed of independent channel-independent multi-head self-attention layers is input. The multi-head attention weight is calculated at each layer, and the output of each attention head is weighted and aggregated. After splicing, the multi-head attention feature is generated by linear transformation. After splicing into a complete vector, it is used as the input of the next layer until the final output of the encoder is obtained. Based on the decoder prediction head, the future is generated through the channel-independent linear projection layer. The HRU predicted value of each harmonic in minutes.

3. The method for predicting harmonics in a distribution network based on a cascaded space-time graph network according to claim 1, characterized in that: The indicator fusion calculation in step 3 is implemented based on the artificial neural network ANN architecture. The specific architecture and calculation process include the following steps: Step 3.1: The predicted values ​​of the harmonic voltage content rate of each measurement node obtained by single-point time series prediction , and the predicted values ​​of harmonic voltage content rate of unmeasured nodes obtained by spatial estimation , spliced ​​into a full-node harmonic data matrix according to the node dimension ; For each node-time step combination , extract the feature vector and input it into the artificial neural network ANN: Step 3.2: For each node-time step combination Extract feature vectors Perform adaptive normalization calculations and dynamically adjust the scaling factor of each harmonic channel to achieve enhanced perception of each harmonic: ; in, is the enhanced feature vector, and is the mean and standard deviation, updated every 5 minutes based on historical data; is the Hadamard product; and are learnable scaling and offset parameters, initialized to 、 ; is a numerical stability constant, h represents the hth harmonic, and represents the learnable scaling and offset parameters of the hth harmonic; Step 3.3: Input the enhanced feature vector into a fully connected network containing L layers of residual blocks. The structure of each residual block is as follows: ; in, and Respectively The weight matrix and bias vector in the layer residual block, GELU is the activation function, Dropout represents random inactivation, and LayerNorm represents layer normalization; the initial input of the fully connected network is ,satisfy: ;in, is a linear transformation, and the enhanced eigenvector Mapped to the hidden space of the network to make it fit the input dimension of the residual block, Indicates the The output of the layer residual block; After passing through the L-layer residual block, the network finally outputs the predicted value of the total harmonic voltage distortion rate of each node.

4. The method for predicting harmonics in a distribution network based on a cascaded space-time graph network according to claim 1, characterized in that: The construction of the undirected weighted graph supports dynamic topology updating. When the distribution network topology changes, the harmonic propagation path information of the input network is adaptively adjusted by updating the spatially estimated adjacency matrix and edge weights in real time.

5. The method for predicting harmonics in a distribution network based on a cascaded space-time graph network according to claim 1, characterized in that: The cascaded spatiotemporal graph network consists of three parts: a single-point time series prediction module, a spatial estimation module, and an indicator fusion calculation module. The training method adopts a phased training strategy, which specifically includes the following steps: Step A: Based on the training data set, a sliding time window is used to intercept the historical time series data of each node, and the single-point time series prediction part is independently pre-trained; at this stage, a phase-sensitive loss function is designed to combine the dynamic time warping DTW term with the harmonic voltage amplitude error to constrain the phase alignment accuracy of the harmonic waveform; the loss function The complete expression is: ; in, Respectively represent Node No. The actual value and predicted value of subharmonic voltage, N represents the total number of nodes, is a hyperparameter, represents dynamic time warping calculation; Step B: Jointly optimize spatial topology features and harmonic voltage prediction values ​​based on spatial estimation; model inter-node harmonic coupling through graph attention mechanism, loss function Defined as: ; Where E represents the edge set of the network topology; is the predicted value of the hth harmonic voltage content rate at node i; is the predicted value of the hth harmonic voltage content rate at node j; is the predicted value of harmonic current of line ij. If some lines have no relevant predicted value, it is taken as 0; is the hth impedance of line ij, is a hyperparameter used to balance the weights of the impedance relationship term and the topology constraint term. KLD represents the KL divergence. for The dynamic graph attention weight distribution calculated by the skip-graph attention mechanism learning, is the prior knowledge distribution of network topology, satisfying: ; in, represents the topological prior knowledge of line ij, is the line weight of line ij, The weight of the edge kl in the network topology, is the line impedance of line ij; the first term in the above loss function forces the inter-node harmonic voltage-current impedance relationship to be satisfied; the second term KL divergence constrains the graph attention weight distribution and topological prior knowledge consistency; when the spatial estimation error changes are stable at Complete parameter solidification during the interval; Step C: Freeze the time-space module parameters and construct the fusion loss function for: ; in, and is the weight hyperparameter; and are the predicted value and true value of the total harmonic voltage distortion THD of node i respectively; is the total number of nodes; For Haddam; is the predicted value of the 2nd to 25th harmonic voltage content rate at node i; is the weight vector of each node; the first term in the above function is the main loss term of the mean square error; the second term is the harmonic order weighted correction term; when the error of the validation set decreases by less than 0.5% for 5 consecutive training cycles, it is determined to have converged and its network parameters are frozen.

6. A method for predicting harmonics in a distribution network based on a cascaded space-time graph network according to claim 1, characterized in that: The measurement node distribution satisfies the connectivity constraints of the distribution network topology.

7. A distribution network harmonic prediction device based on a cascaded space-time graph network, comprising a processor, a storage medium, and a computer program, wherein the computer program is stored in the storage medium, and is characterized in that: When the computer program is executed by a processor, the method for predicting harmonics in a distribution network based on a cascaded space-time graph network according to any one of claims 1 to 6 is implemented.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for predicting harmonics in a distribution network based on a cascaded space-time graph network according to any one of claims 1 to 6 is implemented.

9. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method for predicting harmonics in a distribution network based on a cascaded space-time graph network according to any one of claims 1 to 6 is implemented.