scieee AI-readable full text Open interactive document viewer

Unsupervised Segmentation and Classification of Waveform-Distortion Data Using Non-Active Current

Mariscotti, Andrea

Abstract

Non-active current in the time domain is considered for application to the diagnosticsand classification of loads in power grids based on waveform-distortion characteristics,taking as a working example several recordings of the pantograph current in an AC railwaysystem. Data are processed with a deep autoencoder for feature extraction and thenclustered via k-means to allow identification of patterns in the latent space. Clusteringenables the evaluation of the relationship between the physical meaning and operation ofthe system and the distortion phenomena emerging in the waveforms during operation.Euclidean distance (ED) is used to measure the diversity and pertinence of observationswithin pattern groups and to identify anomalies (abnormal distortion, transients, . . . ).This approach allows the classification of new data by assigning data to clusters basedon proximity to centroids. This unsupervised method exploiting non-active current isnovel and has proven useful for providing data with labels for later supervised learningperformed with the 1D-CNN, which achieved a balanced accuracy of 96.46% under normalconditions. ED and 1D-CNN methods were tested on an additional unlabeled datasetand achieved 89.56% agreement in identifying normal states. Additionally, Grad-CAM,when applied to the 1D-CNN, quantitatively identifies the waveform parts that influencethe model predictions, significantly enhancing the interpretability of the classificationresults. This is particularly useful for obtaining a better understanding of load operation,including anomalies that affect grid stability and energy efficiency. Finally, the method hasbeen also successfully further validated for general applicability with data from a differentscenario (charging of electric vehicles). The method can be applied to load identification andclassification for non-intrusive load monitoring, with the aim of implementing automaticand unsupervised assessment of load behavior, including transient detection, power-qualityissues and improvement in energy efficiency.

Full text

Academic Editor: Michael Negnevitsky Received: 2 June 2025 Revised: 25 June 2025 Accepted: 30 June 2025 Published: 4 July 2025 Citation: Mariscotti, A.; Salles, R.S.; Rönnberg, S. Unsupervised Segmentation and Classification of Waveform-Distortion Data Using Non-Active Current. Energies 2025,18, 3536. https://doi.org/10.3390/ en18133536 Copyright: © 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/ licenses/by/4.0/). Article Unsupervised Segmentation and Classification of Waveform-Distortion Data Using Non-Active Current Andrea Mariscotti 1,* , Rafael S. Salles 2and Sarah K. Rönnberg 2 1 Department of Electrical, Electronic and Telecommunications Engineering, and Naval Architecture (DITEN), University of Genova, 16145 Genova, Italy 2Electric Power Engineering Group, Luleå University of Technology, 93187 Skellefteå, Sweden; [email protected] (R.S.S.); sarah.ronnber[email protected] (S.K.R.) *Correspondence: andr[email protected] Abstract Non-active current in the time domain is considered for application to the diagnostics and classification of loads in power grids based on waveform-distortion characteristics, taking as a working example several recordings of the pantograph current in an AC railway system. Data are processed with a deep autoencoder for feature extraction and then clustered via k-means to allow identification of patterns in the latent space. Clustering enables the evaluation of the relationship between the physical meaning and operation of the system and the distortion phenomena emerging in the waveforms during operation. Euclidean distance (ED) is used to measure the diversity and pertinence of observations within pattern groups and to identify anomalies (abnormal distortion, transients, ... ). This approach allows the classification of new data by assigning data to clusters based on proximity to centroids. This unsupervised method exploiting non-active current is novel and has proven useful for providing data with labels for later supervised learning performed with the 1D-CNN, which achieved a balanced accuracy of 96.46% under normal conditions. ED and 1D-CNN methods were tested on an additional unlabeled dataset and achieved 89.56% agreement in identifying normal states. Additionally, Grad-CAM, when applied to the 1D-CNN, quantitatively identifies the waveform parts that influence the model predictions, significantly enhancing the interpretability of the classification results. This is particularly useful for obtaining a better understanding of load operation, including anomalies that affect grid stability and energy efficiency. Finally, the method has been also successfully further validated for general applicability with data from a different scenario (charging of electric vehicles). The method can be applied to load identification and classification for non-intrusive load monitoring, with the aim of implementing automatic and unsupervised assessment of load behavior, including transient detection, power-quality issues and improvement in energy efficiency. Keywords: anomaly detection; deep learning; electromobility; energy efficiency; load signature; non-intrusive load monitoring; traction power systems 1. Introduction The problem of identifying harmonic sources has been a subject of discussion for a long time, and various approaches have been proposed. Classical approaches used before the advent of neural networks (NN), deep learning (DL) and artificial intelligence (AI) were mostly based on harmonic signatures using active, reactive and distortion power or current Energies 2025,18, 3536 https://doi.org/10.3390/en18133536 Energies 2025,18, 3536 2 of 27 quantities [ 1 , 2 ]. Elaborated transforms have been explored as tools to extract all valuable information from raw signals. These include Fourier transform and its short-time version, S-transform [ 3 , 4 ] and its adaptive version [ 5 ], wavelet transform (WT) [ 4 , 6 ] and empirical mode decomposition (EMD) [ 7 ]. Such methods are particularly attractive when dealing with transient phenomena [ 5 , 8 , 9 ], although there are approaches that involve feeding such transients directly to the NN [ 10 – 12 ]. We emphasize that these approaches have been proposed as tools to classify different power-quality transients [ 10 , 11 ] from a predetermined list; only [ 12 ] addresses anomaly detection applied to the railway environment; however, it focuses on transients identified by the Hilbert transform and uses a supervised method, like a 1D-CNN. This demonstrates the novelty of the present approach, which covers anomalies not previously identified and quantified with an unsupervised approach. Despite the prevalence of a focus on the frequency domain in research produced until the last decade, time-domain (TD) approaches have been also proposed and have become more popular for use in combination with DL [12–14]. Non-intrusive load monitoring (NILM) and distortion classification aim at improving the availability, quality and safety of modern grids [ 15 – 17 ] but face significant challenges in presence of highly dynamic loads and non-ideal grid response. Whereas pure NILM focuses on energy disaggregation of appliances, the use of distortion classification provides important support for disambiguating typical scenarios involving contemporary switching events, similar V-I patterns, etc. Load monitoring and classification can in general support the following features: • grid protection and management (including stability) that are applicable at large scales (e.g., in distribution), but also at the small scale of a microgrid, including renewables and highly dynamic or susceptible loads [18,19]; • control of power flow to improve the quality of service, in particular in terms of voltage fluctuations and transients [20]; • power-quality control encompassing both traditional harmonic distortion and disturbance at higher frequency, which are emerging today as possible threats to grid control and metering that directly affect power-line communication protocols [ 21 – 24 ]; past studies demonstrate that interference with the metering function can occur at various frequency ranges within the harmonic and supraharmonic domains, affecting not only the overall intensity, but also specific parts of the waveform, as in the case of pulsed disturbances [22]; • energy efficiency from a multitude of perspectives: – identification of energy-wasting devices or, in general, devices with less-thanideal power profiles [25]; –demand management and load balancing as part of grid control; – identification of power losses in susceptible grid elements (namely transformers and cables) and in the loads themselves that occur as a consequence of excessive distortion; – correct accounting for harmonic power losses in the estimation of power absorption and energy efficiency [26]; • fair tariffing and billing, associating variable tariffs with the level of load “virtuosity” as soon as a load is connected to the grid; this includes linking tariffs potentially disruptive events that may cause economic losses and also may incentivize improvements in energy efficiency and reduce associated losses. Conversely, at the user level, usage regulation encourages the use of low-price time slots, a change supported by the use of smart meters [25]. Energies 2025,18, 3536 3 of 27 Another interesting application is the monitoring and evaluation of long-term unsupervised power -quality (PQ) measurements as a form of big-data analytics [ 27 ]. A previous application involving transient removal from recorded data in power grids is reported in [28]. Even accurate and sophisticated DL methods can suffer from intrinsic variance in input data (this will be addressed in this work by evaluating the effects of noise in input data) and from the presence of new unlabeled data [ 29 , 30 ] (e.g., a new type of load or an unforeseen operating condition). Focusing on AC railways as a network featuring moving loads (the rolling stock, RS) with variable powering and operating conditions (OCs), this study emphasizes single-point monitoring methods applied at the pantograph interfacing port. While voltage drops can affect voltage values along the contact line (and thus affect the calculated power terms depending on the measurement location in the network), analysis of the pantograph current alone offers an advantage because the pantograph current can be directly related to the line current sourced by the Traction Power Station (TPS), which represents the internal coupling point. In other words, there is a more accurate and direct relationship between the TPS current and the RS pantograph current. RS, with its absorption peaks during tractioning and intense reverse power flow during braking, represents a challenging load, with highly dynamic behavior and continuously changing feeding line impedance as it moves [ 31 ], which cause the voltage-current relationship to change continuously, especially at high frequencies. Complex and varying harmonic patterns occur depending on the variable OCs [ 32 ] and are influenced by the TPS distortion and nearby trains [33]. Basic signal-projection and -classification techniques applied to AC railway data were evaluated in [ 34 ], exploring the benefits of each method (principal component analysis (PCA) and partial least squares regression (PLSR)), and discussing TD features useful for load monitoring and distortion tracking (average and extreme values, slope, intersections, etc.) [35]. The number of candidate features that can be extracted with “classical” methods is large. AI techniques can offer significant support for synthesizing pools of highly informative features [ 36 ]. Such techniques go through suitable projections and data-dimensionality reduction, which are followed by clustering and classification, including identification of anomalies and outliers [ 27 , 36 ]. For example, image-processing techniques may be equally applicable to frequency-domain spectra [ 36 ] and TD waveforms, including V-I trajectories [13,32,37,38]. Information available in TD waveforms can be further exploited by focusing on waveform parts that convey the most relevant information. The advantage of TD waveforms lies in their close relation to load operation, which improves comprehensibility and interpretability for the user. The combinations of information extracted from the TD raw data and possible clustering and classification approaches are countless. Modern artificial intelligence methods may help reduce this complexity, providing effective dimensionality reduction on the one hand and profitable identification of informative features on the other hand [39]. This paper abandons the more classical frequency-domain distortion indexes and discusses the following points: • Non-active current (NAC) provides good classification performance and characterization of waveform distortion (WD). • Classification of unlabeled highly-dimensional WD data with a two-step method: first, dimension reduction using deep autoencoder (DAE) and clustering for OC characterization, labeling and anomaly detection (AD); second, cluster assignment based Energies 2025,18, 3536 4 of 27 on Euclidean distance (ED) for segmentation of new unlabeled data (not clustered or trained); this classification is unsupervised and has diagnostic and interpretative uses. • Alternatively, cluster categorization can be utilized for labeling the data, allowing supervised DL algorithms to train and perform monitoring tasks, since such methods depend on reliable labeling to perform well after training and validation. For that purpose, a 1-D CNN is employed as a benchmark for supervised DL in classification tasks, highlighting the potential of cluster-based labels. • Clustering reveals patterns associated with WD characteristics and system dynamics, including anomalies, thus supporting the identification of outliers without the need for a specific prior criterion. This is a point of novelty with respect to the majority of previous studies and is demonstrated also by considering an additional example, specifically, charging of electric vehicles (EVs). • Assessment of both classification methods using new unseen data from the same system that are not labeled, but are assigned an OC by inspection of data characteristics. • Identification of informative waveform features to provide added value to the supervised classification, focusing on the 1-D CNN and using gradient-weighted class activation mapping (Grad-CAM). The objective is not so much the general classification of PQ disturbances in a power grid, but the characterization of load operation and its changes in OCs to allow the identification of different loads and the separation of anomalous cases, as well as of new, previously unseen loads. This work characterizes WD by segmenting the associated mechanisms with OC variations, allowing unsupervised load characterization. ED allows quantifying the consistency of patterns originating from the same load, including applications for diagnostic purposes, such as identifing outliers and anomalous cases. The overall structure and the main contributions of this work are graphically described in Figure 1. Figure 1. Overall graphical description of the paper structure and organization. Energies 2025,18, 3536 5 of 27 2. Electric System and Related Power Theory This section clarifies the approach to NAC extraction and the characteristics of the studied electric system, which will be relevant in the later discussion of clustering and fingerprinting. 2.1. Time-Domain Non-Active Power Based on Fryze’s theory [ 40 , 41 ], a TD decomposition was applied to the measured i(t)waveforms. Starting from the active current component ip(t) , the NAC iq(t) is then the difference between the total current i(t) and ip(t) . The components ip(t) and iq(t) are orthogonal, so that they can be summed in quadrature. ip(t) = Gv(t)G=P V2(1) where the active power P is directly determined from its TD definition for a sinusoidal signal of period T: P=1 TZt0+T t0 v(t)ip(t)dt(2) The NAC iq(t)is calculated as the difference: iq(t) = i(t)−ip(t)(3) 2.2. Description of the Electric Power System Electrified railway systems (ERSs) feature long line branches (with power distribution mostly through overhead conductors) fed by one or more TPSs. In AC railways, traditional TPSs provide power to the line through transformers, whereas more modern converter-based TPSs interface directly and are a cause of increased background distortion. AC railways may work in synchrony with the national grid (at 50 Hz or 60 Hz ), or autonomously at 16.7 Hz (in central Europe), using their own transmission grids [42]. The electrical interactions among the various elements (national and transmission grids, TPSs, overhead lines, return current circuits, signaling systems, RSs, etc.) can be complex. RSs are moving loads that operate dynamically with traction and braking intervals but also include coasting and standstill. Besides converter-based TPSs, they are the other major source of distortion due to a variety of static power-conversion systems that operate onboard (for traction and auxiliary loads) and have emissions overlapping the background distortion [43]. Identification and assessment of RS distortion has the following technical objectives: • compliance with distortion limits aims at preventing damage to the distribution system and interference with other loads [44]; • distortion limits are also set to limit interference with signaling circuits, such as track circuits [45]; • traction line stability and limitation of overvoltages triggered by RS emissions [ 46 , 47 ]. 3. Segmentation and Classification Method In this work, the DAE is applied to the iq(t) part of the pantograph current, and this step is followed by clustering. In [ 32 ], the DAE was applied to find patterns in WD data of pantograph quantities, showcasing the potential of unsupervised DL and clustering techniques (see Figure 2). While that method effectively characterized WD short-term variations and their relation with OCs, some aspects were not investigated, namely the following: Energies 2025,18, 3536 6 of 27 • how to deal with variability or diversity within a cluster and how to use it to verify new unlabeled data; • the shape and compactness around the clusters’ centroids may be used to identify anomalies and provide information for diagnostic purposes. Figure 2. DAE application to pattern recognition in WD data. This work goes beyond the simple classification task by quantitatively assessing the information conveyed by the various data features, starting the process from the achieved cluster structure in order to provide segmentation of WD data, including AD. This novel approach not only supports robust labeling of data, but also introduces two unique classification methods: • one method is based on the ED of DAE features and predetermined clusters, evaluating the capacity for transferring segmentation knowledge from the unsupervised learning framework to new unlabeled data; • the other method uses a more traditional 1-D CNN, ensuring that labeling can be explored with other DL techniques for independent validation. 3.1. DAE and Clustering for Data Segmentation and Labeling DAE, an unsupervised learning model, is designed to learn a compact input data representation, capturing its significant characteristics and patterns [ 36 ]. This enables the model to achieve dimensionality reduction and feature learning. The architecture consists of an encoder, latent space and a decoder. The choice of DAE over other more traditional methods, such as principal component analysis (PCA), is related to its capacity for modeling complex/complicated non-linear functions with high-dimensional data [ 48 ]. While DAE uses non-linear activation functions, PCA is limited to a linear transformation of data and thus has unavoidable limitations. The encoder, a set of feed-forward filters, transforms the input data into the latent space, where a reduced dimension and a defined number of features represent the data [ 49 ]. Simultaneously, the decoder, a set of reverse filters, produces the input reconstruction. By targeting the input and performing back-propagation during training, the model learns the underlying relevant features of the data. The difference between the reconstructed input and the actual input updates the error term, using metrics like mean squared error (MSE) or cosine similarity (CS), in case of highly-dimensional and noisy data. The encoding step is described by (4): z=f({W,b};u) = σ(Wu +b)(4) Energies 2025,18, 3536 7 of 27 where the input feature vector u is represented by the coded feature vector z , which propagates through the hidden layers. Ware the weights of the network, bis the network biases, and σis an activation function. The decoding step is described by (5) , where the coded feature vector z is mapped back to the higher dimension reconstruction y. y=f(W′,b′;z) = δ(W′z+b′)(5) Table 1describes the architecture and the hyper-parameters used in the DAE. The CS is described by (6) : it assesses the similarity between two vectors, A and B , by calculating the cosine of the angle between them, resulting in almost unity values for similar vectors and towards 0 for dissimilar or orthogonal vectors [50]. CS =A·B ∥A∥∥B∥=∑n i=1AiBi q∑n i=1A2 iq∑n i=1B2 i (6) Table 1. Autoencoder Architecture and Training Hyper-parameters. Layer Type Description Input Layer Input shape: (15,000) Dense (Encoder) 64 units, ReLU activation Dense (Encoder) 32 units, ReLU activation Dense (Encoder) 16 units, ReLU activation Dense (Decoder) 32 units, ReLU activation Dense (Decoder) 64 units, ReLU activation Dense (Decoder) 15,000 units, Linear activation Hyperparameters Optimizer: Adam; Epochs: 150; Learning Rate: 0.001 As illustrated in Figure 2, k-means clustering is applied to the latent space representation of the data that are separated based on the WD characteristics extracted by the DAE. The resulting clusters represent the data segmentation and also provide data labeling, conveying information related to the RS OCs and WD. The k-means clustering algorithm organizes data into a preliminary assigned number of clusters Nc [ 51 ]. It measures similarity using ED and employs centroids to represent each cluster [ 51 , 52 ]. Its choice is motivated by its simplicity of interpretation and implementation, together with the capacity for good performance with large datasets, scalability, and suitability for multiple domains [53]. This approach resembles that used in [ 54 ] for the classification of PQ transients waveforms, although dimensionality reduction is achieved here with the DAE itself and not by applying PCA at the autoencoder output. The PCA and CS were combined in [ 54 ] to associate database labels with the cluster centroids from the observed data. Through this approach, manual analysis of defining the events associated with the clusters is avoided. However, this process requires a dataset with predetermined and reliable labels, and the resultant classification of the clusters is made faster. It is a good alternative for PQ events with such highly distinguishable and separated characteristics, but it is much less effective when only WD characteristics without labels are subject to analysis. Addressing variation of spectral content in the time domain requires that the features captured by the DAE can distinguish unlabeled patterns (not known a priori) with a measurable diagnostic parameter, as proposed in the present work. This process enables the creation of new labels associated with WD features and system characteristics (such as RS type or its OC). The approach in [ 54 ] is appropriate when the objective is to identify patterns and segmenta- Energies 2025,18, 3536 8 of 27 tion with classification based on one type of event (e.g., voltage variations of different magnitudes, such as dips, swells, interruptions, etc.). Since the DAE provides data dimensionality reduction, the predetermined number of clusters to be used in k-means Nc is determined using the Calinski–Harabasz criterion [ 55 ]. The ED metric used by k-means will be further evaluated for AD. 3.2. Suitability of NAC for Fingerprinting Good and consistent performance is provided by the active power index (API), which calculates the active power component Ph at each spectrum frequency bin and is able to track the different behaviors of each component for each type of distortion. The use of various non-active power terms has also been discussed in the literature as an indicator for the identification of disturbing loads, both in the frequency domain [ 56 , 57 ] and in the time domain [58,59]. The problem of selecting informative parts of the spectrum for RS classification was investigated in [34], with the following results: • Active power vs. frequency Ph preserves the sign of power absorption, distinguishing between traction and braking conditions, and has good classification performance, although its performance is not always better than those of harmonic reactive power Qhand harmonic current Ih; • According to the results of Principal Component Analysis (PCA), a small number of the components of the active power spectrum Ph account for the total energy, whereas the components of the reactive power spectrum Qh are more dispersed: the amount of information contained in 20–28 Qh components is equivalent to that contained in just 3Phcomponents; • Partial Least Square Regression (PLSR) has in general better performance than PCA, although not in all cases; • Classification based on harmonic current Ih is consistently better than that based on Qh components, as was also demonstrated by the calculation of the “variable importance in projection” parameter for PLSR. In [ 34 ], the results of the confusion matrices for a wide range of cases (144 for Swiss and German RS) showed that using Ih may nevertheless improve Ph if the data are suitably projected and post-processed, potentially achieving better performance than PCA and PLSR. The use of DAE in the present work is a step in this direction. A similar approach is followed in [59], where the focus is on the first three odd characteristic harmonic waveforms. Considering the current quantity as the input for monitoring, an approach using diagnosis and classification has the advantage of being available at the TPS (or, more generally, in an industrial or residential context at the point of common coupling), where individual load current terms are aggregated. In addition, using the current alone and ignoring the voltage makes it possible to follow the information from the loads to the source almost unaltered, whereas the line voltage is affected by unavoidable voltage drops. The focus on using TD information (thus preserving the waveform shape) shows that iq(t) shows promise for distortion classification, as it is deprived of the preponderant active current term. The investigation of the use of iq(t) in [ 58 ] was limited to showing V-I diagrams of it, which were compared to the complete V-I diagrams of the whole input current i(t) . The use of DL techniques makes it possible to use a broader range of classification and diagnosis capabilities, as discussed below. 3.3. ED for AD and Segmentation of New Data The ED between an observation of a cluster and its centroid may indicate similarity to the identified pattern. It is in fact intuitive that points in the cluster space farther away Energies 2025,18, 3536 9 of 27 might differ more significantly from the typical patterns characterizing that cluster. Such abnormal ED variations may also indicate the presence of an anomaly (or outlier) in the provided data. Thus, one possible application is that of data screening, in particular for long-term recordings. Observations with greater distances within a cluster might differ from the expected pattern represented by that group, and one should be able to determine whether those variations are due to the actual diversity of the cluster or whether they represent anomalies within the data. This work proposes anomaly-detection AD based on the ED metric, as shown in Figure 3. Figure 3. Procedure to find anomalies within the assigned clusters. AD consists on finding outliers based on relative ED within each cluster per the following steps: calculate ED of each observation to the centroid; calculate the z-score of such ED values; determine which observation distance represents an outlier by median absolute deviation (MAD). As is known, with the median being a robust estimator of location, MAD is a robust measure of the variability and scale of a data sample [ 60 ]. Observations with a distance from the median greater than 3 ×MAD are considered anomalies, following the criterion set forth in [ 61 ], who indicated a factor of 3 as a “very conservative” choice, as also discussed in [62]. For a vector Y made up of N scalar observations, MAD is defined as in (7) for i=1, 2, . . . , N. MAD =median(|yi−median(Y)|)(7) Besides already labeled data, new unlabeled data may be screened for anomalies with ED calculation. Based on the same ED, new data may be assigned to an existing cluster, after which the centroid will be updated for the next new observation and its ED value. The process is described in Figure 4. Figure 4. Classification method based on ED and predefined clusters for unlabeled data. 3.4. 1-D Convolutional Neural Network (CNN) A more traditional supervised-learning method may be adopted using a 1-D CNN for that portion of data that is labeled (as shown in Figure 5). The dataset is separated for training, validation and testing, allowing assessment of classification performance for the target classes (using confusion matrix and balanced accuracy quantification). Later, the 1-D CNN is also verified on unlabeled data as part of its testing. DL models based on 1-D CNN are usually composed of the input layer, multiple hidden layers, alternated convolutional and pooling layers, a fully connected layer, and an output layer [63]. In an analog to the popular 2-D CNN, the 1-D CNN allows learning and Energies 2025,18, 3536 16 of 27 in the new data, where 4 are for C1, 69 are for C2, 37 for C3, none for C4, and 11 for C5. From a pattern identification viewpoint, those results are interesting since they can be obtained through the well-defined quantity ED, transferring previous knowledge and data classification to new unlabeled data. (a) (b) Figure 13. Classification results based on ED and predetermined clusters: (a) classification based on the predetermined clusters (circles for evident mis-classification); (b) classification with AD (area identified by the dashed horizontal lines). 4.3. Classification by 1-D CNN with Cluster-Based Labels The results for set 1, based on clustering and AD, support the creation of labels that impose classes on the data, carrying the association of OCs and WD. The presence of labels opens up the opportunity to train more traditional algorithms like 1-D CNN, as described in Section 3.4. Two points are discussed here: the validation of the labeling process based on DAE feature extraction and clustering, and the performance of the 1-D CNN. After successfully using 80% of the data for training and 10% for validation, the remaining 10% was used for classification and to test the 1-D CNN performance (see the confusion matrix in Figure 14a). The 1-D CNN performs well with the given labels considering the following points: it is an unbalanced set of labels and data with high dimensionality. Considering balanced accuracy (BA), since there is a significant unbalance between classes, the system performed with BA = 89.4% for the test set, in which the anomaly class prevalently pushes down the performance (excluding it, BA = 96.5%). (a) (b) Figure 14. 1-D CNN testing results: (a) test cluster-labelled dataset based on confusion matrix (row-normalized) (b) new unlabelled dataset (squares indicate evident misclassification). Figure 14b shows the results for the second set 2 of 3444 waveforms of new unlabeled data. Lacking labels to use as reference for verification, comparison with the active power distribution of clusters allows to check that the 1-D CNN classification is reasonable Energies 2025,18, 3536 17 of 27 and coherent. A few results deviate from the expected OC associated with that cluster (indicated by squares). Comparing the two methods, as in Figure 15, 84.66% of the 1-D CNN predictions are in agreement with the ED method, without considering anomalies. Figure 15. Confusion matrix (row-normalized) comparing 1-D CNN and ED classification methods. From a general standpoint nearly 90% of accuracy, 96.5% excluding anomalous cases, using real data in unsupervised learning conditions, is a significant performance, if we compare to other previous works also using TD waveforms, but in supervised learning conditions: • Ref. [ 13 ] reports quite a variable accuracy for the various classes of the PLAID dataset, ending in 81% of balanced accuracy; • Ref. [ 37 ] shows values of average accuracy between 96.6% and 97.2% when working on the LIT-SIM 5 dataset, that may be considered the closest example in that publication to the present case; other past approaches reported in [ 37 ] range between 77.2% and 95.4%. It is noteworthy the absorption of anomalies identified by the unsupervised ED method into the class C2 of the 1-D CNN method. This is at the base of the different scoring of performance with and without the anomaly category. For more insight in the performance of the 1-D CNN model, the gradient-weighted class activation mapping (Grad-CAM) [ 68 ] can be employed for interpretation, by highlighting the data segments that are key to classification [ 69 ], measuring their informative content. Figure 16 shows three examples of correct prediction for C1, C3 and C4. In the case of the C1 prediction (see Figure 16a), the highest importance is highlighted in particular for the top and intermediate parts of the waveform shape, indicating that those iq(t) segments are more important to determine C1 prediction. The highest value of Grad-CAM importance is 1.84, while the average is 0.68. In that case, 53.4% of the input signal is above the mean value. That signal characteristic can be associated with the high levels of third harmonic in HT conditions, impacting significantly on the TD shape. It is remarkable that the bottom part of each waveform period is not picked up by Grad-CAM: the symmetry of the waveform can be observed, so that probably that part of the waveform is just specular and does not add any innovative information. Looking at the C4 case (see Figure 16e), the most meaningful waveform segment identified by the Grad-CAM is the zero crossing and an almost 50% of amplitude range around it. That might be associated with the change in the zero crossing direction due to regenerative braking; the prominent distortion around the zero crossing is shared in reality with C3 (see Figure 16c), which has the largest distortion to the point that the waveform shape is quite different almost completely dominated by the 3rd harmonic. For Energies 2025,18, 3536 18 of 27 C4, the highest importance value was 10.25, with an average of 1.56. Although the average is significantly lower than the peak, only 26.6% of the waveform exceeds the average, indicating that these segments have a strong influence on the prediction. (a) (b) (c) (d) (e) (f) Figure 16. Explanation of some test prediction of the 1-D CNN using Grad-CAM for correct classifications: (a) true prediction for C1, (b) false prediction for C1, (c) true prediction for C3, (d) false prediction for C3, (e) true prediction for C4, (f) false prediction for C4. All the three insets on the left side of Figure 16 discussed above for C1, C3 and C4 are sided by an example of false prediction (or, misclassification), showing the similarity and closeness of the waveform shape and distortion features. Although the waveforms for C3 in Figure 16c,d may appear visually similar to justify the assignment to the same class (namely C3), Figure 16d actually marks the transition for a new operating state (i.e., C4), as can be evidenced by the increased peak amplitudes and slight change on waveform distortion. This part is particularly challenging due to the similarity of its characteristics to those observed at the limits of normal operating conditions, leading to greater confusion during classification by supervised models as 1-D CNN. It is important to remember that the used labels are not derived from an external or predefined criterion, but Energies 2025,18, 3536 19 of 27 are instead the result of clustering based on features extracted by the DAE. This inherently introduces a degree of imprecision into the labeling process, as previously demonstrated with “diagnosis” based on ED. In the case of the C4 class and its corresponding false prediction ( Figures 16e and 16f, respectively) it is possible to see that an apparently C4 waveform was classified as “Anomaly”, possibly because of larger high-frequency content, visible in the double “tooth” in the hump above the zero crossing, whereas only one larger tooth is visible in the C4 waveform on the left. These Grad-CAM examples show that the 1-D CNN model can understand nuances within the input data signals and exploit them to classify, while providing an indication of the relative importance of even small waveform portions. They also demonstrate how the model can shift its attention across the signal, which can be insightful for complex multiclass classification tasks. The attention aspects, associated with WD identification, further enhance the explicability of the analysis (crucial aspect within multi-domain application, as pointed out in [70] for a similar application regarding power system transients). 4.4. Noise and Noise Effect Some considerations are provided on the noise concept for the method. The experimental data utilized in the work are already characterised by their own intrinsic electric noise that is evaluated in the following to support the statement that the proposed method is robust to data noise. Shifting to a frequency-domain interpretation, the NAC spectrum is evaluated for the characteristic harmonic components compared to the adjacent incoherent spectral frequency bins, assessing what is the amount of noise present in the data as input to the DAE (see Figure 17). It is possible to see in Figure 17c that the fundamental and low-order harmonics are characterized by a 25–35 dB average SNR, whereas beyond the 17th component, included, the SNR settles to about 20 dB going down smoothly to about 10 dB . This is confirmed by the histogram of values in Figure 17b, where altogether they span between 5 and 40 dB , excluding the two tall bins around 0. These SNR values demonstrate how the proposed unsupervised method can deal with a significant amount of intrinsic noise in the data. The negative values occurring at low power levels are due to the operation of the traction converters in an irrelevant operating region, featuring an overlap of distortion caused by onboard auxiliaries that is not associated with the main characteristic harmonics. The many outliers (shown as red crosses in Figure 17c) demonstrate the highly variable dynamic conditions. The two classification methods explored in this work were then evaluated by injecting additional artificial incoherent noise (white noise), thereby worsening the SNR values and assessing the consequent performance. The affected components were those with the largest SNR values, thereby reducing the SNR values globally to less than 20 dB (18 dB on average, to be precise), implying a degradation of 12 ±5 dB. The aim is to observe any possible shifts in the decision criteria and label assignment during the segmentation of the “unlabeled data” in set 2 (see Figure 18). The results comparing the ED-based classification with and without additional noise are illustrated in Figure 18a. Additionally, the ED classification is compared again to the output of the supervised 1D-CNN model, and the results are presented in Figure 18b. Energies 2025,18, 3536 20 of 27 (a) (b) (c) Figure 17. Signal-to-noise ratio (SNR) distribution in form of box-plots of the input NAC data: (a) SNR vs. input active power; (b) histogram of SNR values; (c) SNR distribution for the odd harmonics of the spectrum up to harmonic order 119 (in the boxplot the blue box extends from the first to the third quartile, the horizontal red dash in the middle is the median, and the remaining red crosses are outliers). (a) (b) Figure 18. Confusion matrices for ED unsupervised method operation after injection of additional noise reducing the SNR values below 20 dB : (a) comparison with performance without noise injection (original SNR); (b) comparison with the 1D-CNN classification both with the said additional injected noise. Colours are chosen to visually distinguish the two cases and darker nuances underline higher values. As shown in Figure 18a there is substantial agreement on the class assignments, with a maximum deviation of 2.1%. Anomalies are instead more dispersed, with some “leakage” Energies 2025,18, 3536 21 of 27 (although less than 10%) to the classes C1 through C5 as a result of of noise hitting specific waveform portions, such as the topand zero-crossings. Compared to 1D-CNN, Figure 18b is almost unaltered compared to the previous Figure 15; the largest variation is in the correspondence between class C3 of ED and class C4 of 1-D CNN, with a different of about 6%; all the other values are nearly the same, being within 0.3% of each other. 4.5. Computational Times This brief section discusses the computational time needed for the proposed unsupervised DAE method using ED, including a comparison to the computational time needed for the 1D-CNN. Results are shown in Figure 19 and show that the proposed method is much faster and suitable for a real-time implementation, with the most likely value being 3.4 ms ; all values are within 9.3 ms , with a maximum value of 6.9 ms at 99% probability. The dispersion of computational times is caused by other concurrent processes on the hosting computer, so the fastest times (which also correspond to the mode of the distributions) provide the best estimate of the computational effort of the algorithm alone. Figure 19. Distribution of the computational times for 1000 tests of the unsupervised DAE method and 1D-CNN reference method. 4.6. Application with EV Charging Data for Validation As additional verification, the method has been applied to data measured on the AC side of a 150 kW CCS charging station of a winter car-testing center in the north of Sweden [71] . Several charging sessions lasting several days were recorded by sampling at 40 kHz from the AC feeding lines upstream: the incoming power and associated NAC were then analyzed. Depending on the model of the charging EV, power may vary between 25 kW and 150 kW ; the charging times vary from as fast as 6 min to 3 h. Data were recorded as short 500 ms records every minute using Rogowski current sensors. In total, 3338 snippets were captured and used in the proposed methodology. The objective is to validate the method discussed so far by applying it to a completely new scenario, EV charging, which carries significant applicability potential. Clustering was performed on four classes, which led to the identification of one class involved in the charging at the highest power level (C1), with the two others involved at lower power levels (C3 and C4). The background noise with no EV charging was captured by C2. The in-feed active power is plotted vs. time in Figure 20c, together with the four identified TD patterns. It is possible to see that C2 consistently tags all background noise samples, whereas C1 is reserved for high-power charging, occurring just above 100 kW ; the charging session on 10 February, carried out up to 100 kW , in fact, did not yield any C1 pattern. Energies 2025,18, 3536 22 of 27 (a) (b) (c) Figure 20. Verification of EV CCS charging sessions for 3 consecutive days using the proposed method: (a) 100 ms long pattern waveforms of each NAC cluster (sample number on the time axis); (b) corresponding current spectrum up to 10 kHz ; (c) distribution of clusters over the active power profile. The spectra of the total current up to 10 kHz for the respective clusters are also illustrated. It is possible to see that C3 and C4 are very similar, with a slightly larger high-frequency content for C4. C1 is characterized by the largest emissions, these being approximately four times larger than those of C3 and C4 for the first characteristic harmonics (the 5th, 7th and 11th are particularly visible in Figure 20b). The background noise in between the harmonics of the fundamental is almost the same for all modes when charging takes place (C1, C3 and C4), with a slight reduction for C1 between 800 Hz and 2 kHz. Classification is consistent for the whole 3 days of operation used and reported as an example. 5. Conclusions The work explored Fryze’s TD NAC iq(t) to assess the signature of distorting loads (AC railway RS and its onboard converters in the studied case, with the inclusion of an Energies 2025,18, 3536 23 of 27 additional case of a CCS EV charging station for confirmation). The challenging aspects arise from the RS’s highly dynamic behavior, as it passes through a wide range of power levels while tractioning and braking. Peculiar WD can be associated with the varying OCs, as confirmed by the analysis of the frequency spectra. Unsupervised deep learning was used with iq(t) waveform samples as input. This is a first point of novelty, as it focuses on the informative NAC rather than using the entire V-I trajectory. The exploration of an unsupervised method using unlabeled data is also noteworthy, in particular as it considers the achieved high classification score, providing an interesting solution for the management of new loads, like those seen in electromobility scenarios. The application of DAE and clustering has identified patterns associated with RS OCs, thereby showing the suitability of iq(t) for pattern identification and advanced monitoring. ED was explored to evaluate cluster dispersion, and a new method was proposed for identifying anomalies, input WD samples without defined criteria (so, “outliers”), and unusual shapes. New data are then classified based on ED. Results were validated by showing the distribution of classification indexes over the RS OCs; this way, one can confirm the correctness of the data segmentation by its evident coherence with operation and plausibility. Later, the dataset [ 65 ] with cluster-based labels was used for supervised learning with the 1-D CNN to compare results based on ED. BA achieves 96.5% agreement using the testing portion of this dataset. When exposed to new unlabeled data, the 1D-CNN achieves 89.6% agreement with the ED-based method for normal states. Additionally, Grad-CAM was applied to the 1D-CNN model to quantify the importance of waveform segments for prediction and highlight the different attention mechanisms depending on the observed OC. We here highlight that the work uses clustering and ED to evaluate real-world PQ measurements and that the proposed methodology is capable not only of finding patterns in WD data, but also of addressing uncertainty and inherent variability of the dataset. In other words, it is possible to quantify the quality and consistency of observations, screening to isolate bad, weird or simply unusual data (a feature that is extremely useful with unsupervised measurement and monitoring and big-data analytics). In the studied case, a few records were identified as having anomalous shapes that were not caught earlier by the manual check carried out to build the original dataset in [ 65 ], thereby demonstrating the practical validity of the method. In addition, by classifying new data, this work showed the potential of this approach for transferring knowledge and feature learning to other similar datasets. Possible applications of this method include NILM aimed at the identification and classification of loads by their distortion signatures, as well as the evaluation of PQ from unsupervised long-term measurements for identification of outliers and weird data. The range of high-power distorting loads and sources encompasses industrial drives, such as those for large fans, pumps, compressors and other motor applications. They are interfaced to the AC grid with converters that are either more traditional diode or thyristor rectifiers or advanced active rectifiers of the same type as the RS 4QC considered here. For modern renewable sources, such as photovoltaic parks, the AC grid interface is implemented with an inverter with a grid-forming or grid-following operation. The principle of operation is quite similar to that of the 4QC, having similar modulation and switching patterns. As anticipated, the method has been successfully applied also to a different scenario for further verification: the charging patterns of a CCS charging station were consistently classified over sessions lasting several days. This provides evidence for confidence in Energies 2025,18, 3536 24 of 27 applying the method to the forthcoming test campaigns of the Met4EVCS project [ 72 ], which focus on conducted emissions and distortion caused by EV charging stations. Besides the advantages visualized by the results, some considerations related to possible limitations and negative aspects are highlighted below. • Cluster-based labels are effective in capturing the operational states and load characteristics, enabling other classification algorithms to benefit from the structured data. However, the anomaly category should be used with caution, as it is based on previously known anomalies and may not represent new or previously unseen events. In such cases, the proposed ED-based classification method becomes important again, as it allows the identification of new anomalies that do not conform to existing cluster boundaries. • Additionally, the success of cluster-based segmentation and labeling remains highly dependent on the clustering algorithm used, which in turn is determined by the data characteristics and the distribution of the data in the feature space. • Other limitations can be noted regarding the WD signature used. NAC is more suitable for loads with strong non-linear behavior, so its performance may be limited in systems with low non-linearity and distortion. On examination of the results in the literature, it is easy to see that, currently, the category of distorting loads is much broader than that of linear loads, which are mostly limited to heating elements, some home appliances, and a few others. Author Contributions: Conceptualization, A.M., R.S.S. and S.K.R.; methodology A.M., R.S.S. and S.K.R.; validation, A.M. and R.S.S.; formal analysis, A.M. and R.S.S.; investigation, A.M. and R.S.S.; resources, A.M., R.S.S. and S.K.R.; data curation, A.M. and R.S.S.; writing—original draft, A.M. and R.S.S.; writing—review and editing, A.M., R.S.S. and S.K.R.; visualization, A.M. and R.S.S.; supervision S.K.R.; project administration, A.M. and S.K.R.; funding acquisition, A.M. and S.K.R. All authors have read and agreed to the published version of the manuscript. Funding: The work here presented has received funding from EPM (European Partnership on Metrology) SRTi03 Met4EVCS. The project SRTi03 Met4EVCS has received funding from the European Partnership on Metrology, co-financed by the European Union’s Horizon Europe Research and Innovation Programme and by the Participating States. This work is also partially funded by the Swedish Transport Administration. Institutional Review Board Statement: Not applicable. Informed Consent Statement: Not applicable. Data Availability Statement: Data are contained within the article. Conflicts of Interest: The authors declare no conflict of interest. References 1. Shojaie, M.; Mokhtari, H. A method for determination of harmonics responsibilities at the point of common coupling using data correlation analysis. IET Gener. Transm. Distrib. 2014,8, 142–150. [CrossRef] 2. Safargholi, F.; Malekian, K.; Schufft, W. On the Dominant Harmonic Source Identification—Part I: Review of Methods. IEEE Trans. Power Deliv. 2018,33, 1268–1277. [CrossRef] 3. Bhende, C.; Mishra, S.; Panigrahi, B. Detection and classification of power quality disturbances using S-transform and modular neural network. Electr. Power Syst. Res. 2008,78, 122–128. [CrossRef] 4. Panigrahi, B.; Dash, P.; Reddy, J. Hybrid signal processing and machine intelligence techniques for detection, quantification and classification of power quality disturbances. Eng. Appl. Artif. Intell. 2009,22, 442–454. [CrossRef] 5. Li, P.; Ma, T.; Shi, J.; Jia, Q. Multi-dimensional feature multi-classifier synergetic classification method for power quality disturbances. Comput. Electr. Eng. 2024,120, 109720. [CrossRef] 6. Jain, S.K.; Singh, S.N. Fast Harmonic Estimation of Stationary and Time-Varying Signals Using EA-AWNN. IEEE Trans. Instrum. Meas. 2013,62, 335–343. [CrossRef] Energies 2025,18, 3536 25 of 27 7. Moradifar, A.; Akbari Foroud, A.; Fouladi, M. Identification of multiple harmonic sources in power system containing inverter— Based distribution generations using empirical mode decomposition. IET Gener. Transm. Distrib. 2019,13, 1401–1413. [CrossRef] 8. Katic, V.A.; Stanisavljevic, A.M. Smart Detection of Voltage Dips Using Voltage Harmonics Footprint. IEEE Trans. Ind. Appl. 2018, 54, 5331–5342. [CrossRef] 9. de Aguiar, E.; Lazzaretti, A.; Mulinari, B.; Pipa, D. Scattering Transform for Classification in Non-Intrusive Load Monitoring. Energies 2021,14, 6796. [CrossRef] 10. Chen, Z.M.; Li, M.S.; Ji, T.Y.; Wu, Q.H. Detection and classification of power quality disturbances in time domain using probabilistic neural network. In Proceedings of the International Joint Conference on Neural Networks (IJCNN), Vancouver, BC, Canada, 24–29 July 2016; pp. 1277–1282. [CrossRef] 11. Wang, S.; Chen, H. A novel deep learning method for the classification of power quality disturbances using deep convolutional neural network. Appl. Energy 2019,235, 1126–1140. [CrossRef] 12. Liu, F.; Zhou, F.; Ma, L. An Automatic Detection Framework for Electrical Anomalies in Electrified Rail Transit System. IEEE Trans. Instrum. Meas. 2023,72, 3510313. [CrossRef] 13. Zhou, Z.; Xiang, Y.; Xu, H.; Wang, Y.; Shi, D. Unsupervised Learning for Non-intrusive Load Monitoring in Smart Grid Based on Spiking Deep Neural Network. J. Mod. Power Syst. Clean Energy 2022,10, 606–616. [CrossRef] 14. Salles, R.S.; De Oliveira, R.A.; Rönnberg, S.K.; Mariscotti, A. Data-driven assessment of VI diagrams for inference on pantograph quantities waveform distortion in AC railways. Comput. Electr. Eng. 2024,120, 109730. [CrossRef] 15. Ur Rehman, A.; Tjing Lie, T.; Valles, B.; Rahman Tito, S. Comparative Evaluation of Machine Learning Models and Input Feature Space for Non-intrusive Load Monitoring. J. Mod. Power Syst. Clean Energy 2021,9, 1161–1171. [CrossRef] 16. Angelis, G.F.; Timplalexis, C.; Krinidis, S.; Ioannidis, D.; Tzovaras, D. NILM applications: Literature review of learning approaches, recent developments and challenges. Energy Build. 2022,261, 111951. [CrossRef] 17. Liu, Y.; Wang, Y.; Ma, J. Non-Intrusive Load Monitoring in Smart Grids: A Comprehensive Review. Available online: https: //arxiv.org/abs/2403.06474 (accessed on 20 June 2025). 18. Kerk, S.G.; Hassan, N.U.; Yuen, C. Smart Distribution Boards (Smart DB), Non-Intrusive Load Monitoring (NILM) for Load Device Appliance Signature Identification and Smart Sockets for Grid Demand Management. Sensors 2020,20, 2900. [CrossRef] 19. Stanescu, D.; Enache, F.; Popescu, F. Smart Non-Intrusive Appliance Load-Monitoring System Based on Phase Diagram Analysis. Smart Cities 2024,7, 1936–1949. [CrossRef] 20. Shen, Y.; Abubakar, M.; Liu, H.; Hussain, F. Power Quality Disturbance Monitoring and Classification Based on Improved PCA and Convolution Neural Network for Wind-Grid Distribution Systems. Energies 2019,12, 1280. [CrossRef] 21. Shklyarskiy, Y.; Hanzelka, Z.; Skamyin, A. Experimental Study of Harmonic Influence on Electrical Energy Metering. Energies 2020,13, 5536. [CrossRef] 22. Have, B.t.; Azpurua, M.A.; Hartman, T.; Pous, M.; Moonen, N.; Silva, F.; Leferink, F. Waveform Model to Characterize Time-Domain Pulses Resulting in EMI on Static Energy Meters. IEEE Trans. Electromagn. Compat. 2021,63, 1542–1549. [CrossRef] 23. Loschi, H.; Nascimento, D.; Smolenski, R.; Sayed, W.E.; Lezynski, P. Shaping of converter interference for error rate reduction in PLC based smart metering systems. Measurement 2022,203, 111946. [CrossRef] 24. Mariscotti, A.; Mingotti, A. The Effects of Supraharmonic Distortion in MV and LV AC Grids. Sensors 2024,24, 2465. [CrossRef] [PubMed] 25. Kommey, B.; Tamakloe, E.; Kponyo, J.J.; Tchao, E.T.; Agbemenu, A.S.; Nunoo-Mensah, H. An artificial intelligence-based non-intrusive load monitoring of energy consumption in an electrical energy system using a modified K-Nearest Neighbour algorithm. IET Smart Cities 2024,6, 132–155. [CrossRef] 26. Mariscotti, A. Impact of Harmonic Power Terms on the Energy Measurement in AC Railways. IEEE Trans. Instrum. Meas. 2020, 69, 6731–6738. [CrossRef] 27. Mishra, M.; Nayak, J.; Naik, B.; Abraham, A. Deep learning in electrical utility industry: A comprehensive review of a decade of research. Eng. Appl. Artif. Intell. 2020,96, 104000. [CrossRef] 28. Sima, W.; Zhang, H.; Yang, M.; Yuan, T.; Sun, P.; Chen, Q.; Zhao, H. A framework for automatically cleansing overvoltage data measured from transmission and distribution systems. Int. J. Electr. Power Energy Syst. 2018,102, 381–392. [CrossRef] 29. Oliver, A.; Odena, A.; Raffel, C.A.; Cubuk, E.D.; Goodfellow, I. Realistic evaluation of deep semi-supervised learning algorithms. Adv. Neural Inf. Process. Syst. 2018,31, 3239–3325. 30. Zhang, C.; Bengio, S.; Hardt, M.; Recht, B.; Vinyals, O. Understanding deep learning (still) requires rethinking generalization. Commun. ACM 2021,64, 107–115. [CrossRef] 31. Raygani, S.; Tahavorgar, A.; Fazel, S.; Moaveni, B. Load flow analysis and future development study for an AC electric railway. IET Electr. Syst. Transp. 2012,2, 139. [CrossRef] 32. Salles, R.S.; de Oliveira, R.A.; Ronnberg, S.K.; Mariscotti, A. Analytics of Waveform Distortion Variations in Railway Pantograph Measurements by Deep Learning. IEEE Trans. Instrum. Meas. 2022,71, 2516211. [CrossRef]