Outlier Detection for Permanent Magnet Synchronous Motor (PMSM) Fault Detection and Severity Estimation

: Today, Permanent Magnet Synchronous Motors (PMSMs) are a dominant choice in industry applications. During operation, different possible faults in the system can occur, so early and automated fault detection and severity estimation are required to ensure smooth operation and optimal maintenance planning. In this direction, outlier detection methods are employed in this paper. The motor’s current signals are used to extract useful indicators of the fault, along with d-q transform. Statistical indicators in both time and frequency domains are selected to describe fault-related patterns. Based on the extracted features, three outlier detection methods are investigated: the Isolation Forest, the One Class Support Vector Machine, and the Robust Covariance Ellipse. Each method is investigated through different model parameters to evaluate fault detection and severity estimation capabilities. Finally, an ensemble approach is proposed based on decisions and outlier score ensemble. The proposed methodology is verified through different operating conditions in a PMSM test bench.


Introduction
Today, Permanent Magnet Synchronous Motors (PMSMs) are increasingly used in more applications in industry due to their high efficiency, high power density, dynamic performance, and control capabilities.However, condition monitoring (CM) is necessary to avoid anomalies and fault conditions.Different faults may appear during PMSM operation and can be related to the rotor [1], bearings [2], magnets [3], or stator windings [4].Continuous and online condition monitoring of the system offers the possibility for early fault detection and thus better maintenance planning [5], avoidance of catastrophic faults, and reduction in downtime [6].Various tools are used for motor health assessment, such as vibration analysis, acoustic emission analysis, temperature monitoring, or Motor Current Signature Analysis.Based on the requirements for continuous monitoring of the system, without interruptions, along with integrating possibilities into the existing system, Motor Current Signature Analysis (MCSA) is one of the prevailing options.Indeed, it has been shown that different possible faults can be detected through MCSA [7,8].
However, to automate fault diagnosis processes and enhance their capabilities, various AI and machine learning approaches must be utilized.In recent years, various approaches have been proposed for PMSM fault diagnosis.In [9], MCSA and Wavelets were used to extract eccentricity-related features and then Principal Component Analysis (PCA), k-NN, and Support Vector Machine (SVM) were used for feature reduction, eccentricity type identification, and eccentricity degree estimation, respectively.In [10], a similar approach is used to detect open circuits.FFT was used to extract frequency domain features from the measured signals, PCA was used to reduce dimensionality of the data, and then Bayesian Network (BN) was employed for open circuit fault diagnosis.Moreover, in [11],

PMSM Mathematical Model
The voltage equations of the PMSM in the abc reference system are the following: where R s is the stator's winding resistance, I a , I b , I c are the stator's phase currents, and ψ a , ψ b , ψ c are the stator's flux linkages, which are given by the following equations: where L xx is the self-inductance of the x phase, L xy is the mutual inductance of the x and y phases, and ψ apm , ψ bpm , ψ cpm are the flux linkages associated to the windings abc and the permanent magnets.A schematic representation of the PMSM model is shown in Figure 1.
()         ()   (𝑡) where   is the self-inductance of the x phase,   is the mutual inductance of the x and y phases, and   ,   ,   are the flux linkages associated to the windings abc and the permanent magnets.A schematic representation of the PMSM model is shown in Fig- with respect to an arbitrary reference frame with reference angle θ and q-axis alignment.
By selecting  =   , where   is the rotational reference angle, the simplified voltage equations are the following: where p is the number of pole pairs,   ,   are the d-q reference frame inductances,   is the flux linkage associated with permanent magnets.The zero sequence Vo is neglected here.

Motor d-q Current Signature Analysis
Motor Current Signature Analysis (MCSA) relies on examining a motor's stator current to find specific patterns associated with faults.The stator's current is analyzed in the frequency domain in the interest of extracting specific frequencies associated with motor's faults.For a healthy motor, the form of stator currents is as follows: with respect to an arbitrary reference frame with reference angle θ and q-axis alignment.By selecting θ = θ e , where θ e is the rotational reference angle, the simplified voltage equations are the following: where p is the number of pole pairs, L q , L d are the d-q reference frame inductances, ψ pm is the flux linkage associated with permanent magnets.The zero sequence Vo is neglected here.

Motor d-q Current Signature Analysis
Motor Current Signature Analysis (MCSA) relies on examining a motor's stator current to find specific patterns associated with faults.The stator's current is analyzed in the frequency domain in the interest of extracting specific frequencies associated with motor's faults.For a healthy motor, the form of stator currents is as follows: Using the Park transform matrix in the synchronous rotational reference system ( θ = θ e ): It follows that: With the presence of a fault in the motor, additional harmonics appear in the current's spectrum.The frequency patterns for MCSA related to eccentricity, demagnetization, and bearings faults are presented in Table 1.

Faults Expression
Eccentricity fs: fundamental supply frequency, p: pole pairs, f bch : bearing characteristic frequency, k: integer.
Currents under faulty PMSM state can be expressed as follows: The above-mentioned quantities are expressed in the synchronous rotational reference system as: From the above equations, we can observe that currents in the d-q rotating system contain two quantities, the dc quantities I q h , I d h , which refer to the healthy operational state, and the oscillating quantities I q f , I d f , which refer to additional harmonics associated with the fault.By analyzing the above quantities in the frequency domain, the frequencies that occur beyond dc can be used to detect and identify PMSM faults.

Features Extraction
To extract useful indicators of fault conditions from d-q currents, multiple features can be exploited.The occurrence of a fault affects both the form of d-q current in time and frequency domains.The fault's effect on the current's time waveform can be described by features such as standard deviation, variance, skewness, and kurtosis.In the current spectrum, the appearance of fault harmonics results in the distortion of the shape with the appearance of new peaks.Depending on the fault and its severity, the amplitudes and position of the harmonics may vary.To describe the spectrum, various spectral descriptors can be used.The spectral features shown in Table 2 are used for this task.It is important to note that the total features to be used should be kept as few as possible so that computational complexity remains low, but they must also be sufficient to describe the desired fault characteristics.Isolation Forest (iForest) is an unsupervised outlier detection method that was proposed by Liu et al. [14].iForest creates a forest of decision trees and assigns anomaly scores to every data point in the forest according to the length from the root node.The basic idea is to assign high anomaly scores to the data points with the least length and thus identify outliers.

Features Expression
iForest consists of two phases, the training and evaluating phases.Considering a dataset X with n samples and m features, training starts by selecting a subset of data and building the first Isolation Tree.The procedure is repeated until a certain number of Isolation Trees are built.Every tree is built by splitting the selected samples.Splitting is performed by randomly selecting a feature and a value between the maximum and minimum value of the selected feature.The splitting procedure is repeated until a certain depth in the tree is achieved.In the second phase, the evaluating phase, each data point receives a score based on its position in the created forest.The score of every data point is calculated as: The path of every sample from the root node is denoted as h(x) and the average value of the paths from the forest as E(h(x)).By using BST [14], the non-successful search length is computed, which is denoted as c(n).An illustration of the Isolation Forest is shown in Figure 2. Outliers are defined based on shorter paths from the root node of the created Isolation Trees.

One-Class SVM
Support Vector Machines (SVMs) are a class of supervised machine learning method that are used in a variety of applications for classification.The basic idea behind SVM i to find an optimal hyperplane to separate the data.Linear SVM is used to find an optima 'maximum-margin' hyperplane to separate data.To deal with nonlinear classification tasks, kernel tricks are used.Kernels are used to map the data space into a higher-dimen sional space, the feature space, where classification can be achieved.The functions tha are used more as kernels are polynomial, radial basis function (rbf), and sigmoid.
One Class Support Vector Machines (One Class SVMs) have been proposed for nov elty and outlier detection [15].The goal is to find a function that separates the data from the origin through separating normal data in a specific region.Data points outside tha region can be considered anomalies.Consider a dataset X with n samples and m features Φ, a feature mapping from data space X to feature space F, and a kernel: The quadratic problem to be solved in the case of One Class SVM is the following: subject to:

One-Class SVM
Support Vector Machines (SVMs) are a class of supervised machine learning methods that are used in a variety of applications for classification.The basic idea behind SVM is to find an optimal hyperplane to separate the data.Linear SVM is used to find an optimal 'maximum-margin' hyperplane to separate data.To deal with nonlinear classification tasks, kernel tricks are used.Kernels are used to map the data space into a higher-dimensional space, the feature space, where classification can be achieved.The functions that are used more as kernels are polynomial, radial basis function (rbf), and sigmoid.
One Class Support Vector Machines (One Class SVMs) have been proposed for novelty and outlier detection [15].The goal is to find a function that separates the data from the origin through separating normal data in a specific region.Data points outside that region can be considered anomalies.Consider a dataset X with n samples and m features, Φ, a feature mapping from data space X to feature space F, and a kernel: The quadratic problem to be solved in the case of One Class SVM is the following: where w, ρ are the weight and bias terms of the hyperplane, ξ i are the slack variables, and v is an adjustable parameter.The dual-Lagrangian problem is derived as: Solving the above problem, the coefficients of the following decision function are derived: In Equation ( 12), the parameter v ∈ (0, 1) is used in the second term to adjust the slack variables' effect on the quadratic problem.The parameter controls the trade-off between the number of outliers and the margin from the origin.If v → 0 , then the boundaries of the hyperplane are loose, and then it separates all data from the origin.If v → 1 , then the boundaries of the hyperplane become tighter, and it separates less data from the origin.An illustration of One Class SVM is shown in Figure 3.

Robust Covariance Ellipse
For a dataset X with n samples and m features, the Mahalanobis distance is given as: where ̅ is the mean, S is the covariance matrix of the samples, and T is the annotation of the transpose operation.The calculated distance of every data point can be used to define a region of normal data and outliers.In the calculation of mean and covariance, outliers can affect the calculated values, thus leading to the identification of outliers as normal data, an effect also known as the 'Masking Effect' [16].To enhance robustness against this effect, Minimum Covariance Determinant (MCD) is used to estimate the mean and the covariance matrix.The MCD computes the mean and the covariance matrix for h observations, where ℎ >  and can be calculated as ℎ = (++1)

2
. FAST-MCD [19] is employed for MCD implementation due to computation speed and efficiency.After the estimation of robust mean and covariance, the Mahalanobis distance for every sample is calculated.An illustration of the computed Robust Covariance Ellipse is shown in Figure 4.

Robust Covariance Ellipse
For a dataset X with n samples and m features, the Mahalanobis distance is given as: where x is the mean, S is the covariance matrix of the samples, and T is the annotation of the transpose operation.The calculated distance of every data point can be used to define a region of normal data and outliers.In the calculation of mean and covariance, outliers can affect the calculated values, thus leading to the identification of outliers as normal data, an effect also known as the 'Masking Effect' [16].To enhance robustness against this effect, Minimum Covariance Determinant (MCD) is used to estimate the mean and the covariance matrix.The MCD computes the mean and the covariance matrix for h observations, where h > m and can be calculated as h = (n+m+1)

2
. FAST-MCD [19] is employed for MCD implementation due to computation speed and efficiency.After the estimation of robust mean and covariance, the Mahalanobis distance for every sample is calculated.An illustration of the computed Robust Covariance Ellipse is shown in Figure 4.
can affect the calculated values, thus leading to the identification of outliers as normal data, an effect also known as the 'Masking Effect' [16].To enhance robustness against this effect, Minimum Covariance Determinant (MCD) is used to estimate the mean and the covariance matrix.The MCD computes the mean and the covariance matrix for h observations, where ℎ >  and can be calculated as ℎ = (++1)

2
. FAST-MCD [19] is employed for MCD implementation due to computation speed and efficiency.After the estimation of robust mean and covariance, the Mahalanobis distance for every sample is calculated.An illustration of the computed Robust Covariance Ellipse is shown in Figure 4.

Outlier Ensemble Approach
Outlier ensembles have been quite categorized in [16].Depending on the structure of the ensemble, Sequential and Independent Ensemble or Model-Centered and Data-Centered Ensembles can be employed [20].The approach used in this work falls into Independent and Model-Centered categories, where the whole dataset is used from all the outlier detection models, as shown in Figure 5.Each model generates anomaly scores for each sample point.The use of scores from multiple different models may require normalization as each model generates different arithmetic values.Averaging Ensemble can be used to extract averaging anomaly scores and can be carried out by simply averaging the

Outlier Ensemble Approach
Outlier ensembles have been quite categorized in [16].Depending on the structure of the ensemble, Sequential and Independent Ensemble or Model-Centered and Data-Centered Ensembles can be employed [20].The approach used in this work falls into Independent and Model-Centered categories, where the whole dataset is used from all the outlier detection models, as shown in Figure 5.Each model generates anomaly scores for each sample point.The use of scores from multiple different models may require normalization as each model generates different arithmetic values.Averaging Ensemble can be used to extract averaging anomaly scores and can be carried out by simply averaging the values of each model.Weighted Averaging can also be employed, where values of each model are multiplied by a certain weight to place emphasis on certain values.Typical weights include statistical, adaptive, or case-specific ones [18].Instead of Averaging, Max or RMS value of the overall normalized scores for each sample point can also be used.Like Scores Ensemble, Average, Max, and RMS value of predictions from each model can be employed.Majority Voting can also be used, where the majority of predictions are selected.Various approaches are assessed and compared through experimental tests in Section 6.

Experimental Procedure and Results
The test bench that was used for the experimental procedure is shown in Figure 6.The test rig consists of a Nidec's (Sycracuse, NY, USA) PMSM and DC Generator, a resistive load, an Inverter, a Current Measurement Unit, a Data Acquisition Unit, and a PC.The PMSM is coupled to the DC Generator through a flexible coupling.The DC Generator with the resistive load is used as a load for the PMSM.The PMSM parameters are shown in Table 3.

Experimental Procedure and Results
The test bench that was used for the experimental procedure is shown in Figure 6.The test rig consists of a Nidec's (Sycracuse, NY, USA) PMSM and DC Generator, a resistive load, an Inverter, a Current Measurement Unit, a Data Acquisition Unit, and a PC.The PMSM is coupled to the DC Generator through a flexible coupling.The DC Generator with the resistive load is used as a load for the PMSM.The PMSM parameters are shown in Table 3.The collected data consist of three-phase current measurements for healthy and faulty operating conditions with increasing severity.In Figures 7 and 8, abc current time waveforms for healthy and faulty operating conditions are presented, respectively.The operating speed of the PMSM is 1400 rpm, with a load of 6 Nm.We can notice the deformation of the waveform's envelope in the faulty state due to the misalignment.To extract useful features of the faulty conditions, such as time and frequency domain features, d-q transformation and FFT analysis are employed.In Figures 9 and 10, the corresponding waveforms for q and d axis current in a rotating reference frame are presented.The d current waveform remains at zero, as Field Oriented Control (FOC) is used to drive the PMSM.We observe an increased ripple and distortion in q current signal over time, due to the additional harmonics caused by the misalignment condition.The acquisition of current measurements is performed with a sampling frequency of 5 kHz using an NI Daq and LABVIEW.The fault considered in this case is a misalignment between PMSM and the DC Generator, causing eccentricity effects in the PMSM's shaft.It was achieved by placing metal shims in the support base of the motor.Two levels of fault severity were considered by different shim widths.
The collected data consist of three-phase current measurements for healthy and faulty operating conditions with increasing severity.In Figures 7 and 8, abc current time waveforms for healthy and faulty operating conditions are presented, respectively.The operating speed of the PMSM is 1400 rpm, with a load of 6 Nm.We can notice the deformation of the waveform's envelope in the faulty state due to the misalignment.To extract useful features of the faulty conditions, such as time and frequency domain features, d-q transformation and FFT analysis are employed.In Figures 9 and 10, the corresponding waveforms for q and d axis current in a rotating reference frame are presented.The d current waveform remains at zero, as Field Oriented Control (FOC) is used to drive the PMSM.We observe an increased ripple and distortion in q current signal over time, due to the additional harmonics caused by the misalignment condition.
transformation and FFT analysis are employed.In Figures 9 and 10, the corresponding waveforms for q and d axis current in a rotating reference frame are presented.The d current waveform remains at zero, as Field Oriented Control (FOC) is used to drive the PMSM.We observe an increased ripple and distortion in q current signal over time, due to the additional harmonics caused by the misalignment condition.To derive the frequency characteristics of the fault, analysis of the current in the fr quency domain is required.For this reason, in Figures 11 and 12, Power Spectral Densi is calculated.In Figure 11, the spectrum of the healthy state (blue color) and faulty sta (red color) are placed together.The specific eccentricity-related fault harmonics are ind cated with red circles.In Figure 11, the q-axis Power Spectral Density is shown for th same conditions.Due to design and operation parameters of the PMSM test bench, som harmonics that follow the eccentricity-related pattern are also evident in the healthy stat To derive the frequency characteristics of the fault, analysis of the current in the frequency domain is required.For this reason, in Figures 11 and 12, Power Spectral Density is calculated.In Figure 11, the spectrum of the healthy state (blue color) and faulty state (red color) are placed together.The specific eccentricity-related fault harmonics are indicated with red circles.In Figure 11, the q-axis Power Spectral Density is shown for the same conditions.Due to design and operation parameters of the PMSM test bench, some harmonics that follow the eccentricity-related pattern are also evident in the healthy state.From the waveform of the current over time, the statistical features of standard deviation, variance, skewness, and kurtosis are calculated, and from the signal's power spectrum, spectral density, spectral centroid, spectral spread, spectral skewness, and spectral kurtosis indices are calculated.The above characteristics are calculated for four different speeds and four different load levels under a healthy and faulty (misalignment) condition.The overall dataset consists of the above features for different operating modes and with an increasing severity of the fault.From the waveform of the current over time, the statistical features of standard deviation, variance, skewness, and kurtosis are calculated, and from the signal's power spectrum, spectral density, spectral centroid, spectral spread, spectral skewness, and spectral kurtosis indices are calculated.The above characteristics are calculated for four different speeds and four different load levels under a healthy and faulty (misalignment) condition The overall dataset consists of the above features for different operating modes and with an increasing severity of the fault.
Initially, we investigate the three different methods separately and compare them.The implementation of all methods is performed using Python and Scikit-learn.First, the Isolation Forest is investigated.The training of the model is performed with healthy data while the test is performed with a dataset of healthy data and faulty data with increasing severity of the misalignment fault.The model's performance is investigated for different contamination parameter values and number of trees.As the number of samples and features is small in this dataset, the number of maximum features and maximum samples that can be adjusted as parameters are kept to the default values.However, it is important to note that in larger datasets and features, the above two parameters are important, as they can reduce computational complexity and indicate redundant features.Below, in Figure 13 are the evaluation metrics for different values of the contamination parameter and different number of trees.We observe that in all cases (50, 100, 150, 200 iTrees), better Initially, we investigate the three different methods separately and compare them.The implementation of all methods is performed using Python and Scikit-learn.First, the Isolation Forest is investigated.The training of the model is performed with healthy data, while the test is performed with a dataset of healthy data and faulty data with increasing severity of the misalignment fault.The model's performance is investigated for different contamination parameter values and number of trees.As the number of samples and features is small in this dataset, the number of maximum features and maximum samples that can be adjusted as parameters are kept to the default values.However, it is important to note that in larger datasets and features, the above two parameters are important, as they can reduce computational complexity and indicate redundant features.Below, in Figure 13 are the evaluation metrics for different values of the contamination parameter and different number of trees.We observe that in all cases (50, 100, 150, 200 iTrees), better evaluation metric values appear in the range of 0.4-0.5 for the contamination parameter.The best evaluation metric values for 100 Isolation Trees and contamination parameter in the range of 0.4-0.5 are shown in Table 4.
Table 4. Isolation Forest evaluation metrics for 100 Isolation Trees and contamination parameter in the range of 0.4-0.5.Subsequently, One Class SVM is investigated.Like iForest, only healthy data were used to train the model and then tested with a dataset of healthy and faulty states with increasing severity.One Class SVM was tested for the Radial Basis Function kernel for different gamma and fraction parameter values.The gamma range of the test is between 0.005 and 0.04, as there are no further improvements in the performance of the model above 0.04.This can be seen in the corresponding figures for gamma = 0.02, 0.03, and 0.04, in Figure 14.The best values of evaluation metrics appear for gamma = 0.2 and fraction parameter = 0.6.For these cases, the evaluation metrics are shown in Table 5.Subsequently, One Class SVM is investigated.Like iForest, only healthy data were used to train the model and then tested with a dataset of healthy and faulty states with increasing severity.One Class SVM was tested for the Radial Basis Function kernel for different gamma and fraction parameter values.The gamma range of the test is between 0.005 and 0.04, as there are no further improvements in the performance of the model above 0.04.This can be seen in the corresponding figures for gamma = 0.02, 0.03, and 0.04, in Figure 14.The best values of evaluation metrics appear for gamma = 0.2 and fraction parameter = 0.6.For these cases, the evaluation metrics are shown in Table 5.

Evaluation Metrics Value
Table 5.One Class SVM evaluation metrics for gamma = 0.2 and fraction parameter = 0.6.Lastly, Robust Covariance Elliptic Envelope was assessed for the same dataset.The influence of different contamination parameters is shown in Figure 15.We can observe that the best values of the evaluation metrics arise for a contamination parameter equal to 0.2 or 0.3.The evaluation metrics for the above parameters are shown in Table 6.The main difference lies in the decrease in precision and ROC AUC and the increase in Recall and F1-score for contamination parameter equal to 0.2 and 0.3, respectively.Lastly, Robust Covariance Elliptic Envelope was assessed for the same dataset.The influence of different contamination parameters is shown in Figure 15.We can observe that the best values of the evaluation metrics arise for a contamination parameter equal to 0.2 or 0.3.The evaluation metrics for the above parameters are shown in Table 6.The main difference lies in the decrease in precision and ROC AUC and the increase in Recall and F1-score for contamination parameter equal to 0.2 and 0.3, respectively.The above models can be combined through different ensemble techniques, as discussed in Section 5.More specifically, Majority Voting Ensemble can be used, where the majority of predictions are selected, and the Average Ensemble, where the average of the predicted values is calculated.Note that in the case of Averaging, rounding of the predicted values is required.The evaluation metrics for the above cases are shown in Table 7.To estimate the severity of the fault, the anomaly scores generated by each model are employed.Based on how anomaly scores are generated, each of the above methods generates a different range of values.For this reason, the values are normalized.Higher anomaly scores indicate faulty operating conditions in the PMSM.In the test dataset, the first 11 samples respond to a healthy working state, while the following 11 respond to a faulty state with a low fault severity, and then the last 11 respond to an increased fault severity.In the case of the One Class SVM, in Figure 16, we can see that healthy samples are distinguished from faulty samples, and especially the latest samples of increased severity.However, the difference between each sample for the latest samples and the increased severity is not clear.In the case of the Isolation Forest, in Figure 17, we see that we have increased anomaly scores for faulty cases that can be used as indicators of fault occurrence and increase in severity.In the case of the Elliptic Envelope, in Figure 18, we have the clearest picture, as we observe that anomaly scores are low for healthy samples while increasing with the appearance of the fault and especially at higher severity.

Evaluation Metrics Value
anomaly scores for faulty cases that can be used as indicators of fault occurrence and increase in severity.In the case of the Elliptic Envelope, in Figure 18, we have the clearest picture, as we observe that anomaly scores are low for healthy samples while increasing with the appearance of the fault and especially at higher severity.anomaly scores for faulty cases that can be used as indicators of fault occurrence and increase in severity.In the case of the Elliptic Envelope, in Figure 18, we have the clearest picture, as we observe that anomaly scores are low for healthy samples while increasing with the appearance of the fault and especially at higher severity.anomaly scores for faulty cases that can be used as indicators of fault occurrence and increase in severity.In the case of the Elliptic Envelope, in Figure 18, we have the clearest picture, as we observe that anomaly scores are low for healthy samples while increasing with the appearance of the fault and especially at higher severity.Ensemble techniques can be employed to utilize the scores generated from the models and improve severity estimation.For each sample of the three models, the average values are calculated.This results in the mean anomaly scores, shown in Figure 19.The evaluation metrics extracted in the previous section can be used to introduce weights to each anomaly score produced by each model, respectively.However, in this case, there was no notable change from the mean ensemble, so it was not examined further.Other than Mean Ensemble, Max Ensemble can be employed, where the max values from each model are used.The corresponding anomaly scores are shown in Figure 20.
Ensemble techniques can be employed to utilize the scores generated from the models and improve severity estimation.For each sample of the three models, the average values are calculated.This results in the mean anomaly scores, shown in Figure 19.The evaluation metrics extracted in the previous section can be used to introduce weights to each anomaly score produced by each model, respectively.However, in this case, there was no notable change from the mean ensemble, so it was not examined further.Other than Mean Ensemble, Max Ensemble can be employed, where the max values from each model are used.The corresponding anomaly scores are shown in Figure 20.An additional important piece of information from the generated anomaly scores is related to the detection of conditions where the fault is more intense or detectable.It is known [4,6] that the operating conditions of motor speed and load affect the occurrence and detectability of the fault.By using anomaly scores, we can see in which operating condition the highest anomaly score is displayed, as well as compare each operating condition with the corresponding one with a fault.

Conclusions
The proposed methodology utilizes PMSM's three-phase currents and speed measurements for online, non-invasive, and cost-effective condition monitoring of the PMSM.To extract fault-related features from the measurements, d-q transform was used.Distortions in time waveforms and several eccentricity-related frequencies in the power spectral density were observed for different speed and load conditions of the PMSM.Then, to extract useful indicators of fault conditions, statistical measures in time and frequency domain were used.The extracted statistical features were used for outlier detection by means Ensemble techniques can be employed to utilize the scores generated from the models and improve severity estimation.For each sample of the three models, the average values are calculated.This results in the mean anomaly scores, shown in Figure 19.The evaluation metrics extracted in the previous section can be used to introduce weights to each anomaly score produced by each model, respectively.However, in this case, there was no notable change from the mean ensemble, so it was not examined further.Other than Mean Ensemble, Max Ensemble can be employed, where the max values from each model are used.The corresponding anomaly scores are shown in Figure 20.An additional important piece of information from the generated anomaly scores is related to the detection of conditions where the fault is more intense or detectable.It is known [4,6] that the operating conditions of motor speed and load affect the occurrence and detectability of the fault.By using anomaly scores, we can see in which operating condition the highest anomaly score is displayed, as well as compare each operating condition with the corresponding one with a fault.

Conclusions
The proposed methodology utilizes PMSM's three-phase currents and speed measurements for online, non-invasive, and cost-effective condition monitoring of the PMSM.To extract fault-related features from the measurements, d-q transform was used.Distortions in time waveforms and several eccentricity-related frequencies in the power spectral density were observed for different speed and load conditions of the PMSM.Then, to extract useful indicators of fault conditions, statistical measures in time and frequency domain were used.The extracted statistical features were used for outlier detection by means An additional important piece of information from the generated anomaly scores is related to the detection of conditions where the fault is more intense or detectable.It is known [4,6] that the operating conditions of motor speed and load affect the occurrence and detectability of the fault.By using anomaly scores, we can see in which operating condition the highest anomaly score is displayed, as well as compare each operating condition with the corresponding one with a fault.

Conclusions
The proposed methodology utilizes PMSM's three-phase currents and speed measurements for online, non-invasive, and cost-effective condition monitoring of the PMSM.To extract fault-related features from the measurements, d-q transform was used.Distortions in time waveforms and several eccentricity-related frequencies in the power spectral density were observed for different speed and load conditions of the PMSM.Then, to extract useful indicators of fault conditions, statistical measures in time and frequency domain were used.The extracted statistical features were used for outlier detection by means of fault detection and severity estimation through Isolation Forest, One Class Support Vector Machine (SVM), and Robust Covariance Ellipse.
First, Isolation Forest was investigated for different isolation trees and contamination parameters.The best evaluation metrics were extracted for 100 Isolation Trees and a contamination parameter in the range of 0.4-0.5.The accuracy of Isolation Forest reached 0.82.One Class SVM was employed for the same task.Radial Basis Function was selected as the kernel and different gamma and fraction parameters were investigated.The best evaluation metrics were extracted for gamma equal to 0.2 and fraction parameter equal to 0.6.The accuracy reached 0.97.Lastly, Robust Covariance Ellipse fitting was tested.The highest accuracy achieved was 0.91 for gamma and contamination parameters equal to 0.2 and 0.3, respectively.One Class SVM was the best candidate in terms of Accuracy, Recall, Precision, F1-Score, and ROC AUC.For Severity Estimation, the extracted Outlier Anomaly Scores from the above methods were used.Comparing the three methods, increasing fault severity was better observed in Outlier Scores generated by Robust Covariance Ellipse fitting, then Isolation Forest, and lastly, One Class SVM.To combine the predictions and outlier scores, and so the advantages of each method, Independent Ensemble approaches are proposed.Majority Voting and Averaging Ensemble of the predictions led to Accuracy equal to 0,94 and 0,97, respectively.Max and Mean Ensemble of the Outlier Scores led to better observability of the increasing severity by each sample of the tested dataset.

Figure 1 .
Figure 1.PMSM mathematical model.To simplify the above equations, the Park transform is used, where the Park matrix is obtained as:T θ = 2 3
Appl.Sci.2024, 14, x FOR PEER REVIEW 8 of 18 values of each model.Weighted Averaging can also be employed, where values of each model are multiplied by a certain weight to place emphasis on certain values.Typical weights include statistical, adaptive, or case-specific ones [18].Instead of Averaging, Max or RMS value of the overall normalized scores for each sample point can also be used.Like Scores Ensemble, Average, Max, and RMS value of predictions from each model can be employed.Majority Voting can also be used, where the majority of predictions are selected.Various approaches are assessed and compared through experimental tests in Section 6.

18 Figure 6 .
Figure 6.Configuration of the PMSM test bench for fault detection and severity estimation.

Figure 7 .
Figure 7. Motor ABC current waveforms in healthy state.

Figure 6 .
Figure 6.Configuration of the PMSM test bench for fault detection and severity estimation.

Figure 7 .
Figure 7. Motor ABC current waveforms in healthy state.

Figure 10 .
Figure 10.Motor d-q current waveforms in faulty state.

Figure 10 .
Figure 10.Motor d-q current waveforms in faulty state.

Figure 11 .
Figure 11.A-phase current Power Spectral Density.

Figure 11 .
Figure 11.A-phase current Power Spectral Density.

Figure 11 .
Figure 11.A-phase current Power Spectral Density.
frequency bin, s k is the k-th spectral magnitude value.

Table 5 .
One Class SVM evaluation metrics for gamma = 0.2 and fraction parameter = 0.6.

Table 6 .
Robust Covariance Ellipse evaluation metrics for gamma = 0.2 and contamination parameter = 0.2 and 0.3.