Multi-Condition PMSM Fault Diagnosis Based on Convolutional Neural Network Phase Tracker

In many industrial systems, symmetry is the key to ensuring efficiency and reliability. For example, in electric vehicles, the driving system often requires high symmetry. As widely used motors, permanent magnet synchronous motors (PMSMs) are often used in highly symmetrical structures as the driving devices. Consequently, maintaining the symmetry of the system relies on the normal and stable operation of the PMSM, and it is necessary to diagnose faults in the PMSM in a timely manner. In PMSM fault diagnosis methods, frequency domain features of the stator current are extensively used. However, these features change with the switching of motor operating conditions, leading to difficulty of diagnosis in multiple operating conditions. Therefore, a fault diagnosis method based on a convolutional neural network (CNN) phase tracker is proposed in this paper. Through phase tracking and angular domain resampling, the fundamental frequency of stator currents in different operating conditions are aligned, so as to fix the distribution of frequency domain features and solve the problem of features changing with operating conditions. Experimental results show that the proposed method can resample the stator current signals with a small error, detect faults in a relatively short time with high accuracy, and diagnose fault type and severity level under multiple operating conditions.


Introduction
A permanent magnet synchronous motor (PMSM) is a type of motor that shows excellent dynamic performance and high reliability. It is widely used in electric vehicles, rail transit, smart manufacturing, and other fields. During the running of motors, performance degradation and even failure will inevitably occur, which seriously affects the reliability and safety of the whole system [1,2]. The two most common faults in PMSMs are the inter-turn short circuit fault (ITSF) and the irreversible demagnetization fault (IDF) [3]. ITSF refers to a short circuit between two or more turns winding coils in the same phase of the stator [4], whereas IDF refers to the weakening of the permanent magnets on the rotor [5]. The occurrence of this fault will cause the output torque of the motor to become oscillatory, and at the same time the increase in the heat may lead to further deterioration related to the fault. In order to ensure the operation of the system, fault diagnosis technology is critical in order to quickly detect and diagnose faults.
The motor fault diagnosis method emerged in the last century, but it has attracted considerable attention in recent years, with the rapid development and wide application of PMSMs [6]. Generally, motor fault diagnosis relies on signals measured using sensors to extract fault features, using these features for fault detection, classification, and fault severity estimation. Common fault monitoring signals include stator current, speed, torque, vibration, induced voltage, temperature, and some signals from other parts of the system that can reflect motor faults. Features extracted from these signals include statistical 1.
A phase tracker based on a CNN is proposed, which can directly obtain the fundamental wave amplitude, frequency, and phase of the stator current. This method can automatically adapt the parameters according to historical operation data and does not require a manual adjustment step in computed order tracking.

2.
A method of angular domain resampling and fault spectrum feature extraction is presented, which is based on the output of the phase tracker, in which the stator current is resampled without interpolation and aligned with same fundamental frequency. The resampling error is reduced by means of proper spectrum processing. The resampling speed of this method is faster than order tracking, and it can reduce the number of fault samples needed for training and improve the accuracy of fault diagnosis of a PMSM under multiple operating conditions. The reminder of this paper is organized as follows. The basic techniques of the CNN and fault severity level assessment used in the proposed method are briefly introduced in Section 2. The proposed PMSM fault diagnosis method based on the CNN phase tracker is developed in Section 3. In Section 4, an experiment on a hardware-in-the-loop simulation platform is conducted for method validation and analysis. Section 5 presents our conclusions.

Preliminaries
There are three steps in the complete motor fault diagnosis process: fault detection, classification, and severity prediction. Among all the motor fault diagnosis methods, deep learning models are usually unable to build an end-to-end model due to the difficulty involved in obtaining training data and their poor anti-noise ability, so artificial features are required [16][17][18]. However, deep learning models have a strong representation ability and can be used as a part of a diagnosis method for feature preprocessing and other operations. Furthermore, most stator-current-based PMSM fault diagnosis methods have difficulty predicting severity. In this section, a brief introduction to the deep learning model and fault severity level prediction methods is provided to convey the main purpose of this paper more clearly.

Convolutional Neural Network
A CNN [19] is a kind of neural network, composed of several convolutional layers. By sharing parameters through convolutional kernels, the use of a CNN greatly reduces the number of parameters. Hence, CNNs are widely used in image and video recognition, recommender systems, and natural language processing, and have made remarkable achievements [20]. In motor fault diagnosis, CNN is usually used as a feature extraction model for time series [21,22]. Depending on the features of the input data, the convolutional kernels of the first layer can be one-dimensional or two-dimensional convolutional kernels, or both. After extracting features from the CNN, the fully connected layer or other models can be used to realize fault diagnosis. For example, CNN-long short-term memory (LSTM) [23] is a common structure. When the input features are multiple time series, such as three-phase stator currents, the processing of the convolutional layers will not destroy the time-domain distribution of the features, so the output of CNNs are still time series, which can be transferred to the LSTM model for fault diagnosis. To realize fault diagnosis using a CNN requires accurate manual feature extraction and a large amount of data, but actual motor fault operation data are hard to obtain, which can easily lead to model overfitting.

Fault Severity Level Assessment
Faults of differing severity have various influences on motor operation [24], and the corresponding maintenance measures that need to be taken are also discriminative, so it is necessary to assess the fault severity. Due to the influence of noise, it is hard to accurately estimate the fault severity based on the raw sensor signal. A more reasonable approach is to grade the fault severity according to the characteristics of motor faults [25,26], and then to predict the level. This assessment is actually a classification problem, so it can be implemented using various classification algorithms [27]. For motor faults, machine learning is usually used to diagnose fault severity, such as support vector machine (SVM) and random forest (RF) methods. Similarly to fault type diagnosis, severity diagnosis also depends on artificial features. For example, when a PMSM suffers from an inter-turn short-circuit fault, the specific fault frequency will appear in the stator current, and its amplitude is proportional to the degree of the inter-turn short circuit. When the fault severity is small, that is, the short circuit resistance is minor, the amplitude of the fault frequency will be tiny, so the estimation is difficult. The common solution is to separate the fault and noise signal from the original sensor data for analysis.

Proposed Fault Diagnosis Method
The fundamental frequency of the stator current changes when the motor is running in multiple operating conditions, which leads to a change in the fault frequency. In order to apply frequency-domain features to fault diagnosis in a PMSM under multiple operating conditions, a new method based on a CNN phase tracker is proposed. Figure 1 shows the flowchart of fault diagnosis in a PMSM using the proposed method. First, the appropriate phase tracker is trained on an artificial dataset according to the motor's historical operation dataset. Then the phase tracker is used to convert original signals in time domain into the angular domain. After angular resampling, the fundamental frequency of stator current signals under any operating condition will be adjusted to the same, so the motor fault diagnosis can be performed by using the fixed frequency-domain fault features. At this point, the construction of a fixed frequency feature library and the diagnosis of a fault by matching samples with the library can effectively reduce the complexity of the method. In the testing phase, the real-time stator current signal is inputted into the trained phase tracker, and the obtained phase signal is used for resampling, and then the residual signal and its frequency-domain features are calculated. These features are inputted into the fault diagnosis algorithm to obtain the final result. In this method, both the training and testing phases only need to obtain the stator three-phase current signal as inputs, which are common feedback signals in almost any PMSM monitoring system. No other information or instructions are needed, so it can run in parallel with the PMSM control system and monitoring system.

CNN-Based Phase Tracker
If order tracking is directly applied to the PMSM system, the following problems exist. First, accurate electrical rotating speed feedback is needed. Generally, the PMSM is equipped with a rotating speed sensor and a three-phase stator current sensor. The rotating speed sensor can obtain motor mechanical rotating speed in r/min, which can be converted into electrical rotating speed in rad/s using Equation (1) where ω e is the electrical rotating speed, n p is the number of poles, and N is the mechanical rotating speed acquired by the sensor. It can be seen from Equation (1) that if such a conversion is performed, the number of poles of the motor needs to be obtained, that is, parameter identification is required. Secondly, changing the sampling rate of the stator current sensor in real time may affect the running of other subsystems. For example, the control system generally requires the sampling rate of current feedback to be constant. If the sampling rate changes, the control system also needs to make corresponding modifications, which introduces additional work. Therefore, the sampling rate of the stator current sensor cannot be changed at will.
Although the stator current sensor cannot implement order tracking at the hardware level, a similar approach can be achieved at the software level. The stator current is a sine wave when in the normal status or fault severity is not high, and the amplitude, frequency, and phase of any sine wave can be calculated using dedicated algorithms. After the parameters of the fundamental wave are obtained, the order tracking at the software level can be realized by digital resampling, that is, via the phase tracking of the stator current.
Before building the CNN model, the training and validation dataset of the phase tracker are first constructed, which are a number of computer-generated sinusoidal wave sequences with certain noise, and the generation equation is where S i denotes the i-th generated sequence; a i , f i , and θ i represent the amplitude, frequency, and phase of i-th sequence, respectively; a i ∈ [A min , A max ], A min , and A max represent the minimum and maximum values of stator current amplitude and that determined based on the actual operation data of the motor; f i ∈ [F min , F max ], F min , and F max denote the minimum and maximum value of the stator current frequency and that determined based on the actual data; θ i is drawn randomly from [0, 2π]; T is a time series, . . , L f s ], f s is the sampling rate of the stator current sensor; and L is the sequence length. n i (T) is a noise sequence contained in the i-th sequence; it is assumed to follow a Gaussian distribution in this paper. A large number of sequences can be generated by changing a i , f i and θ i , and it is not necessary to have the corresponding actual motor data; this allows the phase tracker to operate over a very wide range and ensure accuracy.
After generating the training sequences, the next step is to build a CNN-based phase tracker. The framework for the proposed CNN-based phase tracker is shown in Figure 2. The inputs of the CNN model in the training phase are the sequences generated by Equation (2), and the inputs in testing phase are the real-time stator current signals fed back by the sensors. The input signals are passed through the CNN, then three outputs are obtained, corresponding to the amplitude, frequency, and phase of the fundamental frequency of the input signals. The model consists of several convolutional layers and pooling layers stacked to form the former CNN part, and then the fully connected layer as the output layer. In the sequences generated, the larger the amplitude and frequency intervals, or the greater the noise, the more convolutional and pooling layers are required, according to experience. The activation function used by all neurons in the model is rectified linear units (ReLU), and the loss function is the sum of the mean square error of the three outputs that are normalized between 0 and 1. It is worth noting that phase trackers are not necessarily built using only CNN models; other neural networks can perform the same function. Compared with other neural networks, CNN has fewer parameters and a faster training speed, so the CNN model was chosen in this work.

One-dimensional Convolution
Training Data . .

Pooling
... After the CNN model is trained using the stochastic gradient descent method, actual motor data or simulation data are used for testing. In the stator-current data used for testing, the amplitude should be within [A min , A max ], the frequency should be within [F min , F max ], and the noise amplitude should not exceed the maximum noise added when generating the phase tracker training dataset. As long as the stator-current data used in the test are within the previously defined range, the phase tracker can accurately output the amplitude, frequency, and phase of the stator current's fundamental wave.

Angular Domain Resample
With the proposed CNN-based phase tracker, the signal collected by the stator current sensor can be converted into three time-domain signals, namely, the amplitude, frequency, and phase, among which the phase signal can be used for the angular domain resampling of the original signal. The principle of angular domain resampling is based on selecting the first sampling point of the signal as a benchmark and resampling every time it passes a set angle interval until traversing the entire signal. However, since the feedback signal of the sensor is discrete, if the resampling is not carried out physically, it cannot be guaranteed that there is a corresponding sampling point at every angle, so interpolation or approximate sampling is required. The angular domain resampling method is introduced below.
After resampling at fixed-angle intervals, the frequency of the stator current signal in any operating conditions will be aligned to the same frequency, that is, the frequency reference. If the fundamental frequency of the original signal is higher than the reference, it will be upsampled, or otherwise subsampled. Resampling in this way will require interpolation calculations and reduce the execution speed of the algorithm. Since the sampling rate of the stator current sensor is usually very fast, selecting a high frequency as the reference and subsampling the signals under all operating conditions can effectively improve the calculation speed. This method will introduce some resampling error, but this error can be reduced by means of feature extraction. The angle interval of resampling is calculated by where ∆θ re is the resampling interval and F re f is the frequency reference, which should be chosen manually. Since no interpolation is carried out, resampling using only the original data will lead to a certain error in the fundamental frequency of the resampled signals, which will decrease with the increment of F re f . However, a larger reference value means that more data will be discarded when the low-frequency signal is resampled, which will lead to a slow speed of the algorithm. Therefore, the selection of the reference value should be decided according to the actual situation. The odd harmonics of the highest fundamental frequency should be retained, so in this paper 3F max is selected as the reference value. After the angle interval is calculated based on Equation (3), the phase signal is reselected with each sampling interval of ∆θ re ; if there is no corresponding point on the phase signal, the nearest point is selected. The next step is to record the index of each reselected point on the phase signal, and extract the point of the same position from the original stator current signal to obtain the angular-domain resampled signal.

Fault Feature Library Construction
The fundamental frequency of the stator current after angular domain resampling will become F re f , but each sampling point may have a certain error. The next step is to minimize these errors by establishing a fault feature library. Common fault frequency domain features of PMSMs are proportional to the fundamental frequency of the stator current, so a small number of fault samples can be used to construct the fault feature library after fundamental frequency unification. Firstly, in the historical data of the PMSM, each kind of fault and various fault severities are selected uniformly. After phase tracking and angular-domain resampling with the proposed method, the samples for constructing the fault feature library are obtained. Since the amplitude of the fundamental frequency in the stator current is much larger than the fault frequency amplitude, in order to improve the accuracy of fault diagnosis, it is necessary to delete the fundamental frequency component from the original signal and retain only the residual signal for fault diagnosis. The residual signal is computed as follows: whereâ i ,f i , andθ i represent the estimated value of amplitude, frequency, and phase of the i-th signal by the phase tracker; T i is the sampling of T according to the index of i-th signal in the angular domain resampling; and I i is the i-th signal after angular domain resampling. Then fast Fourier transform (FFT) is performed on these residual signals, and components with frequencies less than the highest fault frequency are retained. If the highest fault frequency is three times that of the fundamental frequency, components with frequencies less than 3F re f are retained.
The deviation caused by resampling is reduced by dividing the FFT results into segments and merging them; that is, among all retained components, the average value of each adjacent Q components is taken as a new feature; Q is an integer and can be adjusted depending on the size of deviation.

Fault Diagnosis
The motor fault diagnosis procedure is divided into fault detection, fault classification, and fault severity prediction. After establishing the fault feature library with a small number of samples, motor fault detection and classification can be realized by matching features between the real-time stator current and the fault feature library. In the case of the fault severity prediction, it is necessary to learn the relationship between the fault frequency amplitude and the fault severity from the data. In an SVM model, the kernel function can map the complex nonlinear relationship, while having a certain smoothing effect. For this reason, the SVM model is used for the fault severity prediction, as shown in Figure 3. The real-time stator currents are first fed into the phase tracker. After completing the signal resampling, the FFT of the residual signals is performed, and then several similar samples can be found in the fault feature library. These similar samples and residual signals are fed into the SVM model for further determination. The specific diagnostic steps are shown in Algorithm 1. Divide data into segments and input to the CNN phase tracker, obtain corresponding amplitudeâ i , frequencyf i , and phaseθ i ; 2: Resample data with interval ∆θ re and record resampling index; 3: Calculate residual signals e i using Equation (4); 4: Perform FFT on e i , retain frequency spectrum coefficients less than 3F re f , and divide into Q intervals to obtain residual frequency spectral features s i ; 5: Input s i ,â i ,f i to different trained SVM model to get F s , F t , F l .

Comparison
Compared with traditional PMSM fault diagnosis methods based on frequencydomain feature analysis, the proposed method features two key components: the phase tracker and angular domain resampling, in which the phase tracker can be executed quickly after off-line training, whereas the angular domain resampling step cancels the interpolation algorithm to improve execution speed, so it can maintain the same level of timeliness as the traditional method. In constructing the fault feature library steps, the signals' fundamental frequency is adjusted to a same value after sampling; thus, it is not necessary to use a large number of fault samples under different operating conditions, as in traditional methods. Only the minimum speed, maximum speed, and small samples of other speeds under fault conditions are needed. The proposed method reduces the demand for fault samples, and at the same time improves the generalization ability. Figure 4 shows an illustrative comparison between the proposed method and traditional methods. In the next section, experimental verification and further analysis are carried out using simulation data.

Experimental Validation and Discussion
In this section, the proposed method is experimentally verified using simulation data, and the results are analyzed in detail.

Introduction to Experiment Platform and Data Set
The experimental data were collected from a real-time PMSM fault injection simulation model, which was built on a hardware-in-the-loop (HIL) simulation platform. A schematic diagram of the simulation system is shown in Figure 5. It consisted of three parts, in which a computer was used to set parameters, control the simulation process, and record and display data. DSP performed PMSM control and the fault injection program; the inverter and motor models were implemented by the field programmable gate array (FPGA). During the simulation, all relevant parameters were set using the setup software in the computer, and then the motor control commands and fault injection commands were sent to the DSP controller. The controller generated corresponding driving signals to the inverter instantly, so the PMSM could output corresponding signals on the stator current, rotational speed, torque, etc. During the simulation process, all output signals of the PMSM were fed back to the controller and its computer through the sampling circuit. The system operation parameters and fault injection parameters can be set using the computer software. The system operation parameters include speed and load, and the fault injection parameters include injection time, fault type, and fault severity. After establishing these settings, the simulation system was run, and the three-phase stator current and PMSM rotating speed were fed back to the computer and recorded. The DSP chip used in the simulation system was TMS320F28335, in which the motor control program and fault injection program were executed. The main function of control program was to receive the three-phase stator current feedback from the motor, modulate the drive signal of the inverter by using a vector control strategy, and output the drive signal of each transistor of the three-phase inverter through digital I/O pins. The main function of the fault injection program was to superimpose an additional signal in the motor feedback stator currents, causing the motor to operate in the same state as the fault conditions, so as to realize software fault injection. The principle of fault injection is discussed further in [28]. The inverter received the drive signal from DSP, generated the three-phase voltage, and then transferred this to the PMSM model. The PMSM model calculated the state of the motor according to the motor equation, and outputted the three-phase stator current, rotating speed, electromagnetic torque, etc. All programs in the computer were realized through the MATLAB platform, including the simulation control software and fault diagnosis program. The motor parameters used in the experiment are shown in Table 1; it was a small power PMSM for a drive system.
In the simulation model, the PMSM has a constant load, so only rotating speed setting values were considered as operating conditions. Under each condition, three kinds of data-namely, normal, ITSF and IDF data-were collected for the experiment regarding the fault diagnosis method. The motor rotating speed ranged from 500 r/min to 1800 r/min, so operating conditions consisted of four rotating speeds, i.e., 500, 1000, 1500, and 1800 r/min. Fault severity was set at three levels of 3%, 5%, and 10%, respectively, to simulate corresponding degrees of short-circuit and demagnetization. With the addition of the normal data, there were four levels of fault severity in each condition. Table 2 shows the settings used for the experimental dataset. According to the range in Table 2, there were three levels of each fault in each condition, so there were 24 groups of fault data and 4 groups of normal data in four operating conditions. The sampling rate of the stator current fed back by the PMSM was 25 kHz. In order to collect enough samples, the data under normal and fault conditions were continuously sampled for 30 s. Under the same operating conditions, the speed set value was unchanged, but the actual speed of the motor fluctuated to some extent, and the sensor was affected by noise and measurement errors, so the stator current signal collected was not an ideal sine wave, as shown in Figure 6. For the faulty signal, only weak PMSM faults were studied in this experiment, so the change in the stator-current signals when a fault occurred was small, and there were no obvious fault symptoms. As a result, faults were invisible and could only be diagnosed using a specific algorithm.  Figure 7 shows the stator current spectrum of ITSF with four different fault severity levels under 500 r/min. It can be seen that the amplitude of the third harmonic increased with the aggravation of the fault, but was relatively small compared with the fundamental frequency amplitude.

Experimental Results and Analysis
To construct a phase tracker, the training dataset of the phase tracker needs to be generated first. According to statistics of the collected experimental data, since the load was constant and the amplitude of stator current did not change much, it was assumed to be [5,30]; the fundamental frequency range of the current was [25,130]. Considering the requirement of diagnostic rapidity, the diagnostic period was set to 0.1s, so the input sequence length of the phase tracker was 2500. A total of 10,000 sequences with different amplitudes and frequencies were generated using Equation (2). The CNN model was trained by taking these sequences as the input and amplitude, frequency, and phase as the output. There were seven layers of the CNN constructed in this experiment; the first four layers were alternately stacked with a convolutional layer and average pooling layer, whereas the last three layers were fully connected. The last layer did not use an activation function, and the activation functions of the other layers were all ReLU.
The entire model had only 160,000 parameters, and the training time on a GTX1080Ti GPU was only a few minutes. The phase tracking result for a normal stator current at a rotating speed of 500 r/min is shown in Figure 8. In fact, the phase tracker acts as a phase lock loop, but can acquire amplitude, frequency, and phase at the same time, without the manual adjustment of parameters and with a larger range of operation. After the phase of each sampling point of the stator current was obtained by the phase tracker, angular domain resampling was performed, and the angle interval of sampling ∆θ re was 0.0905 calculated by Equation (3). After resampling at this interval, the fundamental frequency of the stator current at all rotating speeds became 360 Hz. Figure 9 shows the stator current after resampling at 500 r/min, and Figure 10 presents the spectrum diagrams of normal stator currents after resampling under four operating conditions.   It can be seen that the fundamental frequency of the stator current under different conditions was aligned to 360 Hz after resampling, but there was a very small error. In the resampling process, the point closest to the set value of the sampling interval is directly selected instead of using an interpolation algorithm, and the sensor sampling rate is constant, so the actual sampling interval is not always equal to ∆θ re . Therefore, the actual sampling interval needs to be recorded and the residual calculated according to the actual sampling interval.
After the residual signals were obtained from Equation (4), FFT was applied to obtain the residual spectrum. Considering that when ITSF occurs in PMSM, the fault frequency is an odd times of the fundamental frequency, and that resampling also has certain errors, all components less than 1500 Hz were retained in the residual spectrum. As mentioned above, in order to make up for the spectral error caused by angular domain resampling, the spectral coefficients were divided into ranges and combined. In this experiment, the rotating speed distribution was not wide, so the error caused by resampling was very small, and the width of the range was set to 30. That is, every 30 spectral coefficients were averaged once, and the resulting mean sequence was taken as the spectral features. Figure 11 presents an example of segmenting and merging operation, in which the number of coefficients is greatly reduced, which can eliminate the errors caused by resampling and noise to some extent. In addition, the amplitude of the fault frequency is not only related to the severity of the fault, but is also related to operating conditions of the motor. Therefore, the fundamental frequency amplitude and frequency obtained by the phase tracker were added as the residual features. Figure 11. Examples of segmenting and merging the spectral coefficients of residual signals.
According to the above discussion, the residual features included the spectrum coefficient and the amplitude and frequency outputted by the phase tracker, and these features were taken as the sample features of diagnostic algorithm to realize PMSM fault diagnosis. Before constructing the fault feature library, first of all, all the data were divided into the training set, validation set, and test set, in order to test the proposed method in the performance of multi-condition fault diagnosis. In this experiment, the data obtained at 500, 1000, and 1800 r/min were divided into training sets and validation sets with the ratio of 7:3, and the data obtained at 1500 r/min were taken as the test set to verify the diagnostic performance of the algorithm under conditions other than the training set. As a comparison, the traditional motor fault diagnosis method using an SVM [29] and RF [30,31] based on the fault frequency features of the stator current was tested using the same data set division, and the fault detection, fault type classification, and fault severity level prediction were compared, respectively. To compare the performance of each method with these three tasks, a unified indicator of accuracy was used for comparison, that is, we measured the proportion of samples of which the predicted values were consistent with the true values according to the total number of test samples. A statistical table of the accuracy and execution time per sample of the experimental results is shown in Table 3. It can be seen in Table 3 that both methods were able to accurately realize fault diagnosis under the existing conditions on training set, but in the test set, the diagnosis performance of the traditional SVM and RF method based on fault frequency features was not good, whereas the proposed method maintained high diagnostic accuracy. Although there is still room for improvement in the prediction of fault severity on the test set, with the main bias concentrated on samples with a fault severity of 3% and 5%, the experimental results imply that the proposed method improves the accuracy of motor fault diagnosis under different operating conditions, and can be trained with partial fault samples and diagnose samples under conditions outside of the training set. Based on the comparison of these methods, the main difference of the proposed method is that the stator current is processed through the phase tracker and angular domain resampling. Therefore, it can be shown that phase tracking and angular domain resampling are effective methods to improve the accuracy of fault diagnosis in the multi-condition motor.
From the perspective of execution time, the proposed method requires neural network calculation, so the execution time is longer than that of the traditional method, but it still can meet the requirement of a diagnosis time within 0.1s. Depending on the actual sampling rate of the stator current sensor, the phase tracker will define different input sequence lengths and the execution time may vary, which is an issue to be considered.

Discussion
Firstly, based on the experimental results, the proposed method can significantly improve the accuracy of fault diagnosis under multiple operating conditions. When the sampling rate is sufficient, only fault samples in partial operating conditions can be used to complete the fault diagnosis in other intermediate operating conditions. Compared with the methods in [29][30][31] that use a large number of training samples and complex artificial features, the proposed method is based on traditional fault features and is still effective under multiple working conditions, reducing the number of fault samples required by the diagnostic algorithm and helps to solve the problem that fault samples are rare and difficult to obtain at present. Considering that most PMSM control systems have stator three-phase current feedback, and the fault frequency domain features are not affected by PMSM types and parameters, this method can be applied to most PMSM fault diagnoses.
The phase tracker based on CNN aligns the fundamental frequency of the stator current, so it can also be used by fault diagnosis algorithms with frequency domain features or residual signals as inputs. The proposed method has good portability. According to the input of different algorithms, the output of the phase tracker, the resampling signal, residual signal, and other intermediate components can be extracted as features for multi-condition fault diagnosis.
The phase tracker can obtain the corresponding phase of each sampling point, and the phase signal can be used for other aspects in addition to the resampling step of the proposed method, such as complementary filtering with the electromechanical angle obtained by the sensor to improve the control performance.
Some factors have an impact on the final fault diagnosis performance but have not been fully considered. For fault symptoms, this paper only considers faults that cause an increase in the magnitude of specific harmonics; other faults with special symptoms may not be properly diagnosed. Another concern is the training of neural networks. Due to the existence of environmental noise, phase tracking cannot be completely accurate. Different model structures and parameters may cause different loss values when the model converges. Although the phase tracker has three outputs, a single total loss value may not accurately reflect the quality of training, which is worth considering. Moreover, the hyperparameters in the model include the length of inputs and the number of network layers and neurons, and it is hard to summarize a suitable hyperparameter setting scheme at present.
The proposed method also has some shortcomings, such as the fact that the anti-noise ability depends on the error between the artificially added noise distribution and the actual stator current sensor noise distribution; therefore, the performance of the phase tracker depends entirely on the generated training dataset. Thus, a transfer learning method can be added to the training of phase tracker to improve its accuracy with regard to actual data. Due to the use of a neural network, the model parameters of proposed method are more numerous than those of traditional methods and the execution speed is slower. It would be worth considering a faster method to achieve phase tracking.

Conclusions
In this paper, a multi-condition PMSM fault diagnosis method based on a CNN phase tracker is proposed. By tracking the amplitude, frequency, and phase of the stator current and conducting angular-domain resampling, the fundamental frequency of the stator current is aligned, so as to make the fault frequency distribution consistent under different operating conditions, reduce the training samples required by the diagnosis algorithm, and improve the performance of PMSM fault diagnosis under multiple operating conditions. The experimental results show that the proposed method can maintain high diagnostic accuracy in conditions outside the training set with a small number of training samples and without extracting complex artificial features. Moreover, the shortcomings and possible future directions for the improvement of the proposed method have been analyzed. Nowadays, there are still some difficulties in motor fault diagnosis under multiple operating conditions. As a feasible and verified scheme, the phase tracking method proposed in this paper can provide a reference for other motor fault diagnosis methods.