Artificial Intelligence-Based Power Quality Disturbance Identification and Location Method
By combining adaptive wavelet threshold denoising and curvature change boundary detection with multi-resolution time-frequency analysis, along with deep learning models and Bayesian inference, the noise interference and boundary localization problems in power quality disturbance identification and localization are solved, achieving high-precision disturbance identification and localization and improving the reliability and accuracy of the system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-10
- Publication Date
- 2026-04-03
AI Technical Summary
Existing technologies for power quality disturbance identification and location suffer from problems such as improper noise interference handling, inaccurate disturbance boundary positioning, inconsistency in identification and location due to the separation of identification and location tasks, and uncertainty in results, which cannot meet the rapid identification and location requirements of complex power systems.
An adaptive wavelet threshold denoising and curvature abrupt boundary detection combined with multi-resolution time-frequency analysis are employed. A deep learning model is used for disturbance feature extraction and identification and localization. The output confidence is estimated using a cross-scale attention mechanism and Bayesian inference. A method for power quality disturbance identification and localization is constructed.
It significantly improves the identification and location accuracy of power quality disturbances, can work stably in complex noise environments, provides reliable quantification of identification and location results, and enhances the reliability of the system.
Smart Images

Figure CN121278664B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of artificial intelligence technology, specifically relating to an artificial intelligence-based method for identifying and locating power quality disturbances. Background Technology
[0002] Power quality disturbances can be caused by a variety of factors, such as equipment failure, external grid interference, and load fluctuations, and exhibit different characteristics in different parts of the power system. Power quality disturbances not only affect the stability and security of the power system but can also have serious impacts on industrial production, commercial operations, and household life. With the increasing complexity of power systems, especially the integration of new energy sources and the gradual increase in the types and number of power equipment, the types and patterns of disturbances are becoming increasingly diverse. Traditional power quality monitoring methods often rely on manual inspections and single, traditional power quality analysis equipment. These methods are not only inefficient but also carry a significant risk of misjudgment and cannot meet the needs of rapidly changing power systems for disturbance identification and location.
[0003] Existing time-frequency analysis methods typically employ fixed windows, which cannot simultaneously extract features from different types of disturbances, thus limiting the accuracy of identification and localization. Denoising techniques often fail to effectively preserve the details of voltage abrupt changes, especially in noisy conditions, leading to disturbance boundary localization failures or misjudgments. Separating identification and localization tasks without optimizing the correlation between tasks results in insufficient localization accuracy or inconsistencies between identification and localization results. The lack of confidence estimation for identification and localization results and the absence of quantification of system output uncertainty make the results unreliable in complex situations, making it difficult to determine the accuracy of the system output.
[0004] Therefore, there is an urgent need to develop an artificial intelligence-based method for identifying and locating power quality disturbances in order to effectively solve the above problems. Summary of the Invention
[0005] The purpose of this invention is to provide an artificial intelligence-based method for identifying and locating power quality disturbances, in order to solve the problems of effectively removing noise interference, accurately locating disturbance boundaries, and precisely matching identification and location results.
[0006] This invention is achieved through the following technical solution:
[0007] An artificial intelligence-based method for identifying and locating power quality disturbances includes the following steps:
[0008] S1. Construct a power quality disturbance signal dataset:
[0009] The system acquires voltage signals, collects samples and generates simulated disturbance data, simulates voltage waveforms under different load conditions and noise environments, labels each sample with disturbance type and disturbance start and end time points, and divides the dataset.
[0010] S2. Segmented preprocessing of power quality disturbance voltage data:
[0011] First, noise reduction is performed using adaptive wavelet thresholding to preserve details of voltage abrupt changes. Then, curvature abrupt change boundary detection and dynamic segmentation of data blocks are performed.
[0012] S3. Time-frequency joint feature enhancement and perturbation-sensitive region coding:
[0013] Extract multi-resolution time-frequency features, generate phase consistency features, encode location-sensitive regions, and generate gradient-sensitive location heatmaps;
[0014] S4. Construct a deep learning model for identifying and locating power quality disturbances:
[0015] First, the fundamental frequency and distortion features are separated using a harmonic mask matrix. A cross-scale attention mechanism is then employed to fuse multi-scale semantic information, mining decoupled and cross-scale features of the disturbance. Next, a gated temporal convolutional network with a shared backbone is used, combined with positional encoding to generate dedicated features for identification and localization, completing the construction and feature fusion of a dual-task shared backbone network. Then, based on the feature vectors from the identification and localization tasks, a multi-task cross-attention mechanism is used to fuse the identification and localization features. Bayesian inference is used to estimate the output confidence, achieving power quality disturbance identification and localization. Loss function calculation is performed. Finally, iterative training and parameter updates of the deep learning model are conducted.
[0016] S5. Identify and locate power quality disturbances.
[0017] Further, in step S1, the data acquisition obtains voltage signals through actual power system monitoring equipment, the sampling frequency is set to 12.8kHz, each sample contains 8192 sampling points, and the dataset is divided into training set, validation set and test set in a ratio of 7:2:1. The training set is used for model parameter learning, the validation set is used for hyperparameter tuning and training process monitoring, and the test set is used for final performance evaluation.
[0018] Further, step S2 specifically includes the following steps:
[0019] S21. Adaptive wavelet threshold denoising:
[0020] By applying discrete wavelet transform to decompose the high-frequency detail coefficients of the original voltage sequence, dynamically adjusting the threshold scaling factor according to the local standard deviation of the high-frequency detail coefficients, and then using the indicator function to perform threshold processing on the detail coefficients, sparse and edge-preserving processed detail coefficients are generated, thus achieving noise suppression while preserving the details of voltage abrupt changes.
[0021] S22, Curvature Abrupt Boundary Detection:
[0022] The second derivative curvature value is calculated based on the denoised voltage sequence. The detection threshold is dynamically determined based on the mean and median absolute deviation of the curvature value. The abrupt change point is identified by comparing the curvature value with the threshold as the segment boundary point, so as to accurately locate the start and end position of the disturbance.
[0023] Further, step S3 specifically includes the following steps:
[0024] S31. Multi-resolution time-frequency feature extraction:
[0025] A multi-scale time-frequency representation of segmented voltage sequences is generated using variable window short-time Fourier transform. The weights are calculated by Softmax normalization based on the signal-to-noise ratio under each window, and the time-frequency energies of different windows are weighted and fused to obtain a multi-resolution time-frequency matrix, which avoids the limitations of fixed windows and enhances feature representation.
[0026] S32. Phase Consistency Feature Generation:
[0027] The phase difference between adjacent frequency channels is calculated based on the phase angle of the multi-resolution time-frequency matrix. The phase difference probability distribution is normalized and then the entropy value of the distribution is calculated. At the same time, the second time derivative of the time-frequency matrix value at the fundamental frequency is calculated. The entropy value and curvature are weighted and fused to generate phase consistency characteristics, quantify the phase distortion caused by the disturbance and enhance the sensitivity.
[0028] S33, Location-Sensitive Area Coding:
[0029] The gradient magnitude matrix is calculated based on the partial derivatives of the multi-resolution time-frequency matrix in the time and frequency directions. The phase consistency feature is scaled and exponentially transformed and then multiplied element-wise with the gradient magnitude matrix. The SoftArgMax function is then applied to generate a positioning heatmap, highlighting the disturbance-sensitive area and providing positioning supervision signals.
[0030] Further, step S4 specifically includes the following steps:
[0031] S41. Disturbance feature decoupling and cross-scale feature mining: The fundamental wave and distortion features are separated by using a harmonic mask matrix, and multi-scale semantic information is fused through a cross-scale attention mechanism to eliminate feature coupling interference.
[0032] S42. Dual-task shared backbone network construction and feature fusion: A gated temporal convolution shared backbone is adopted, combined with position encoding separation to generate special features for recognition and localization, so as to achieve dual-task collaborative optimization;
[0033] S43, Power quality disturbance identification and power quality disturbance localization: Based on the feature vectors of the identification and localization tasks, the identification and localization features are fused through a multi-task cross-attention mechanism to enhance the consistency between tasks, and Bayesian inference is used to estimate the output confidence.
[0034] S44. Calculate the loss function;
[0035] S45. Deep Learning Model Iterative Training and Parameter Update: An adaptive moment estimation optimizer is used to update model parameters. The gradient of the loss function with respect to the model parameters is calculated using the backpropagation algorithm, and the learning rate is dynamically adjusted using the first and second moments of the gradient. During training, the training set data is input into the model, and forward propagation is used to obtain the recognition probability, localization time, and confidence. Then, the recognition loss and localization loss are calculated, and the total loss function is the weighted sum of the recognition loss and localization loss. After each iteration, the parameter update is based on the calculated gradient. The learning rate is initially set to 0.001 and decays using a cosine annealing strategy. The comprehensive performance indicators on the validation set are monitored during the training process, including recognition accuracy and localization mean absolute error. Training is stopped when the validation set loss no longer decreases within 10 consecutive cycles or reaches the maximum number of iterations (1000), and the model from the last iteration is saved as the completed model.
[0036] Furthermore, step S41 specifically includes the following steps:
[0037] S411, Frequency Domain Feature Decoupling:
[0038] By using trainable weights and bias parameters, combined with phase consistency features and frequency information, a harmonic mask matrix is generated. Then, it is mapped by the Sigmoid activation function and multiplied element-wise with the multi-resolution time-frequency matrix. At the same time, the fundamental wave component is added to the result with weights to achieve frequency domain feature decoupling and eliminate coupling interference.
[0039] S412, Cross-scale feature attention-weighted fusion:
[0040] The harmonic feature matrix is downsampled to generate multi-scale feature maps. After concatenating the features of each scale, a convolutional block attention module is applied to enhance the discriminative power of the features. The importance weights of each scale are calculated through trainable parameters, and the cross-scale attention features are obtained by weighted summation to mine deep semantic information.
[0041] Furthermore, step S42 specifically includes the following steps:
[0042] S421, Shared temporal convolutional backbone:
[0043] Using cross-scale attention features and localization heatmaps as input, features are extracted through stacking causal convolutions with different dilation rates. Then, gated convolutions are applied to generate gated signals, and the Sigmoid activation function is used to control the information flow. The weighted output is a shared feature representation matrix, which achieves long-range dependency capture and location detail preservation.
[0044] S422, Dual-task feature separation and fusion:
[0045] The recognition task feature vector is generated by splicing the shared features and the element-wise product of the localization heatmap and the global average pooling shared features. At the same time, the localization task feature vector is generated by using the element-wise product of the weighted shared features with the localization heatmap processed by the multilayer perceptron. This achieves the separation and fusion of dual-task dedicated features.
[0046] Furthermore, step S43 specifically includes the following steps:
[0047] S431, Multi-task cross-attention recognition:
[0048] Based on the feature vectors of the recognition task and the feature vector of the localization task, the cross-attention weight is calculated through the query-key attention mechanism, and the recognition and localization features are weighted and fused. Then, the bilinear transformation and the Softmax function are applied to generate the probability distribution of the perturbation category, which enhances the utilization of localization information by the recognition task.
[0049] S432, Gated Spatiotemporal Positioning Regression:
[0050] Based on the feature vectors of the localization task and the feature vectors of the recognition task, the spatiotemporal information flow is controlled by a gating mechanism, and the spatiotemporal convolution and sigmoid function are applied to generate normalized start and end times. Finally, the time is scaled to the actual time range to achieve localization.
[0051] S433, Bayesian confidence estimation:
[0052] Based on the feature vectors of the recognition task and the feature vector of the localization task, the variance of recognition and localization is estimated through a fully connected layer and the Softplus activation function, and then the joint confidence is calculated as the output uncertainty measure.
[0053] Furthermore, step S44 specifically includes the following steps:
[0054] S441. Calculation of recognition loss:
[0055] Based on the feature vector of the recognition task and the true label, the recognition loss is calculated by uncertainty-weighted negative log-likelihood loss. The classification loss weight is adjusted by using the recognition variance. At the same time, a variance regularization term is added to avoid excessive increase of variance and enhance the model's ability to model recognition uncertainty.
[0056] S442. Positioning loss calculation:
[0057] Based on the feature vector of the positioning task and the actual start and end times, the positioning loss is calculated by heteroscedastic regression loss. The positioning variance weighted mean square error is used, and a variance regularization term is added to achieve a balance between positioning error and uncertainty.
[0058] Further, step S5 specifically includes the following steps: After the model training is completed, for a new power quality disturbance voltage signal, the voltage data is first preprocessed by segmentation, including adaptive wavelet threshold denoising and curvature change boundary detection, to obtain a segmented voltage sequence; then, time-frequency joint feature enhancement and disturbance sensitive area encoding are performed to generate a multi-resolution time-frequency matrix, phase consistency features, and location heatmap; then, the processed features are input into the trained deep learning model for forward propagation, and the model outputs the disturbance category probability distribution, disturbance start and end times, and joint confidence; finally, the category with the highest probability is selected as the recognition result, and the start and end times are mapped back to the actual time point to complete the identification and location of the power quality disturbance; if the joint confidence is lower than the threshold of 0.7, the sample is marked as a low-confidence sample.
[0059] Compared with the prior art, the beneficial effects of the present invention are:
[0060] 1. This invention significantly improves the identification and positioning accuracy of power quality disturbances through adaptive denoising processing, accurate boundary detection, and multi-resolution time-frequency feature extraction, and can still work stably in complex noise environments;
[0061] 2. In this invention, the combination of adaptive wavelet denoising and dynamic segmentation effectively suppresses noise interference and maintains the edge characteristics of voltage change points, overcoming the edge smoothing problem caused by fixed threshold processing in traditional denoising methods.
[0062] 3. In this invention, the dual-task shared network optimizes the disturbance identification and localization tasks collaboratively, enabling the network to simultaneously consider the classification and temporal localization of disturbances, thus avoiding the performance loss caused by task separation in traditional methods.
[0063] 4. Through Bayesian inference, the system can output confidence estimates, providing a reliable quantification of identification and localization results, which effectively improves the reliability of the system, especially in high-noise or complex environments. Attached Figure Description
[0064] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0065] Figure 1 This is a comparison chart of the original voltage signal and the noisy signal;
[0066] Figure 2 Comparison chart of the effects of different noise reduction methods;
[0067] Figure 3 This is a diagram showing the results of curvature abrupt change boundary detection.
[0068] Figure 4 A performance comparison chart of different boundary detection methods;
[0069] Figure 5 This is a comparison chart showing the accuracy of different methods in identifying power quality disturbances. Detailed Implementation
[0070] The present invention will be further described below with reference to embodiments:
[0071] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, the accompanying drawings show only the parts relevant to the present invention, and not all of the structures.
[0072] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, in the description of this invention, terms such as "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0073] This invention provides an artificial intelligence-based method for power quality disturbance identification and localization. By combining adaptive wavelet threshold denoising and curvature change boundary detection, it accurately preserves the details of voltage change points, solving the problems of noise interference and disturbance boundary localization. This innovation enables accurate identification of the start and end times of disturbances even in high-noise environments. A multi-resolution time-frequency analysis method is employed, combined with phase consistency features, to generate a localization heatmap, overcoming the limitations of fixed-window time-frequency resolution and effectively enhancing the representational capability of time-frequency features at multiple scales, thus improving the accuracy of disturbance localization. Through a shared temporal convolutional network combined with positional encoding, collaborative optimization of the two tasks of disturbance identification and localization is achieved. This network controls the information flow through a gating mechanism and weightedly fuses multi-scale features, improving the interdependence and performance of the two tasks and resolving the feature coupling problem. Bayesian confidence estimation is used in the output of disturbance identification and localization to quantify the uncertainty of the results, effectively solving the mismatch between identification and localization results and making the system output more reliable.
[0074] Specifically, it includes the following steps:
[0075] S1. Construct a power quality disturbance signal dataset:
[0076] Data acquisition uses voltage signals obtained from actual power system monitoring equipment. The sampling frequency is set to 12.8kHz, and each sample contains 8192 sampling points, corresponding to a time window of 0.64 seconds, to capture the complete dynamic process of disturbance events. At the same time, to enhance data diversity and model generalization ability, simulated disturbance data is generated based on the IEEE1159-2019 standard to simulate voltage waveforms under different load conditions and noise environments, including steady-state and transient disturbance scenarios.
[0077] Data annotation was done manually by experts in the power field, who labeled each sample with the disturbance type and the start and end times of the disturbance. The disturbance types include eight categories: transient sag, transient rise, interruption, harmonic, gap, transient pulse, transient oscillation and flicker. They are represented by one-hot encoding, and the start and end times are recorded precisely in the form of sampling point index.
[0078] The dataset is divided into training, validation, and test sets in a 7:2:1 ratio. The training set is used for model parameter learning, the validation set is used for hyperparameter tuning and training process monitoring, and the test set is used for final performance evaluation, thus ensuring the comprehensiveness and reliability of the dataset.
[0079] S2. Segmented preprocessing of power quality disturbance voltage data:
[0080] Power quality disturbance identification faces the dual challenges of disturbance features being masked by strong noise interference and steep gradients at the start and end points of disturbances being easily smoothed. Conventional sliding window segmentation methods using fixed threshold denoising weaken the steep characteristics of voltage change edges, leading to localization failure. At the same time, fixed window lengths are difficult to adapt to the time scale differences of different types of disturbances such as sags and harmonics, resulting in feature extraction distortion.
[0081] This invention solves the problems of noise interference and disturbance boundary localization by preserving voltage change details through adaptive wavelet threshold denoising and combining curvature change detection with dynamic segmentation of data blocks. The specific steps are as follows:
[0082] S21. Adaptive wavelet threshold denoising:
[0083] By applying discrete wavelet transform to decompose the high-frequency detail coefficients of the original voltage sequence, and dynamically adjusting the threshold scaling factor based on the local standard deviation of the high-frequency detail coefficients, and then using an indicator function to perform thresholding on the detail coefficients, sparse and edge-preserving processed detail coefficients are generated. This achieves noise suppression while retaining details of voltage abrupt changes, as expressed in:
[0084] ;
[0085] In the formula, The detail coefficients after thresholding in the j-th level wavelet decomposition have sparsity and edge preservation properties, effectively suppressing noise while preserving abrupt change points;
[0086] For time indexing, the default value range is from 1 to... ;
[0087] This is the wavelet decomposition layer index, with values ranging from 1 to... ;
[0088] This is the maximum number of decomposition levels; the default value is 4.
[0089] For the first The layer detail coefficients, generated by discrete wavelet transform, contain high-frequency noise and abrupt change information. Specifically, the high-frequency detail coefficients are obtained by performing discrete wavelet transform on the original voltage sequence using the Mallat algorithm, and then decomposing it layer by layer.
[0090] This is an indicator function that outputs 1 when the internal condition is true, and 0 otherwise;
[0091] Let be the adaptive threshold scaling factor for the j-th level wavelet decomposition, dynamically adjusted based on the statistical characteristics of the detail coefficients to adapt to the noise levels of different decomposition levels. The calculation method is expressed as follows:
[0092] ;
[0093] The standard deviation of the detail coefficients of the j-th layer represents the noise intensity of that layer. Specifically, it is obtained by calculating the local standard deviation of the detail coefficients of the j-th layer through a sliding window of preset length.
[0094] This is the length of the original voltage sequence, which defaults to 8192.
[0095] It is an L1 norm;
[0096] It is an L2 norm;
[0097] This is an empirically adjustable parameter, with a value ranging from 0.8 to 1.2, used to adjust the balance between noise reduction intensity and edge preservation;
[0098] It represents the natural logarithm.
[0099] S22, Curvature Abrupt Boundary Detection:
[0100] The second derivative curvature value is calculated based on the denoised voltage sequence. The detection threshold is dynamically determined according to the mean and median absolute deviation of the curvature value. Abrupt change points are identified by comparing the curvature value with the threshold, serving as segment boundary points. This achieves precise location of the start and end positions of the disturbance, expressed as:
[0101] ;
[0102] In the formula, It is a set of segmented boundary points, representing the set of critical points where the voltage waveform undergoes drastic changes. It has time accuracy and disturbance sensitivity, and can accurately mark the start and end times of disturbances.
[0103] Let be the curvature value at point k, calculated by the absolute value of the second derivative of the voltage sequence, characterizing the steepness of the voltage change; the larger the value, the more obvious the abrupt change.
[0104] Curvature sequence abbreviation;
[0105] The mean curvature value reflects the average level of the overall curvature, and is calculated as follows:
[0106] ;
[0107] The median of the absolute deviation of curvature is used to measure the degree of dispersion of curvature.
[0108] The dynamic threshold coefficient ranges from 1.5 to 2.5 and is adaptively adjusted according to the signal-to-noise ratio to control the sensitivity of boundary detection. The preferred value is 2.0, which achieves a balance between sensitivity and noise immunity.
[0109] The amplitude of the denoised voltage sequence at the k-th sampling point is represented by the detail coefficients after thresholding following the j-th level wavelet decomposition. The original approximation coefficients are reconstructed using an inverse wavelet transform. The reconstruction method is expressed as follows:
[0110] ;
[0111] Represents the inverse discrete wavelet transform;
[0112] This represents the set of all thresholded detail coefficients from layer 1 to layer J;
[0113] The approximate coefficients of the J-th level wavelet decomposition are generated by discrete wavelet transform;
[0114] It is a second-order central difference operator. The discrete form is , used to approximate the calculation of curvature;
[0115] To denoise the voltage sequence in the first... The amplitude of each sampling point;
[0116] To denoise the voltage sequence in the first... The amplitude of each sampling point;
[0117] This is a median function.
[0118] In one embodiment, the effectiveness of the adaptive wavelet threshold denoising and curvature change boundary detection method proposed in the voltage signal preprocessing stage of this invention is verified. The experiment compares the performance differences in noise suppression and boundary preservation between the traditional sliding window denoising method and the adaptive wavelet denoising method of this invention, and also compares the performance of different boundary detection methods in terms of disturbance start and end point localization accuracy. Traditional sliding window denoising uses mean filtering with a fixed window size. This simple denoising method smooths the edges of voltage changes, leading to blurred disturbance boundaries. While fixed threshold and gradient detection methods are commonly used boundary detection methods, the former is sensitive to noise, and the latter is prone to false detections under disturbance conditions. The experimental configuration simulates a voltage sag disturbance scenario in a real power system, with a signal fundamental frequency of 50 Hz, 8912 sampling points, and a time window of 0.64 seconds. Strong noise interference is added to the voltage sag disturbance signal, with a sag amplitude of 30% of the normal voltage and a duration of approximately 0.2 seconds. Figure 1 As shown in the figure, the experiment demonstrates a comparison between the original clean signal and the noisy signal. The clean signal, relative to the noisy signal, refers to the clean voltage sag signal, clearly showing the impact of noise on signal quality. The effects of different denoising methods are compared. Figure 2 As shown, while traditional sliding window denoising smooths the noise, it produces a noticeable transition band at the boundary between the start and end of the disturbance. In contrast, the method of this invention effectively suppresses noise while better preserving the steep characteristics of voltage abrupt changes. The curvature abrupt change detection effect is shown in the figure. Figure 3 The figure shows the curvature value change calculated based on the denoised voltage sequence. The red dashed line represents the dynamically determined detection threshold, and the red scatter dots mark the detected boundary points. As can be seen from the figure, the curvature value shows significant peaks at the beginning and end of the disturbance, exceeding the detection threshold, which highly matches the actual disturbance range. Performance comparison of different boundary detection methods is also provided. Figure 4 As shown, the performance of different methods was quantitatively compared using three metrics: precision, recall, and F1 score. The curvature mutation method of this invention significantly outperforms traditional methods in all three metrics, demonstrating its superiority in perturbation boundary localization. The entire experiment verified the technical advantage of the preprocessing method of this invention in accurately identifying perturbation boundaries even in strong noise environments.
[0119] S3. Time-frequency joint feature enhancement and perturbation-sensitive region coding:
[0120] The short-time Fourier transform, which uses a fixed analysis window, cannot simultaneously meet the feature extraction requirements of both short-time impulse disturbances and long-time harmonic disturbances, resulting in a single resolution of time-frequency representation and a lack of location information.
[0121] This invention employs multi-resolution time-frequency analysis to fuse phase consistency features, generating gradient-sensitive localization heatmaps, overcoming the limitations of fixed-window time-frequency resolution. The specific steps are as follows:
[0122] S31. Multi-resolution time-frequency feature extraction:
[0123] A multi-scale time-frequency representation of the piecewise voltage sequence is generated using variable-window short-time Fourier transform. Weights are calculated based on the signal-to-noise ratio (SNR) of each window using Softmax normalization. The time-frequency energies of different windows are then weighted and fused to obtain a multi-resolution time-frequency matrix. This addresses the limitations of fixed-window representation and enhances feature representation, as shown below:
[0124] ;
[0125] In the formula, It is a multi-resolution time-frequency matrix. Represents the multi-resolution time-frequency matrix at frequency and The value at time t represents the signal at a specific frequency. and The time-frequency energy distribution at time t has multi-scale resolution and frequency weighting characteristics, with dimensions of . ;
[0126] This is a frequency index, with values ranging from 1 to F;
[0127] F is the frequency dimension, which is the total number of frequency points;
[0128] The time dimension, i.e., the total number of time points;
[0129] To distinguish from The time index corresponds to the segmented voltage sequence. The point in time;
[0130] This is the window index, with values ranging from 1 to W;
[0131] W represents the number of windows, i.e., the total number of different window sizes used;
[0132] The weights for window w are calculated using Softmax normalization of the signal-to-noise ratio and are used for weighted fusion of time-frequency representations from different windows. The calculation method is as follows:
[0133] ;
[0134] In the formula, To distinguish it from the window index of w, the value ranges from 1 to W;
[0135] This indicates that the short-time Fourier transform of window w is used to generate the time-frequency representation under that window.
[0136] A piecewise voltage sequence is formed by using the set of segment boundary points. The adaptive-length data blocks obtained by segmenting the original voltage sequence, and the set of segment boundary points. The boundary points in the segmented voltage sequence define the start and end positions of each data block. It is a voltage data block obtained by dividing the data at boundary points;
[0137] The temperature coefficient is preferably set to 5.0, which is used to control the sharpness of the weight distribution.
[0138] Let w be the signal-to-noise ratio under window w, used to evaluate the signal quality of that window. The calculation method is expressed as follows:
[0139] ;
[0140] In the formula, The signal power within window w is determined by the segmented voltage sequence. The time-frequency representation is obtained by taking the square mean.
[0141] The noise power is obtained by calculating the power of the voltage sequence during periods of no disturbance.
[0142] Display window Signal-to-noise ratio at the following levels;
[0143] Represents the natural constant.
[0144] S32. Phase Consistency Feature Generation:
[0145] The phase difference between adjacent frequency channels is calculated based on the phase angle of the multi-resolution time-frequency matrix. This is normalized to form a phase difference probability distribution. Then, the entropy value of this distribution is calculated, along with the second-order time derivative of the time-frequency matrix value at the fundamental frequency. The entropy value and curvature are weighted and fused to generate phase consistency features, quantifying phase distortion caused by perturbations and enhancing sensitivity. This is expressed as:
[0146] ;
[0147] In the formula, The phase consistency characteristic value at time t is considered in conjunction with both the phase distribution entropy and the second time derivative at the fundamental frequency, thus enhancing the sensitivity to transient disturbances.
[0148] The normalized phase difference probability represents the frequency at time t. and frequency The proportion of the phase difference between two frequencies to the sum of the phase differences of all adjacent frequencies is calculated as follows:
[0149] ;
[0150] In the formula, Phase angle operator;
[0151] This is the fundamental frequency index, which defaults to 50Hz.
[0152] Represents the multi-resolution time-frequency matrix at frequency and The time-frequency matrix value at time 1;
[0153] Represents the multi-resolution time-frequency matrix at frequency and The time-frequency matrix value at time 1;
[0154] Represents the multi-resolution time-frequency matrix at frequency and The time-frequency matrix value at time 1;
[0155] Represents the multi-resolution time-frequency matrix at frequency and The time-frequency matrix value at time 1;
[0156] To distinguish from The frequency index, with values ranging from 1 to F;
[0157] The second-order partial derivative operator with respect to time is used to calculate the curvature of the time-frequency matrix value at the fundamental frequency.
[0158] To integrate the weighting coefficients and balance the contributions of phase coherence entropy and fundamental frequency curvature, the preferred value is [value missing]. ;
[0159] To ensure smoothness and prevent division by zero errors, a value of [value to be filled in] is preferred. .
[0160] S33, Location-Sensitive Area Coding:
[0161] The gradient magnitude matrix is calculated based on the partial derivatives of the multi-resolution time-frequency matrix in the time and frequency directions. The phase consistency feature is scaled and exponentially transformed, then multiplied element-wise with the gradient magnitude matrix. Finally, the SoftArgMax function is applied to generate a location heatmap, highlighting disturbance-sensitive areas and providing location monitoring signals. This is represented as:
[0162] ;
[0163] In the formula, The time-frequency gradient magnitude matrix, The time-frequency gradient magnitude matrix in Time and The value at a frequency represents the degree of drastic change in time-frequency energy in both time and frequency directions, and is calculated as follows:
[0164] ;
[0165] In the formula, The time-frequency joint gradient operator is defined as the partial derivatives of the multi-resolution time-frequency matrix in the time and frequency directions, used to calculate the gradient. Indicating multi-resolution time-frequency matrix in The gradient vector at the location;
[0166] This is the Hadamard product, i.e., element-wise multiplication;
[0167] It is a natural exponential function;
[0168] This is a scaling factor for phase consistency characteristics, used to adjust the weight of the time series vector in the heatmap;
[0169] The phase-consistency time series vector is composed of the phase-consistency eigenvalues at all times. The t-th element of the phase-consistency time series vector is... ;
[0170] It is the L1 norm, used to calculate the sum of the absolute values of the gradient vectors, and is used to aggregate gradient information;
[0171] To locate the heat map, it includes both gradient information and phase consistency features to highlight areas sensitive to disturbances;
[0172] This is a temperature parameter, preferably set to 0.1, used to control the sharpness of the SoftArgMax output; the smaller the value, the sharper the output.
[0173] It is a differentiable position aggregation function, also known as the SoftArgMax function, whose output is a heatmap.
[0174] S4. Construct a deep learning model for identifying and locating power quality disturbances:
[0175] S41. Perturbation Feature Decoupling and Cross-Scale Feature Mining:
[0176] The fundamental component of the disturbance is coupled with the harmonic distortion characteristics, making it difficult for conventional methods to effectively separate the interference components. Furthermore, deep networks lose shallow-layer location details, leading to confusion in identification and location deviation.
[0177] This invention utilizes a harmonic mask matrix to separate the fundamental frequency and distortion features, and fuses multi-scale semantic information through a cross-scale attention mechanism to eliminate feature coupling interference. The specific steps are as follows:
[0178] S411, Frequency Domain Feature Decoupling:
[0179] Using trainable weights and bias parameters, a harmonic mask matrix is generated by combining phase consistency features and frequency information. Then, it is mapped using a sigmoid activation function and multiplied element-wise with a multi-resolution time-frequency matrix. Simultaneously, the fundamental component is weighted and added to the result to achieve frequency domain feature decoupling and eliminate coupling interference, as shown below:
[0180] ;
[0181] In the formula, It is a harmonic characteristic matrix that contains both harmonic components and retains fundamental perturbation information;
[0182] This is the fundamental perturbation enhancement coefficient, preferably 0.6, used to adjust the weight of the fundamental component in the harmonic characteristic matrix and avoid loss of fundamental information;
[0183] Represents the fundamental frequency in the multi-resolution time-frequency matrix Row vectors of the time-frequency matrix corresponding to all time points;
[0184] This is the Hadamard product, i.e., element-wise multiplication;
[0185] The harmonic mask matrix, generated using the sigmoid activation function, is used to selectively preserve harmonic correlation features. The harmonic mask matrix has frequency... and The value at time t is ;
[0186] For the harmonic mask matrix at frequency and The value at time t is calculated as follows: ;
[0187] The Sigmoid activation function maps the input to the interval between 0 and 1.
[0188] The harmonic mask weight matrix is a trainable parameter used to learn the mapping from phase consistency and frequency information to mask values.
[0189] This represents the phase consistency eigenvalue at time t. With frequency index Concatenate them into a vector;
[0190] The bias parameter representing the harmonic mask is a trainable parameter used to adjust the baseline value of the mask.
[0191] S412, Cross-scale feature attention-weighted fusion:
[0192] The harmonic feature matrix is downsampled to generate multi-scale feature maps. Then, features from each scale are concatenated and a convolutional block attention module is applied to enhance feature discriminative power. The importance weights of each scale are calculated using trainable parameters, and a weighted sum is obtained to obtain cross-scale attention features, thereby mining deeper semantic information. This is represented as:
[0193] ;
[0194] In the formula, To weight and fuse attention features, the key semantic information of the perturbation is represented at multiple scales;
[0195] For feature splicing operations;
[0196] This is a scale index, with values of 1, 2, and 3. Corresponding to coarse resolution features, Corresponding to medium resolution features Corresponding to fine-resolution features;
[0197] To distinguish it from the scale index of s;
[0198] Represents the harmonic characteristic matrix In the The scaled version, through the harmonic characteristic matrix Downsampling is performed to obtain features at different resolutions;
[0199] The total number of dimensions is preferably 3, representing the number of layers in the pyramid;
[0200] Let be the weight for the s-th scale. The importance of each scale is learned through an attention mechanism to balance the contribution of features at different scales. The calculation method is expressed as follows:
[0201] ;
[0202] In the formula, It is a convolutional block attention module that applies both channel and spatial attention to enhance the discriminative ability of features;
[0203] For the feature map at scale s, the harmonic feature matrix is analyzed. Obtained by multi-scale downsampling;
[0204] This is an importance weight vector, consisting of trainable parameters used to calculate the importance score at each scale. for transpose;
[0205] Let be the transformation weight matrix at scale s, and be trainable parameters used for the feature linear transformation;
[0206] Indicates the first The transformation weight matrix of the scale is a trainable parameter used for feature linear transformation;
[0207] Indicates the first The feature map of the scale, through the harmonic feature matrix Obtained by multi-scale downsampling;
[0208] To modify the activation function of the linear unit;
[0209] It is a natural exponential function.
[0210] In practical implementation, the multi-scale downsampling operation uses pyramid pooling on the harmonic feature matrix. The process involves generating feature maps at different resolutions. Corresponding to the original resolution, This corresponds to downsampling to half the resolution. This corresponds to downsampling to one-quarter resolution.
[0211] It should be noted that the convolutional block attention module It includes channel attention and spatial attention. Channel attention generates channel weights through global average pooling and fully connected layers, while spatial attention generates spatial weights through convolution operations.
[0212] S42. Construction and Feature Fusion of Dual-Task Shared Backbone Network:
[0213] Disturbance recognition and localization tasks require sharing low-level features but separating high-level semantics. Conventional single-task networks cannot optimize both objectives simultaneously, and deep features lack position awareness.
[0214] This invention employs gated temporal convolution with a shared backbone, combined with positional encoding separation to generate dedicated features for recognition and localization, achieving collaborative optimization of dual tasks. The specific steps are as follows:
[0215] S421, Shared temporal convolutional backbone:
[0216] Using cross-scale attention features and localization heatmaps as input, features are extracted through stacked causal convolutions with different dilation rates. Then, gated convolutions are applied to generate gated signals, and the information flow is controlled using a sigmoid activation function. The weighted output is a shared feature representation matrix, achieving long-range dependency capture and location detail preservation, as shown below:
[0217] ;
[0218] In the formula, The shared feature representation matrix has dimensions of . It captures long-range temporal dependencies through dilated causal convolution and integrates a gating mechanism to control the information flow while preserving details of perturbation locations;
[0219] This is the expansion rate index, with values ranging from 1 to D;
[0220] This is the number of dilatation rate levels, preferably 5, to expand the receptive field;
[0221] Indicates the concatenation operator;
[0222] A causal convolution with an inflation rate of d is used to capture multi-scale temporal patterns;
[0223] These are the gated convolution weight parameters, which are trainable parameters used for linear transformations;
[0224] This indicates a convolution operation used to calculate the gate signal;
[0225] The bias parameters for the gated convolution are trainable parameters used to adjust the gate threshold.
[0226] S422, Dual-task feature separation and fusion:
[0227] The recognition task feature vector is generated by concatenating the shared features and the element-wise product of the localization heatmap and the globally average pooled shared features. Simultaneously, the localization task feature vector is generated by element-wise multiplying the balanced coefficient weighted shared features with the features processed by the multilayer perceptron after processing the localization heatmap. This achieves the separation and fusion of dual-task dedicated features, as shown below:
[0228] ;
[0229] ;
[0230] In the formula, To identify the task feature vector, it is obtained by concatenating shared features and global features modulated by position coding, focusing on perturbation type discrimination;
[0231] This is the Hadamard product, i.e., element-wise multiplication;
[0232] The balancing coefficient is used to adjust the weights of shared features and location encoding in the feature vector of the localization task;
[0233] For global average pooling;
[0234] To locate the feature vector of the task, it is obtained by weighted fusion of shared features and location encoding, focusing on perturbation-time-location regression;
[0235] For feature splicing operations;
[0236] It is a multilayer perceptron, with an input layer, a hidden layer and an output layer. The activation function is the sigmoid activation function, which is used to process position encoding and generate modulation weights.
[0237] S43, Power quality disturbance identification and power quality disturbance location
[0238] Power quality disturbance identification and localization needs to address the issues of low identification confidence and insufficient localization accuracy. Conventional methods handle identification and localization tasks separately, ignoring the correlation between tasks and lacking output uncertainty quantification, resulting in inconsistencies between identification results and localization boundaries.
[0239] This invention is based on feature vectors from recognition and localization tasks. It fuses recognition and localization features through a multi-task cross-attention mechanism to enhance consistency between tasks. At the same time, it uses Bayesian inference to estimate the output confidence to solve the mismatch problem between recognition and localization results. The specific steps are as follows:
[0240] S431, Multi-task cross-attention recognition:
[0241] Based on the feature vectors of the recognition task and the localization task, cross-attention weights are calculated through a query-key-value attention mechanism. These weighted features are then fused together. Finally, a bilinear transform and a softmax function are applied to generate a probability distribution for perturbation categories, enhancing the utilization of localization information by the recognition task. This is expressed as:
[0242] ;
[0243] In the formula, Let be the probability value of the c-th category, representing the confidence level of the perturbation type as the c-th category, exhibiting task cross-reinforcement characteristics, with dimensions of . ;
[0244] This is the perturbation category index, with values ranging from 1 to... ;
[0245] To distinguish from The perturbation category index, with values ranging from 1 to ;
[0246] This represents the total number of disturbance categories, with a default value of 8, corresponding to 8 categories: transient slump, transient rise, interruption, harmonic, gap, transient pulse, transient oscillation, and flicker.
[0247] To identify the temperature coefficient and control the sharpness of the probability distribution, a value of 1.0 is preferred.
[0248] Let be the bilinear weight matrix for the c-th category, which are trainable parameters used to capture the interaction information between recognition and localization features;
[0249] Let be the recognition weight vector for the c-th category, which is a trainable parameter used for linear transformation of recognition features;
[0250] Let be the localization weight vector for the c-th category, which is a trainable parameter used for linear transformation of localization features;
[0251] is the bias term for the c-th class, which is a trainable parameter used to adjust the baseline probability of the class;
[0252] For the first The bilinear weight matrix for each category consists of trainable parameters.
[0253] For the first The recognition weight vectors for each category are trainable parameters;
[0254] For the first The localization weight vectors for each category are trainable parameters;
[0255] For the first The bias terms for each category are trainable parameters.
[0256] S432, Gated Spatiotemporal Positioning Regression:
[0257] Based on the feature vectors of the localization task and the recognition task, a gating mechanism is used to control the spatiotemporal information flow. Spatiotemporal convolution and the sigmoid function are applied to generate normalized start and end times. Finally, the data is scaled to the actual time range to achieve high-precision localization, as shown below:
[0258] ;
[0259] In the formula, The disturbance start time is the absolute time point that characterizes the initial moment of the disturbance, and it has gating enhancement characteristics.
[0260] The disturbance end time is the absolute time point that characterizes the moment the disturbance ends, and it has gating enhancement characteristics;
[0261] The gating positioning weight matrix is a trainable parameter used for linear transformation of the gating features;
[0262] It is the hyperbolic tangent activation function;
[0263] The attention weight matrix consists of trainable parameters used to generate gating signals from the recognized features.
[0264] The attention bias vector is a trainable parameter used to adjust the gating baseline.
[0265] The gated positioning bias vector is a trainable parameter used to adjust the time output reference.
[0266] S433, Bayesian confidence estimation:
[0267] Based on the feature vectors of the recognition task and the localization task, the variances of recognition and localization are estimated through a fully connected layer and the Softplus activation function. Then, the joint confidence score is calculated as an output uncertainty measure to solve the inconsistency problem between recognition and localization results, expressed as:
[0268] ;
[0269] In the formula, The joint confidence score characterizes the overall reliability of the identification and localization results; a higher value indicates a more reliable result.
[0270] This is the confidence scaling factor, used to adjust the confidence range; a value of 0.5 is preferred.
[0271] The confidence weight vector is a trainable parameter used for linear transformation to identify features.
[0272] for transpose;
[0273] The location confidence weight vector is a trainable parameter used for linear transformation of location features;
[0274] for transpose;
[0275] The confidence bias term is a trainable parameter used to adjust the confidence baseline.
[0276] This is the variance scaling factor, used to control the impact of variance on the confidence level; a value of 0.1 is preferred.
[0277] To identify the variance, it is estimated using the feature vector of the identification task, expressed as:
[0278] ;
[0279] The localization variance is estimated using the feature vectors of the localization task, and is expressed as:
[0280] ;
[0281] This is the Softplus activation function;
[0282] The variance weight vector is a trainable parameter;
[0283] for transpose;
[0284] To identify the variance bias term, these are trainable parameters;
[0285] The variance weight vector is a trainable parameter.
[0286] for transpose;
[0287] The localization variance bias term is a trainable parameter.
[0288] S44. Loss Function Calculation:
[0289] The identification and location of power quality disturbances need to address the issues of low identification confidence and insufficient location accuracy.
[0290] This invention improves model performance by combining a multi-task loss function with uncertainty estimation. The specific steps are as follows:
[0291] S441. Calculation of recognition loss:
[0292] Based on the feature vectors of the recognition task and the true labels, the recognition loss is calculated using uncertainty-weighted negative log-likelihood loss. The classification loss weights are adjusted using the recognition variance, and a variance regularization term is added to avoid excessive variance increase, thereby enhancing the model's ability to model recognition uncertainty. This is expressed as follows:
[0293] ;
[0294] In the formula, To identify the loss, the error in the model's identification of the perturbation type is characterized by uncertainty weighting.
[0295] The first for the real label The category indicator takes a value of 0 or 1, indicating whether the sample belongs to the category. Disturbance categories;
[0296] To identify the uncertainty scaling factor used to adjust the impact of variance on loss, a value of 1.0 is preferred;
[0297] To identify the variance regularization coefficient, which controls the weight of the variance term in the loss, a value of 0.5 is preferred;
[0298] It is a logarithmic function, with the default base being the natural constant.
[0299] S442. Positioning loss calculation:
[0300] Based on the feature vector of the positioning task and the actual start and end times, the positioning loss is calculated using heteroscedastic regression loss. The positioning variance is used to weight the mean squared error, and a variance regularization term is added to achieve a balance between positioning error and uncertainty, expressed as:
[0301] ;
[0302] In the formula, The location loss characterizes the model's error in locating the start and end times of the disturbance and exhibits heteroscedastic regression characteristics.
[0303] For time-type indexes, the value is... or , Corresponding to the start time of the disturbance and the end time of the disturbance , Corresponding to the actual start time of the disturbance and the actual end time of the disturbance ;
[0304] The actual start time of the disturbance is recorded in the form of a sampling point index;
[0305] The actual end time of the disturbance is recorded in the form of a sampling point index;
[0306] To determine the uncertainty scaling factor, which is used to adjust the impact of variance on loss, a value of 1.0 is preferred.
[0307] The variance regularization coefficient is used to control the weight of the variance term in the loss, and a value of 0.5 is preferred.
[0308] S45. Iterative Training and Parameter Update of Deep Learning Models:
[0309] An adaptive moment estimator optimizer is used to update model parameters. The gradient of the loss function with respect to the model parameters is calculated through the backpropagation algorithm, and the learning rate is dynamically adjusted by estimating the first and second moments of the gradient.
[0310] During training, the training set data is input into the model, and forward propagation is used to obtain the recognition probability, localization time, and confidence level. Then, the recognition loss and localization loss are calculated, and the total loss function is obtained. The weighted sum of the identification loss and the location loss is:
[0311] ;
[0312] In the formula, To identify task weight coefficients, To determine the task weight coefficients, the optimal values are as follows: and This is to emphasize the importance of the positioning task.
[0313] After each iteration, the parameters are updated based on the calculated gradient, the learning rate is initially set to 0.001, and a cosine annealing strategy is used to decay the learning rate.
[0314] The training process monitors the comprehensive performance metrics on the validation set, including recognition accuracy and localization mean absolute error. Training stops when the validation set loss no longer decreases within 10 consecutive cycles or reaches the maximum number of iterations of 1000, and the model from the last iteration is saved as the model after training is complete.
[0315] S5. Power quality disturbance identification and location:
[0316] After the model training is completed, for new power quality disturbance voltage signals, the voltage data is first preprocessed by segmentation, including adaptive wavelet threshold denoising and curvature change boundary detection, to obtain segmented voltage sequences.
[0317] Then, joint time-frequency feature enhancement and perturbation-sensitive area coding are performed to generate a multi-resolution time-frequency matrix, phase consistency features, and localization heatmap;
[0318] Then, the processed features are input into the trained deep learning model for forward propagation, and the model outputs the probability distribution of the perturbation category, the start and end time of the perturbation, and the joint confidence.
[0319] Finally, the category with the highest probability is selected as the identification result, and the start and end times are mapped back to the actual time points to complete the identification and location of power quality disturbances;
[0320] If the joint confidence level is below the threshold of 0.7, the sample is marked as a low-confidence sample.
[0321] In one embodiment, a comparative experiment was conducted on the accuracy of different methods in identifying power quality disturbances. The purpose of this experiment was to verify the superiority of the method of the present invention in terms of disturbance identification accuracy. A systematic comparison was performed with three traditional power quality analysis methods, and the comparison results are as follows: Figure 5As shown in the figure, the traditional techniques compared include methods based on wavelet transform and support vector machines (SVMs). These methods first use wavelet transform to extract signal features and then classify them using SVMs. Other methods are based on short-time Fourier transform and convolutional neural networks (SSWs), which use a fixed-window SSW to generate time-frequency maps and then use a convolutional neural network for recognition. Finally, methods are based on empirical mode decomposition (EMD) and long short-term memory (LSTM) networks, which obtain intrinsic mode functions (EMFs) through EMD and then use LSMs to process time-series features. The box plot distribution shows that the accuracy of the method in this invention is significantly higher than other traditional methods. It not only has the highest median accuracy but also the lowest data dispersion, indicating better stability. In the figure, the vertical axis represents the recognition accuracy as a percentage, and the horizontal axis lists the four comparison methods. Each box represents the quartile range of the accuracy. The midline inside the box represents the median, and the upper and lower edges represent the upper and lower quartiles, respectively. The whiskers outside the boxes show the normal range of the data, and the scatter points represent individual experimental data points. The method of this invention effectively preserves perturbation features through adaptive wavelet threshold denoising and curvature change boundary detection. Combined with multi-resolution time-frequency analysis and deep learning models, it significantly improves recognition accuracy and stability.
[0322] Note that the design of the digital prototype model, the parameter settings for each material, and the selection of the measuring plane described above are merely preferred embodiments and technical principles of the present invention. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the appended claims.
Claims
1. A method for identifying and locating power quality disturbances based on artificial intelligence, characterized in that: Includes the following steps: S1. Construct a power quality disturbance signal dataset: The system acquires voltage signals, collects samples and generates simulated disturbance data, simulates voltage waveforms under different load conditions and noise environments, labels each sample with disturbance type and disturbance start and end time points, and divides the dataset. S2. Segmented preprocessing of power quality disturbance voltage data: First, noise reduction is performed using adaptive wavelet thresholding to preserve details of voltage abrupt changes. Then, curvature abrupt change boundary detection and dynamic segmentation of data blocks are performed. S3. Time-frequency joint feature enhancement and perturbation-sensitive region coding: Multi-resolution time-frequency features are extracted, phase consistency features are generated, location-sensitive regions are encoded, and gradient-sensitive location heatmaps are generated. These location heatmaps are used as inputs to the temporal convolutional shared backbone in subsequent models. S4. Construct a deep learning model for identifying and locating power quality disturbances: First, the fundamental frequency and distortion features are separated using a harmonic mask matrix. A cross-scale attention mechanism is then employed to fuse multi-scale semantic information, achieving perturbation feature decoupling and cross-scale feature mining. Next, a gated temporal convolutional shared backbone is used, combined with positional encoding to generate dedicated features for identification and localization, completing the construction of the temporal convolutional shared backbone network and feature fusion. Then, based on the feature vectors from the identification and localization tasks, a multi-task cross-attention mechanism is used to fuse the identification and localization features. Bayesian inference is used to estimate the output confidence, achieving power quality perturbation identification and localization. Loss function calculation is performed. Finally, iterative training and parameter updates of the deep learning model are conducted. S5. Identify and locate power quality disturbances.
2. The method for identifying and locating power quality disturbances based on artificial intelligence according to claim 1, characterized in that: In step S1, the data acquisition uses voltage signals obtained from actual power system monitoring equipment. The sampling frequency is set to 12.8kHz, and each sample contains 8192 sampling points. The dataset is divided into training set, validation set and test set in a ratio of 7:2:
1. The training set is used for model parameter learning, the validation set is used for hyperparameter tuning and training process monitoring, and the test set is used for final performance evaluation.
3. The method for identifying and locating power quality disturbances based on artificial intelligence according to claim 1, characterized in that, Step S2 specifically includes the following steps: S21. Adaptive wavelet threshold denoising: By applying discrete wavelet transform to decompose the high-frequency detail coefficients of the original voltage sequence, dynamically adjusting the threshold scaling factor according to the local standard deviation of the high-frequency detail coefficients, and then using the indicator function to perform threshold processing on the detail coefficients, sparse and edge-preserving processed detail coefficients are generated, thus achieving noise suppression while preserving the details of voltage abrupt changes. S22, Curvature Abrupt Boundary Detection: The second derivative curvature value is calculated based on the denoised voltage sequence. The detection threshold is dynamically determined based on the mean and median absolute deviation of the curvature value. The abrupt change point is identified by comparing the curvature value with the threshold as the segment boundary point, so as to accurately locate the start and end position of the disturbance.
4. The method for identifying and locating power quality disturbances based on artificial intelligence according to claim 1, characterized in that, Step S3 specifically includes the following steps: S31. Multi-resolution time-frequency feature extraction: A multi-scale time-frequency representation of segmented voltage sequences is generated using variable window short-time Fourier transform. The weights are calculated by Softmax normalization based on the signal-to-noise ratio under each window, and the time-frequency energies of different windows are weighted and fused to obtain a multi-resolution time-frequency matrix, which avoids the limitations of fixed windows and enhances feature representation. S32. Phase Consistency Feature Generation: The phase difference between adjacent frequency channels is calculated based on the phase angle of the multi-resolution time-frequency matrix. The phase difference probability distribution is normalized and then the entropy value of the distribution is calculated. At the same time, the second time derivative of the time-frequency matrix value at the fundamental frequency is calculated. The entropy value and curvature are weighted and fused to generate phase consistency characteristics, quantify the phase distortion caused by the disturbance and enhance the sensitivity. S33, Location-Sensitive Area Coding: The gradient magnitude matrix is calculated based on the partial derivatives of the multi-resolution time-frequency matrix in the time and frequency directions. The phase consistency feature is scaled and exponentially transformed and then multiplied element-wise with the gradient magnitude matrix. The SoftArgMax function is then applied to generate a positioning heatmap, highlighting the disturbance-sensitive area and providing positioning supervision signals.
5. The method for identifying and locating power quality disturbances based on artificial intelligence according to claim 1, characterized in that, Step S4 specifically includes the following steps: S41. Disturbance feature decoupling and cross-scale feature mining: The fundamental wave and distortion features are separated by using a harmonic mask matrix, and multi-scale semantic information is fused through a cross-scale attention mechanism to eliminate feature coupling interference. S42. Dual-task shared backbone network construction and feature fusion: A gated temporal convolution shared backbone is adopted, combined with position encoding separation to generate special features for recognition and localization, so as to achieve dual-task collaborative optimization; S43, Power quality disturbance identification and power quality disturbance localization: Based on the feature vectors of the identification and localization tasks, the identification and localization features are fused through a multi-task cross-attention mechanism to enhance the consistency between tasks, and Bayesian inference is used to estimate the output confidence. S44. Calculate the loss function; S45. Deep Learning Model Iterative Training and Parameter Update: An adaptive moment estimation optimizer is used to update model parameters. The gradient of the loss function with respect to the model parameters is calculated using the backpropagation algorithm, and the learning rate is dynamically adjusted using the first and second moments of the gradient. During training, the training set data is input into the model, and forward propagation is used to obtain the recognition probability, localization time, and confidence. Then, the recognition loss and localization loss are calculated, and the total loss function is the weighted sum of the recognition loss and localization loss. After each iteration, the parameter update is based on the calculated gradient. The learning rate is initially set to 0.001 and decays using a cosine annealing strategy. The comprehensive performance indicators on the validation set are monitored during the training process, including recognition accuracy and localization mean absolute error. Training is stopped when the validation set loss no longer decreases within 10 consecutive cycles or reaches the maximum number of iterations (1000), and the model from the last iteration is saved as the completed model.
6. The method for identifying and locating power quality disturbances based on artificial intelligence according to claim 5, characterized in that, Step S41 specifically includes the following steps: S411, Frequency Domain Feature Decoupling: By using trainable weights and bias parameters, combined with phase consistency features and frequency information, a harmonic mask matrix is generated. Then, it is mapped by the Sigmoid activation function and multiplied element-wise with the multi-resolution time-frequency matrix. At the same time, the fundamental wave component is added to the result with weights to achieve frequency domain feature decoupling and eliminate coupling interference. S412, Cross-scale feature attention-weighted fusion: The harmonic feature matrix is downsampled to generate multi-scale feature maps. After concatenating the features of each scale, a convolutional block attention module is applied to enhance the discriminative power of the features. The importance weights of each scale are calculated through trainable parameters, and the cross-scale attention features are obtained by weighted summation to mine deep semantic information.
7. The method for identifying and locating power quality disturbances based on artificial intelligence according to claim 5, characterized in that, Step S42 specifically includes the following steps: S421, Gated Temporal Convolution Sharing Backbone: Using cross-scale attention features and localization heatmaps as input, features are extracted through stacking causal convolutions with different dilation rates. Then, gated convolutions are applied to generate gated signals, and the Sigmoid activation function is used to control the information flow. The weighted output is a shared feature representation matrix, which achieves long-range dependency capture and location detail preservation. S422, Dual-task feature separation and fusion: The localization heatmap is multiplied element-wise with the global average pooling shared features, and then the element-wise multiplication result is concatenated with the shared features to generate a feature vector for the recognition task. The features after the multilayer perceptron processes the localization heatmap are multiplied element-wise with the shared features, and the shared features are weighted with the balance coefficients and the element-wise multiplication result to generate a feature vector for the localization task, thus realizing the separation and fusion of dual-task dedicated features.
8. The method for identifying and locating power quality disturbances based on artificial intelligence according to claim 5, characterized in that, Step S43 specifically includes the following steps: S431, Multi-task cross-attention recognition: Based on the feature vectors of the recognition task and the feature vector of the localization task, the cross-attention weight is calculated through the query-key attention mechanism, and the recognition and localization features are weighted and fused. Then, the bilinear transformation and the Softmax function are applied to generate the probability distribution of the perturbation category, which enhances the utilization of localization information by the recognition task. S432, Gated Spatiotemporal Positioning Regression: Based on the feature vectors of the localization task and the feature vectors of the recognition task, the spatiotemporal information flow is controlled by a gating mechanism, and the spatiotemporal convolution and sigmoid function are applied to generate normalized start and end times. Finally, the time is scaled to the actual time range to achieve localization. S433, Bayesian confidence estimation: Based on the feature vectors of the recognition task and the feature vector of the localization task, the variance of recognition and localization is estimated through a fully connected layer and the Softplus activation function, and then the joint confidence is calculated as the output uncertainty measure.
9. The method for identifying and locating power quality disturbances based on artificial intelligence according to claim 5, characterized in that, Step S44 specifically includes the following steps: S441. Calculation of recognition loss: Based on the feature vector of the recognition task and the true label, the recognition loss is calculated by uncertainty-weighted negative log-likelihood loss. The classification loss weight is adjusted by using the recognition variance. At the same time, a variance regularization term is added to avoid excessive increase of variance and enhance the model's ability to model recognition uncertainty. S442. Positioning loss calculation: Based on the feature vector of the positioning task and the actual start and end times, the positioning loss is calculated using heteroscedastic regression loss. The positioning variance is used to weight the mean squared error, and a variance regularization term is added to achieve a balance between positioning error and uncertainty, expressed as: ; In the formula, The location loss characterizes the model's error in locating the start and end times of the disturbance and exhibits heteroscedastic regression characteristics. u For time-type indexes, the value is... s or e , t u Corresponding to the start time of the disturbance t s and the end time of the disturbance t e , Corresponding to the actual start time of the disturbance and the actual end time of the disturbance ; The actual start time of the disturbance is recorded in the form of a sampling point index; The actual end time of the disturbance is recorded in the form of a sampling point index; To determine the uncertainty scaling factor, which is used to adjust the impact of variance on the loss; This is the variance regularization coefficient, used to control the weight of the variance term in the loss.
10. The method for identifying and locating power quality disturbances based on artificial intelligence according to claim 1, characterized in that, Step S5 specifically includes the following steps: After the model training is completed, for a new power quality disturbance voltage signal, the voltage data is first preprocessed by segmentation, including adaptive wavelet threshold denoising and curvature change boundary detection, to obtain a segmented voltage sequence; then, time-frequency joint feature enhancement and disturbance sensitive area encoding are performed to generate a multi-resolution time-frequency matrix, phase consistency features, and location heatmap; then, the processed features are input into the trained deep learning model for forward propagation, and the model outputs the disturbance category probability distribution, disturbance start and end times, and joint confidence; finally, the category with the highest probability is selected as the recognition result, and the start and end times are mapped back to the actual time point to complete the identification and location of the power quality disturbance; if the joint confidence is lower than the threshold of 0.7, the sample is marked as a low-confidence sample.
Citation Information
Patent Citations
Voltage sag disturbance source positioning and disturbance reason identification method and system
CN118779689A
Electric energy quality composite disturbance detection classification and time positioning method based on MS-TCN + +
CN120632682A