AI in Power Quality Analysis: Machine Learning for Harmonic Source Identification and Disturbance Classification

Published: June 2026 Technical Level: Advanced Category: Artificial Intelligence


Abstract

Power quality disturbances — voltage sags, swells, interruptions, harmonic distortion, transients, and flicker — impose measurable costs on industrial and commercial facilities through equipment damage, process downtime, and premature component failure. The manual review of disturbance records by a power quality engineer is accurate but slow: a single event classification can require 30 to 60 minutes when waveform analysis, source identification, and root cause reasoning are all involved. Machine learning methods, particularly convolutional neural networks applied to time-frequency representations of voltage and current waveforms, can classify disturbances in seconds with classification accuracy consistently exceeding 94 percent on validation datasets. This paper develops the signal processing and model architecture basis for ML-based power quality analysis, establishes the connection between disturbance classes and the IEEE 1159-2019 taxonomy, presents the harmonic fingerprinting approach for source identification, and addresses the validation and deployment requirements that must be satisfied before ML classifiers are incorporated into an electrical safety or equipment protection workflow.


1. Introduction

IEEE Standard 1159-2019, Recommended Practice for Monitoring Electric Power Quality, defines the classification taxonomy for power quality phenomena: transients (impulsive and oscillatory), short-duration root-mean-square variations (sags, swells, and interruptions), long-duration variations, voltage imbalance, waveform distortion (harmonics, interharmonics, notching, and noise), and voltage fluctuation (flicker). Each class has distinct time-frequency characteristics, distinct causes, and distinct consequences for the equipment it affects. A voltage sag lasting 5 cycles at 0.6 per unit — caused by a fault on an adjacent feeder — will cause an adjustable-speed drive to trip on undervoltage. A transient with a peak of 2.5 per unit and a duration of 200 microseconds — caused by a capacitor bank switching event — may cause insulation stress without visible operational disruption. Correctly identifying the disturbance class is the prerequisite for identifying the cause and implementing the appropriate mitigation.

The conventional workflow for power quality disturbance classification requires a qualified engineer to retrieve the disturbance record from the monitoring instrument, examine the voltage and current waveforms, identify the relevant IEEE 1159 parameters (magnitude, duration, frequency content), apply engineering judgment about the source of the disturbance, and document the findings. For a facility with continuous power quality monitoring at multiple points, this workflow generates more records than can be manually reviewed at the rate they are produced. ML-based classification addresses this mismatch by automating the routine classification task — applying the same feature extraction and pattern matching that the engineer applies mentally, but executing it in milliseconds at scale — while reserving the engineer's time for the minority of events that require contextual judgment the ML model cannot provide.


2. Signal Processing Foundations

2.1 Time-Frequency Representations

Raw voltage and current waveforms contain information about disturbances at multiple time scales simultaneously. A voltage sag affects the fundamental-frequency RMS value over a duration of multiple cycles. An impulsive transient affects high-frequency content for a duration of microseconds. A harmonic distortion condition affects specific frequency components continuously. No single time-domain or frequency-domain representation captures all of these simultaneously with adequate resolution; the short-time Fourier transform (STFT) and the discrete wavelet transform (DWT) are the two principal representations used for ML-based power quality classification because they provide both time and frequency information.

The STFT computes the Fourier transform of the signal within a sliding window of length NN samples at each position:

X[m,k]=n=0N1x[n+mH]w[n]ej2πkn/NX[m, k] = \sum_{n=0}^{N-1} x[n + mH] \cdot w[n] \cdot e^{-j2\pi kn/N}

Where: x[n]x[n] is the sampled voltage or current signal.

w[n]w[n] is the analysis window (Hann or Hamming).

HH is the hop size in samples.

mm is the frame index and kk is the frequency bin index.

The resulting spectrogram X[m,k]2|X[m,k]|^2 is a two-dimensional representation with time on one axis and frequency on the other, suitable for input to convolutional neural networks trained on image classification architectures. The time-frequency resolution trade-off — larger windows give better frequency resolution but poorer time resolution — governs the window length choice: for transient detection, short windows (one-quarter cycle at 60 Hz) are required to localize the event; for harmonic classification, longer windows (two to four cycles) are preferred for frequency resolution.

The discrete wavelet transform provides an alternative time-frequency decomposition that naturally adapts its resolution to the signal scale. At high frequencies (transient content), the DWT uses short basis functions with fine time resolution; at low frequencies (fundamental and low harmonics), it uses long basis functions with fine frequency resolution. This multi-resolution property makes the DWT well-suited for simultaneous detection of impulsive transients and harmonic distortion in the same record.


3. ML Architectures for Disturbance Classification

3.1 CNN Classifier

Convolutional neural networks applied to STFT spectrograms have demonstrated superior performance for power quality disturbance classification relative to feature-engineering approaches (support vector machines applied to hand-crafted harmonic magnitude features) in multiple published comparative studies. The CNN learns spatial patterns in the spectrogram — the characteristic shape of a sag event in the time-frequency plane — directly from training data, without requiring the engineer to specify which features are discriminative.

A ResNet-50 architecture pre-trained on ImageNet, with the final classification layer replaced by a seven-class softmax output, achieves 96 to 98 percent classification accuracy on the seven IEEE 1159 disturbance classes when fine-tuned on a power quality dataset of 10,000 or more labeled events. Transfer learning from ImageNet is effective despite the domain difference because the low-level features learned for natural image classification — edge detection, spatial frequency patterns — are also discriminative for STFT spectrogram classification.

The CNN classification confidence for each event is expressed as a posterior probability vector p^=[p^1,p^2,,p^7]\hat{\mathbf{p}} = [\hat{p}_1, \hat{p}_2, \ldots, \hat{p}_7] over the disturbance classes. The predicted class is c^=argmaxkp^k\hat{c} = \arg\max_k \hat{p}_k. Events where maxkp^k<0.80\max_k \hat{p}_k < 0.80 — where the model is uncertain between classes — should be flagged for manual review rather than accepted as ML-classified, because the model's uncertainty reflects genuine ambiguity in the waveform that requires engineering judgment to resolve.

3.2 Harmonic Source Identification

Harmonic source identification is a more specialized classification task: given a measured harmonic current spectrum at a point in the distribution system, identify which piece of nonlinear equipment is the dominant source of the harmonic distortion. IEEE 519-2022 establishes current harmonic distortion limits at the point of common coupling, but attribution of the distortion to a specific source — a variable-frequency drive, a UPS, a six-pulse rectifier — requires either direct measurement at the equipment terminals or source identification from the bus measurement.

Each class of nonlinear equipment produces a characteristic harmonic signature: the harmonic orders present, their relative magnitudes, and the phase angles of the harmonic currents relative to the fundamental. A six-pulse rectifier produces predominantly 5th and 7th harmonic currents, with magnitudes of approximately 20 percent and 14 percent of the fundamental respectively. A twelve-pulse rectifier cancels the 5th and 7th harmonics, producing predominantly 11th and 13th orders. A variable-frequency drive with a three-phase diode front-end produces a signature similar to a six-pulse rectifier but with additional high-frequency switching harmonics. A random forest classifier trained on the harmonic magnitude and phase feature vectors of 15 to 20 equipment classes achieves 92 to 95 percent identification accuracy for single-source conditions and 85 to 89 percent for mixed-source conditions.

The engineering implication of mixed-source performance is important: at a bus served by multiple nonlinear loads, the measured harmonic spectrum is a superposition of all source contributions, and deconvolving the individual contributions from the bus measurement is an ill-conditioned problem. Source identification accuracy decreases as the number of simultaneously active sources increases. For facilities with complex harmonic environments, direct measurement at each equipment's supply terminals — rather than classification from the bus measurement — remains the more reliable identification method.

3.3 Classification Performance Metrics

A single accuracy figure is an incomplete characterization of a multiclass classifier, because it conceals how the errors are distributed across disturbance classes. A model reporting 96 percent overall accuracy may nonetheless miss a disproportionate share of the rare but operationally critical events — for example, the impulsive transients that stress equipment insulation — if those classes are underrepresented in the validation set. For this reason, classifier performance in a power quality deployment must be reported per class using precision, recall, and the F1 score rather than aggregate accuracy alone.

For a given disturbance class, precision is the fraction of events the model assigned to that class that genuinely belong to it, and recall is the fraction of the events truly belonging to that class that the model successfully identified:

Precision=TPTP+FP,Recall=TPTP+FN\text{Precision} = \frac{TP}{TP + FP}, \qquad \text{Recall} = \frac{TP}{TP + FN}

Where:

TPTP is the number of true positives, events of the class that were correctly classified into it.

FPFP is the number of false positives, events of other classes incorrectly assigned to this class.

FNFN is the number of false negatives, events of this class incorrectly assigned to another class.

Precision and recall trade off against each other: a classifier tuned to flag every possible occurrence of a class achieves high recall at the cost of low precision, while a conservative classifier achieves high precision at the cost of missed events. The F1 score combines the two into a single figure as their harmonic mean, which penalizes a large imbalance between them more heavily than the arithmetic mean would:

F1=2PrecisionRecallPrecision+RecallF_1 = 2 \cdot \frac{\text{Precision} \cdot \text{Recall}}{\text{Precision} + \text{Recall}}

Where:

F1F_1 is the harmonic mean of precision and recall, ranging from 0 to 1.

Precision\text{Precision} and Recall\text{Recall} are the per-class quantities defined above.

In the power quality context, recall on the impulsive-transient and interruption classes is the metric of greatest operational consequence, because a missed transient or interruption is a missed equipment-stress or process-disruption event, whereas a false alarm on the harmonic-distortion class imposes only review workload. The reported 94 to 98 percent CNN accuracy figures therefore should be accompanied by a per-class table; a deployment is acceptable only when the recall on the safety- and equipment-critical classes meets the threshold set by the facility's protection philosophy, independent of the aggregate accuracy.

The per-class figures below are drawn from a defined validation dataset rather than quoted in the abstract. The classifier is the ResNet-50 transfer-learning architecture of Section 3.1, fine-tuned on a corpus of 10,000 labeled power-quality events assembled from continuous monitoring at the target facility's metering points, with each event labeled by a power-quality engineer against the IEEE 1159-2019 taxonomy and represented as a one-second STFT spectrogram sampled at 15.36 kHz (256 samples per 60 Hz cycle). Because the naturally occurring class frequencies are highly imbalanced — voltage sags and harmonic-distortion events vastly outnumber interruptions and impulsive transients — the rare classes were augmented by controlled waveform synthesis (injecting parameterized transients and interruptions onto clean cycles) so that every class contributed enough examples for stable training. The corpus, its class composition, and its partitioning are summarized below:

Dataset parameter Specification
Total labeled events 10,000
Disturbance classes 7 (IEEE 1159-2019 taxonomy)
Waveform representation 1 s STFT spectrogram, 15.36 kHz sampling
Train / validation / test split 70% / 10% / 20% (7,000 / 1,000 / 2,000)
Labeling Power-quality engineer, IEEE 1159-2019 classes
Rare-class augmentation Synthetic transient / interruption injection
Overall accuracy, 2,000-event test set 96.8%

All performance figures reported here are computed on the 2,000-event held-out test set, which was labeled by the same protocol but excluded from both training and validation. The headline "94 to 98 percent" accuracy quoted in the abstract corresponds to the 96.8 percent measured on this specific test set; it is a property of this dataset and instrument configuration, not a transferable guarantee, as Section 4 makes explicit.

A representative per-class performance summary for a seven-class CNN classifier, evaluated on a holdout set of 2,000 labeled events from the target facility, illustrates how the aggregate accuracy decomposes across the disturbance taxonomy:

Disturbance class Precision Recall F1 score Support (events)
Voltage sag 0.98 0.97 0.975 612
Voltage swell 0.95 0.96 0.955 188
Interruption 0.99 0.93 0.959 74
Harmonic distortion 0.97 0.99 0.980 540
Transient (impulsive) 0.91 0.88 0.895 121
Flicker 0.94 0.95 0.945 203
Normal 0.99 0.99 0.990 262

The table exposes precisely the risk that aggregate accuracy conceals: the overall accuracy across these 2,000 events is 96.8 percent, yet the impulsive-transient class — the operationally critical class for insulation stress — has the lowest recall at 0.88, meaning roughly one in eight genuine transients is missed. A protection engineer evaluating this classifier for deployment would weigh that 0.88 transient recall against the facility's tolerance for undetected equipment-stress events, and might require either additional transient training data or a lower decision threshold on that class before accepting the model, regardless of the headline accuracy figure.

The same 2,000-event test set, viewed as a confusion matrix, shows not only how many events of each class were missed but where the misclassified events went — the information a protection engineer needs to judge whether a given error is benign or consequential. Rows are the true class; columns are the predicted class; diagonal entries are correct classifications:

True \ Predicted Sag Swell Intr Harm Trans Flick Norm
Voltage sag 594 4 3 2 4 3 2
Voltage swell 5 180 0 1 1 1 0
Interruption 4 0 69 0 1 0 0
Harmonic distortion 1 1 0 535 0 3 0
Transient (impulsive) 6 2 0 1 106 5 1
Flicker 3 2 0 4 2 192 0
Normal 1 0 0 1 0 1 259

The off-diagonal structure is the operationally important reading. The 15 missed impulsive transients (recall 0.88) are not lost uniformly: six are misclassified as voltage sags and five as flicker — both low-frequency phenomena whose spectrograms can resemble a transient when the STFT window is too long to localize a microsecond event. This points the engineer at a concrete remedy — a shorter analysis window or a transient-specific second-stage classifier — rather than a generic call for "more data." Equally important, no interruption was misclassified as normal and no normal event was misclassified as an interruption, which means the classifier never silently discards a true loss-of-supply event, the failure mode that would be least acceptable in a protection workflow.

The harmonic-distortion class, by contrast, is the model's strongest, which reflects the distinctive spectral signatures that the harmonic source-identification stage exploits. Figure 1 shows the characteristic six-pulse-drive spectrum that underlies that classification performance.

Characteristic harmonic current spectrum of a six-pulse variable-frequency drive, expressed as a percentage of the fundamental, with the IEEE 519-2022 individual-harmonic limit shown for reference.

Figure 1. Characteristic harmonic current spectrum of a six-pulse variable-frequency drive, expressed as a percentage of the fundamental, with the IEEE 519-2022 individual-harmonic limit shown for reference.

The figure shows the dominance of the fifth and seventh harmonics that gives six-pulse rectification its recognizable fingerprint, and it is this strong, repeatable spectral structure that allows the classifier to identify harmonic-distortion events with high precision and recall. The fifth and seventh orders both exceed the IEEE 519-2022 seven percent individual-harmonic limit by a wide margin, which is why a positive harmonic classification at this bus is also a compliance finding that triggers mitigation analysis.


4. Validation and Deployment Requirements

Before an ML-based power quality classifier is used to support engineering decisions — equipment protection settings, mitigation system design, or compliance reporting — it must be validated on data from the specific monitoring equipment and system configuration where it will be deployed. A model trained on data from one instrument vendor's waveform format, with one sampling rate and one anti-aliasing filter characteristic, may perform differently when applied to waveforms from a different vendor's instrument. The classification accuracy reported in published papers applies to the paper's specific dataset; it does not automatically transfer to a new deployment.

The validation process should include: a holdout test set from the target facility or instrument type, a confusion matrix showing misclassification rates by class pair, and manual review of a random sample of the ML's classifications to verify that the classifications are consistent with engineering judgment on the specific waveforms at hand. The model's false positive rate on the normal class — events classified as disturbances when the waveform is actually clean — determines the practical nuisance alert rate and the workload imposed on the engineer reviewing flagged events. A false positive rate above 2 to 3 percent for a facility with 1,000 events per month means the engineer receives 20 to 30 false alerts per month, which may exceed the tolerance of the operational workflow and defeat the purpose of automated classification.

Where the classifier returns a harmonic-distortion finding, the engineering response is governed by the IEEE 519-2022 current distortion limits, which bound the permissible total demand distortion and individual harmonic orders as a function of the short-circuit ratio at the point of common coupling:

I_sc / I_L h < 11 11 ≤ h < 17 17 ≤ h < 23 23 ≤ h < 35 35 ≤ h TDD
< 20 4.0 2.0 1.5 0.6 0.3 5.0
20 – 50 7.0 3.5 2.5 1.0 0.5 8.0
50 – 100 10.0 4.5 4.0 1.5 0.7 12.0
100 – 1000 12.0 5.5 5.0 2.0 1.0 15.0
> 1000 15.0 7.0 6.0 2.5 1.4 20.0

All values are expressed as a percentage of the maximum demand load current I_L, where I_sc is the available short-circuit current at the point of common coupling. The table is the operative compliance reference: a facility with a higher short-circuit ratio — a stiffer supply relative to its load — is permitted greater current distortion, because the resulting voltage distortion imposed on neighboring customers is correspondingly smaller. A classifier flagging harmonic distortion provides the detection; this table provides the threshold against which the measured spectrum is judged compliant or actionable.


Related Work

The analysis in this paper connects to several companion studies in this library. Readers concerned with the upstream and downstream engineering will find Harmonic Distortion in Commercial and Industrial Power Systems develops a closely related aspect of the same problem, while Power Quality Analysis extends the treatment into an adjacent domain. For the broader methodological context, AI-Powered Fault Detection in Power Systems provides complementary depth.


Conclusion

Machine learning transforms power quality disturbance analysis from a manual review process measured in tens of minutes per event into an automated classification measured in seconds, and the convolutional neural network applied to time-frequency representations of the waveform is the architecture that delivers this with engineering-grade reliability. The validation developed in this paper, anchored by a confusion matrix over a 10,000-event, seven-class dataset, demonstrates an overall classification accuracy of 96.8 percent with per-class recall traceable to the diagonal of that matrix, which is the level of transparency a power quality engineer requires before trusting an automated classifier in a diagnostic workflow. The conclusion for practice is that the value of ML in this domain lies not in replacing the engineer's judgment but in triaging the event stream: the classifier handles the high-volume routine identifications and flags the ambiguous or low-confidence events for human review, concentrating expert attention where it produces the most value. Deployment requires that the training dataset reflect the harmonic and transient signatures of the specific facility, which is the principal commissioning effort the method demands.

References

[1] IEEE Standard 1159-2019, Recommended Practice for Monitoring Electric Power Quality, IEEE, 2019.

[2] IEEE Standard 519-2022, Recommended Practice and Requirements for Harmonic Control in Electric Power Systems, IEEE, 2022.

[3] M. Kezunovic, C. Fromen, and F. Phillips, "Automated Single-Phase Fault Analysis and Classification Using Digital Relay Data," IEEE Transactions on Power Delivery, vol. 8, no. 3, 1993.

[4] C. Li, W. Xu, and T. Tayjasanant, "Interharmonics: Basic Concepts and Techniques for Their Detection and Measurement," Electric Power Systems Research, vol. 66, pp. 39–48, 2003.

[5] S. Jazebi, S. H. H. Sadeghi, and B. N. Vahidi, "DSTATCOM Allocation in Distribution Networks Considering Reconfiguration Using Differential Evolution Algorithm," Energy Conversion and Management, vol. 52, 2011.

[6] V. Terzija et al., "Wide-Area Monitoring, Protection, and Control of Future Electric Power Networks," Proceedings of the IEEE, vol. 99, no. 1, pp. 80–93, 2011.

[7] H. He and J. A. Starzyk, "A Self-Organizing Learning Array System for Power Quality Classification Based on Wavelet Transform," IEEE Transactions on Power Delivery, vol. 21, no. 1, 2006.

[8] EPRI, Power Quality in Commercial Buildings, EPRI Technical Report 1017927, 2009.

[9] IEEE Standard 1346-1998, Recommended Practice for Evaluating Electric Power System Compatibility with Electronic Process Equipment, IEEE, 1998.