Power grid fault diagnosis method and device, computer equipment and storage medium
The power grid fault diagnosis method combining incremental PID controller and attention mechanism solves the problems of insufficient speed, accuracy and robustness of traditional methods, realizes fast and accurate fault diagnosis, reduces the false positive rate and enhances the adaptability of the model.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- XISHUANGBANNA POWER SUPPLY BUREAU OF YUNNAN POWER GRID CO LTD
- Filing Date
- 2025-11-18
- Publication Date
- 2026-04-21
AI Technical Summary
Traditional power grid fault diagnosis methods are insufficient in terms of speed, accuracy and robustness, making it difficult to cope with complex and ever-changing power grid conditions. Furthermore, single intelligent algorithms are inadequate in dynamically responding to fault mutations and in feature weight allocation.
An incremental PID controller is used to correct transient fault characteristics, an attention mechanism is used for weight allocation, and a fault classifier is used to identify fault types. End-to-end training is used to optimize model parameters and reduce reliance on human experience.
It significantly improves the accuracy and response speed of fault diagnosis, reduces the false positive and false negative rates, and the model can learn autonomously to adapt to different fault types and power grid operation modes, and has strong generalization ability.
Smart Images

Figure CN121899559A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of smart grid technology, and in particular to a method, apparatus, computer equipment, and storage medium for diagnosing power grid faults. Background Technology
[0002] With the continuous expansion of power system scale and the ongoing improvement of its intelligence level, the operation of the power grid is becoming increasingly complex, and the causes of faults are becoming more diverse, placing higher demands on the "speed, accuracy, and robustness" of fault diagnosis. Traditional fault diagnosis methods, such as rule-based judgment methods that rely on expert experience, are limited by the limitations of human knowledge and are difficult to cope with complex and ever-changing power grid conditions. While single intelligent algorithms (such as deep learning models) have certain advantages in feature extraction, they are insufficient in dynamically responding to fault mutations and balancing feature weight allocation, often leading to lag in fault diagnosis or misjudgment due to excessive focus on interference features. Summary of the Invention
[0003] Based on this, it is necessary to propose a power grid fault diagnosis method to address the shortcomings of existing fault diagnosis technologies in terms of speed, accuracy, and robustness.
[0004] Firstly, a method for diagnosing power grid faults is provided, the method comprising: Acquire key electrical quantity time-series data, and denoise the key electrical quantity time-series data to obtain denoised electrical quantity time-series data; Extract transient fault features from the denoised electrical quantity time-series data; Obtain the updated PID parameters from the previous diagnostic process, and correct the transient fault characteristics based on the PID parameters using an incremental PID controller to obtain the corrected transient fault characteristics. Obtain the attention mechanism parameters updated in the previous diagnostic process, and based on the attention mechanism parameters, assign weights to the corrected transient fault features through the attention mechanism to obtain weighted transient fault features. Obtain the updated classifier parameters from the previous diagnostic process, and based on the classifier parameters, use a fault classifier to identify the fault type of the weighted transient fault features to obtain the fault diagnosis result. Based on the error between the fault diagnosis result and the actual result, update the PID parameters, the attention mechanism parameters, and the classifier parameters.
[0005] Preferably, the step of acquiring key electrical quantity time-series data and denoising the key electrical quantity time-series data includes: Key electrical quantity time-series data within 0-2 cycles after the fault occurs, including voltage time-series data, current time-series data, and power time-series data; The electrical quantity time series data is reconstructed using wavelet functions to obtain the denoised signal.
[0006] Preferably, the steps of extracting transient fault features from the denoised electrical quantity time-series data; obtaining the PID parameters updated in the previous diagnostic process; and correcting the transient fault features based on the PID parameters using an incremental PID controller to obtain the corrected transient fault features include: Obtain the reference vector of the electrical quantity time series data; Based on the denoised electrical quantity time-series data, a transient fault feature vector is obtained; Calculate the feature deviation between the transient fault feature vector and the reference vector; The incremental PID controller is used to correct the characteristic deviation, thereby obtaining the corrected transient fault characteristics.
[0007] Preferably, the step of obtaining the attention mechanism parameters obtained from the previous diagnostic process, and based on the attention mechanism parameters, weighting the corrected transient fault features through the attention mechanism to obtain weighted transient fault features includes: The modified transient fault features are linearly mapped to obtain the mapped transient fault features. The transient fault characteristics of the mapping are constrained by a constraint function to obtain an attention score; The modified transient fault features are multiplied element-wise with the attention scores to obtain weighted transient fault features.
[0008] Preferably, the step of obtaining the updated classifier parameters from the previous diagnostic process, and then using a fault classifier to identify the fault type of the weighted transient fault features based on the classifier parameters to obtain the fault diagnosis result includes: The weighted transient fault characteristics are linearly transformed to obtain intermediate variables; The intermediate variables are transformed by the fault classifier to obtain the probability distribution results of each type of fault. Determine whether the current fault diagnosis meets the preset convergence conditions; If yes, then the fault type with the highest probability of failure will be output as the result of this fault diagnosis. If not, update the incremental PID parameters, the attention mechanism parameters, and the classifier parameters for processing electrical quantity time-series data.
[0009] Preferably, the convergence condition includes: Reaching the maximum number of iterations; or Reaching the maximum iteration time; or The probability of the most likely fault type is greater than the preset threshold.
[0010] Preferably, the step of updating the PID parameters, the attention mechanism parameters, and the classifier parameters based on the error between the diagnostic result and the true result includes: The error value of the probability distribution results of each type of fault is quantified by the cross-entropy loss function; The error value is minimized using gradient descent, and the incremental PID parameters, attention mechanism parameters, and classifier parameters are optimized based on the error value and the gradient information it contains.
[0011] Secondly, a power grid fault diagnosis device is provided, the device comprising: The data acquisition module is used to acquire key electrical quantity time-series data, and to denoise the key electrical quantity time-series data to obtain denoised electrical quantity time-series data. The fault diagnosis module extracts transient fault features from the denoised electrical quantity time-series data; Obtain the updated PID parameters from the previous diagnostic process, and correct the transient fault characteristics based on the PID parameters using an incremental PID controller to obtain the corrected transient fault characteristics. Obtain the attention mechanism parameters updated in the previous diagnostic process, and based on the attention mechanism parameters, assign weights to the corrected transient fault features through the attention mechanism to obtain weighted transient fault features. Obtain the updated classifier parameters from the previous diagnostic process, and based on the classifier parameters, use a fault classifier to identify the fault type of the weighted transient fault features to obtain the fault diagnosis result. The parameter update module is used to update the PID parameters, the attention mechanism parameters, and the classifier parameters based on the error between the diagnostic results and the true results.
[0012] Thirdly, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the steps of the power grid fault diagnosis method as described in any of the preceding claims.
[0013] Fourthly, a computer-readable storage medium is provided, the computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the power grid fault diagnosis method as described in any of the preceding claims.
[0014] The beneficial effects of this application are: By leveraging the sensitivity of incremental PID to the rate of change of deviation, it is possible to quickly capture minute dynamic characteristics in the early stages of a fault, shortening the fault response time far beyond traditional methods and meeting the real-time requirements of the power grid for fault clearing.
[0015] By automatically enhancing key fault features and suppressing redundant interference through an attention mechanism, combined with the feature correction capabilities of PID, the quality of features is significantly improved. This results in a significant improvement in overall fault diagnosis accuracy compared to traditional PID and single deep learning models, while greatly reducing the false positive and false negative rates.
[0016] The entire fault diagnosis model (including PID and attention mechanism parameters) is optimized through end-to-end training, enabling the model to learn autonomously from data, adapt to different fault types and power grid operation modes, and has strong generalization ability, reducing the reliance on manual experience for debugging. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] in: Figure 1 This is a diagram illustrating the application environment of a power grid fault diagnosis method in one embodiment. Figure 2 Here is a flowchart of a power grid fault diagnosis method in one embodiment; Figure 3 This is a structural block diagram of a power grid fault diagnosis method apparatus in one embodiment; Figure 4 This is a structural block diagram of a computer device in one embodiment. Detailed Implementation
[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0020] The power grid fault diagnosis method provided in this embodiment of the invention can be applied to, for example, Figure 1In this application environment, the physical terminal communicates with the server via a network. The server can obtain key electrical quantity time-series data from the physical terminal, denoise the key electrical quantity time-series data to obtain denoised electrical quantity time-series data; extract transient fault features from the denoised electrical quantity time-series data; obtain the PID parameters updated in the previous diagnostic process, and correct the transient fault features based on the PID parameters using an incremental PID controller to obtain corrected transient fault features; obtain the attention mechanism parameters updated in the previous diagnostic process, and weight the corrected transient fault features based on the attention mechanism parameters to obtain weighted transient fault features; obtain the classifier parameters updated in the previous diagnostic process, and identify the fault type of the weighted transient fault features based on the classifier parameters using a fault classifier to obtain a fault diagnosis result; and update the PID parameters, the attention mechanism parameters, and the classifier parameters based on the error between the fault diagnosis result and the actual result. In this invention, addressing the complexity of smart grids, the sensitivity of incremental PID to deviation change rates is utilized to quickly capture minute dynamic features in the early stages of a fault. An attention mechanism automatically enhances key fault features and suppresses redundant interference. Combined with the feature correction capabilities of PID, feature quality is significantly improved. The entire fault diagnosis model (including PID and attention mechanism parameters) is optimized through end-to-end training, enabling the model to learn autonomously from data, adapt to different fault types and grid operation modes, exhibit strong generalization ability, and reduce reliance on manual experience-based debugging. The physical end can be, but is not limited to, various personal computers, laptops, tablets, and grid parameter monitoring equipment. The server end can be implemented using a standalone server or a server cluster consisting of multiple servers. The invention will be described in detail below through specific embodiments.
[0021] Please see Figure 2 As shown, Figure 2 A flowchart illustrating a power grid fault diagnosis method provided in an embodiment of the present invention includes the following steps: S1 acquires key electrical quantity time-series data, denoises the key electrical quantity time-series data, and obtains denoised electrical quantity time-series data.
[0022] Specifically, electrical quantity time-series data refers to a series of electrical physical quantities monitored from the power grid that most effectively characterize its operating status and fault features, recorded in chronological order. Key electrical quantities typically include: Voltage (U): A physical quantity measuring electric field strength, often showing a sudden increase or decrease during faults. Current (I): A physical quantity measuring charge flow, increasing sharply during faults (such as short circuits). Power (P / Q / S): Includes active power, reactive power, and apparent power, reflecting the energy transmission status of the power grid. Frequency (f): A core indicator of stable power grid operation. Power factor (cosφ): Reflects the efficiency of power transmission.
[0023] Time-series data: This emphasizes that the data is a series of points collected at fixed time intervals (e.g., 2000 points per second, or 2000Hz), forming a signal on a time axis, rather than a single isolated value. This data format can completely preserve the dynamic changes and transient characteristics of the signal (such as the sudden changes at the moment a fault occurs).
[0024] Denoising key electrical quantity time-series data refers to the technical process of using digital signal processing algorithms to identify and remove random fluctuations (i.e., "noise") introduced by non-target factors such as measurement errors and electromagnetic interference from the raw time-series data, thereby preserving or enhancing the core signal components that can truly reflect the operating status of the power grid. By improving the signal-to-noise ratio and fidelity of the data from the source, it provides a high-quality and highly reliable processing object for all subsequent advanced algorithms (incremental PID, attention mechanism), fundamentally ensuring the excellent performance of the entire fault diagnosis system in terms of accuracy, robustness, and speed.
[0025] S2 extracts transient fault features from the denoised electrical quantity time-series data.
[0026] Specifically, transient fault characteristics refer to the brief, abrupt dynamic properties of electrical quantities exhibited in the initial stage of a power grid fault (usually within a few cycles). These characteristics are key to distinguishing the type and severity of faults.
[0027] S3 obtains the updated PID parameters from the previous diagnostic process, and corrects the transient fault characteristics based on the PID parameters using an incremental PID controller to obtain the corrected transient fault characteristics.
[0028] Specifically, the incremental PID parameters updated in the previous diagnostic process refer to the set of parameters that the diagnostic model has continuously iterated and optimized during the previous diagnostic process, and finally converged to be the most effective in extracting and correcting fault characteristics. In practical applications, if the optimization of the parameters is conducive to the optimization of the diagnostic results, they are updated; if the optimization of the parameters is not conducive to the optimization of the diagnostic results, they are not updated.
[0029] An incremental PID controller is a discretized form of the PID (proportional-integral-derivative) control algorithm. Its key difference from a positional PID controller is that it does not calculate the absolute magnitude of the control variable, but rather its increment (change).
[0030] The modified transient fault characteristics refer to the optimized characteristics obtained by inputting the original transient fault characteristics into an incremental PID controller and calculating and adjusting the characteristics through the combined action of its proportional, integral, and derivative terms. The purpose of modification is to suppress fluctuations caused by noise and disturbances, while enhancing the true trend of fault changes, so that the characteristics better reflect the essence of the fault.
[0031] S4 obtains the attention mechanism parameters updated in the previous diagnostic process. Based on the attention mechanism parameters, the corrected transient fault features are weighted and assigned through the attention mechanism to obtain the weighted transient fault features.
[0032] Specifically, the attention mechanism is a computational model that simulates human cognitive attention. Its core idea is that when processing information, instead of treating all parts equally, it learns to focus on the more critical parts and assign them higher weights. In this paper, it's a small neural network used to evaluate which fault features are more important to the current diagnostic task. Weight assignment is the core operation of the attention mechanism; specifically, the model calculates an attention score between 0 and 1 for each transient fault feature (voltage spike, current peak, power factor deviation) in the input vector. This score represents the "importance" of that feature.
[0033] Weighted transient fault features refer to the result obtained by element-wise multiplication (Hadamard product) of the calculated attention score and the corrected transient fault features. By introducing an attention mechanism, adaptive weight allocation of transient fault features is achieved, thereby strengthening key transient fault features, suppressing redundant and interfering information, and ultimately significantly improving the classification accuracy and generalization ability of fault diagnosis.
[0034] S5 obtains the updated classifier parameters from the previous diagnostic process, and uses the fault classifier to identify the fault type of the weighted transient fault features based on the classifier parameters to obtain the fault diagnosis result.
[0035] Specifically, a fault classifier is a function or output layer commonly used in machine learning multi-classification tasks, and can be an algorithm such as Random Forest, SVM, or Gradient Boosting Machine. The fault classifier described in this application is a Softmax classifier, which transforms (normalizes) an input vector containing arbitrary real numbers (often called "logic values" or "scores") into a probability distribution. This distribution is characterized by the sum of all output values being 1, and each output value being between 0 and 1, which can be intuitively interpreted as the confidence probability of belonging to the corresponding category. The probability distribution results for each type of fault are the direct output of the Softmax classifier. It is a vector where each element represents the predicted probability that the input sample belongs to a specific fault type (such as "short circuit," "grounding," or "overload"). For example, a possible output distribution is: [Short circuit: 0.02, Grounding: 0.97, Overload: 0.01]. This means that the model determines the current state as a "grounding" fault with a 97% confidence level.
[0036] Outputting the fault type is the final decision-making step in the diagnostic process. Specifically, it involves selecting the category with the highest probability value from the probability distribution output by Softmax as the final diagnostic conclusion.
[0037] S6 updates the PID parameters, attention mechanism parameters, and classifier parameters based on the error between the diagnostic results and the true results.
[0038] Specifically, during model training, all simulated data are synchronously set with corresponding real results. Steps S1-S6 describe the diagnostic process of the diagnostic model. Updating the incremental PID parameters, attention mechanism parameters, and classifier parameters is to make the diagnostic model more accurate in the next diagnosis. In some cases, the current diagnostic process does not point to a better diagnostic result, and the updated incremental PID parameters and attention mechanism parameters can remain unchanged.
[0039] Optionally, step S1 may further include: S11 provides key electrical quantity timing data for 0-2 cycles after a fault occurs. The key electrical quantity timing data includes voltage timing data, current timing data, and power timing data.
[0040] Specifically, in a power system, a "cycle" refers to the time it takes for an alternating current to complete one full sinusoidal wave change, for example, 20 milliseconds (ms) in my country's 50Hz system. 0-2 cycles refer to the short period of time from the moment the fault occurs (time 0) to 40 milliseconds; this window is the core period of the transient process.
[0041] Voltage time-series data refers to a continuous sequence of instantaneous voltage values recorded over time, which often manifests as a sudden drop or distortion during faults. Current time-series data refers to a continuous sequence of instantaneous current values recorded over time, which rise sharply during faults (such as short circuits), directly reflecting the energy of the fault. Power time-series data refers to a continuous sequence of power values recorded over time that can be calculated from voltage and current (such as apparent power), reflecting abrupt changes in the system's energy transport.
[0042] For example, a synchronous phasor measurement unit or a high-performance data acquisition system can be used to synchronously sample the voltage and current signals of the three phases of the power grid at high speed. The sampling frequency must satisfy the Nyquist sampling theorem and have sufficient margin, usually much higher than the power frequency, such as ≥2000 Hz as specified in the document, to ensure that high-frequency components in the transient process can be clearly distinguished. The system maintains a circular buffer in memory to continuously store the raw electrical quantity data of the most recent period (e.g., several seconds). A fault initiation criterion is set, such as a current surge exceeding a set value or a voltage drop exceeding a threshold. Once the condition is met, a fault is determined to have occurred, and "time 0" is locked. From the circular buffer, starting from the trigger point, one cycle is taken backward (to calculate the baseline value before the fault), and two cycles (0-2 cycles in total) of raw voltage and current timing data are precisely extracted backward.
[0043] This application explicitly limits the data acquisition window to 0-2 cycles after the fault, which maximizes the capture of transient features generated in the early stages of the fault, providing the richest and most significant fault fingerprints for the diagnostic algorithm and fundamentally ensuring the method's sensitivity to early faults. Simultaneously, it collects three interrelated but distinct electrical quantities—voltage, current, and power—forming a multi-dimensional and complementary feature observation set. This ensures that different types of faults (such as voltage-sensitive short-circuit faults and power-sensitive overload faults) can find their corresponding feature manifestations, providing comprehensive information support for subsequent algorithms to perform accurate fault classification.
[0044] S12 performs wavelet reconstruction on the electrical quantity time series data using wavelet functions to obtain the denoised signal.
[0045] Specifically, a wavelet function is a mathematical function with localized properties in both time and frequency. It resembles a decaying wave and exhibits "tightly supported" characteristics. Unlike the Fourier transform, which only provides frequency information, the wavelet transform provides both time and frequency information simultaneously, making it ideal for analyzing non-stationary signals (such as transient fault signals). Wavelet reconstruction, also known as inverse wavelet transform, is the process of reconstructing the signal using processed wavelet coefficients after completing the core steps of wavelet denoising (decomposition and thresholding). It is the final step in the wavelet denoising process, aiming to generate a signal that exists in the original time domain but with improved quality—that is, the denoised signal.
[0046] For example, with f s ≥2000 Hz (Covering the transient characteristics of the power grid) Real-time data is sampled to obtain discrete sequences. u (n) , i(n) , p(n) ( n =0,1,..., N -1, N (The number of sampling points corresponds to 0-2 cycles after the fault). Wavelet denoising is used to suppress measurement noise while preserving the transient characteristics of the fault. The denoised data is denoised as follows: , , The mathematical expression is: in, x ( n ( ) represents the original data, and ( ) represents the denoised signal at discrete time points. n The amplitude at that point; ω j,k These are wavelet coefficients, the coefficients after thresholding and shrinking. ψ (·) represents the db4 wavelet basis function, which is a standard, local waveform template; j=3 is the decomposition scale, balancing denoising effect and feature preservation; For the translation and scaling of the wavelet basis function ψ, As a scaling factor, the larger the scale, the wider the wavelet function is stretched in time, corresponding to the lower frequency components of the signal; k The translation parameter determines the position of the wavelet function on the time axis; For all translation positions k To perform a summation, this summation operation means that at time point... n Reconstructed signal value at the location x(n) It is composed of all different locations k The above, scaled wavelet basis functions, and their corresponding purified forms ω j,k The coefficients are weights, linearly superimposed.
[0047] By leveraging the localization analysis capabilities of wavelet transform in the time-frequency domain, noise components in a signal can be accurately identified and separated, and then filtered out through thresholding, thereby significantly improving the signal-to-noise ratio. Unlike traditional low-pass filters, wavelet denoising can perfectly preserve key transient features such as sharp abrupt changes and singularities generated during fault occurrence while denoising. Using the denoised wavelet coefficients, the time-domain waveform of the original signal can be accurately reconstructed, ensuring that key features are preserved to the maximum extent possible during the denoising process.
[0048] Optionally, steps S2 and S3 include: S21 acquires the reference vector of electrical quantity time sequence data; Specifically, the reference vector is represented as x 0=[ u 0, i 0, cosφ 0]T, where u 0 represents the rated voltage. i 0 represents the rated current. cosφ 0 represents the normal power factor. The baseline vector is derived from historical data statistics, meaning it is established from long-term accumulated historical data labeled "normal operation." Its purpose is to establish a reliable health baseline for fault diagnosis, enabling the system to sensitively detect and identify faults by quantifying the degree of deviation from this baseline.
[0049] S22 obtains the transient fault feature vector based on the denoised electrical quantity time series data; Transient fault features refer to dynamic quantitative indicators extracted from electrical quantity data during the initial stage of a fault (transient process) that can effectively distinguish the fault type and severity. The set of individual transient fault features is encapsulated into a multi-dimensional vector, which serves as the input to the diagnostic model. The specific expression is as follows: ; Among them, the voltage surge reflects the degree of voltage drop caused by the fault, and is expressed as: ; The peak transient current reflects the severity of the short-circuit fault and is expressed as: ); Power factor deviation reflects the degree of change in the power factor, and is expressed as: ; in Indicates at a point in time n The approximate value of the real-time power factor is the normal power factor reference value.
[0050] The transient fault feature vector described in this application x(n) To be at the same point in timen, Due to voltage fluctuation Transient current peak value and power factor deviation This is combined into a column vector. Fault information is captured from three different physical dimensions: voltage amplitude, current amplitude, and power phase. Together, they form a comprehensive and complementary feature set, enabling subsequent classification algorithms to reliably distinguish different fault types. Transient fault feature vectorization achieves intelligent extraction from the original signal to the fault fingerprint, compressing high-dimensional waveform data into low-dimensional, efficient, and physically meaningful feature indicators, laying the foundation for accurate classification.
[0051] S23 calculates the characteristic deviation between the transient fault characteristic vector and the reference vector.
[0052] Specifically, the characteristic deviation, i.e., the difference between the current characteristic and the normal benchmark, is calculated as follows: ; in (The characteristic deviation is 0 under normal conditions) e ( n )∈ R 1×D This is the characteristic deviation.
[0053] S24 corrects the characteristic deviation through an incremental PID controller to obtain the corrected transient fault characteristics.
[0054] Specifically, incremental PID is used to calculate the control increment, and the expression is as follows: in: Δe ( n ) is the first-order increment of the deviation, expressed as Δe ( n )= e ( n )- e ( n -1) (Proportional term, rapid response deviation change); Δ 2 e ( n ) represents the second-order increment of the deviation, expressed as Δ 2 e ( n )= e ( n )-2 e ( n -1)+ e ( n -2) (Differential term, suppressing abrupt deviations and reducing the impact of disturbances); Ki e ( n The integral term is used to eliminate static bias. Furthermore, the fault characteristics are corrected by using PID incremental compensation to compensate for the characteristic deviations caused by disturbances: (1) Revised x ′ ( n Most perturbations have been filtered out and used as input for the attention mechanism to improve the accuracy of subsequent feature weight allocation.
[0055] The derivative term in a PID controller It is highly sensitive to abrupt changes in the signal and can effectively suppress high-frequency, sudden random noise in the feature data, preventing this noise from being misjudged as important features by subsequent attention mechanisms. (Integral term) This smooths out some low-frequency fluctuations through a cumulative effect. (Proportional term) It responds to the rate of change (trend) of the deviation. When the fault characteristics begin to change rapidly (e.g., at the moment of the fault occurrence), this item can immediately generate a large correction, making the corrected characteristics... It can capture the initial dynamics of a fault more quickly, solving the problem of delayed response in traditional methods.
[0056] Optionally, step S4 includes: S41 performs a linear mapping on the corrected transient fault characteristics to obtain the mapped transient fault characteristics.
[0057] Specifically: based on the corrected fault characteristics To enhance feature representation, a feature linear mapping is employed, expressed as follows: For example, receiving a corrected transient fault feature vector from an incremental PID module. Assume its dimensions are D×1 (e.g., D=3), where the weight matrix W has dimensions D×D, and the bias vector b has dimensions D×1. Matrix multiplication. A linear combination of input features is achieved, and a bias vector b is added to shift the result. The calculated vector... Output, It is a with Intermediate feature vectors of the same dimension (D×1). This linear mapping step transforms the PID-corrected physical features into abstract features more suitable for "importance assessment," laying a solid foundation for achieving accurate feature weight allocation in the end.
[0058] S42 constrains the mapped transient fault features using constraint functions to obtain attention scores.
[0059] Specifically, the constraint function is the Sigmoid function. By using the Sigmoid function to constrain the mapping result to [0,1], the attention score is obtained. Output vector It is the attention score vector. Its dimension is... Same (D×1). The Sigmoid function takes the "importance evidence" of each feature (i.e., The values in the value are transformed into an intuitive score between 0 and 1, which clearly quantifies the relative importance of each feature in this diagnosis, making the decision of the attention mechanism transparent and interpretable. The score represents the importance weight of the corresponding fault feature. The closer the score is to 1, the more important the feature is; the closer it is to 0, the less important it is.
[0060] S43 performs element-wise multiplication of the corrected transient fault features with the attention scores to obtain weighted transient fault features.
[0061] Based on the corrected feature x′(n) and attention score s(n), weight allocation is achieved through element-wise multiplication: Here, ⊙ represents the Hadamard product (element-wise multiplication), ensuring that highly important features have a higher weight in subsequent diagnoses; Features weighted by attention.
[0062] Element-wise multiplication, also known as the Hadamard product, is a vector operation denoted by ⊙. Its rule is that the corresponding elements of two vectors of the same dimension are multiplied to generate a new vector of the same dimension. The core decision of the attention mechanism is to physically apply the calculated importance scores to features, achieving intelligent feature enhancement and suppression, thereby optimizing the input quality of the diagnostic model.
[0063] Optionally, step S5 includes: S51 performs a linear transformation on the weighted transient fault characteristics to obtain intermediate variables.
[0064] Specifically, attention-weighted features of the input A linear transformation is performed to obtain the intermediate variable z(n), whose calculation formula is as follows: Among them, W cls ∈R D×KHere, D is the weight matrix, D is the input feature dimension, and K is the number of fault categories; b cls ∈R K This is the bias vector.
[0065] Linear transformation refers to the transformation through a weight matrix. and bias vector b cls The operation of mapping input features to another vector space. Called the logical value or score, it contains the model's raw predictive evidence for each fault category.
[0066] S52 uses the fault classifier to perform probability distribution transformation on the intermediate variables to obtain the probability distribution results of each type of fault.
[0067] Specifically, the fault classifier is a Softmax classifier, which uses intermediate variables to classify faults. z ( n Transform it into a probability distribution, for the th k Class of failure probability The formula for calculation is, in, The probability distribution for each fault type, The final diagnostic result is obtained by mapping the linearly transformed result to the interval [0, 1], and the sum of the probabilities of all categories is 1, thus obtaining the probability distribution of various faults.
[0068] The Softmax classifier is a mathematical function that transforms (normalizes) a set of arbitrary real numbers into a probability distribution, outputting a sum of all probabilities equal to 1. Each value represents the model's confidence that the input sample belongs to that category.
[0069] S53 determines whether the current fault diagnosis meets the preset convergence conditions; If S54 is true, then the fault diagnosis result will be output.
[0070] Specifically, the fault diagnosis process described in this application is the operation process of the fault diagnosis model. By continuously obtaining the fault type distribution, it is determined whether it meets the convergence condition of the fault diagnosis model. If the convergence condition is met, the fault diagnosis result is output. If the condition is not met, the model modifies certain parameters and executes the fault diagnosis process again. The fault diagnosis result is the fault type with the highest probability of fault distribution.
[0071] If S55 is not specified, update the incremental PID parameters, attention mechanism parameters, and classifier parameters for processing electrical quantity time series data.
[0072] Specifically, if the current fault diagnosis does not meet the convergence condition, the incremental PID parameters, attention mechanism parameters, and classifier parameters are updated, and the fault diagnosis model continues to iterate to output more accurate fault diagnosis results, thereby improving the accuracy of the fault diagnosis model.
[0073] Optionally, the convergence conditions for step S53 include: Reaching the maximum number of iterations; or Reaching the maximum iteration time; or The probability of the most likely fault type is greater than the preset threshold.
[0074] Specifically, setting the probability of the most probable fault type to be greater than a preset threshold is the most direct and ideal stopping condition. For example, if a clear accuracy target is set, such as a fault type probability greater than 99.99%, then the fault diagnosis result is directly output. Once the prediction accuracy of the fault diagnosis model on the training data reaches this high standard, the results of the fault diagnosis model are considered reliable. The design of the maximum number of iterations and the maximum iteration time can prevent the model from oscillating infinitely around a local optimum or failing to converge due to issues such as learning rate settings, thus preventing the program from entering an infinite loop.
[0075] Optionally, step S6 includes: S61 quantifies the error value of the probability distribution results of each type of fault using the cross-entropy loss function.
[0076] Specifically, the cross-entropy loss function is a function used to measure the difference between the probability distribution predicted by the model and the actual data. The actual data refers to the real fault type, the corresponding actual fault type under the measured data. The predicted fault type probability is compared with the actual fault type probability to obtain the difference; the smaller the difference, the more accurate the model's prediction. For example, if the actual fault type is a short circuit at node A, it is denoted as 100%, and the predicted short circuit probability at node A is 95%, then the difference is 5%. The specific expression is as follows: Where M is the number of samples, y m,k =1 indicates that the m-th sample belongs to the k-th class; otherwise, it is 0.
[0077] S62 minimizes the error value using gradient descent and optimizes the incremental PID parameters, attention mechanism parameters, and classifier parameters based on the error value and the gradient information it contains.
[0078] Specifically, for the attention parameters W, b and the classifier parameters W cls b cls The loss function is minimized using gradient descent, and the parameter update formula is based on gradient descent, as shown in the following expression: ( ) in, η For learning rate, It is the loss function with respect to parameters θ By updating the attention parameters W and b, and the classifier parameters Wcls and bcls in the opposite direction of the gradient, the loss function can be gradually reduced.
[0079] For incremental PID parameters K p , K i , K d To ensure optimal feature correction, fine-tuning is performed using loss value feedback. The update formulas are as follows: η is the learning rate. The loss function L with respect to parameter K p The partial derivatives (gradient) of the PID controller. This allows the PID controller to dynamically adjust its parameters based on the losses identified in the fault diagnosis, better adapting to the dynamic changes in power grid faults and improving the effectiveness of feature processing. K p K i K d The update enables the PID controller to extract features that are more favorable for classification and more robust to disturbances. The update allows the attention mechanism to more accurately assign high weights to important fault features.
[0080] This application utilizes the sensitivity of incremental PID to the rate of change of deviation, which can quickly capture the minute dynamic characteristics in the early stage of a fault, greatly shortening the fault response time, far exceeding traditional methods, and meeting the real-time requirements of the power grid for fault clearing.
[0081] By automatically enhancing key fault features and suppressing redundant interference through an attention mechanism, combined with the feature correction capabilities of PID, the quality of features is significantly improved. This results in a significant improvement in overall fault diagnosis accuracy compared to traditional PID and single deep learning models, while greatly reducing the false positive and false negative rates.
[0082] The entire fault diagnosis model (including PID, attention mechanism, and fault classifier) is optimized through end-to-end training, enabling the model to learn autonomously from data, adapt to different fault types and power grid operation modes, and has strong generalization ability, reducing the reliance on manual experience for debugging.
[0083] Please see Figure 3 As shown, in one embodiment, a power grid fault diagnosis method apparatus is provided, the apparatus comprising: The data acquisition module is used to acquire time-series data of key electrical quantities and to denoise the time-series data of key electrical quantities. The fault diagnosis module is used to obtain the incremental PID parameters updated in the previous diagnosis process. Based on the incremental PID parameters, the incremental PID controller extracts transient fault features from the denoised electrical quantity time series data and corrects the transient fault features to obtain the corrected transient fault features. Obtain the attention mechanism parameters updated in the previous diagnostic process. Based on the attention mechanism parameters, assign weights to the corrected transient fault features through the attention mechanism to obtain weighted transient fault features. Based on weighted transient fault features, the probability distribution of each type of fault is obtained through a fault classifier, and the fault type is output. The parameter update module is used to update incremental PID parameters, attention mechanism parameters, and classifier parameters.
[0084] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 4 As shown. The computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile and / or volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface is used to communicate with external clients via a network connection. When the computer program is executed by the processor, it implements the functions or steps of a power grid fault diagnosis method. The power grid fault diagnosis method specifically includes: Acquire key electrical quantity time-series data, denoise the key electrical quantity time-series data, and obtain denoised electrical quantity time-series data; Extract transient fault features from the denoised electrical quantity time series data; Obtain the updated PID parameters from the previous diagnostic process, and correct the transient fault characteristics based on the PID parameters using an incremental PID controller to obtain the corrected transient fault characteristics. Obtain the attention mechanism parameters updated in the previous diagnostic process. Based on the attention mechanism parameters, assign weights to the corrected transient fault features through the attention mechanism to obtain the weighted transient fault features. Obtain the updated classifier parameters from the previous diagnostic process, and use the fault classifier to identify the fault type of the weighted transient fault features based on the classifier parameters to obtain the diagnostic results. Based on the error between the diagnostic results and the true results, update the PID parameters, attention mechanism parameters, and classifier parameters.
[0085] This implementation method utilizes the sensitivity of incremental PID to the rate of change of deviation, which can quickly capture the minute dynamic characteristics in the early stage of a fault, greatly shortening the fault response time, far exceeding traditional methods, and meeting the real-time requirements of the power grid for fault clearing.
[0086] By automatically enhancing key fault features and suppressing redundant interference through an attention mechanism, combined with the feature correction capabilities of PID, the quality of features is significantly improved. This results in a significant improvement in overall fault diagnosis accuracy compared to traditional PID and single deep learning models, while greatly reducing the false positive and false negative rates.
[0087] The entire fault diagnosis model (including PID and attention mechanism parameters) is optimized through end-to-end training, enabling the model to learn autonomously from data, adapt to different fault types and power grid operation modes, and has strong generalization ability, reducing the reliance on manual experience for debugging.
[0088] In one embodiment, a computer-readable storage medium is provided, the computer-readable storage medium storing a computer program that, when executed by a processor, performs the following steps: Acquire key electrical quantity time-series data, denoise the key electrical quantity time-series data, and obtain denoised electrical quantity time-series data; Extract transient fault features from the denoised electrical quantity time series data; Obtain the updated PID parameters from the previous diagnostic process, and correct the transient fault characteristics based on the PID parameters using an incremental PID controller to obtain the corrected transient fault characteristics. Obtain the attention mechanism parameters updated in the previous diagnostic process. Based on the attention mechanism parameters, assign weights to the corrected transient fault features through the attention mechanism to obtain the weighted transient fault features. Obtain the updated classifier parameters from the previous diagnostic process, and use the fault classifier to identify the fault type of the weighted transient fault features based on the classifier parameters to obtain the diagnostic results. Based on the error between the diagnostic results and the true results, update the PID parameters, attention mechanism parameters, and classifier parameters.
[0089] This implementation utilizes the sensitivity of incremental PID to the rate of change of deviation, which can quickly capture the minute dynamic characteristics in the early stage of a fault, greatly shortening the fault response time, far exceeding traditional methods, and meeting the real-time requirements of the power grid for fault clearing.
[0090] By automatically enhancing key fault features and suppressing redundant interference through an attention mechanism, combined with the feature correction capabilities of PID, the quality of features is significantly improved. This results in a significant improvement in overall fault diagnosis accuracy compared to traditional PID and single deep learning models, while greatly reducing the false positive and false negative rates.
[0091] The entire fault diagnosis model (including incremental PID, attention mechanism and fault classifier) is optimized through end-to-end training, enabling the model to learn autonomously from data, adapt to different fault types and power grid operation modes, and has strong generalization ability, reducing the reliance on manual experience for debugging.
[0092] It should be noted that the functions or steps that can be implemented by the computer-readable storage medium or computer device described above can be referred to the relevant descriptions on the server side and client side in the foregoing method embodiments. To avoid repetition, they will not be described one by one here.
[0093] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0094] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0095] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. A method for diagnosing power grid faults, characterized in that, The method includes: Acquire key electrical quantity time-series data, and denoise the key electrical quantity time-series data to obtain denoised electrical quantity time-series data; Extract transient fault features from the denoised electrical quantity time-series data; Obtain the updated PID parameters from the previous diagnostic process, and correct the transient fault characteristics based on the PID parameters using an incremental PID controller to obtain the corrected transient fault characteristics. Obtain the attention mechanism parameters updated in the previous diagnostic process, and based on the attention mechanism parameters, assign weights to the corrected transient fault features through the attention mechanism to obtain weighted transient fault features. Obtain the updated classifier parameters from the previous diagnostic process, and based on the classifier parameters, use a fault classifier to identify the fault type of the weighted transient fault features to obtain the fault diagnosis result. Based on the error between the fault diagnosis result and the actual result, the PID parameters, the attention mechanism parameters, and the classifier parameters are updated.
2. The power grid fault diagnosis method according to claim 1, characterized in that, The steps of acquiring key electrical quantity time-series data and denoising the key electrical quantity time-series data include: Key electrical quantity time-series data within 0-2 cycles after the fault occurs, including voltage time-series data, current time-series data, and power time-series data; The electrical quantity time series data is reconstructed using wavelet functions to obtain the denoised signal.
3. The power grid fault diagnosis method according to claim 1, characterized in that, The transient fault features are extracted from the denoised electrical quantity time-series data; The steps of obtaining the updated PID parameters from the previous diagnostic process, and correcting the transient fault characteristics using an incremental PID controller based on the PID parameters to obtain the corrected transient fault characteristics include: Obtain the reference vector of the electrical quantity time series data; Based on the denoised electrical quantity time-series data, a transient fault feature vector is obtained; Calculate the feature deviation between the transient fault feature vector and the reference vector; The incremental PID controller is used to correct the characteristic deviation, thereby obtaining the corrected transient fault characteristics.
4. The power grid fault diagnosis method according to claim 1, characterized in that, The step of obtaining the attention mechanism parameters obtained from the previous diagnostic process, and then, based on these parameters, assigning weights to the corrected transient fault features through the attention mechanism to obtain weighted transient fault features includes: The modified transient fault features are linearly mapped to obtain the mapped transient fault features. The transient fault characteristics of the mapping are constrained by a constraint function to obtain an attention score; The modified transient fault features are multiplied element-wise with the attention scores to obtain weighted transient fault features.
5. The power grid fault diagnosis method according to claim 1, characterized in that, The steps of obtaining the updated classifier parameters from the previous diagnostic process, and identifying the fault type based on the weighted transient fault features using a fault classifier to obtain the fault diagnosis result include: The weighted transient fault characteristics are linearly transformed to obtain intermediate variables; The intermediate variables are transformed by the fault classifier to obtain the probability distribution results of each type of fault. Determine whether the current fault diagnosis meets the preset convergence conditions; If yes, then the fault type with the highest probability of failure will be output as the result of this fault diagnosis. If not, update the incremental PID parameters, the attention mechanism parameters, and the classifier parameters for processing electrical quantity time-series data.
6. The power grid fault diagnosis method according to claim 5, characterized in that, The convergence conditions include: Reaching the maximum number of iterations; or Reaching the maximum iteration time; or The probability of the most likely fault type is greater than the preset threshold.
7. The power grid fault diagnosis method according to claim 1, characterized in that, The step of updating the PID parameters, the attention mechanism parameters, and the classifier parameters based on the error between the diagnostic result and the true result includes: The error value of the probability distribution results of each type of fault is quantified by the cross-entropy loss function; The error value is minimized using gradient descent, and the incremental PID parameters, attention mechanism parameters, and classifier parameters are optimized based on the error value and the gradient information it contains.
8. A power grid fault diagnosis device, characterized in that, The device includes: The data acquisition module is used to acquire key electrical quantity time-series data, and to denoise the key electrical quantity time-series data to obtain denoised electrical quantity time-series data. The fault diagnosis module extracts transient fault features from the denoised electrical quantity time-series data; Obtain the updated PID parameters from the previous diagnostic process, and correct the transient fault characteristics based on the PID parameters using an incremental PID controller to obtain the corrected transient fault characteristics. Obtain the attention mechanism parameters updated in the previous diagnostic process, and based on the attention mechanism parameters, assign weights to the corrected transient fault features through the attention mechanism to obtain weighted transient fault features. Obtain the updated classifier parameters from the previous diagnostic process, and based on the classifier parameters, use a fault classifier to identify the fault type of the weighted transient fault features to obtain the fault diagnosis result. The parameter update module is used to update the PID parameters, the attention mechanism parameters, and the classifier parameters based on the error between the diagnostic results and the true results.
9. A computer device, characterized in that, The computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the power grid fault diagnosis method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the power grid fault diagnosis method as described in any one of claims 1 to 7.