Fault Diagnosis of PMSG Stator Inter-Turn Fault Using Extended Kalman Filter and Unscented Kalman Filter

Since the permeant magnet synchronous generator (PMSG) has many applications in particular safety-critical applications, enhancing PMSG availability has become essential. An effective tool for enhancing PMSG availability and reliability is continuous monitoring and diagnosis of the machine. Therefore, designing a robust fault diagnosis (FD) and fault tolerant system (FTS) of PMSG is essential for such applications. This paper describes an FD method that monitors online stator winding partial inter-turn faults in PMSGs. The fault appears in the direct and quadrature (dq)-frame equations of the machine. The extended Kalman filter (EKF) and unscented Kalman filter (UKF) were used to detect the percentage and the place of the fault. The proposed techniques have been simulated for different fault scenarios using Matlab®/Simulink®. The results of the EKF estimation responses simulation were validated with the practical implementation results of tests that were performed with a prototype PMSG used in the Arab Academy For Science and Technology (AAST) machine lab. The results showed impressive responses with different operating conditions when exposed to different fault states to prevent the development of complete failure.


Introduction
In the last decade, the permeant magnet synchronous generator (PMSG) has been used in many industries, especially, for renewable energy applications [1][2][3], aircraft [4,5], and propulsion systems [6]. Consequently, this has generated growing concern about the operation reliability of the PMSG, especially in safety critical applications like the shaft generators (SG) in marine applications.
The PMSG faults inexorably decrease the reliability of the system, which may lead to malfunction or a failure in the system. Moreover, most PMSG applications are safety-critical, which makes the presence of fault an unwanted option. Mechanical, magnetic, and electrical faults are the major types of faults that may occur in a PMSG [7]. Extensive research has examined the detection of mechanical faults, which is the most usual fault in the PMSG; these faults can be divided into eccentricity faults [8][9][10], and bearing faults [11][12][13][14], based on [15], the bearing faults represent from 40 to 50% of the total faults while the eccentricity fault represents from 5 to 10% in the machines. Further research has considered the detection of demagnetization faults [16][17][18]. Both types of faults cause torque to unbalance; followed by an increase in the overall temperature of the machine. The high temperature may cause the deterioration of the stator winding insulation, which may lead to the presence of a stator

The Faulty PMSG Model
The model was implemented in the direct and quadrature (dq-frame) in [39], in both states, healthy and faulty.

PMSG Healthy State Model
The healthy state represents the machine in the case of no fault; in this case, the internal current outgoing from the machine is the same current consumed from the load. Figure 1 shows the equivalent circuit of the machine in the abc-frame, R s and L s are the stator resistance and inductance. E a ,E b ,E c , are the induced voltages, and the output current from the generator is represented by I a , I b ,I c .
To simplify the model, the equations of the machine should be converted to the dq-frame. Figure 2 shows the equivalent circuit of the machine in the dq-frame. L d and L q are the direct and quadrature inductance, I sd and I sq is the internal direct and quadrature current of the generator respectively, I sd and I sq are the terminal direct and quadrature current of the generator respectively, the V sd and V sq are the direct and quadrature stator terminal voltages, and ω e is the electrical angular speed that can be related to rotor mechanical angular speed ω m . All the equations representing the machine on the dq-frame are given in [39].
Energies 2020, 13, x FOR PEER REVIEW 3 of 24 The model was implemented in the direct and quadrature (dq-frame) in [39], in both states, healthy and faulty.

PMSG Healthy State Model
The healthy state represents the machine in the case of no fault; in this case, the internal current outgoing from the machine is the same current consumed from the load. Figure 1 shows the equivalent circuit of the machine in the abc-frame, and are the stator resistance and inductance.
, , , are the induced voltages, and the output current from the generator is represented by , , .
To simplify the model, the equations of the machine should be converted to the dq-frame. Figure  2 shows the equivalent circuit of the machine in the dq-frame. and are the direct and quadrature inductance, ′ and ′ is the internal direct and quadrature current of the generator respectively, and are the terminal direct and quadrature current of the generator respectively, the and are the direct and quadrature stator terminal voltages, and is the electrical angular speed that can be related to rotor mechanical angular speed . All the equations representing the machine on the dq-frame are given in [39].

PMSG Faulty State Model
In the case of a PMSG stator winding fault, the number of turns in a certain phase is reduced due to the deterioration in the stator winding insulation, which causes a short circuit in this phase. Most stator winding insulation failures are caused by high temperatures and overloading. When a stator winding short circuit happens, the value of generator impedance changes, consequently the amplitude of stator current harmonics will increase, the torque will drag, and potential overheating will appear, and so on, this symptom may lead to complete failure if the fault was not addressed.
The short circuit current [ / ]dq is generated inside the machine as shown in Figure 3 due to the presence of the short circuit impedance / in any phase; this impedance value changes according to the ratio between the number of inter-turn short-circuit windings and the total number of turns in one healthy phase. Figure 4 shows the equivalent circuit of the faulty machine in the dq-frame. The mathematical equations representing the faulty state model of the PMSG in dq-frame are given in [39]. The model was implemented in the direct and quadrature (dq-frame) in [39], in both states, healthy and faulty.

PMSG Healthy State Model
The healthy state represents the machine in the case of no fault; in this case, the internal current outgoing from the machine is the same current consumed from the load. Figure 1 shows the equivalent circuit of the machine in the abc-frame, and are the stator resistance and inductance.
, , , are the induced voltages, and the output current from the generator is represented by , , .
To simplify the model, the equations of the machine should be converted to the dq-frame. Figure  2 shows the equivalent circuit of the machine in the dq-frame. and are the direct and quadrature inductance, ′ and ′ is the internal direct and quadrature current of the generator respectively, and are the terminal direct and quadrature current of the generator respectively, the and are the direct and quadrature stator terminal voltages, and is the electrical angular speed that can be related to rotor mechanical angular speed . All the equations representing the machine on the dq-frame are given in [39].

PMSG Faulty State Model
In the case of a PMSG stator winding fault, the number of turns in a certain phase is reduced due to the deterioration in the stator winding insulation, which causes a short circuit in this phase. Most stator winding insulation failures are caused by high temperatures and overloading. When a stator winding short circuit happens, the value of generator impedance changes, consequently the amplitude of stator current harmonics will increase, the torque will drag, and potential overheating will appear, and so on, this symptom may lead to complete failure if the fault was not addressed.
The short circuit current [ / ]dq is generated inside the machine as shown in Figure 3 due to the presence of the short circuit impedance / in any phase; this impedance value changes according to the ratio between the number of inter-turn short-circuit windings and the total number of turns in one healthy phase. Figure 4 shows the equivalent circuit of the faulty machine in the dq-frame. The mathematical equations representing the faulty state model of the PMSG in dq-frame are given in [39].

PMSG Faulty State Model
In the case of a PMSG stator winding fault, the number of turns in a certain phase is reduced due to the deterioration in the stator winding insulation, which causes a short circuit in this phase. Most stator winding insulation failures are caused by high temperatures and overloading. When a stator winding short circuit happens, the value of generator impedance changes, consequently the amplitude of stator current harmonics will increase, the torque will drag, and potential overheating will appear, and so on, this symptom may lead to complete failure if the fault was not addressed.
The short circuit current [I s/c ] dq is generated inside the machine as shown in Figure 3 due to the presence of the short circuit impedance Z s/c in any phase; this impedance value changes according to the ratio between the number of inter-turn short-circuit windings and the total number of turns in one healthy phase. Figure 4 shows the equivalent circuit of the faulty machine in the dq-frame. The mathematical equations representing the faulty state model of the PMSG in dq-frame are given in [39].

Parameter Estimation Procedures
The general faulty PMSG state-space model and EKF algorithm are presented in this section.

General PMSG State-Space Model
To use the EKF and UKF techniques to estimate the presence of the fault, the precise state-space model of the machine should be highlighted. Based on [39], the state-space model equation of the faulty machine can be written as: where: The extension of the model states to estimate the presence of a fault in any phase is compulsory for the estimation process of EKF and UKF, the new states of the model become as follows:

Parameter Estimation Procedures
The general faulty PMSG state-space model and EKF algorithm are presented in this section.

General PMSG State-Space Model
To use the EKF and UKF techniques to estimate the presence of the fault, the precise state-space model of the machine should be highlighted. Based on [39], the state-space model equation of the faulty machine can be written as: where: The extension of the model states to estimate the presence of a fault in any phase is compulsory for the estimation process of EKF and UKF, the new states of the model become as follows:

Parameter Estimation Procedures
The general faulty PMSG state-space model and EKF algorithm are presented in this section.

General PMSG State-Space Model
To use the EKF and UKF techniques to estimate the presence of the fault, the precise state-space model of the machine should be highlighted. Based on [39], the state-space model equation of the faulty machine can be written as: where: Q(θ S/C ) = cos 2 θ S/C sinθ S/C ·cosθ S/C sinθ S/C ·cosθ S/C sin 2 θ S/C The extension of the model states to estimate the presence of a fault in any phase is compulsory for the estimation process of EKF and UKF, the new states of the model become as follows: where X e (t) is the estimated state; After that, the model equations are linearized around a definite operating point followed by discretization at a sampling time Ts, the model expressed as:

Extended Kalman Filter Algorithm
The EKF gives an approximation of the optimal estimate. The non-linearity of the system's dynamics is approximated by a linearized version of the non-linear system model around the last state estimate. As in many cases, if the nonlinear system is approximately linearized, the EKF may not perform well [20]. If there is a bad initial guess regarding the underlying system's state, then this may cause a bad estimation. The first step in the EKF algorithm is the prediction step equations, which consist of state prediction and error covariance matrix update, and the second step is the correction step which corrects the predicted state estimate and it's covariance matrix as in Figure 5. Consider applying EKF to estimate the parameter λ k in the PMSG system, the discrete linearized state-space model of PMSG is expressed as: F K and H K represent the state and output equations of the discrete linearized model. By substituting matrix A and B in (4) into (6), F K and H K in case of, n A s/c , n B s/c , n C s/c , as an estimated parameter will be: where

Unscented Kalman Filter Algorithm
Instead of using linearized equations using the Jacobin matrix to approximate the nonlinear model as the EKF approach, the UKF generates a finite set of sigma points to compute the predicted states and measurements and the associated covariance matrices [45]. Mathematically, the UKF process can be described as in Figure 6. where and are weighting factors and they are equal to.
where L is the state dimension and = ( + ) − , can be tuned from 10 to 1 and usually was chosen to be 0. Figure 7 shows the block diagram of the fault diagnosis online monitoring for the PMSG.

Unscented Kalman Filter Algorithm
Instead of using linearized equations using the Jacobin matrix to approximate the nonlinear model as the EKF approach, the UKF generates a finite set of sigma points to compute the predicted states and measurements and the associated covariance matrices [45]. Mathematically, the UKF process can be described as in Figure 6.

Unscented Kalman Filter Algorithm
Instead of using linearized equations using the Jacobin matrix to approximate the nonlinear model as the EKF approach, the UKF generates a finite set of sigma points to compute the predicted states and measurements and the associated covariance matrices [45]. Mathematically, the UKF process can be described as in Figure 6. where and are weighting factors and they are equal to.
where L is the state dimension and = ( + ) − , can be tuned from 10 to 1 and usually was chosen to be 0. Figure 7 shows the block diagram of the fault diagnosis online monitoring for the PMSG. Where W m i and W c i are weighting factors and they are equal to.
where L is the state dimension and λ = α 2 ((L + k) − L), α can be tuned from 10 −4 to 1 and k usually was chosen to be 0.

The Covariance Matrices Tuning
The noises covariance matrices are diagonals, can be divided into two matrices: (for measured states) and (for the estimated parameters). Thus, and can be expressed as: where m is the state's x numbers and n is estimated parameters numbers, and could be determined by measuring the variance of noises on input and output signals [20], they are expressed as Equation (9) and the ratio λ ⁄ is set by the evolution time constant of the estimated parameters (τ) as expressed in Equation (10).

The Covariance Matrices Tuning
The noises covariance matrices are diagonals, Q can be divided into two matrices: q x (for measured states) and q λ (for the estimated parameters). Thus, Q and R can be expressed as: where m is the state's x numbers and n is estimated parameters λ numbers, q x and r could be determined by measuring the variance of noises on input σ 2 u and output signals σ 2 y [20], they are expressed as Equation (9) and the ratio q λ /q x is set by the evolution time constant of the estimated parameters (τ) as expressed in Equation (10).

Simulation Results
The machine parameters were taken from the nameplate of the generator, as shown in Table 1, the equations of the generator were used to simulate the output of the machine with different operating points, and the simulation run at sampling time T s = 100 us.  Figure 8 shows the instantaneous internal current of phase A of the machine at RMS load current of 0.75 A and frequency of 30 Hz; a simulated inter-turn fault was implemented at t = 0.5 s, this fault caused an increase in the current inside the machine, respectively, the voltage in the faulty phase decreased by a small amount and the machine started to become hotter. The current reached an RMS value of 1.63 in the case of n A s/c = 4%, which is more than double the used load current. Also, the current reached an RMS value of 4.6 A in the case of n A s/c = 16%, which is more than 6 times the load current (0.75 A). This implies the importance of taking fast action to save the machine from damage. Figure 9 shows the estimation response of EKF and UKF in either a healthy or faulty state; it was noticed that the UKF technique gives more precise values for the fault estimation than the EKF. As the PMSG model used is a linearized and discretized model around a specified operating point in the case of EKF, the error in the estimation varies non-linearly with the value of the short circuit turns ratio. Besides, the covariance matrices (Q and R) were chosen, which play an important role in the quality of the estimation. Also, the presence of sensor errors and the use of a phased locked loop (PLL) in the estimation of the angular position θ cause error in the estimated parameters. Figure 10 shows the error-index, which indicates the values of the inter-turn short circuit that the EKF and UKF techniques will estimate varies the percentage of error. It was noticed that the UKF had much less error than the EKF, especially for short circuit turns ratios greater than 20%, the highest error detected in case of using UKF was at n A s/c = 4% and reached 0.3%, however, the EKF estimation error reach 23.72% at n A s/c = 100%, the lowest estimation error detected by EKF was at n s/c = 16%.
The dynamic time response of detecting the fault was 0.02 s, which is very fast (approximately equal to 1.5 periodic cycles related to the used frequency). The covariance matrix Q, in this case, was tuned by time constant τ = 5 ms, which increased the dynamic response; however, it increased the presence of noise in the estimation action. Figure 11 illustrates the effect of τ on the estimation time, and it was noticed that when the τ = 10 ms, the estimation response reached a steady-state after 0.02 s with the presence of noise, however, when the τ = 80 ms, the estimation response reached a steady-state after 0.2 s but with filtering action. Figure 12 shows the dynamic estimation responses versus the parameter estimation evolution time constant (τ); the detection time increased linearly with the increase of the τ value.

Robustness Tests
The technique was tested in different operating conditions and showed a robust response; the same tests are done in cases of practical implementation, and are listed as the following: Test 1: Variation of load current variation from 0.75 A to 3 A by 0.75 A step at a constant frequency of 30 Hz. Test 2: Variation of frequency from 20 Hz to 50 Hz, with a 10 Hz step. Figure 13 shows the estimated internal instantaneous currents in the presence of a 16% stator inter-turn short circuit in phase A in case of load variation from 0.75 to 3 A with a rate of 1 Hz. In the case of a 16% stator inter-turn fault, the current reached an RMS value of 5.3 A when ILoad = 1.5 A, and it reached an RMS value of 6 A when the ILoad = 2.25 A. This confirms the increase of fault severity as load current increases; this form of the fault requires fast action. Figures 14 and 15 show the estimation response of EKF and UKF in load current variation from ILoad = 0.75 A to 3 A condition in the presence of 4%, 8%, 12%, and 16% stator inter-turn short circuit by a rate of 1 Hz. The time constant of the estimated parameters (τ) was chosen to be 10 ms based on the measured value of the input signal noises variance ( ). The estimation for both techniques show a constant response with the load variation with different short circuit values.

Robustness Tests
The technique was tested in different operating conditions and showed a robust response; the same tests are done in cases of practical implementation, and are listed as the following: Test 1: Variation of load current variation from 0.75 A to 3 A by 0.75 A step at a constant frequency of 30 Hz. Test 2: Variation of frequency from 20 Hz to 50 Hz, with a 10 Hz step. Figure 13 shows the estimated internal instantaneous currents in the presence of a 16% stator inter-turn short circuit in phase A in case of load variation from 0.75 to 3 A with a rate of 1 Hz. In the case of a 16% stator inter-turn fault, the current reached an RMS value of 5.3 A when ILoad = 1.5 A, and it reached an RMS value of 6 A when the ILoad = 2.25 A. This confirms the increase of fault severity as load current increases; this form of the fault requires fast action. Figures 14 and 15 show the estimation response of EKF and UKF in load current variation from ILoad = 0.75 A to 3 A condition in the presence of 4%, 8%, 12%, and 16% stator inter-turn short circuit by a rate of 1 Hz. The time constant of the estimated parameters (τ) was chosen to be 10 ms based on the measured value of the input signal noises variance ( ). The estimation for both techniques show a constant response with the load variation with different short circuit values.

Robustness Tests
The technique was tested in different operating conditions and showed a robust response; the same tests are done in cases of practical implementation, and are listed as the following: Test 1: Variation of load current variation from 0.75 A to 3 A by 0.75 A step at a constant frequency of 30 Hz.
Test 2: Variation of frequency from 20 Hz to 50 Hz, with a 10 Hz step. Figure 13 shows the estimated internal instantaneous currents in the presence of a 16% stator inter-turn short circuit in phase A in case of load variation from 0.75 to 3 A with a rate of 1 Hz. In the case of a 16% stator inter-turn fault, the current reached an RMS value of 5.3 A when I Load = 1.5 A, and it reached an RMS value of 6 A when the I Load = 2.25 A. This confirms the increase of fault severity as load current increases; this form of the fault requires fast action. Figures 14 and 15 show the estimation response of EKF and UKF in load current variation from I Load = 0.75 A to 3 A condition in the presence of 4%, 8%, 12%, and 16% stator inter-turn short circuit by a rate of 1 Hz. The time constant of the estimated parameters (τ) was chosen to be 10 ms based on the measured value of the input signal noises variance (ó x ). The estimation for both techniques show a constant response with the load variation with different short circuit values.    Figure 16 shows the estimated internal instantaneous currents in the case of faults in various frequencies, ranging from 20 Hz to 50 Hz with 10Hz step frequency and rate of change of 1Hz. Figures  17 and 18 show the EKF the UKF estimation response in the presence of 4%, 8%, 12%, and 16% stator inter-turn short circuit in phase A at constant ILoad = 0.75 A and frequencies of 20 Hz, 30 Hz, 40 Hz and 50 Hz. The results show a constant response for both techniques with the frequency variation condition.    Figure 16 shows the estimated internal instantaneous currents in the case of faults in various frequencies, ranging from 20 Hz to 50 Hz with 10Hz step frequency and rate of change of 1Hz. Figures  17 and 18 show the EKF the UKF estimation response in the presence of 4%, 8%, 12%, and 16% stator inter-turn short circuit in phase A at constant ILoad = 0.75 A and frequencies of 20 Hz, 30 Hz, 40 Hz and 50 Hz. The results show a constant response for both techniques with the frequency variation condition.    Figure 16 shows the estimated internal instantaneous currents in the case of faults in various frequencies, ranging from 20 Hz to 50 Hz with 10Hz step frequency and rate of change of 1Hz. Figures  17 and 18 show the EKF the UKF estimation response in the presence of 4%, 8%, 12%, and 16% stator inter-turn short circuit in phase A at constant ILoad = 0.75 A and frequencies of 20 Hz, 30 Hz, 40 Hz and 50 Hz. The results show a constant response for both techniques with the frequency variation condition.  Figure 16 shows the estimated internal instantaneous currents in the case of faults in various frequencies, ranging from 20 Hz to 50 Hz with 10Hz step frequency and rate of change of 1 Hz. Figures 17 and 18 show the EKF the UKF estimation response in the presence of 4%, 8%, 12%, and 16% stator inter-turn short circuit in phase A at constant I Load = 0.75 A and frequencies of 20 Hz, 30 Hz, 40 Hz and 50 Hz. The results show a constant response for both techniques with the frequency variation condition.

Test Bench
For safety conditions, to prevent the used PMSG from being damaged, it is not possible to make an actual stator inter-turn fault. However, it is possible to validate this detection method by adding a shunt resistance / between the needed phase and the neutral, to increase the current in this phase and make the machine unbalanced by a percentage equal to that of an inter-turn fault.
The generator used rotates by means of a separately excited DC motor as a prime mover; the shaft of the motor is coupled directly to the shaft of the PMSG. The power pack supplies the DC motor field with a constant DC supply, and the armature is supplied with a variable DC supply to control the speed of the generator. The load used is a three-phase variable load with a maximum RMS value of 5 A; the shunt resistance / is variable resistance, which will be added to any phase of the three phases using a circuit breaker. Figure 19 shows all the power components of the test bench.
The three-phase voltages were measured by three voltage transformers. The transformers used were typical 220 v/12 v single-phase transformers. Hence, the voltages measured were connected to

Test Bench
For safety conditions, to prevent the used PMSG from being damaged, it is not possible to make an actual stator inter-turn fault. However, it is possible to validate this detection method by adding a shunt resistance / between the needed phase and the neutral, to increase the current in this phase and make the machine unbalanced by a percentage equal to that of an inter-turn fault.
The generator used rotates by means of a separately excited DC motor as a prime mover; the shaft of the motor is coupled directly to the shaft of the PMSG. The power pack supplies the DC motor field with a constant DC supply, and the armature is supplied with a variable DC supply to control the speed of the generator. The load used is a three-phase variable load with a maximum RMS value of 5 A; the shunt resistance / is variable resistance, which will be added to any phase of the three phases using a circuit breaker. Figure 19 shows all the power components of the test bench.
The three-phase voltages were measured by three voltage transformers. The transformers used were typical 220 v/12 v single-phase transformers. Hence, the voltages measured were connected to

Test Bench
For safety conditions, to prevent the used PMSG from being damaged, it is not possible to make an actual stator inter-turn fault. However, it is possible to validate this detection method by adding a shunt resistance / between the needed phase and the neutral, to increase the current in this phase and make the machine unbalanced by a percentage equal to that of an inter-turn fault.
The generator used rotates by means of a separately excited DC motor as a prime mover; the shaft of the motor is coupled directly to the shaft of the PMSG. The power pack supplies the DC motor field with a constant DC supply, and the armature is supplied with a variable DC supply to control the speed of the generator. The load used is a three-phase variable load with a maximum RMS value of 5 A; the shunt resistance / is variable resistance, which will be added to any phase of the three phases using a circuit breaker. Figure 19 shows all the power components of the test bench.
The three-phase voltages were measured by three voltage transformers. The transformers used were typical 220 v/12 v single-phase transformers. Hence, the voltages measured were connected to

Test Bench
For safety conditions, to prevent the used PMSG from being damaged, it is not possible to make an actual stator inter-turn fault. However, it is possible to validate this detection method by adding a shunt resistance R S/C between the needed phase and the neutral, to increase the current in this phase and make the machine unbalanced by a percentage equal to that of an inter-turn fault.
The generator used rotates by means of a separately excited DC motor as a prime mover; the shaft of the motor is coupled directly to the shaft of the PMSG. The power pack supplies the DC motor field with a constant DC supply, and the armature is supplied with a variable DC supply to control the speed of the generator. The load used is a three-phase variable load with a maximum RMS value of 5 A; the shunt resistance R S/C is variable resistance, which will be added to any phase of the three phases using a circuit breaker. Figure 19 shows all the power components of the test bench.
The three-phase voltages were measured by three voltage transformers. The transformers used were typical 220 v/12 v single-phase transformers. Hence, the voltages measured were connected to analog signal conditioning boards to manipulate the voltage to be level with the digital signal processor (DSP) voltage (from 0 to 3.3 v).
On the other hand, the currents were measured using three CTs at a ratio of 10000:5. The current signals measured were connected to the signal conditioning circuit board to convert the current into a manipulated voltage which was compatible with a DSP analog to digital (A/D) input. The DSP used (Texas Instrument TMS320F280) had all measured signals connected to the A/D port in the DSP. The EKF algorithm was implemented online with a sampling period of T s = 200 µs. The relay board was used to take the action of disconnection of the faulty phase to prevent fault propagation leading to severe failure. Figure 20 shows the connection diagram for the whole circuit.
Energies 2020, 13, x FOR PEER REVIEW 13 of 24 analog signal conditioning boards to manipulate the voltage to be level with the digital signal processor (DSP) voltage (from 0 to 3.3 v).
On the other hand, the currents were measured using three CTs at a ratio of 10000:5. The current signals measured were connected to the signal conditioning circuit board to convert the current into a manipulated voltage which was compatible with a DSP analog to digital (A/D) input. The DSP used (Texas Instrument TMS320F280) had all measured signals connected to the A/D port in the DSP. The EKF algorithm was implemented online with a sampling period of = 200 μs. The relay board was used to take the action of disconnection of the faulty phase to prevent fault propagation leading to severe failure. Figure 20 shows the connection diagram for the whole circuit.

PMSG Test Output
The next step was to compare the measured output voltages and currents of the PMSG used in a simulation of a healthy state. The value of the measured currents and voltages was found to be approximately the same as that in simulation, but with more measurement noise around a mean of 0.4; this will affect the dynamic response of EKF estimation in case of a fault. The output was measured in different load and frequency operating conditions and showed the same output as the simulation. Figure 21a,b show the instantaneous three-phase currents and voltages in the case of a healthy state of PMSG with a load current 0.72 A and frequency of 30 Hz. Figure 22 shows the difference between the three-phase instantaneous currents and voltages in simulation and practical implementations. It can be seen that the experimental results appear noisier On the other hand, the currents were measured using three CTs at a ratio of 10000:5. The current signals measured were connected to the signal conditioning circuit board to convert the current into a manipulated voltage which was compatible with a DSP analog to digital (A/D) input. The DSP used (Texas Instrument TMS320F280) had all measured signals connected to the A/D port in the DSP. The EKF algorithm was implemented online with a sampling period of = 200 μs. The relay board was used to take the action of disconnection of the faulty phase to prevent fault propagation leading to severe failure. Figure 20 shows the connection diagram for the whole circuit.

PMSG Test Output
The next step was to compare the measured output voltages and currents of the PMSG used in a simulation of a healthy state. The value of the measured currents and voltages was found to be approximately the same as that in simulation, but with more measurement noise around a mean of 0.4; this will affect the dynamic response of EKF estimation in case of a fault. The output was measured in different load and frequency operating conditions and showed the same output as the simulation. Figure 21a,b show the instantaneous three-phase currents and voltages in the case of a healthy state of PMSG with a load current 0.72 A and frequency of 30 Hz. Figure 22 shows the difference between the three-phase instantaneous currents and voltages in simulation and practical implementations. It can be seen that the experimental results appear noisier

PMSG Test Output
The next step was to compare the measured output voltages and currents of the PMSG used in a simulation of a healthy state. The value of the measured currents and voltages was found to be approximately the same as that in simulation, but with more measurement noise around a mean of 0.4; this will affect the dynamic response of EKF estimation in case of a fault. The output was measured in different load and frequency operating conditions and showed the same output as the simulation. Figure 21a,b show the instantaneous three-phase currents and voltages in the case of a healthy state of PMSG with a load current 0.72 A and frequency of 30 Hz. Figure 22 shows the difference between the three-phase instantaneous currents and voltages in simulation and practical implementations. It can be seen that the experimental results appear noisier than that of the simulation. Accordingly, the parameter estimation responses will require more filtering action, which will cause a delay in the dynamic response.
Energies 2020, 13, x FOR PEER REVIEW 14 of 24 than that of the simulation. Accordingly, the parameter estimation responses will require more filtering action, which will cause a delay in the dynamic response.

EKF Response
The model of a faulty machine and the EKF model were implemented in the DSP, the input to the machine state-space model are the measured stator voltages in the dq-frame. The short circuit current was calculated from the measured dq stator load currents and is presented in the model as the feed-forward matrix . Therefore, the measured three-phase voltages and currents must be converted in dq-frame to make the EKF estimator work probably.
Indeed, the detection of electrical angular position is essential to use it in the abc to dq0 transformation. There are two suitable solutions for the detection of electrical angular position ; the first is to use an encoder sensor coupled directly to the machine shaft and uses its counts to calculate the mechanical angular position, and then calculates the electrical angular position. Nevertheless, this solution requires the addition of new hardware to the system. The second solution is to generate the electrical angular position from voltage signals through the three phases of the phased locked loop (PLL), this solution is more economical as extra sensing devices are not needed. Nevertheless, the angular position generated will be dependent on the nature of the measured voltage.
The machine works at a load current of 0.72 and a frequency of 30 Hz in a healthy state. The practical experiments tested the EKF estimation responses in different values of short circuit interturn to turn the ratio in all phases ( / , / & / ) and in different operating points. The and were tuned at τ = 20 ms to achieve the required fast response with a good filtering action.  than that of the simulation. Accordingly, the parameter estimation responses will require more filtering action, which will cause a delay in the dynamic response.

EKF Response
The model of a faulty machine and the EKF model were implemented in the DSP, the input to the machine state-space model are the measured stator voltages in the dq-frame. The short circuit current was calculated from the measured dq stator load currents and is presented in the model as the feed-forward matrix . Therefore, the measured three-phase voltages and currents must be converted in dq-frame to make the EKF estimator work probably.
Indeed, the detection of electrical angular position is essential to use it in the abc to dq0 transformation. There are two suitable solutions for the detection of electrical angular position ; the first is to use an encoder sensor coupled directly to the machine shaft and uses its counts to calculate the mechanical angular position, and then calculates the electrical angular position. Nevertheless, this solution requires the addition of new hardware to the system. The second solution is to generate the electrical angular position from voltage signals through the three phases of the phased locked loop (PLL), this solution is more economical as extra sensing devices are not needed. Nevertheless, the angular position generated will be dependent on the nature of the measured voltage.
The machine works at a load current of 0.72 and a frequency of 30 Hz in a healthy state. The practical experiments tested the EKF estimation responses in different values of short circuit interturn to turn the ratio in all phases ( / , / & / ) and in different operating points. The and were tuned at τ = 20 ms to achieve the required fast response with a good filtering action.

EKF Response
The model of a faulty machine and the EKF model were implemented in the DSP, the input to the machine state-space model are the measured stator voltages in the dq-frame. The short circuit current was calculated from the measured dq stator load currents and is presented in the model as the feed-forward matrix D m . Therefore, the measured three-phase voltages and currents must be converted in dq-frame to make the EKF estimator work probably.
Indeed, the detection of electrical angular position θ is essential to use it in the abc to dq0 transformation. There are two suitable solutions for the detection of electrical angular position θ; the first is to use an encoder sensor coupled directly to the machine shaft and uses its counts to calculate the mechanical angular position, and then calculates the electrical angular position. Nevertheless, this solution requires the addition of new hardware to the system. The second solution is to generate the electrical angular position θ from voltage signals through the three phases of the phased locked loop (PLL), this solution is more economical as extra sensing devices are not needed. Nevertheless, the angular position generated will be dependent on the nature of the measured voltage.
The machine works at a load current of 0.72 and a frequency of 30 Hz in a healthy state. The practical experiments tested the EKF estimation responses in different values of short circuit inter-turn to turn the ratio in all phases (n A s/c , n B s/c & n C s/c ) and in different operating points. The Q and R were tuned at τ = 20 ms to achieve the required fast response with a good filtering action. Figure 23 display the response of EKF to estimate n A s/c = 4% using these conditions. The parameter estimation showed an excellent response to this case when compared to the results of the simulation. Figure 24 display the estimated internal instantaneous currents in the presence of 4%, stator inter-turn short circuit in phase A at t = 0.5 s, respectively. The same response was noticed on the estimation of n A s/c = 8% in Figure 25 followed by the estimated internal instantaneous currents in phase A in Figure 26, respectively. Also, The same response was noticed on the estimation of n A s/c = 12% in Figure 27 followed by the estimated internal instantaneous currents in phase A in Figure 28, respectively. In addition, the estimation of the fault in n A s/c = 16% casein Figure 29 and it's etimated internal current in Figure 30. It was noted that the current reached higher values when compared to the rated current of 0.72 A.                                         Figure 31 shows the dynamic estimation response with different values of evolution time constant of the estimated parameter (τ) in the presence of a 16% fault in phase A. The weighting matrices (Q and R) were chosen based on measuring the variance of input noise and the variance of output noise to achieve the required fast dynamic response for the estimation of the parameters at different operating conditions. However, the change in the weighting matrices caused changes in the nature of the estimation response.

Tuning of Covariance Matrices
Energies 2020, 13, x FOR PEER REVIEW 17 of 24 of output noise to achieve the required fast dynamic response for the estimation of the parameters at different operating conditions. However, the change in the weighting matrices caused changes in the nature of the estimation response.

Robustness Test
As in the simulation, the machine was tested using different load conditions; this approach tested the parameter estimation response to various load conditions. The tests are listed as following: The EKF showed a constant response in assays with different frequencies (20 Hz,30 Hz,40 Hz and 50 Hz) in the presence of 4%, 8%, 12%, and 16% stator inter-turn fault in phase A, and a load current of 0.72 A in a healthy state ( Table 2). This emphasized the robustness of this technique when there was a variation in frequency. Moreover, the results confirmed the simulation results for the same machine during the same operating and fault conditions. Besides, the estimation response was tested when exposed to variations in the current (1.5 A and 2.25 A) and at a constant frequency of 30 Hz. Again, the response of the EKF technique showed a robust estimation in load current variation at a constant frequency, (Table 3). For safety conditions, it was not able to emulate short circuit inter turns fault more than 12% as the current in the faulty state went over 5 A; 5 A being the maximum load current for this machine.

Robustness Test
As in the simulation, the machine was tested using different load conditions; this approach tested the parameter estimation response to various load conditions. The tests are listed as following: Test 1: Variation of frequency from 20 Hz to 50 Hz with a 10 Hz step. The EKF showed a constant response in assays with different frequencies (20 Hz,30 Hz,40 Hz and 50 Hz) in the presence of 4%, 8%, 12%, and 16% stator inter-turn fault in phase A, and a load current of 0.72 A in a healthy state ( Table 2). This emphasized the robustness of this technique when there was a variation in frequency. Moreover, the results confirmed the simulation results for the same machine during the same operating and fault conditions. Besides, the estimation response was tested when exposed to variations in the current (1.5 A and 2.25 A) and at a constant frequency of 30 Hz. Again, the response of the EKF technique showed a robust estimation in load current variation at a constant frequency, (Table 3). For safety conditions, it was not able to emulate short circuit inter turns fault more than 12% as the current in the faulty state went over 5 A; 5 A being the maximum load current for this machine.

Decision-Making Process
The decision was taken based on the estimated total internal current in all three phases of the machine. The loads were divided into two groups: critical loads and uncritical loads were connected through contactors K2 and K1, respectively. To prevent the propagation of internal inter-turn faults inside the machine, there are two proposed scenarios: • the disconnection of the machine; • load shedding. This scenario is presented in the experimental work at RMS load current of 1.5 and 30 Hz frequency, in a healthy state the machine gives n A s/c = 0, n B s/c = 0 and n C s/c = 0. At t = 0.5 s. A 4% inter-turn fault exists in phase A, the estimated parameter n A s/c = 4.1% and the total estimated internal current reached an RMS value of 2.8 A. As the FDS works in parallel with the protection system of the machine, the disconnection of the machine will be based on the extremely inverse time (EIT) thermal characteristics curve of overcurrent relay based on IEEE standard [46], the expected time to disconnect the machine is 17 s, at TDS = 0.1 s. Figure 33b,c show the detection time and disconnection time of contactor K1 and contactor K2 after detecting the presence of a fault. An LCD was used to monitor the situation of the machine in both the healthy and faulty states; it also shows the expected disconnection time of both contactors and the position of the loads' contactor to inform the operator about the situation.

Scenario 2: Load Shedding
The second scenario is the disconnecting of some uncritical loads (contactor K1) to decrease the total current of the machine allowing it to run under the fault condition. This solution offers the reliability for the process; the machine can continue running in the presence of a fault but with partial loading. This solution does not solve the main problem of internal fault, but it gives the operator a suitable time to take corrective action; the fault may propagate for other turns or phases, respectively, increasing the internal short circuit current, causing a severe fault.
This scenario was implemented at RMS load current of 1.5 A and 30 Hz frequency; at t = 0.5 s, 2% inter-turn fault was emulated in phase C, which caused an increase in the total estimated internal current to 2 A. The fault was indicated, and the first group of loads (the uncritical loads) connected through contactor K1 was disconnected (Figure 34a). The disconnection of K1 decreased the current in the machine, and the total current became 1.25 A, allowing the machine to return to its normal state for a definite time and consequently canceling the alarm indication. After a time, the fault percentage increased to 8%, causing an increase in the internal current. In this case, the right decision was to disconnect the machine to solve the internal fault problem. The machine was disconnected after the estimated time based on the EIT characteristics of the overcurrent relay.
Energies 2020, 13, x FOR PEER REVIEW 19 of 24 the expected disconnection time of both contactors and the position of the loads' contactor to inform the operator about the situation.

Scenario 2: Load Shedding
The second scenario is the disconnecting of some uncritical loads (contactor K1) to decrease the total current of the machine allowing it to run under the fault condition. This solution offers the reliability for the process; the machine can continue running in the presence of a fault but with partial loading. This solution does not solve the main problem of internal fault, but it gives the operator a suitable time to take corrective action; the fault may propagate for other turns or phases, respectively, increasing the internal short circuit current, causing a severe fault.
This scenario was implemented at RMS load current of 1.5 A and 30 Hz frequency; at t = 0.5 s, 2% inter-turn fault was emulated in phase C, which caused an increase in the total estimated internal current to 2 A. The fault was indicated, and the first group of loads (the uncritical loads) connected through contactor K1 was disconnected (Figure 34a). The disconnection of K1 decreased the current in the machine, and the total current became 1.25 A, allowing the machine to return to its normal state for a definite time and consequently canceling the alarm indication. After a time, the fault percentage increased to 8%, causing an increase in the internal current. In this case, the right decision was to disconnect the machine to solve the internal fault problem. The machine was disconnected after the estimated time based on the EIT characteristics of the overcurrent relay.

Conclusions
The paper presents the detection and isolation of PMSG stator windings faults using the EKF and the UKF, which are model-based techniques. The model of the faulty machine was implemented in the state-space model using the machine equations in the dq-frame. The estimated states of the EKF and the UKF techniques were the short circuit turns ratio in each phase. It was noted that the proposed techniques have the following advantages: • a fast and accurate response in relation to the time needed to take action in real time; • a robust estimation, in the presence of process and measurement noises, in addition to load and frequency variations.
On the other hand, the UKF technique overcomes the EKF technique drawback of the inaccuracy of the technique in case of severe faults, as it is a nonlinear system and it was linearized around a definite operating point, and so the error of estimation increased as the value of the short circuit turn ratio increased.
Also, the tuning of the weighting matrices ( and ) has a great impact on the estimated parameters. As indicated in the result, an increase in implies an acceleration of the dynamic response of the fault indicator with an increase in noise sensitivity, however, decreasing Q implies better filtering with a decrease in the dynamic response.

Conclusions
The paper presents the detection and isolation of PMSG stator windings faults using the EKF and the UKF, which are model-based techniques. The model of the faulty machine was implemented in the state-space model using the machine equations in the dq-frame. The estimated states of the EKF and the UKF techniques were the short circuit turns ratio in each phase. It was noted that the proposed techniques have the following advantages: • a fast and accurate response in relation to the time needed to take action in real time; • a robust estimation, in the presence of process and measurement noises, in addition to load and frequency variations.
On the other hand, the UKF technique overcomes the EKF technique drawback of the inaccuracy of the technique in case of severe faults, as it is a nonlinear system and it was linearized around a definite operating point, and so the error of estimation increased as the value of the short circuit turn ratio increased.
Also, the tuning of the weighting matrices ( and ) has a great impact on the estimated parameters. As indicated in the result, an increase in implies an acceleration of the dynamic response of the fault indicator with an increase in noise sensitivity, however, decreasing Q implies better filtering with a decrease in the dynamic response.

Conclusions
The paper presents the detection and isolation of PMSG stator windings faults using the EKF and the UKF, which are model-based techniques. The model of the faulty machine was implemented in the state-space model using the machine equations in the dq-frame. The estimated states of the EKF and the UKF techniques were the short circuit turns ratio in each phase. It was noted that the proposed techniques have the following advantages: • a fast and accurate response in relation to the time needed to take action in real time; • a robust estimation, in the presence of process and measurement noises, in addition to load and frequency variations.
On the other hand, the UKF technique overcomes the EKF technique drawback of the inaccuracy of the technique in case of severe faults, as it is a nonlinear system and it was linearized around a definite operating point, and so the error of estimation increased as the value of the short circuit turn ratio increased.
Also, the tuning of the weighting matrices (Q and R ) has a great impact on the estimated parameters. As indicated in the result, an increase in Q implies an acceleration of the dynamic response of the fault indicator with an increase in noise sensitivity, however, decreasing Q implies better filtering with a decrease in the dynamic response.
The results of this paper point to several exciting directions for future research work. The proposed technique can be used on FD of different types of faults such as bearing, eccentricity, and demagnetizations faults in machines. Moreover, other types of FD techniques may be used, such as artificial intelligence-based techniques and signal-based techniques, and comparing their results with the results of the EKF Technique. This result raises the ability to implement the fault tolerant control (FTC) technique in case of faults such as using the model predictive control (MPC) [47], which would increase the reliability of the machine safety-critical applications.