A method and apparatus for locating a source of a power grid voltage sag

By employing a multi-head attention mechanism and a graph attention network with an improved loss function, combined with contrastive learning training, the problem of insufficient monitoring points and scarce labels in the location of voltage sag sources in the power grid was solved, achieving accurate location of voltage sag sources and efficient operation of hardware devices.

CN121208505BActive Publication Date: 2026-04-17SICHUAN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SICHUAN UNIV
Filing Date
2025-09-26
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

Existing methods for locating voltage sag sources in power grids suffer from a shortage of monitoring points and labeling, leading to inaccurate location and impacting the stable operation of the power grid and the division of responsibilities.

Method used

A graph attention network employing a multi-head attention mechanism and an improved loss function, combined with contrastive learning training, achieves accurate localization of voltage sag sources using a small amount of labeled data.

Benefits of technology

It improves the accuracy and robustness of grid voltage sag source location, reduces the need for large amounts of labeled data, and enhances the operating speed and efficiency of hardware devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121208505B_ABST
    Figure CN121208505B_ABST
Patent Text Reader

Abstract

This application discloses a method and apparatus for locating grid voltage sag sources, relating to the field of grid voltage sag source location. The method includes: acquiring voltage and current waveform data of monitoring points during grid voltage sags; inputting the voltage and current waveform data of the monitoring points during grid voltage sags into a trained graph attention network to obtain the location of the grid voltage sag source; the graph attention network includes an input layer, cascaded graph attention layers, a pooling layer, and an output layer; the graph attention layers introduce a multi-head attention mechanism and a voltage sag amplitude; the voltage sag amplitude is determined by the voltage and current waveform data; the graph attention network is trained using an improved loss function and contrastive learning; the improved loss function incorporates grid voltage sag source discrimination based on instantaneous disturbance power and disturbance energy. This application improves the accuracy of grid voltage sag source location.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of locating voltage sag sources in power grids, and in particular to a method and apparatus for locating voltage sag sources in power grids. Background Technology

[0002] According to the Institute of Electrical and Electronics Engineers (IEEE), a voltage sag is a phenomenon in which the effective value of the supply voltage drops rapidly from 90% to 10% of the rated value within a very short period of time (10ms-1min), and then recovers to near normal levels.

[0003] With the rapid development of the semiconductor and chip industries and the continuous improvement of automation levels in recent years, more and more loads sensitive to voltage sags are being connected to the power grid, making the problems they cause increasingly apparent. For example, in the currently booming chip manufacturing industry, when the voltage drops below 85% of the rated value, the electronic circuits of testing and processing equipment will malfunction, leading to equipment shutdown. In the automotive manufacturing and precision machining industries, voltage sags may damage critical components or processing equipment, affecting welding quality and even requiring reflow or restarting of the welding process. The safety issues caused by voltage sags cannot be ignored either. In public transportation sectors such as subways and airports, voltage sags may cause escalators to suddenly stop and baggage sorting systems to become chaotic.

[0004] Therefore, when a voltage sag occurs, accurate and reliable location of the voltage sag source can help grid maintenance personnel quickly find the location of the sag source, shorten the time for clearing the sag source, and control its impact to the lowest possible level. Accurate location of the voltage sag source can also fundamentally prevent the recurrence of such events. At the same time, the location results can also serve as an important basis for power plants, grids and users to divide responsibilities afterward.

[0005] Voltage sag source location refers to determining the location of the voltage fault or non-fault event that causes the voltage sag based on existing data.

[0006] Current methods for locating voltage sag sources suffer from a limited number of monitoring points and scarce labels. How to achieve accurate location using a small number of monitoring points and a small sample of labels based on deep learning is of great significance for the stable operation of the power grid and the subsequent division of responsibilities. Summary of the Invention

[0007] The purpose of this application is to provide a method and apparatus for locating voltage sag sources in a power grid. It employs a multi-head attention mechanism and an improved loss function to address the relatively small number of monitoring points in the power grid, and uses contrastive learning to train a graph attention network to reduce the need for large amounts of labeled data. Furthermore, its application in hardware devices can improve the operating speed and efficiency of the hardware.

[0008] To achieve the above objectives, this application provides the following solution:

[0009] In a first aspect, this application provides a method for locating grid voltage sag sources, including:

[0010] Acquire voltage and current waveform data at monitoring points during grid voltage dips;

[0011] Voltage and current waveform data from monitoring points during grid voltage sags are input into a trained graph attention network to obtain the location of the grid voltage sag source. The graph attention network includes an input layer, cascaded graph attention layers, a pooling layer, and an output layer. The graph attention layers incorporate a multi-head attention mechanism and a voltage sag amplitude. The voltage sag amplitude is determined by the voltage and current waveform data. The graph attention network is trained using an improved loss function and contrastive learning. The improved loss function incorporates grid voltage sag source discrimination based on instantaneous disturbance power and disturbance energy.

[0012] Secondly, this application provides a grid voltage sag source locating device, comprising:

[0013] The data acquisition module is used to acquire voltage and current waveform data at monitoring points when the grid voltage dips.

[0014] A voltage sag source location acquisition module is used to input voltage and current waveform data of monitoring points during grid voltage sags into a trained graph attention network to obtain the location of the grid voltage sag source. The graph attention network includes an input layer, cascaded graph attention layers, pooling layers, and an output layer. The graph attention layers introduce a multi-head attention mechanism and a voltage sag amplitude. The voltage sag amplitude is determined by the voltage and current waveform data. The graph attention network is trained using an improved loss function and contrastive learning. The improved loss function incorporates grid voltage sag source discrimination based on instantaneous disturbance power and disturbance energy.

[0015] According to the specific embodiments provided in this application, this application has the following technical effects:

[0016] This application provides a method and apparatus for locating voltage sag sources in power grids. By incorporating a multi-head attention mechanism and voltage sag amplitude into the graph attention layer, the method enhances the graph attention network's ability to capture complex dependencies between nodes, better adapting to voltage sag application scenarios. By adding physical constraints for power grid voltage sag source discrimination to the improved loss function, the interpretability and reliability of the graph attention network are enhanced. A large amount of unlabeled waveform data is collected through comparative learning for training the graph attention network, improving its robustness and reducing the need for large amounts of labeled data. In summary, the graph attention network improves the accuracy of power grid voltage sag source location. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 A flowchart illustrating a method for locating a power grid voltage sag source according to an embodiment of this application;

[0019] Figure 2 The diagram below shows the structure of the attention network in a method for locating grid voltage sag sources provided in an embodiment of this application.

[0020] Figure 3 A schematic diagram of the attention network training process is shown in the figure below, which is a method for locating grid voltage sag sources provided in an embodiment of this application.

[0021] Figure 4 This application provides a steady-state power flow pattern during steady-state operation of the power grid voltage, as an embodiment of the present application.

[0022] Figure 5 This application provides a power flow pattern for disturbances during a grid voltage sag, as shown in one embodiment.

[0023] Figure 6 A functional module schematic diagram of a power grid voltage sag source locating device provided in an embodiment of this application;

[0024] Figure 7 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0025] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0026] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0027] In one exemplary embodiment, such as Figure 1 As shown, a method for locating grid voltage sag sources is provided. This method is executed by a computer device, specifically by a terminal or server alone, or by both a terminal and a server. In this embodiment, the method includes steps 101 to 102. Wherein:

[0028] Step 101: Obtain voltage and current waveform data at the monitoring point when the grid voltage drops.

[0029] Step 102: Input the voltage and current waveform data of the monitoring point during the grid voltage sag into the trained graph attention network to obtain the location of the grid voltage sag source; the graph attention network includes an input layer, cascaded graph attention layers, pooling layers, and an output layer; the graph attention layers introduce a multi-head attention mechanism and voltage sag amplitude; the voltage sag amplitude is determined by the voltage and current waveform data; the graph attention network is trained using an improved loss function and contrastive learning; the improved loss function introduces grid voltage sag source discrimination based on instantaneous disturbance power and disturbance energy.

[0030] Implementing steps 101 to 102 above improves the accuracy of locating voltage sag sources in the power grid. Graph Attention Network (GAT) is a deep learning model based on graph-structured data. Its core principle is to update the state of each node based on the calculated attention weights between each node and its neighboring nodes, while simultaneously differentiating the hierarchical relationships between nodes. In this way, the GAT network can capture key nodes and combine their features to output results.

[0031] Graph attention networks can perform node-level and graph-level tasks. Graph-level tasks include graph generation and graph classification. This application uses the graph classification function of graph attention networks, and the final output is a location label, which is a classification task with multiple labels.

[0032] The voltage sag propagation characteristic of this application is that the closer a node is to the sag source, the smaller the sag amplitude. By incorporating the sag propagation characteristic and a multi-head attention mechanism into the graph attention network, nodes with small sag amplitudes receive more attention, enabling the rapid identification of the monitoring node closest to the sag source and its effective association with the location label.

[0033] In another exemplary embodiment of this application, such as Figure 2 As shown, step 102 specifically includes the following steps 301 to 305.

[0034] Step 301: Determine the node feature vector matrix based on the voltage and current waveform data of the monitoring points when the grid voltage drops, and determine the adjacency matrix based on the grid topology; where one monitoring point is one node.

[0035] Step 302: Input the node feature vector matrix and the adjacency matrix into the input layer to obtain the first node feature vector matrix.

[0036] Step 303: Input the first node feature vector matrix into the cascaded graph attention layer to obtain the node embedding matrix.

[0037] Step 304: Input the node embedding matrix into the pooling layer to obtain the graph embedding vector.

[0038] Step 305: Input the graph embedding vector into the output layer to obtain the prediction probability vector, and determine the location of the grid voltage sag source based on the prediction probability vector.

[0039] The output of the graph attention layer is 3D node embedding matrix Global aggregation of the node embedding matrix generates a global representation of the graph, resulting in... dimensional graph embedding vector Common aggregation methods include max pooling and average pooling. Max pooling maximizes the feature value across all nodes in each dimension, while average pooling averages the feature value across all nodes in each dimension. (This involves embedding the graph into a vector.) The input is fed into the classifier, which is a fully connected layer that performs a linear transformation, mapping it to the dimension of the number of classes, to obtain the predicted probability vector. .

[0040] In another exemplary embodiment of this application, the cascaded graph attention layer includes m graph attention layers; Step 303 specifically includes:

[0041] For the z-th iteration, the output feature matrix of the (z-1)-th graph attention layer is input into the z-th graph attention layer to obtain the output feature matrix of the z-th graph attention layer; The output feature matrix of the 0th graph attention layer is the feature vector matrix of the first node.

[0042] Determine if z is greater than or equal to m; if yes, use the output feature matrix of the z-th graph attention layer as the node embedding matrix; otherwise, proceed to the next iteration.

[0043] The input to the z-th graph attention layer can be represented as:

[0044] .

[0045] in, Let z be the output feature matrix of the (z-1)th graph attention layer. This is the (z-1)th output feature vector of the first node. This is the (z-1)th output feature vector of the second node. For the first The output feature vector of the (z-1)th node This is the (z-1)th output feature vector of the i-th node. This indicates that the dimension of each output feature vector is Z. The number of nodes.

[0046] The output of the z-th graph attention layer can be represented as:

[0047] .

[0048] in, Let z be the output feature matrix of the z-th graph attention layer. This is the z-th output feature vector of the first node. This is the z-th output feature vector of the second node. For the first The z-th output feature vector of the n nodes Let z be the output feature vector of the i-th node.

[0049] In another exemplary embodiment of this application, the output feature matrix of the (z-1)th graph attention layer includes the (z-1)th output feature vector of each node.

[0050] The output feature matrix of the (z-1)th graph attention layer is input into the z-th graph attention layer to obtain the output feature matrix of the z-th graph attention layer, specifically including the following steps 401 to 406.

[0051] Step 401: Determine the effective voltage value of each node based on the voltage and current waveform data of the monitoring points when the grid voltage drops.

[0052] Step 402: Determine the voltage sag of each node based on the effective voltage value of each node and the rated effective voltage value of each node.

[0053] Step 403: For any node in the z-th graph attention layer, determine the weight coefficients between the node and its neighboring nodes based on the (z-1)-th output feature vector of the node, the (z-1)-th output feature vector of any neighboring node of the node, and the voltage sag of the neighboring node.

[0054] Step 404: Determine the attention coefficient between the node and its neighboring nodes based on the weight coefficients between the node and its neighboring nodes.

[0055] Step 405: Based on the attention coefficients between the node and its neighboring nodes, a multi-head attention mechanism is used to determine the z-th output feature vector of the node.

[0056] Step 406: Determine the output feature matrix of the z-th graph attention layer based on the z-th output feature vector of each node.

[0057] In another exemplary embodiment of this application, the weight coefficients of the i-th node and the j-th node are determined using the following formula:

[0058] .

[0059] .

[0060] in, Let be the voltage sag at the j-th node. Let J be the effective voltage value of the j-th node. Let J be the effective value of the rated voltage of the j-th node. Let be the weight coefficient between the i-th node and the j-th node. It is a non-linear activation function. For learnable weight vectors, To share the weight matrix, This is the (z-1)th output feature vector of the i-th node. Let be the (z-1)th output feature vector of the j-th node, where i and j are the indices of the nodes. Specifically, j is the index of the neighboring nodes of the i-th node. This formula represents training a shared weight matrix for all nodes. After concatenation, it is then combined with the learnable weight vector. Multiplying them together, we get a real number, which is the weighting coefficient. .

[0061] In addition, this application can also use the following formula to determine the voltage sag of the j-th node: .

[0062] in, This represents the minimum voltage value collected during the voltage sag. To determine the voltage value during normal operation, the three-phase system requires calculating the sag value for each of the three phases separately and selecting the minimum value as the voltage value. .

[0063] The function formula is:

[0064] .

[0065] in, These are the weight coefficients of the activation function. The value is usually 0.01. The output range is , These are the eigenvalues.

[0066] In another exemplary embodiment of this application, the attention coefficients between the i-th node and the j-th node are determined using the following formula. :

[0067] .

[0068] This formula is used to employ The function normalizes the weight coefficients. In calculating the weight and attention coefficients, this application amplifies the attention coefficient of the node with the smallest transient amplitude among the i-th node's neighbors, enabling the graph attention network to find the source of the transient along the transient propagation path.

[0069] In another exemplary embodiment of this application, the multi-head attention mechanism enhances the graph attention network's ability to capture complex dependencies between nodes and improves the richness of feature representation by learning multiple independent attention weights in parallel. Incorporating the propagation characteristics of voltage sags into multi-head attention computation allows the graph attention network to focus on nodes closer to the sag source, improving the robustness of the graph attention network and making it more suitable for training with small sample sizes.

[0070] If multi-head attention is applied to the intermediate hidden layer of a graph attention network, a vector concatenation method can be used, that is, the z-th output feature vector of the i-th node can be determined by the following formula:

[0071] .

[0072] in, Let z be the z-th output feature vector of the i-th node. This represents the concatenation operation of feature vectors. The number of heads in a multi-head attention mechanism. This is an index for the number of heads in a multi-head attention mechanism. Let j be the set of neighboring nodes of the i-th node, and j be the index of the neighboring node of the i-th node. For the first Attention coefficient in head attention mechanism For the first The weight matrix of the linear transformation in the head attention mechanism. For activation function, For the first The (z-1)th output feature vector of the j-th node in the head attention mechanism.

[0073] If multi-head attention is applied to the final graph attention layer, the stitching operation is no longer sensitive and effective; averaging can be used instead.

[0074] .

[0075] In another exemplary embodiment of this application, before step 101, the following steps 501 to 503 are further included:

[0076] Step 501: Connect the graph attention network to the projection transformation layer.

[0077] Step 502: Based on unlabeled historical voltage and current waveform data, comparative learning is used to pre-train the graph attention network and projection transformation layer to obtain pre-trained graph attention network and pre-trained projection transformation layer; the label is the location of the grid voltage sag source.

[0078] Step 503: Based on labeled historical voltage and current waveform data, the pre-trained graph attention network is optimized using an improved loss function to obtain a trained graph attention network.

[0079] In another exemplary embodiment of this application, such as Figure 3As shown, steps 502 and 503 specifically include: obtaining a node feature vector matrix based on unlabeled historical voltage and current waveform data; performing data augmentation on the node feature vector matrix to obtain a positive and negative sample set for contrastive learning; inputting the positive and negative sample set and the adjacency matrix into the graph attention network and the projection transformation layer; using contrastive learning to pre-train the parameters of the graph attention network and the projection transformation layer to obtain a pre-trained graph attention network and a pre-trained projection transformation layer; and at this time, the graph attention layer in the graph attention network introduces a multi-head attention mechanism and a voltage sag value, i.e., an improved attention mechanism. Removing the pre-trained projection transformation layer, and using an improved loss function to optimize the pre-trained graph attention network based on labeled historical voltage and current waveform data to obtain a trained graph attention network.

[0080] The core idea of ​​contrastive learning is to categorize samples into positive and negative samples. Positive samples are those similar to the original samples; in voltage sag source localization, this refers to voltage and current waveforms of sag sources at the same location. Negative samples are those dissimilar to the original samples; in voltage sag source localization, this refers to voltage and current waveforms of sag sources at different locations or during normal operation. Contrastive learning aims to bring similar samples closer together in the representation space and keep dissimilar samples further apart. Contrastive learning pre-training utilizes a large amount of unlabeled data for pre-training, and then transfers the learned knowledge from related tasks to the target task. This method improves the robustness and other performance characteristics of the graph attention network.

[0081] In this application, the input data used for contrastive learning pre-training consists of a large amount of voltage and current waveform data from monitoring points during normal operation and voltage sag. The voltage and current data of a node are placed in the same row, and each node has... One data point, then Each node forms Node eigenvector matrix eigenvector matrix of each node For a single sample.

[0082] .

[0083] in, This is the first voltage data for the first node. For the s-th electrical current data of the first node, This is the first voltage data for the nth node. This is the s-th electrical current data for the nth node.

[0084] After obtaining the node feature vector matrix Subsequently, data augmentation is performed. Since the voltage and current waveform data at the monitoring points during grid voltage sags are time-series signals, data augmentation is not performed using common image processing operations such as translation, flipping, or rotation. To improve the generalization ability of the graph attention network, increase the number of training samples, and correct sampling errors, the following strategies can be used to augment the data:

[0085] Noise injection: Mixing actual acquired data with various types of noise, such as adding Gaussian noise, background noise, etc. to the sample to simulate the acquired data under real conditions.

[0086] Randomly masking nodes: Randomly setting the data of some nodes in the sample to zero improves the generalization performance of graph attention networks.

[0087] Randomly occluded data: in the node feature vector matrix Different strategies are used to randomly delete data, such as deleting a region or a few columns of data.

[0088] Data augmentation is performed on all samples. Two augmented samples of the same sample are used as a pair of positive samples, and the other samples are used as negative samples, resulting in a sample set that is twice the original size.

[0089] The input to a graph attention network includes a matrix of node feature vectors. and adjacency matrix Adjacency matrix It is An order matrix, in a graph structure, reflects the connection relationships between internal nodes. and Both represent the node's sequence number.

[0090] .

[0091] node feature vector matrix and adjacency matrix The input is fed into a graph attention network, and the node embedding matrix is ​​calculated. . It is The matrix, This is the dimension of the output of the last layer of the graph attention network. Next, global average pooling is performed on the node embedding matrix to obtain a... Graph embedding vectors Each sample yielded a graph embedding vector. .

[0092] Embedding graphs into vectors Through the output layer, and then through the projection transformation layer, a result is obtained. vector The projection transformation layer is a nonlinear transformation performed by a multilayer perceptron (MLP). Contrastive learning is a method for learning feature representations of high-dimensional data through a self-supervised task. The implementation strategy is based on measuring the distance between feature vectors; this application adopts... As a loss function for contrastive learning.

[0093] It is a loss function in self-supervised learning that learns data representation by distinguishing between positive and negative samples, thereby maximizing the mutual information of positive sample pairs and avoiding explicit normalization of all negative samples. The formula is shown below:

[0094] .

[0095] in, For a mapping function, Indicates a positive sample. For input data, This indicates a negative sample. The meaning is: if there is a set of quantities... samples The goal is to learn a , making Compared with positive samples The similarity should be as high as possible to the negative samples. The similarity should be as low as possible. Therefore, in the formula, let To each and Inner product, and make right The inner product should be as large as possible for The inner product should be as small as possible.

[0096] In another exemplary embodiment of this application, the loss function is a function used in machine learning / deep learning to measure the difference between the prediction result of the graph attention network and the true label. Its functions are: first, to quantify the "error level" of the model, the smaller the loss value, the closer the graph attention network prediction is to the real situation; second, to guide parameter optimization, through the backpropagation algorithm, to make the graph attention network adjust its parameters in the direction of reducing the loss function value, so as to make the prediction more accurate.

[0097] In graph attention networks, different loss functions can be used. For example, cross-entropy loss is often used in tasks such as node classification, graph classification, and link prediction, while mean squared error is usually used in regression tasks.

[0098] However, traditional loss functions are mostly data-driven, optimizing graph attention networks by measuring the difference between model predictions and real data. Therefore, the performance of graph attention networks depends entirely on the quantity and quality of the data. By adding physical constraints, we can force the predictions of graph attention networks to conform to known physical laws by introducing penalty terms related to physical laws. This avoids the output of graph attention networks violating basic physical laws, making the training results more reliable. Furthermore, reliable graph attention networks can be trained with less data, reducing data acquisition costs.

[0099] This application uses the results obtained from upstream and downstream discrimination of voltage sag sources as physical constraints, and combines them with a data-driven loss function to form an improved loss function driven by both physical and data. Step 503 specifically includes the following steps 601 to 609:

[0100] Step 601: Obtain voltage and current waveform data of the monitoring points when the grid voltage is in steady state, and obtain the steady-state three-phase instantaneous power of each monitoring point based on the voltage and current waveform data of the monitoring points when the grid voltage is in steady state.

[0101] Step 602: Based on the voltage and current waveform data of the monitoring points when the grid voltage drops, obtain the instantaneous three-phase power of the disturbance at each monitoring point.

[0102] Step 603: Determine the instantaneous disturbance power of each monitoring point based on the steady-state three-phase instantaneous power and the disturbance three-phase instantaneous power of each monitoring point.

[0103] Step 604: Integrate the instantaneous disturbance power of each monitoring point over time to obtain the disturbance energy of each monitoring point.

[0104] Step 605: Determine the location of the actual grid voltage sag source based on the instantaneous disturbance power or disturbance energy at each monitoring point.

[0105] Step 606: Determine the first loss value based on the location of the actual grid voltage sag source and the location of the grid voltage sag source obtained from the pre-trained graph attention network.

[0106] Step 607: Determine the cross-entropy loss value based on the predicted probability vector and label obtained from the pre-trained graph attention network.

[0107] Step 608: Determine the improved loss value based on the cross-entropy loss value and the first loss value.

[0108] Step 609: Optimize the pre-trained graph attention network based on the improved loss value to obtain the trained graph attention network.

[0109] Specifically, when a disturbance occurs in the power grid, the grid's steady state is disrupted, and the energy flow changes. By analyzing the difference between the power flowing through monitoring nodes during the disturbance and during normal operation, the upstream and downstream locations of the transient source can be identified. This method introduces the concepts of disturbance energy (DE) and instantaneous disturbance power (DP). Instantaneous disturbance power is defined as the difference between the instantaneous three-phase power in any state and the three-phase power during steady-state operation. Disturbance energy is the time integral of the disturbance power during the disturbance period. In a three-phase system:

[0110] .

[0111] .

[0112] .

[0113] in, The instantaneous power of the three-phase system. , , Let A, B, and C be the voltages of the three phases at time t. , , Let A, B, and C be the currents in phases A, B, and C at time t. Disturbance three-phase instantaneous power, For steady-state three-phase instantaneous power, For time.

[0114] This application achieves upstream and downstream location of the transient source through the following method: the disturbance energy value when the disturbance ends. Greater than At 80% of the peak value, a discriminant method is used. Achieve upstream and downstream positioning of temporary descent source, when Less than At 80% of the peak value, a discriminant method is used. Make a judgment. This represents the initial peak value of the instantaneous disturbance power.

[0115] In another exemplary embodiment of this application, the prediction probability vector includes the prediction probability of each node; the improved loss function is determined using the following formula:

[0116] .

[0117] .

[0118] .

[0119] in, This represents the cross-entropy loss value. Let be the label of the i-th node. Let be the predicted probability of the i-th node obtained from the pre-trained graph attention network. Let be the number of nodes, and i be the index of the node. The first loss value, and These are the node numbers at both ends of the section where the actual grid voltage sag source is located. and These are the node numbers at both ends of the segment where the grid voltage sag source is located, obtained from the pre-trained graph attention network. For the improved loss value, As the first weighting coefficient, This is the second weighting coefficient, and the node numbers are assigned values ​​in ascending order.

[0120] This application improves upon the cross-entropy loss function by incorporating the results obtained from the upstream and downstream discrimination method of transient source into the cross-entropy loss function to increase the credibility of the graph attention network. The specific details are as follows:

[0121] First, obtain the steady-state power flow direction matrix when the grid voltage is in steady-state operation. Steady-state power flow direction matrix Dimension is In the steady-state power flow direction matrix In the matrix, elements between unconnected nodes are 0, while elements between connected nodes are set to 1 or -1 depending on the power flow direction. The steady-state power flow direction matrix is ​​then set. The obtained power direction is set as the reference direction.

[0122] Then, based on the voltage and current waveform data at the monitoring points during the grid voltage sag, the disturbance power flow direction matrix is ​​obtained. The steady-state power flow direction matrix With the direction matrix of the disturbance power flow Subtraction yields the matrix , Adding it to its transpose matrix yields the positioning matrix. , The non-zero elements represent the sections where the grid voltage faults are located.

[0123] In another exemplary embodiment of this application, the steady-state power flow pattern during steady-state operation of the power grid voltage is as follows: Figure 4 As shown, the steady-state power flow pattern includes 5 nodes, and the steady-state power flow direction matrix... for:

[0124] .

[0125] Assuming a short-circuit fault occurs between node 2 and node 3, causing a voltage dip in the power grid, the disturbance power flow pattern during the voltage dip is as follows: Figure 5 As shown, the direction matrix of the disturbance power flow : .

[0126] Matrix subtraction:

[0127] .

[0128] Calculate the positioning matrix:

[0129] .

[0130] According to the localization matrix, the fault location is between node 2 and node 3. In practical applications, the monitoring nodes may not be adjacent, so the displayed location is the segment between two monitoring nodes. The exact location needs to be determined more precisely using the predicted probability vector generated by the graph attention network.

[0131] Based on the same inventive concept, in an exemplary embodiment, such as Figure 6 As shown, a device for locating grid voltage sag sources is provided, the device comprising:

[0132] The data acquisition module 601 is used to acquire voltage and current waveform data of the monitoring point when the grid voltage drops.

[0133] The voltage sag source location acquisition module 602 is used to input the voltage and current waveform data of the monitoring point when the grid voltage sags into a trained graph attention network to obtain the location of the grid voltage sag source. The graph attention network includes an input layer, cascaded graph attention layers, pooling layers, and an output layer. The graph attention layers introduce a multi-head attention mechanism and a voltage sag amplitude. The voltage sag amplitude is determined by the voltage and current waveform data. The graph attention network is trained using an improved loss function and contrastive learning. The improved loss function incorporates grid voltage sag source discrimination based on instantaneous disturbance power and disturbance energy.

[0134] In one exemplary embodiment, a computer device is provided, which may be a server or a terminal, and its internal structure diagram may be as follows. Figure 7As shown, the computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs in the non-volatile storage media to run. The database stores voltage and current waveform data at monitoring points during grid voltage sags. The I / O interfaces are used for information exchange between the processor and external devices. The communication interface is used for communication with external terminals via a network connection. When executed by the processor, the computer program implements a method for locating grid voltage sag sources.

[0135] Those skilled in the art will understand that Figure 7 The structures shown are merely block diagrams of some structures related to the present application and do not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than shown in the figures, or combine certain components, or have different component arrangements. In an exemplary embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.

[0136] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0137] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0138] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A method for locating sources of voltage sag in a power grid, characterized in that, The method includes: Acquire voltage and current waveform data at monitoring points during grid voltage dips; Voltage and current waveform data from monitoring points during grid voltage sags are input into a trained graph attention network to determine the location of the grid voltage sag source. The graph attention network comprises an input layer, cascaded graph attention layers, a pooling layer, and an output layer. The graph attention layers incorporate a multi-head attention mechanism and a voltage sag amplitude, determined by the voltage and current waveform data. The graph attention network is trained using an improved loss function and contrastive learning. The improved loss function incorporates grid voltage sag source discrimination based on instantaneous disturbance power and disturbance energy. The voltage and current waveform data of the monitoring points during grid voltage sags are input into a trained graph attention network to obtain the location of the grid voltage sag source, specifically including: The node feature vector matrix is ​​determined based on the voltage and current waveform data of the monitoring points during the grid voltage sag, and the adjacency matrix is ​​determined based on the grid topology; where each monitoring point is a node. The node feature vector matrix and the adjacency matrix are input into the input layer to obtain the first node feature vector matrix; The first node feature vector matrix is ​​input into the cascaded graph attention layer to obtain the node embedding matrix; The node embedding matrix is ​​input into the pooling layer to obtain the graph embedding vector; The graph embedding vector is input into the output layer to obtain the prediction probability vector, and the location of the grid voltage sag source is determined based on the prediction probability vector.

2. The method for locating grid voltage sag sources according to claim 1, characterized in that, The cascaded graph attention layers include m graph attention layers; ; The first node feature vector matrix is ​​input into the cascaded graph attention layer to obtain the node embedding matrix, specifically including: For the z-th iteration, the output feature matrix of the (z-1)-th graph attention layer is input into the z-th graph attention layer to obtain the output feature matrix of the z-th graph attention layer; The output feature matrix of the 0th graph attention layer is the feature vector matrix of the first node. Determine if z is greater than or equal to m; if yes, use the output feature matrix of the z-th graph attention layer as the node embedding matrix; otherwise, proceed to the next iteration.

3. The method for locating grid voltage sag sources according to claim 2, characterized in that, The output feature matrix of the (z-1)th graph attention layer includes the (z-1)th output feature vector of each node; The output feature matrix of the (z-1)th graph attention layer is input into the z-th graph attention layer to obtain the output feature matrix of the z-th graph attention layer, specifically including: The effective voltage value of each node is determined based on the voltage and current waveform data of the monitoring points during the grid voltage sag. Based on the effective voltage value of each node and the rated effective voltage value of each node, determine the voltage sag value of each node; For any node in the z-th graph attention layer, the weighting coefficients between the node and its neighboring nodes are determined based on the (z-1)-th output feature vector of the node, the (z-1)-th output feature vector of any neighboring node of the node, and the voltage sag of the neighboring node. Based on the weight coefficients of the node and its neighboring nodes, the attention coefficients between the node and its neighboring nodes are determined. Based on the attention coefficients between the node and its neighboring nodes, a multi-head attention mechanism is used to determine the z-th output feature vector of the node. The output feature matrix of the z-th graph attention layer is determined based on the z-th output feature vector of each node.

4. The method for locating power grid voltage sag sources according to claim 3, characterized in that, The weight coefficients between the i-th node and the j-th node are determined using the following formula: ; ; in, Let be the voltage sag at the j-th node. Let J be the effective voltage value of the j-th node. Let J be the effective value of the rated voltage of the j-th node. Let be the weight coefficient between the i-th node and the j-th node. It is a non-linear activation function. For learnable weight vectors, To share the weight matrix, This is the (z-1)th output feature vector of the i-th node. Let i be the (z-1)th output feature vector of the j-th node, where i and j are the indices of the node.

5. The method for locating grid voltage sag sources according to claim 3, characterized in that, The z-th output feature vector of the i-th node is determined using the following formula: ; in, Let z be the z-th output feature vector of the i-th node. This represents the concatenation operation of feature vectors. The number of heads in a multi-head attention mechanism. This is an index for the number of heads in a multi-head attention mechanism. Let i be the set of neighboring nodes of the i-th node. For the first Attention coefficient in head attention mechanism For the first The weight matrix of the linear transformation in the head attention mechanism. For activation function, For the first The output feature vector of the j-th node in the head attention mechanism is z-1, where i and j are the indices of the node.

6. The method for locating grid voltage sag sources according to claim 1, characterized in that, Before acquiring the voltage and current waveform data at the monitoring point during a grid voltage sag, the following steps are also included: Connect the graph attention network to the projection transformation layer; Based on unlabeled historical voltage and current waveform data, contrastive learning is used to pre-train the graph attention network and projection transformation layer to obtain the pre-trained graph attention network and pre-trained projection transformation layer; the label is the location of the grid voltage sag source. Based on labeled historical voltage and current waveform data, an improved loss function is used to optimize the pre-trained graph attention network, resulting in a well-trained graph attention network.

7. The method for locating grid voltage sag sources according to claim 6, characterized in that, Based on labeled historical voltage and current waveform data, an improved loss function is used to train a pre-trained graph attention network, resulting in a well-trained graph attention network, which specifically includes: Acquire voltage and current waveform data of monitoring points during steady-state operation of the power grid, and obtain the steady-state three-phase instantaneous power of each monitoring point based on the voltage and current waveform data of monitoring points during steady-state operation of the power grid. Based on the voltage and current waveform data of the monitoring points during the grid voltage sag, the instantaneous three-phase power of the disturbance at each monitoring point is obtained; The instantaneous disturbance power of each monitoring point is determined based on the steady-state three-phase instantaneous power and the disturbance three-phase instantaneous power of each monitoring point. The instantaneous disturbance power at each monitoring point is integrated over time to obtain the disturbance energy at each monitoring point; The location of the actual grid voltage sag source is determined based on the instantaneous disturbance power or disturbance energy at each monitoring point. The first loss value is determined based on the location of the actual grid voltage sag source and the location of the grid voltage sag source obtained by the pre-trained graph attention network. Based on the predicted probability vector and label obtained from the pre-trained graph attention network, the cross-entropy loss value is determined. The improved loss value is determined based on the cross-entropy loss value and the first loss value; The pre-trained graph attention network is optimized based on the improved loss value to obtain a trained graph attention network.

8. The method for locating power grid voltage sag sources according to claim 7, characterized in that, The predicted probability vector includes the predicted probability of each node; the improved loss function is determined using the following formula: ; ; ; in, This represents the cross-entropy loss value. Let be the label of the i-th node. Let be the predicted probability of the i-th node obtained from the pre-trained graph attention network. Let be the number of nodes, and i be the index of the node. The first loss value, and These are the node numbers at both ends of the section where the actual grid voltage sag source is located. and These are the node numbers at both ends of the segment where the grid voltage sag source is located, obtained from the pre-trained graph attention network. For the improved loss value, As the first weighting coefficient, This is the second weighting coefficient.

9. A device for locating a voltage sag source in a power grid, characterized in that, The method for locating a grid voltage sag source according to any one of claims 1-8, wherein the apparatus comprises: The data acquisition module is used to acquire voltage and current waveform data at monitoring points when the grid voltage dips. A voltage sag source location acquisition module is used to input voltage and current waveform data of monitoring points during grid voltage sags into a trained graph attention network to obtain the location of the grid voltage sag source. The graph attention network includes an input layer, cascaded graph attention layers, pooling layers, and an output layer. The graph attention layers introduce a multi-head attention mechanism and a voltage sag amplitude. The voltage sag amplitude is determined by the voltage and current waveform data. The graph attention network is trained using an improved loss function and contrastive learning. The improved loss function incorporates grid voltage sag source discrimination based on instantaneous disturbance power and disturbance energy. The voltage and current waveform data of the monitoring points during grid voltage sags are input into a trained graph attention network to obtain the location of the grid voltage sag source, specifically including: The node feature vector matrix is ​​determined based on the voltage and current waveform data of the monitoring points during the grid voltage sag, and the adjacency matrix is ​​determined based on the grid topology; where each monitoring point is a node. The node feature vector matrix and the adjacency matrix are input into the input layer to obtain the first node feature vector matrix; The first node feature vector matrix is ​​input into the cascaded graph attention layer to obtain the node embedding matrix; The node embedding matrix is ​​input into the pooling layer to obtain the graph embedding vector; The graph embedding vector is input into the output layer to obtain the prediction probability vector, and the location of the grid voltage sag source is determined based on the prediction probability vector.

Citation Information

Patent Citations

  • Voltage sag disturbance source positioning method fusing attention mechanism and deep learning

    CN112684284A

  • Voltage sag acquisition method and device considering transformer impedance voltage drop

    CN113848421A