Support-Vector Machine Approach for Robust Fault Diagnosis of Electric Vehicle Permanent Magnet Synchronous Motor

Permanent magnet synchronous motor (PMSM) is a leading technology for electric vehicles (EVs) and other high-performance industrial applications. These challenging applications demand robust fault diagnosis schemes, but conventional strategies based on models, system knowledge, and signal transformation have limitations that degrade the agility of diagnosing faults. These methods require extremely detailed design and consideration to remain robust against noise and disturbances in the actual application. Recent advancements in artificial intelligence and machine learning have proven to be promising next-generation solutions for fault diagnosis. In this paper, a support-vector machine (SVM) utilizing sparse representation is developed to perform sensor fault diagnosis of a PMSM. A simulation model of the pertinent PMSM drive system for automotive applications is used to generate a set of labelled training example sets that the SVM uses to determine margins between normal and faulty operating conditions. The PMSM model includes input as a torque reference profile and disturbance as a constant road grade, against both of which faults must be detectable. Even with limited training, the SVM classifier developed in this paper is capable of diagnosing faults with a high degree of accuracy, suggesting that such methods are feasible for the demanding fault diagnosis challenge in PMSM.


INTRODUCTION
Permanent magnet synchronous motor (PMSM) is one of the most critical technologies for electric vehicle (EV) powertrains. As a combination of an induction motor and a brushless direct current (DC) motor, PMSM is typically used in high-performance and high-efficiency applications, like EVs. PMSM has a permanent magnet rotor and windings on the stator similar to those of a brushless DC motor. The symmetrical three-phase stator windings produce a sinusoidal distribution of flux in the air gap and thus a sinusoidal back electromotive force (EMF). PMSM has low mass and moment of inertia with a smooth rotational drive over the speed range and maximum torque at zero speed. The primary advantages of PMSM are simple structure, high efficiency, low mass, large overload capacity, and high dynamic performance. These advantages lead PMSM to many applications in manufacturing systems, marine drives, wind generators, EVs (Zheng, Wang, Wang, Li, and Li, 2017), and other industrial equipment (Kalimov & Shimansky, 2015).
However, due to the diverse applications and highly dynamic operating conditions of PMSM, the long-term reliability and robustness are critical. Various load conditions and application environments make PMSM susceptible to faults throughout its service life. Because the reliability is essential for the high-performance applications of PMSM, the timely detection, diagnosis, and countermeasure of faults are crucial (Chen, Liang, Li, Liang, and Wang, 2019). Thus, a robust, agile, and reliable fault diagnosis strategy is of great interest for PMSM. In this study, the main focus is on the sensor faults in the PMSM drive systems, and a methodology via SVM is proposed to assess the trustworthiness of signals obtained by various sensors. The main objective is therefore to develop an SVM based fault diagnosis approach to detect and isolate sensor faults in PMSM, which is also robust to disturbance and noises.
The paper is organized as follows. Section 2 shows related work in the field of fault diagnosis of PMSM. Section 3 introduces the problem statement. Section 4 presents the PMSM drive model and the proposed diagnosis approach Chunheng Zhao et al. This is an open-access article distributed under the terms of the Creative Commons Attribution 3.0 United States License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited. using SVM. In Section 5, the simulation results are reported, and conclusions are presented in Section 6.

RELATED WORK
Faults in PMSMs can be classified into three types: electrical faults, mechanical faults, and magnetic faults (Chen, Liang, Li, Liang, and Wang, 2019). Electrical faults occur primarily due to incorrect connections of the motor windings, inter-turn short circuits of the stator phase windings, grounding issues, and open circuits. Mechanical faults are those damaging the electric machine due to shaft bending, loose bolts or fixtures, air gap eccentricity, or bearing wear. Magnetic faults degrade the magnetization of the permanent magnet and can occur due to high temperature, excessive stator current, short circuit of the inverter or stator, or aging. To maintain the reliability of the PMSM in service, it is critical to quickly and precisely identify any faults that may occur and their type, location, and severity. Fault diagnosis methods for these machines typically fall into one of three categories: model-based approach, signal processing approach, and data-driven intelligent approach.

Model-based Approach
Model-based fault diagnosis predicts the behavior and performance of the system's signals after the occurrence of various faults in the motor. The actual performance is compared with the predicted data and any difference, or residual, between the two can indicate a faulty state. A basic model is based on the electrical equivalent circuit (EEC), which is fast but less accurate (Chen, Liang, Li, Liang, and Wang, 2019). In order to get a higher accuracy, magnetic equivalent circuit (MEC) and inductance are utilized by Faiz, Nejadi-Koti, and Exiri (2017) to detect inter-turn faults. Digital simulation models such as the finite element model (FEM) have also been commonly used for almost all PMSM faults, which could give even better accuracy. Fitouri, BenSalem, and Abdelkrim (2016) presented a finite element analysis and equivalent circuit simulation for PMSM. The simulation model is exploited to analyze the system with faults caused by an electric component such as the short circuit in the stator. Li and Liang (2015) utilized finite element analysis to study the inter-tern short circuit fault of PMSM. Khan, Okonkwo, Usman, and Rajpurohit (2018) developed and analyzed a FEM for the PMSM system with demagnetization faults. Usman, Joshi, and Rajpurohit (2017) compared commonly used models including analytical mathematical models, magnetic equivalent circuit models, and digital simulation models.

Signal Processing Approach
Signal processing approach typically includes time domain methods, frequency domain methods, and the time-frequency domain methods. Time domain statistical methods are used in the initial period of fault diagnosis development, but they are not accurate enough (Chen, Liang, Li, Liang, and Wang, 2019). The most powerful frequency domain method is the Fast Fourier Transform (FFT). It shows the frequency distribution of the signal using amplitude and frequency of harmonic components as features (Rosero, Romeral, Cusido, Garcia, and Ortega, 2007). Hang, Ding, Zhang, Cheng, Chen, and Wang (2016) defined a simple fault indicator as the sum of the absolute values of amplitude differences between the stator currents by using a frequency-tracking algorithm. Stack, Harley, and Habetler (2004) utilized frequency characteristics of machine vibration signals to identify singlepoint defects in rolling element bearings. However, FFT is unable to provide time domain information, and sometimes similar harmonics are difficult to be distinguished. Therefore, time-frequency methods like Short-time Fourier Transform (STFT), Wavelet Transform (WT), and Hilbert-Huang Transform (HHT) were introduced to generate timefrequency domain data. Rosero, Cusido, Espinosa, Ortega, and Romeral (2007) analyzed stator current by means of STFT and used the results to detect damaged bearings in PMSM. Obeid, Battiston, Boileau, and Nahid-Mobarakeh (2017) discussed the stator incipient fault diagnosis by studying reference voltage using WT. Strangas, Aviyente, and Zaidi (2008) presented and compared different methods to identify electrical faults, which are based on Short-time Fourier Transform, Undecimated Wavelet Transform, and Wiger and Choi-Williams distributions of the field-oriented currents.

Artificial Intelligence Approach
As artificial intelligence and machine learning rise in popularity and prevalence, data-driven intelligent diagnosis systems begin to emerge as prospective strategies for fault diagnosis in a wide range of applications (Chen, Liang, Li, Liang, and Wang, 2019). Data from the PMSM can be fed to a machine learning algorithm as training examples to predict normal and faulty operating states. These systems have the advantage of not requiring advanced knowledge of machine characteristics or a sophisticated model of PMSM. Methods like fuzzy logic, neural networks, and support vector machines (SVM) can be used to identify faults directly using only the states of the PMSM drive system like three-phase current signals, rotor position signals, and motor speed signals. Çira, Arkan, and Gümüş (2015) detected stator winding short circuit faults and estimated severity by utilizing an artificial neural network (ANN) based pattern recognition system. Wen, Li, Gao, and Zhang (2017) proposed a two-dimensional (2D) Convolutional Neural Network (CNN) for fault diagnosis, which is tested on three famous datasets, including a motor bearing dataset, self-priming centrifugal pump dataset, and axial piston hydraulic pump dataset. Luo, Qiu, and Shi (2018) also proposed a deep learning algorithm for motor fault detection using Long Short-Term Memory (LSTM). Liang, Chen, Liang, and Li (2019) utilized sparse representation and SVM to detect inter-turn short-circuit fault. The sparse representation is used to extract signal features and SVM is used to classify normal conditions or faulty conditions. In this paper, an SVM based machine learning approach is used to detect sensor faults in a PMSM. Machine learning is advantageous because it doesn't require sophisticated modeling of the motor, instead it only requires enough data. System nonlinearity can be handled, and a high accuracy can be achieved by a good selection of datasets (Lee, Wu, Zhao, Ghaffari, Liao, and Siegel, 2014). In addition, machine learning methods tend to perform better when dealing with multi-dimension and continuous features (Liu, Yang, Zio, and Chen, 2018). As there are many sensors for an automotive application (e.g. current sensors, voltage sensors, vehicle speed sensors, etc.), a large scale of data can be generated. In order to reduce the time spent on data collection and training, SVM is chosen as it can work pretty well with even little data. According to Shin, Lee, and Kim (2005), SVM can achieve a similar performance as neural networks with a training set that is 50% or less in classification tasks. More specifically, inspired by Liang et al. (2019), a sparse representation based SVM classifier is proposed to detect different sensor faults in a PMSM drive system on electric vehicles. Different from just a single type of fault considered by Liang et al. (2019), various sensor faults under the presence of disturbances are considered here, specifically for an electric vehicle application. Therefore, input features are different, and the types of features are also expanded.

PROBLEM STATEMENT
Consider an EV traveling on a straight lane, which is driven by a PMSM drive system. As the PMSM works relying on multiple sensor data (e.g. motor speed, vehicle speed, etc.), those data should be identified as faulty or not. This is achieved by a fault diagnosis algorithm in the Electronic Control Unit (ECU), which could evaluate the trustworthiness of the sensor data. ECU can access data from different sensors through Controller Area Network (CAN) with their unique identification numbers. Ten types of different sensor data are assumed to be accessible in this project as shown in Eq. (1).

= [ 1 … 10 ]
(1) where is is the total accessible sensor data at time ; Among all the ten sensors, eight types of sensor faults are considered here, which are phase ab current sensor fault, phase abc voltage sensor fault, motor angular position sensor fault, motor speed sensor fault, and vehicle speed sensor fault. All the eight faults also occur with road grade disturbance.
The goal is to generate a fault diagnostic algorithm which is able to detect and isolate the occurrence of a single fault from the given list of potential faults. The algorithm must be robust to disturbance and inherent noise.

METHODOLOGY
The proposed approach is an SVM classifier based on features extracted by sparse representation. The sensor data presented in Eq.
(1) is streamed directly from vehicle onboard sensors and fed to a sparse representation algorithm to extract features. Then the features will be cascaded into an SVM classifier to output the conditions of the PMSM system, which could tell a faulty sensor or normal state. In lieu of realworld test data from the vehicle or a hardware-in-the-loop (HIL) bench, this paper employs a PMSM simulator to generate data and perform a diagnosis algorithm. The PMSM drive model is designed to accept a torque reference profile in the motor controller. This torque reference is the command that the PMSM simulator will follow as it is subject to fault injection and disturbance. The command is an input to the motor controller block and mimics the actual type of input that would be received from an accelerator pedal position sensor as the driver requests tractive torque. In the following subsections, subsection 4.1 introduces details of the PMSM drive model, subsection 4.2 introduces details of sparse representation design and subsection 4.2 introduces SVM classifier design.

PMSM Model Description
The PMSM drive model used in this paper is shown in Fig.  1, which is comprised of three main subsystem blocks: the inverter and battery, the motor controller, and the PMSM and vehicle dynamics. Since the PMSM model is typically described in the rotor dq axis, Park's transformation matrices are employed to change to and from the three-phase abc axis between subsystems. The transformation matrix is given by Eq. (2), where is the angle between the coordinate systems, is the original state in the abc axis and is the transformed state in the dq axis.
The motor controller takes the reference torque profile, motor position, and measured abc phase currents as inputs and generates the S1~S6 switching sequence for the inverter. Both motor position and measured abc phase currents are subject to faults. The motor controller is assumed to be free of disturbance.
The inverter and battery subsystem block actuate the abc axis voltages which are then transformed into the dq axis for the PMSM subsystem. Interaction between the motor controller and the inverter/battery system is assumed fault-free, so the subsystem is not subject to any input sensor faults. However, the sensors measuring abc phase voltages are subject to faults. The inverter and battery are assumed to be free of disturbance.
As the dynamics of the PMSM and its fault diagnosis are the focus of the model, the vehicle dynamics are simulated with a simple model. The motor speed is coupled with the vehicle's road wheel speed through the radius of the wheel and the gear ratio. In this subsystem, the motor speed sensor and vehicle speed sensor also experience faults, all of which are independent and of finite duration. The PMSM and vehicle dynamics subsystem are also subject to disturbances in the form of road grade variation.
The load torque due to road forces is given by Eq. (3) where is the density of air, is the drag coefficient, is the front cross-sectional area of the vehicle, ℎ is the vehicle speed, is the rolling resistance, M is the mass of the vehicle, g is the acceleration due to gravity, is the road grade, is the radius of the tire, and GR is the gear ratio.
The electromechanical dynamics of the PMSM are given by the five state equations of Eq. (4) where and are the currents in the dq axis, and are the voltages in the dq axis, and are the inductances in the dq axis, is the magnetic flux generated by the rotor permanent magnets, is the motor speed, P is the number of pole pairs, is the electromagnetic torque produced by the PMSM, is the angular position, J is the effective inertia of the rotating components, and b is the coefficient of friction.

Sparse Representation Design
The purpose of sparse representation is to represent the original signal as a sparse linear combination of the dictionary atoms in an overcomplete dictionary matrix (Zhang, Xu, Yang, Li, and Zhang, 2015). The main idea is to utilize as fewer dictionary atoms as possible to obtain a simpler representation of the digital signal. Sparse representation can extract basic information from the signal and avoid the interference of small noise in the signal, such as inherent measurement noises. In our case, there are ten signals from ten different sensors, given the sensor signal = [ 1 , 2 , … , ] with length = 10. For each ∈ where = [ 1 , 2 , … , ] is the dictionary matrix which is a subset of basis dictionary * = [ 1 * , 2 * , … , * ] , the column vector with a dimension of × 1 is the dictionary atom (i.e. sample), is the length of which depends on the sampling time interval and || || = 1. The dictionary is an overcomplete dictionary with > . = [ 1 , 2 , … , ] is the solution to the sparse representation of the original signal and for each ∈ is the sparse representation coefficient. The goal of sparse representation is to find a subset from * and the corresponding . A commonly used dictionary is discrete cosine transform ( The coefficient solution can be obtained by solving the linear representation problem with 0 − minimization constraint: where refers to the Lagrange multiplier associated with || || 0 . || || 0 represents the number of nonzero elements in . In order to solve this optimization problem, a greedy iterative algorithm called orthogonal matching pursuit (OMP) is used in this paper . First, it chooses the atom 1 that matches the input signal best from the basis dictionary matrix and calculates 1 and residual, which is orthogonal to the span of the atoms already selected. Then it continues to select the second atom 2 that matches the signal best using updated residual and iterates over until it meets a residual criterion.
After the OMP algorithm is used to obtain the sparse coefficients vector for ten sensor signals ( = 1, . . . ,10), the variance of , the largest and second largest elements of are selected for each sensor signal as features, because they show obvious differences under normal condition and faulty condition as further discussed in Section 5. Therefore, there are ten sensor signals with three features for each signal and 30 features in total. Mark the extracted features as 1 , 2 , 3 , … , 10 respectively for three-phase current signals, three-phase voltage signals, motor angular position, motor speed, vehicle speed, and motor torque, where 1,1 is the maximum coefficient feature of phase a current, 1,2 is the second maximum coefficient feature of phase a current, 1,3 is the variance feature of phase a current and so on. Then the input to the SVM classifier becomes in Eq. (8).

SVM Classifier Design
The aim of using SVM is to find a hyperplane to segment all the data points. Segmentation is the process of defining the hyperplane such that the margin from the hyperplane to the nearest data point on each side is maximized. Considering a binary SVM classifier, let the sample points for training be ( , ), = 1, 2, … , . The input is ∈ ℝ 30 as illustrated in Eq. (10) and the output is ∈ {−1, 1}. If is the normal vector of the hyperplane and b is the displacement, the equation of the hyperplane is The best hyperplane (i.e. largest margin) could be obtained by solving  It is computationally simpler to solve a dual quadratic programming problem. The dual formulation is given by and it is derived by setting the gradient of ( , , ) to zero, which leads to the following equations and by substituting Eq. (13) into Eq. (11).
From the solution of Eq. (12), the hyperplane equation could be obtained. Note that sometimes the original data is not linear separable, in order to make it linear separable, a nonlinear transformation is usually performed on original data by use of kernel function. A kernel function ( , ) is usually used to replace , which could transform data into the required form. For example, in Fig. 2, there is an original dataset = [ −1, 1, −2, 2] and a linear boundary is not feasible if we'd like to separate between [-1, 1] and [-2, 2], but they can be separated by = 2 after transformed into a dataset ′ =[1, 1, 4, 4] using transformation ′ = 2 . There are two most commonly used kernels which are gaussian kernel and polynomial function kernel. A Gaussian kernel is defined as Polynomial function kernel is defined as where indicates the order of the polynomial function. In our case, the input vector of the sample point is 30dimensional as illustrated in Eq. (8), which means ∈ ℝ 30 . As for the output, ∈ {1 … 9}, where represents phase a current sensor fault, phase b current sensor fault, phase a voltage sensor fault, phase b voltage sensor fault, phase c voltage sensor fault, motor angular position sensor fault, motor speed sensor fault, vehicle speed sensor fault, and normal condition. In order to implement the multi-class SVM classifier, a one-vs-the-rest (OVR) strategy is utilized here (Hsu & Lin 2002). As a single SVM is a binary classifier, this strategy consists in fitting one classifier per class. For each classifier, the class is fitted against all the other classes. For example, the first classifier outputs phase a sensor fault or not, the second classifier outputs phase b sensor fault or not. Therefore, there are 9 classifiers in the whole SVM model as shown in Fig. 3.

Simulation Setup
The PMSM motor and vehicle parameters used in this simulation are listed in Table 1. The parameters come from the modeling of a typical electric vehicle with a PMSM drive system. The sensors' measurements are simplified as a summation of true value and random bias.
During the simulation, a scheme showed in Table 2 is used to implement faults and disturbance, all of which are independent and of finite duration. Figure 4 shows the profile of the torque reference for the motor controller. The simulator injects all the eight faults and the two disturbance events as shown in Fig. 5 where values of 1 or 0 indicate that the fault disturbance is active or inactive, respectively.
In order to generate training and testing datasets from the simulation, the sampling period is set to 0.0001s. One thousand data points are bundled as one set, which means the time of each set is 0.1s. Sixty sets collected under different fault conditions are used as the training dataset and 15 sets are used as the testing dataset. The selected kernel function for the SVM classifier is a gaussian kernel. The comparison of different kernels is presented in subsection 5.2. An outlier fraction is considered as 0.1, which means 10% of the training data is regarded as expected outliers.
Since sparse representation is time-consuming, and it cannot be done within the sampling time for one set of data which is 0.1s, real-time implementation cannot be done. In order to show the detection time in a real-time operating environment, data preprocessing for time-series data fault detection is implemented. First, during the running of the PMSM drive model, all the sensor data are saved with corresponding timestamps. Then the sequential data is sliced into multiple slices and each slice contains 1000 data points, which has the same size as one training set used to train the SVM classifier. Finally, all the sliced sequential data is fed into the SVM classifier to determine the highest probability state which is faulty conditions or normal conditions. In this conditional real-time scenario, the execution time of feature extraction and SVM classification is ignored, and only the delay due to the sample size is considered. More details about delay time are discussed in subsection 5.2.

Simulation Results
First, the dataset from 10 sensor signals is created, which are three-phase abc current signals, three-phase abc voltage signals, motor angular position signals, motor speed signals, vehicle speed signals, and motor torque signals under 8 faulty conditions and 1 normal condition. One set of the collected phase a current under normal condition and under rotor angular position sensor fault are shown in Fig. 6.
After the dataset is generated, sparse representation is implemented to extract features. Features extracted from phase a current data under motor speed sensor fault and normal conditions are shown in Fig. 7 as an example. The values of most small sparse coefficients of the fault signal and the normal signal are almost the same, but the difference between the large sparse coefficients is obvious. The amplitude of large sparse coefficients of fault signals is usually higher than them of the normal signal, especially the maximum sparse coefficient. Also, the sparse coefficients of fault signals always have a larger variance than those of normal signals.  The extracted features are fed into the SVM classifier to get the support vectors and hyperplanes. Support vectors are data points that are closer to the hyperplane and influence the position and orientation of the hyperplane. As there are 30 features in total, which is high-dimensional data, the overall hyperplane cannot be visualized. However, support vectors using only 2 predictors could be visualized. As shown in Fig.  8, the maximum coefficient feature of phase a current and coefficient variance feature of phase a current act as the coordinate axes, where support vectors are circled.
With minimal processing time, the SVM is able to detect and isolate all eight fault conditions from normal operation, robust of disturbance. As shown in Table 3, a simple linear kernel function only gives 66.67% accuracy on the testing dataset, which indicates the data is not linear separable and nonlinearity should be included by adopting a Gaussian kernel or polynomial function kernel. The best accuracy of the training dataset is 100%, which is achieved by a second and higher order polynomial kernel function. However, this perfect accuracy may result from the overfitting problem due to the small training dataset. The decreasing accuracy on the test dataset also shows the effect of overfitting. Therefore, the Gaussian kernel function is selected with 93.33% accuracy on the testing dataset. The testing results prove that the features extracted by sparse representations can be used for fault diagnosis of PMSM, and the SVM method proposed is effective. Figure 8. Support vectors and sample points for all faulty conditions and normal conditions.
An example of conditional real-time implementation is shown in Fig. 9. In the given fault injection scheme, a phase a current sensor bias fault of +10A is injected at t = 3~3.5s and a motor position sensor bias fault of -2° is injected at t = 7~9s. The values on the 'Fault' axis are arbitrary scalars that identify the various fault states. In the case of Fig. 9, a fault value of '1' indicates the presence of a phase a current sensor fault, and '2' indicates the presence of a motor position sensor fault. Note that the delay in detection after the fault injection event is equal to the size of discrete sample slices used to determine the highest probability state, which is 0.1s. As the length of the sample slice decreases, so will the detection delay. However, there is a practical limit to the minimum sample length that can effectively match the features to highprobability states. Figure 9. Comparison of actual fault injection timing and corresponding detection via pre-processed SVM approach.
Note in this case, the execution time of sparse representation and SVM classification is override because it is found that sparse representation is time-consuming and cannot be done in real time. Table 4 shows the execution time of sparse representation and SVM classification for the first 5 sampling set, which is generated using true real-time simulation instead of the above-mentioned conditional approach.
As shown in Table. 4, the time interval for each sampling set is 0.1s, the execution time of SVM classification is around 0.003s and the execution time of sparse representation is around 6.6s. It shows that SVM classification is fast and can 6.70867s 0.00308s 2 6.64316s 0.00342s 3 6.58546s 0.00298s 4 6.61523s 0.00318s 5 6.64958s 0.00357s run in real-time but sparse representation needs more than 6s to handle data generated in 0.1s.

Discussion
As we see from the simulation results, the proposed SVM classifier can achieve a 93.33% accuracy on the collected datasets given the torque input shown in Fig. 4. This indicates that the SVM is able to learn the characteristics of sensor data, detect and isolate the abnormal data. The input torque profile is quite simple and becomes constant after 20 s, but we believe that this is an important part of the training data, which helps the SVM to better learn the patterns of normal data and faulty data. The SVM trained with this simple torque profile may not work well if tested against a more complex torque profile, because the SVM cannot learn the dynamic characteristic of the motor from static inputs. In order to make SVM achieve good results also with a complex torque profile, it has to be trained with dynamic and complex inputs. Also, a deep neural network (DNN) is another option to replace the SVM classifier because DNN has more parameters, which gives it a stronger ability to learn more complex characteristics of the system.
In this paper, not all the sensor faults are considered. For example, the phase c current sensor fault is not considered because that phase abc currents belong to the same kind of sensor signals. Phase ab currents are used to train the classifier and the identification of faulty phase c current can be inferred from the relationship between 3 phase currents.
As for more potential sensor faults, the classifier can be trained with an additional class which is "Other faults". This class includes all the different types of faults which have not been considered before (i.e. the fault is not assigned with one specific faulty label in the training phase) but still result in an abnormal performance of the system. In this case, although the classifier cannot isolate these faults, it can still detect them.
Training a robust classifier is always a research hotspot in the field of machine learning. In this paper, the robustness refers to the best threshold which can distinguish between normal condition (with noises) and faults under disturbances. The duration and magnitude of faults can be determined by evaluating the performance of the vehicles, which means to find out the minimum duration or magnitude which results in a significantly negative effect on vehicles. The threshold in SVM refers to the hyperplane (boundary) and a good hyperplane is usually selected to maximize the margin between two classes. This selection is similar to the optimal threshold method which is to minimize the probability of false alarms (i.e. false positive rate) and the probability of misdetection (i.e. false negative rate). In order to train a classifier robust to noises, noisy data should be included in the training dataset in order to form a new distribution of data with noises. Once there is a slight change of the distribution, SVM is able to use the optimization (i.e. Eq. (10)) to generate a new hyperplane which considers the noises. In reality, noisy normal data may have some overlapping area with faulty data and SVM can have a penalty for a hyperplane resulting in overlaps. In this way, the hyperplane can be adjusted considering the tradeoff between misclassification and false alarms, and the tradeoff can be also set manually by considering which one is more important.

CONCLUSION
PMSMs are an important propulsion technology for EVs and other high-performance industrial applications. Their demanding operating conditions and application-critical use require that PMSMs be protected against faults and failures in practice. For this reason, a robust fault diagnosis scheme is imperative for PMSMs. Inspired by emerging research in the application of artificial intelligence for fault diagnosis in PMSMs, an SVM based fault diagnosis scheme is proposed in this paper. The simulated PMSM system is equipped with ten sensors, all of which are utilized to generate training data for the SVM classifier. Sparse representation is adopted to extract features which are used to identify sensor data as normal or one of the eight possible fault conditions. Ultimately, the SVM is able to detect the presence of each of the eight injected faults in the presence of noise and disturbance with 93.33% accuracy. A conditional simulation of real-time operation shows that the detection time of fault injection is around 0.1s, which is determined by sample size.
Although the sparse representation seems unable to be done in real-time in this case, there should be a possibility to increase the computational power or reduce one-time computational cost. As future work, more research and experimentation are required to shorten the time required for sparse representation. Another direction could be looking for an alternative feature extraction method which is not timeconsuming. In total, the SVM based fault diagnosis approach is still effective. As the complexity of control strategies for automotive ECUs increases, so do the advantages of agile machine learning methods like SVM for robust fault diagnosis.