From Modeling to Failure Prognosis of Permanent Magnet Synchronous Machine

: Due to the accelerating pace of environmental concerns and fear of the depletion of conventional sources of energy, researchers are working on ﬁnding renewable energy sources of power for di ﬀ erent axes of life. The transportation sector has intervened in this ﬁeld and introduced hybrid electric vehicles. Many complaints have been mentioned concerning fault detection and identiﬁcation in the vehicle to ensure its safety, reliability and availability. Diagnosis has not been able to overcome all these concerns, and research has shifted toward prognosis, where the manufacturing sector is urged to integrate fault prognosis in the vehicle’s electrical powertrain. In this article, prognosis of the vehicle’s electrical machine is treated using a hidden Markov model after modeling the electrical machine using the ﬁnite element method. Permanent magnet machines are preferable in this application. The modeling of the machine is a combination of the electromagnetic, thermal and vibration ﬁnite element models. The considered faults are demagnetization, turn-to-turn short circuit and eccentricity. A strategy for the calculation of the remaining useful life (RUL) is suggested when a turn-to-turn short circuit fault occurs. show that torque, and vibration are good vital parameters to predict the turn-to-turn short circuit and eccentricity faults. hidden Markov model is prognosis as it is easy to implement and its input is directly collected from data sensors.


Introduction
Nowadays, conventional automobile transportation is in a crisis due to the high price of gasoline. It is expected that this crisis will worsen gravely due to a diminishing oil supply. Moreover, climate change has turned out to be a very powerful motivator for research to head toward energy efficiency and emission reduction goals. According to the yearly consumption of oil and gas, studies state that oil will run out in 2052 and gas will run out in 2060 [1]. On the other hand, the Intergovernmental Panel on Climate Change (IPCC) assesses that CO 2 emissions should be reduced by up to 85% by 2050 in order to limit the global temperature rise [2]. Accordingly, the only envisaged solution is to switch to green transportation technology.
Electric vehicles (EV) and hybrid electric vehicles (HEV) are a good alternative for conventional vehicles. However, HEVs have earned higher popularity over EVs due to EVs' problems linked to their battery capacity, reliability and lifecycle. This is why the idea of combining conventional technology with environmentally friendly technology is more salable. It is assessed that the production and use of HEVs will increase in the coming years and divert the situation [3][4][5]. To increase the integration of HEVs in the domestic market, research should be upgraded to assure reliability, availability, health and proper operation of HEVs.
Much research has focused on the diagnosis of the different elements in the HEV; the evolution in the field drives us to prognosis, to predict the fault before it occurs. In this article, prognosis  Electromagnetic, thermal and vibration aspects are all important to accurately model the electrical machine. Hence, an electromagnetic, thermal and vibration finite element model is built at normal operation of the machine and when different types of faults are integrated. The measured collected data will be torque, temperature and vibration at normal operation and in the case of fault. This will be presented in Section 2 where those data signals will be illustrated, and the corresponding feature that will help for fault detection will be mentioned. Those selected data features will be inputs of the HMM. In Section 3, the prognostic strategy using HMM and the technical concept will be illustrated. In Section 4, additional information about the permanent magnet machine's aging is presented. In Section 5, a strategy for the calculation of the remaining useful life of the machine in the case of turn-to-turn short circuit in one slot is developed.

Finite Element Models of the Permanent Magnet Machine
Finite element analysis is useful for models having complicated geometry and containing several types of materials with different properties. It consists of dividing the domain subject of analysis into small elements called sub-domains where the differential equation for each domain is built separately. Then, the combination of the whole sub-systems forms the general solution.
As we stated previously, the dynamic electromagnetic, thermal and vibration aspects of the machine are all very important for accurately modeling it. Hence, a finite element model combining all those sub models is elaborated for a 10 kw surface-mounted permanent magnet used in HEV application.
An electromagnetic, thermal and vibration model of this machine was developed in paper [17][18][19] respectively. The governing equation of the dynamic electromagnetic model are Electromagnetic, thermal and vibration aspects are all important to accurately model the electrical machine. Hence, an electromagnetic, thermal and vibration finite element model is built at normal operation of the machine and when different types of faults are integrated. The measured collected data will be torque, temperature and vibration at normal operation and in the case of fault. This will be presented in Section 2 where those data signals will be illustrated, and the corresponding feature that will help for fault detection will be mentioned. Those selected data features will be inputs of the HMM. In Section 3, the prognostic strategy using HMM and the technical concept will be illustrated. In Section 4, additional information about the permanent magnet machine's aging is presented. In Section 5, a strategy for the calculation of the remaining useful life of the machine in the case of turn-to-turn short circuit in one slot is developed.

Finite Element Models of the Permanent Magnet Machine
Finite element analysis is useful for models having complicated geometry and containing several types of materials with different properties. It consists of dividing the domain subject of analysis into small elements called sub-domains where the differential equation for each domain is built separately. Then, the combination of the whole sub-systems forms the general solution.
As we stated previously, the dynamic electromagnetic, thermal and vibration aspects of the machine are all very important for accurately modeling it. Hence, a finite element model combining all those sub models is elaborated for a 10 kw surface-mounted permanent magnet used in HEV application.
An electromagnetic, thermal and vibration model of this machine was developed in paper [17][18][19] respectively. The governing equation of the dynamic electromagnetic model are

•
The time-dependent magnetic diffusion equation • Expression of current in each conductor • Circuit equation: series bar-coil equation ν: reluctivity. A: vector potential. σ: conductivity. Vb: voltage across rotor's bar (the equivalent of the magnets). l: axial length of the machine. v: linear rotor's speed. t: time. I: current in each conductor. Vc: voltage across series coils (stator's coil). db: a diagonal matrix with entries of +1 or −1, indicating the polarity of each bar in the coil. Lext: coils' equivalent inductance. Rext: coils' equivalent resistance. Rs: parallel conductor's equivalent resistance. Ls: parallel conductor's equivalent inductance. m: rotor's mass. x: rotor's position. λ: damping factor (in a synchronous machine this value is almost zero). Fem: electromagnetic force. Fext: externally-applied mechanical force (load).
According to the Demerdash approach, the piece of magnets in the machine can be modeled as two parallel conductors having the same direction of the magnetic flux.
After discretization and linearization, the global matrix of the system is [18] The system is solved using the Newton-Raphson method. For each step of rotation, an update of the system is done using the below transformation coordinates where θ is the rotating angle of the rotor. xnew = xold * cosθ − yold * sinθ (8) The solution gives the change in the vector potential, voltages, currents and rotor position. Hence, for example, Anew = Aold + ∆A.
A sketch of the rotor's sweep at different times during the simulation is presented in Figure 1.
The purpose of this generalized model is to generate a synthetic data signal of torque temperature and vibration for the machine in its healthy state and in the case of faulty states. Demagnetization, turn-to-turn short circuit and eccentricity are integrated in the FEMs model of the machine. The simulation is done for five revolutions [20].
To extract these data signals, a fictive sensor, for each measured parameter, is located in the machine. The temperature and vibration sensors are located at the machine's boundary. The torque sensor is assumed to be at the shaft level [21].

Outcome of Electromagnetic FEM
The electromagnetic model of the investigated permanent magnet machine is presented in [15,17,22]. It computes the flux density in the whole machine. The air gap flux density will be used to calculate the torque [19,23].
Appl. Sci. 2020, 10, 691 5 of 28 Torque [24]: where electric loading The average air gap flux density can be expressed as In Figure 2, the flux lines in the healthy machine at four different moments is illustrated. The magnitude of these flux lines is represented by arrows (zoomed out) representing the magnitude and sense of flux density at the centroid of each finite element.

Outcome of Electromagnetic FEM
The electromagnetic model of the investigated permanent magnet machine is presented in [15,17,22]. It computes the flux density in the whole machine. The air gap flux density will be used to calculate the torque [19,23].
Torque [24]: where electric loading The average air gap flux density can be expressed as In Figure 2, the flux lines in the healthy machine at four different moments is illustrated. The magnitude of these flux lines is represented by arrows (zoomed out) representing the magnitude and sense of flux density at the centroid of each finite element.
Bgav: average air gap flux density over one pole for an instant of time. Dr: rotor's diameter. la: the axial length of the machine. J: average current density. As: slot's area. Kf: slot's filing factor. Ns: number of slots in the stator. Bg(x): the flux density at equidistant points in the air gap. tp: the tooth pitch.  Bgav: average air gap flux density over one pole for an instant of time. Dr: rotor's diameter. la: the axial length of the machine. J: average current density. As: slot's area. Kf : slot's filing factor. Ns: number of slots in the stator. Bg(x): the flux density at equidistant points in the air gap. tp: the tooth pitch.
In our model, the air gap region is considered to be moving as the rotor rotates. The air gap flux density function of time for the healthy case, case of crack in a magnet, case of turn-to-turn short circuit in one stator's coil and case of eccentricity fault is illustrated in Figures 3-6 respectively. To draw the air gap flux density in the time domain, an arbitrary point in the air gap is considered. This point has almost the same vertices for all the studied cases of the machine.
vertices for all the studied cases of the machine.
The analytical described equation to calculate the torque is integrated in the time stepping model of the machine, which generates the torque function of time. The simulation is done for the healthy case and different types of fault previously mentioned. Figure 7 illustrates the torque for the healthy case, case of 10% eccentricity fault, turn-to-turn short circuit in one slot and 1 mm crack in one piece of magnet.   The analytical described equation to calculate the torque is integrated in the time stepping model of the machine, which generates the torque function of time. The simulation is done for the healthy case and different types of fault previously mentioned. Figure 7 illustrates the torque for the healthy case, case of 10% eccentricity fault, turn-to-turn short circuit in one slot and 1 mm crack in one piece of magnet.       Contemplating Figure 7, we can see the impact of the faults on the torque which shows that the torque is a good indicator for fault detection. The transient part of the machine's operation is clearly illustrated in the graph; this is the main advantageous of the time stepping dynamic model.
Comparing the graphs in Figure 7, several notes can be recorded. The blue graph is the torque in the healthy case. The red graph is the machine torque in the case of demagnetization represented by a 1 mm crack in one piece of magnet. This graph is close to that of the healthy case; however, this fault has impacted the torque with ripples clearly visualized on the graph. The average torque in this case of demagnetization is greater than the healthy case (Table 2) due to the numerical calculation where the average is calculated over the first tooth pitch that contains the peak. This increased the value of air gap flux density and, subsequently, the torque.
The yellow graph is the torque of the machine when a turn-to-turn short circuit occurred in one slot of phase A. When a short circuit occurs, temperature rises in the whole machine in general and in the magnet in particular. This rise in temperature weakens the magnet, its flux density decreases; the cause is the high dependence of the magnet's electromagnetic performance on the operating temperature. Accordingly, the torque decreases, being directly proportional to the air gap flux density. This torque will continue decreasing as the number of short circuited turns increases. We mention that in other types of electrical machines, like induction machines, when a short circuit occurs in the stator's windings, the air gap flux density may increase and the torque will increase accordingly because the intervention of the The analytical described equation to calculate the torque is integrated in the time stepping model of the machine, which generates the torque function of time. The simulation is done for the healthy case and different types of fault previously mentioned. Figure 7 illustrates the torque for the healthy case, case of 10% eccentricity fault, turn-to-turn short circuit in one slot and 1 mm crack in one piece of magnet.
Appl. Sci. 2020, 10, x FOR PEER REVIEW 8 of 29 stator in the average air gap flux density is high in this type of electrical machine, in contrast to the permanent magnet machine. The purple graph is the torque in the case of 10% eccentricity fault at the right of the machine. The air gap flux density in this area increases since the stator and rotor became closer. The average torque in the case of eccentricity fault is slightly higher than the healthy case due to the numerical calculation method used as mentioned for the case of demagnetization fault.
To evaluate the impact of the designated faults on the machine's torque, several statistical features were extracted from the torque signals; the average of the data set was a good fault indicator. This is shown in Table 2 where we can see the disparity between the values of average torque for the different interpreted cases.  As we declared previously, the absence of prototype pushes us to choose FEM to model the SPMM. We mention that a confrontation has been done among the electromagnetic FEM and analytical method in previous studies in [22], where the matching between the results has been shown.

Outcomes of Thermal FEM Model
The thermal FEM model is capable of computing the temperature in the whole machine. The importance of monitoring the boundary temperature for fault detection and localization is clarified in paper [18].
The governing equation of heat transfer for any application is [25]  Contemplating Figure 7, we can see the impact of the faults on the torque which shows that the torque is a good indicator for fault detection. The transient part of the machine's operation is clearly illustrated in the graph; this is the main advantageous of the time stepping dynamic model.
Comparing the graphs in Figure 7, several notes can be recorded. The blue graph is the torque in the healthy case. The red graph is the machine torque in the case of demagnetization represented by a 1 mm crack in one piece of magnet. This graph is close to that of the healthy case; however, this fault has impacted the torque with ripples clearly visualized on the graph. The average torque in this case of demagnetization is greater than the healthy case ( Table 2) due to the numerical calculation where the average is calculated over the first tooth pitch that contains the peak. This increased the value of air gap flux density and, subsequently, the torque. The yellow graph is the torque of the machine when a turn-to-turn short circuit occurred in one slot of phase A. When a short circuit occurs, temperature rises in the whole machine in general and in the magnet in particular. This rise in temperature weakens the magnet, its flux density decreases; the cause is the high dependence of the magnet's electromagnetic performance on the operating temperature. Accordingly, the torque decreases, being directly proportional to the air gap flux density. This torque will continue decreasing as the number of short circuited turns increases. We mention that in other types of electrical machines, like induction machines, when a short circuit occurs in the stator's windings, the air gap flux density may increase and the torque will increase accordingly because the intervention of the stator in the average air gap flux density is high in this type of electrical machine, in contrast to the permanent magnet machine.
The purple graph is the torque in the case of 10% eccentricity fault at the right of the machine. The air gap flux density in this area increases since the stator and rotor became closer. The average torque in the case of eccentricity fault is slightly higher than the healthy case due to the numerical calculation method used as mentioned for the case of demagnetization fault.
To evaluate the impact of the designated faults on the machine's torque, several statistical features were extracted from the torque signals; the average of the data set was a good fault indicator. This is shown in Table 2 where we can see the disparity between the values of average torque for the different interpreted cases.
As we declared previously, the absence of prototype pushes us to choose FEM to model the SPMM. We mention that a confrontation has been done among the electromagnetic FEM and analytical method in previous studies in [22], where the matching between the results has been shown.

Outcomes of Thermal FEM Model
The thermal FEM model is capable of computing the temperature in the whole machine. The importance of monitoring the boundary temperature for fault detection and localization is clarified in paper [18].
The governing equation of heat transfer for any application is [25] ρ Cp tz ρ: material density, kg/m 3 . Cp: the specific heat, J/kg.K. tz: the thickness model. k: thermal conductivity, W/m·K. t: time, sec. T: temperature at a particular x and y location, k. Qd: heat source, watt/m 2 .
The amount of heat transferred from a surface, per unit area, due to convection is expressed as Ta: ambient temperature. hc: convection coefficient, W/m 2 ·K. The amount of heat transferred, per unit area, due to radiation is expressed as : emissivity of the face. σ: Stefan-Boltzmann constant, W/m 2 K 4 In this study, a thermal steady state analysis is executed for each machine revolution, where the input is considered a pure three phase sine wave voltage. The machine has 12 poles and a nominal speed of 668 rpm [26].
The general heat equation is a parabolic partial differential equation. The aim of the thermal analysis is to know the distribution of temperature throughout the machine in general, at the magnet level in specific and at the machine's boundary. Figure 8 shows the temperature detected by this sensor for the case of healthy machine and faulty machine with short circuit in the first slot. A high difference between the sensed temperatures in the two cases can be seen. This is expected since the short circuit increases the value of current in the faulty phase; this increases the copper losses, which will be expressed as heat. In fact, the main sources of heat inside electric machines are the copper windings.    Since our goal is to detect the presence of turn-to-turn short circuit wherever it is located, the fault is moved each time to one of the 36 slots and the recorded data for each case. This is shown in Figure 9.    The same measurement is done for the case of 1 mm crack in one piece of magnet in the machine. Each time, the crack is moved to one of the magnets and the sensor temperature position remains intact. The results are shown in Figure 10.   For the state of 10% eccentricity fault in the machine, four cases are considered: rotor shifted to the right, rotor shifted to the left, rotor shifted upward and rotor shifted downward. The temperature collected by the sensor, in this case, is illustrated in Figure 11.     It should be mentioned that temperature is not a good indicator for eccentricity and demagnetization faults since the value of the temperature is almost the same for those types of faults.
After collecting the temperature data for the different machine states, statistical and spectral features were extracted. Statistical features were not a good indicator for fault detection using temperature data signal; hence, we will take advantage of the spectral characteristics [27]. Figure 12 illustrates the Fourier transformation of the collected temperature data for all the investigated states of the machine. Figure 13 is a zoomed view of Figure 12. As we can see, a sharp peak is detected at the 10th harmonic of the spectrum where the frequency is equal (10*f fundamental ) and where f fundamental is the fundamental frequency. A zoomed view on those sharp peaks in Figure 13 shows distinction between the different machine states. We mention that the amplitude of this Fourier transformation is not normalized.

Outcomes of Vibration FEM Model
The same followed strategy will be applied for the vibration model in the aim of generating a useful database of vibration. The efficiency of using vibration signal for fault detection was highlighted in paper [19]. The government equation of the vibration FEM model is

Outcomes of Vibration FEM Model
The same followed strategy will be applied for the vibration model in the aim of generating a useful database of vibration. The efficiency of using vibration signal for fault detection was highlighted in paper [19].

Outcomes of Vibration FEM Model
The same followed strategy will be applied for the vibration model in the aim of generating a useful database of vibration. The efficiency of using vibration signal for fault detection was highlighted in paper [19]. The government equation of the vibration FEM model is G is the modulus of elasticity, λ is the Poisson's ratio, fB is the electromagnetic force and x is the displacement. Figures 14-17 are the vibration signals, in time domain, for the healthy machine, machine with 10% eccentricity fault, machine with crack in one piece of magnet and machine with turn-to-turn short circuit in one slot respectively.
G is the modulus of elasticity, is the Poisson's ratio, fB is the electromagnetic force and x is the displacement. Figures 14-17 are the vibration signals, in time domain, for the healthy machine, machine with 10% eccentricity fault, machine with crack in one piece of magnet and machine with turn-to-turn short circuit in one slot respectively.   G is the modulus of elasticity, is the Poisson's ratio, fB is the electromagnetic force and x is the displacement. Figures 14-17 are the vibration signals, in time domain, for the healthy machine, machine with 10% eccentricity fault, machine with crack in one piece of magnet and machine with turn-to-turn short circuit in one slot respectively.      Different statistical features are tested for the above vibration signals. It has been proven that the average over one revolution is a good indicator for fault detection.

Comparison between Machine's Dynamic Features
As we presented earlier, the three selected dynamic parameters, torque, temperature and vibration, are all affected, with uneven percentages and ranges for the different investigated machine's states and faults. Table 3 illustrates the deviation of each parameter in the case of a specific fault, compared with the case of healthy machine. The comparison is of the average values of the signals.
For fault detection, the vibration is the mostly and highly affected parameter when any of the mentioned types of fault is integrated in the electrical machine. The second affected parameter in the case of fault is the electric torque. The less affected parameter is the temperature. Different statistical features are tested for the above vibration signals. It has been proven that the average over one revolution is a good indicator for fault detection.

Comparison between Machine's Dynamic Features
As we presented earlier, the three selected dynamic parameters, torque, temperature and vibration, are all affected, with uneven percentages and ranges for the different investigated machine's states and faults. Table 3 illustrates the deviation of each parameter in the case of a specific fault, compared with the case of healthy machine. The comparison is of the average values of the signals. For fault detection, the vibration is the mostly and highly affected parameter when any of the mentioned types of fault is integrated in the electrical machine. The second affected parameter in the case of fault is the electric torque. The less affected parameter is the temperature.
However, for fault localization, the temperature is useful to localize the slot where the turn-to-turn short circuit occurred. The vibration is useful to localize the magnet where the crack occurred.
For prognostic purposes, monitoring more than one dynamic parameter for each type of fault is more likely to prevent a false alarm. Hence, all collected parameters are of big interest to assure a safe and correct prognostic decision.

The Prognostic Strategy
A prognostic strategy, using HMM, will be developed to detect the presence of fault at its early stage [28]. Extracted features of data coming from torque, temperature and vibration sensors will be the input of the prognostic HMM. The output of the model will be the prognostic decision that will state if the machine is at its healthy or faulty state. If it is at a faulty state, it will give the type of fault and the machine's remaining useful life. The chart in Figure 18 represents the prognostic strategy and its tasks.
A prognostic strategy, using HMM, will be developed to detect the presence of fault at its early stage [28]. Extracted features of data coming from torque, temperature and vibration sensors will be the input of the prognostic HMM. The output of the model will be the prognostic decision that will state if the machine is at its healthy or faulty state. If it is at a faulty state, it will give the type of fault and the machine's remaining useful life. The chart in Figure 18 represents the prognostic strategy and its tasks. In the beginning, the raw signal coming from torque, temperature and vibration sensors is collected. The selected features, for each dataset, will be extracted over one machine revolution. Those features will be the input of the prognostic model, as will be explained in the following sections. This prognostic approach will answer the following question: 'what is the state of the machine?'. If the machine is healthy, we stop. If the machine is faulty, the type of fault, demagnetization, eccentricity or turn to turn short circuit, will be identified and localized. Then, the remaining useful life of the damaged component will be estimated. In the beginning, the raw signal coming from torque, temperature and vibration sensors is collected. The selected features, for each dataset, will be extracted over one machine revolution. Those features will be the input of the prognostic model, as will be explained in the following sections. This prognostic approach will answer the following question: 'what is the state of the machine?'. If the machine is healthy, we stop. If the machine is faulty, the type of fault, demagnetization, eccentricity or turn to turn short circuit, will be identified and localized. Then, the remaining useful life of the damaged component will be estimated.

The HMM of Our System
In general, HMM can be expressed as: λ HMM = (TM, EM, π). It consists of [29]: An initial probability value (π) for each state. This consists of an estimate expressing the probability that initially the system is at a definite state -A transition probability matrix (TM). This matrix represents the probability that the system moves from one state to another. The size of matrix (TM) is n by n. -An output probability distribution matrix or emission matrix (EM). This expresses the likelihood that a certain measured sequence of values corresponds to a specific sequence of states. The size of matrix (EM) is n by m, where m is the number of observables.
In our system, the elements of the HMM are as follows [30]: -53 main states, which encounter the healthy state, 12 states where there is a 1 mm crack in one piece of the 12 magnets located on the machine's rotor, 36 states where there is a turn-to-turn short circuit in one slot of the 36 slots and 4 states where there is a 10% eccentricity fault on the left, right, upward and downward.
We mention that in this analysis, one type of fault is considered at a time; hence, there is no interrelation between the different types of faults.
Each of the above mentioned main states can propagate and reveal a new state. For example, let's consider a scenario where the machine moves from the healthy state to the state of a turn-to-turn short circuit in one slot. In this case, the set of states that may face the machine can be expressed as where S H refers to the healthy state, S F1-1 refers to the faulty state with one turn short circuited, S F1-2 refers to the faulty state where two turns are short circuited, S F1-13 refers to the faulty state where all the thirteen turns of the coil are circuited.
-Three distinct observation sequences per state. This expresses the observed data. In our case, the observation will be the measured values from the torque, temperature or vibration sensors. We mention that the raw data set, coming from the three sensors, is investigated over one machine revolution, and the number of sampling points is 400.
Considering the above example of turn-to-turn short circuit, the sequence of observation can be expressed as where {SO 1-1 } is a vector containing torque, temperature and vibration data in the case of one turn short circuited, {SO 1-2 } is a vector containing torque, temperature and vibration data in the case of two turns short circuited, . . . The trellis diagram representing this example is illustrated in Figure 19 [11,31].
In Figure 19, 'Temp' is for temperature and 'Vib' is for vibration. The trellis diagram in this figure illustrates the life cycle of the coil from the small-scale fault until the complete deterioration. However, the prognostic model that we are going to build will detect the presence of the fault at its early stage, and this is highlighted in red in the diagram.
Each type of fault has its own trellis diagram. If we consider the case of a 1 mm crack in one piece of the magnet, the states of the trellis diagram, other than the initial healthy state, will be 5: the first state refers to 1 mm crack in magnet 1, state 2 refers to the faulty state where the 1 mm crack deepens and becomes a 2 mm crack, state 3 refers to the faulty state where the 2 mm crack deepens and becomes a 3 mm crack, state 4 refers to the faulty state where the 3 mm crack deepens and becomes a 4 mm crack and state 5 refers to the faulty state where the crack becomes a complete fracture. Hence, in our case, we have a multilevel trellis diagram that can be schematically represented as in Figure 20.
In our case, the considered states are the healthy state and the faulty states with primitive fault. The observations are a continuous signals function of time; the extracted features from those signals (average for torque and vibration signal and spectral amplitude for temperature) will be the input of the model.  In Figure 19, 'Temp' is for temperature and 'Vib' is for vibration. The trellis diagram in this figure illustrates the life cycle of the coil from the small-scale fault until the complete deterioration. However, the prognostic model that we are going to build will detect the presence of the fault at its early stage, and this is highlighted in red in the diagram.
Each type of fault has its own trellis diagram. If we consider the case of a 1 mm crack in one piece of the magnet, the states of the trellis diagram, other than the initial healthy state, will be 5: the first state refers to 1 mm crack in magnet 1, state 2 refers to the faulty state where the 1 mm crack deepens and becomes a 2 mm crack, state 3 refers to the faulty state where the 2 mm crack deepens and becomes a 3 mm crack, state 4 refers to the faulty state where the 3 mm crack deepens and becomes a 4 mm crack and state 5 refers to the faulty state where the crack becomes a complete fracture. Hence, in our case, we have a multilevel trellis diagram that can be schematically represented as in Figure 20.
for the case of crack in one magnet or eccentricity fault. Hence, the total number of observations will be 94 encountering 53 vibration ranges, 4 torque ranges and 37 temperature ranges.
Accordingly, the size of the transition matrix is (53 × 53), the size of the emission matrix is (53 × 94), and the initial state of the machine is considered to be healthy.
The below 'TM' matrix is a schematic presentation of the transmission matrix.  In other words, the constructed model will encounter the first layers highlighted in red in Figure 19 because these layers represent the system with the small scale faults we are interested in.
As we stated previously, the observations of the HMM will come from three observers: torque, vibration and temperature sensors. For each state of the machine there is data coming from the three sensors. However, some states share the same observations. For example, the temperature of the machine remains almost the same in the healthy case, case of eccentricity fault or case of crack in one magnet. Torque in the case of turn-to-turn short circuit remains the same wherever the short circuit is. The same is applied for the case of crack in one magnet or eccentricity fault. Hence, the total number of observations will be 94 encountering 53 vibration ranges, 4 torque ranges and 37 temperature ranges.
Accordingly, the size of the transition matrix is (53 × 53), the size of the emission matrix is (53 × 94), and the initial state of the machine is considered to be healthy.
The below 'TM' matrix is a schematic presentation of the transmission matrix.
The percentage that the machine remains healthy is 60%. The percentage that the machine becomes faulty is 40%. This 40% was distributed among the different considered faulty states according to the percentage of fault occurrence.
This self-correlation of the states is very common in hidden Markov models, and it is always observed as a strong diagonal in the transition matrix. We note also that faults of a similar nature have a similar probability of transition to crack in magnet 1 and crack in magnet 2 and crack in magnet 3 . . .
The below 'EM' matrix is a schematic presentation of the emission matrix.
The probabilities in the emission matrix can be arbitrary. However, in our HMM model, the numbers expressing the probabilities of emission between the states and the observations are inspired from the percentage of observations' deviation between that of the healthy case and the faulty case [15].
The TM and the EM constitutes the HMM of our model. The input sequence of observations will be features of vibration, torque and temperature data sensors. The decoding of the observation sequence will be executed using the Viterbi algorithm. Viterbi will elaborate the appropriate sequence of states by calculating the likelihood probability. A schematic representation of the combination between the HMM and the Viterbi algorithm, where the states and the observations are shown, is presented in Figure 21.
Appl. Sci. 2020, 10, x FOR PEER REVIEW 19 of 29 After the elaboration of the machine's condition state, the next and final step will be the calculation of the remaining useful life (RUL).

Aging of PMM's Components
The components forming the electrical machine are the core of the stator and rotor, which are formed mainly from steel, the stator's coil, which is made from copper, the magnet on the rotor, which in our machine is a rare earth magnet called neodymium iron boron, and the shaft, constituted of aluminum. They are all subject to aging.
The aging of the delicate components in the electrical machine is the major factor that intervenes in the calculation of the RUL of the system after the prognostic decision is formulated. The machine's components that are most subject to aging are the coil and the magnet.

Aging of the Stator's Coil
The stator's coils are made of copper wire and its insulation. The main causes of the wire's aging are temperature, humidity and corrosion. The internal resistance of the wire is considered the parameter that impacts its age. The aging equation of resistance is [32] ∆R R 0 = A t n e (− T0 T ) %.  Figure 22 shows how this sequence will be decoded through the Viterbi algorithm and the corresponding sequence of states is detected.
Appl. Sci. 2020, 10, x FOR PEER REVIEW 19 of 29 After the elaboration of the machine's condition state, the next and final step will be the calculation of the remaining useful life (RUL).

Aging of PMM's Components
The components forming the electrical machine are the core of the stator and rotor, which are formed mainly from steel, the stator's coil, which is made from copper, the magnet on the rotor, which in our machine is a rare earth magnet called neodymium iron boron, and the shaft, constituted of aluminum. They are all subject to aging.
The aging of the delicate components in the electrical machine is the major factor that intervenes in the calculation of the RUL of the system after the prognostic decision is formulated. The machine's components that are most subject to aging are the coil and the magnet.

Aging of the Stator's Coil
The stator's coils are made of copper wire and its insulation. The main causes of the wire's aging are temperature, humidity and corrosion. The internal resistance of the wire is considered the parameter that impacts its age. The aging equation of resistance is [32] ∆ = A t e ( ) %. At the start, the probability that the system is healthy is '0.6', and the probability that the system is faulty is '0.4'. The probability that the system state is S H if the observation is SO H is '0.6', and the probability that the system state is S F1-1 if the observation is SO H is '0'. Hence, the weight probability from 'Start' to 'S H ' is 0.36 (0.6*0.6), and the weight probability from 'Start' to 'S F1-1 ' is 0 (0.4*0). Viterbi will choose the path having the highest probability, which is in this case 0.36, and the selected path is highlighted in red. For simplicity, we will consider the observation from one sensor; the selected one is the vibration sensor.
The second observation is also SO H . The probability of remaining in state S H is '0.6' (from the transition matrix). The probability of being in state S H if the observation is SO H is '0.6'. The probability from the previous state is 0.36. Hence, the weight probability of remaining in state S H when the second observation is SO H will be 0.1296 (0.36×0.6×0.6). Following the same logic calculation, we got the weighted probabilities of all the paths. The path of higher probability, at each observation time, is highlighted in red. Accordingly, the adequate sequence of states is {S H , S H , S F1-1 }. This path, selected by the Viterbi algorithm, is called the 'survivor path'.
After the elaboration of the machine's condition state, the next and final step will be the calculation of the remaining useful life (RUL).

Aging of PMM's Components
The components forming the electrical machine are the core of the stator and rotor, which are formed mainly from steel, the stator's coil, which is made from copper, the magnet on the rotor, which in our machine is a rare earth magnet called neodymium iron boron, and the shaft, constituted of aluminum. They are all subject to aging.
The aging of the delicate components in the electrical machine is the major factor that intervenes in the calculation of the RUL of the system after the prognostic decision is formulated. The machine's components that are most subject to aging are the coil and the magnet.

Aging of the Stator's Coil
The stator's coils are made of copper wire and its insulation. The main causes of the wire's aging are temperature, humidity and corrosion. The internal resistance of the wire is considered the parameter that impacts its age. The aging equation of resistance is [32] ∆R T: operating temperature of resistor in • C. t: time the resistor is operating at temperature T in hours. R0: initial value of the resistor in ohms. ∆R: increase in resistance of the resistor operating at temperature T for a time t, in ohms. A: statistically independent random variables (the value of this variable can be taken as 1.51 × 1012.). n: calibration parameter (it can be considered '0.610'). T0: initial temperature.
The type of copper used in the machine's coil is of class 200 • C, grade 2. The wire's diameter is 0.6 mm and its resistance is 0.05876-0.06222 ohm/m. At ambient temperature, 20 • C, the resistance of one phase is 0.42 ohm [33].
According to the Copper Development Association, the lifetime of the conductor part of the wire is 100 years. The lifetime of the wire's insulation is 70 years. This remains true if no fault or abnormal environmental characteristics occur. However, the average life cycle of a permanent magnet machine is up to 14 years. Hence, it is useful to study the aging effect of copper resistance during the lifetime of the machine only. Table 4 shows the variation of the coil's resistance value due to aging, where no physical fault occurs in the machine. Although the resistance of the coil increases over the years, its impact is negligible on the operation of the machine as long as no fault occurs and the temperature at the coil level is within the tolerated values.
According to [34], the insulation's aging is directly related and inversely proportional to temperature (T). It is expressed as A and B are constant characteristics of the insulation. The aging is in years and the temperature is in Celsius.
The insulation aging degradation function of the machine's temperature ranges is illustrated in Figure 23. According to this figure, if normal operation of the electric machine is guaranteed, there is no need to worry about the insulation aging. However, when a fault occurs, insulation aging becomes a huge concern; ignoring it will lead to catastrophic consequences.
23. According to this figure, if normal operation of the electric machine is guaranteed, there is no need to worry about the insulation aging. However, when a fault occurs, insulation aging becomes a huge concern; ignoring it will lead to catastrophic consequences.

Aging of the Magnet
Several factors affect the stability and performance of magnets: temperature, change in reluctance, external magnetic fields, radiation, and vibration. The magnet used in our machine is neodymium iron boron (NdFeB). The most common temperature related parameters for NdFeB are mentioned in Table 5, [35]. NdFeB loses approximately 0.11% of its remanence 'Br' and 0.4% of its coercive force 'Hc' for every degree Celsius above 20 • C. Rare earth magnets may face three types of losses; each type moves the magnet to a specific phase [36].
Reversible losses: They can be defined as temporary loss of the magnet's magnetic force. These losses can be reversed when the magnet returns to its normal original temperature. Reversible losses are expressed by the reversible temperature coefficient, -%Br/ • C.
Irreversible losses: These losses are defined as a partial demagnetization of the magnet due to exposure to high or low temperatures or other demagnetizing stimuluses. These losses are only recoverable by re-magnetization and are not recovered when the temperature returns to its original value. This occurs when the magnets are operating at temperatures higher than the identified "maximum operating temperature" or when the operating temperature of the magnet reaches a minimal value.
Permanent losses: They occur when magnets are exposed to extremely high temperatures that are usually as high as the initial heat treatment when they were manufactured. This is called the magnet's Curie temperature. In this case, the magnetic properties are not recoverable to its initial state even after re-magnetization.
The effect of time on modern permanent magnets is minimal. Figure 24 shows the percentage decrease of Br function of time when the maximum operating temperature of the magnet is 100 • C and 150 • C.
There is no aging equation for magnet relating its remanence flux density 'Br' to its temperature and operating time. However, an approximate analytical equation can be deduced from experimental graphs like the one in Figure   As we can see, at 100 °C, there is small remarked degradation of Hc and Br with time. The degradation worsens if the temperature at the magnet level increases. The numbers in Table 6 detect a pace acceleration in Br and Hc. The negative values indicate a complete deterioration of the magnet.
The air gap flux density of the machine function of aging, in the faulty case, is illustrated in Figure 25. As we can see, the air gap flux density degrades radically at 150 °C. This will greatly affect the performance of the machine since the machine's torque is directly proportional to the average air gap flux density.  Table 6 shows the effect of magnet aging on Br and Hc, under healthy conditions. Table 7 shows the effect of magnet aging at 150 • C. As we can see, at 100 • C, there is small remarked degradation of Hc and Br with time. The degradation worsens if the temperature at the magnet level increases. The numbers in Table 6 detect a pace acceleration in Br and Hc. The negative values indicate a complete deterioration of the magnet.
The air gap flux density of the machine function of aging, in the faulty case, is illustrated in Figure 25. As we can see, the air gap flux density degrades radically at 150 • C. This will greatly affect the performance of the machine since the machine's torque is directly proportional to the average air gap flux density. In the end of this section, we conclude that tracking the aging of the dynamic and sensitive components inside the machine is not of big interest during normal operation because the life cycle of these components is much greater than that of the electric machine itself. However, studying and considering this aging, when a fault occurs, is very important because this will largely influence the machine's health operation.

Estimation Strategy of RUL Calculation Using Thermal FEM in the Case of Turn-to-Turn Short Circuit
As explained previously, the aging and performance of critical components in the PMM are highly affected by temperature. The aging equation for the coil insulation is noted. The phases of the magnet function of temperature are noted. In this section, we will take advantage of the detailed knowledge of the machine's thermal aspect and its well-developed thermal FEM, combine it with the aging equations, and elaborate the appropriate RUL for the insulation and magnet phase in the case of turn-to-turn short circuit.
The proposed strategy will solve and answer two questions: what is the remaining useful life of insulation? And, in which slot will the next turn-to-turn short circuit fault occur? In other words, at the end of this analysis we will get the time we still have before insulation, in specific areas, deteriorates and causes a new turn-to-turn short circuit fault.
A block diagram presenting the steps of this strategy is illustrated in Figure 26. An illustrative example clarifying the prognostic approach and the RUL calculation in the case of turnto-turn short circuit will be presented in Figure 27. The sensor's data will be collected. The prognostic approach (HMM) will investigate this data and elaborate the state of the machine.
If a turn-to-turn short circuit is detected in the electric machine, the thermal FEM will be conducted, where the phase of the magnet and the remaining useful life of the insulation are elaborated. The location of the next turn-to-turn short circuit that will occur in the machine will be identified also.
The thermal FEM is capable of determining temperature in the whole machine. As stated in the previous section, the critical machine elements whose performance is directly related to the operating temperature are the magnet and the stator coil. Hence, when a turn-to-turn short circuit fault occurs, the higher temperature at the magnet and coil level is noted. The RUL of insulation is calculated using insulation aging Equation (11) from the previous section. The new 'Br' of the magnet due to the increase of its temperature is calculated using the aging magnet Equations (12) and (13). In the end of this section, we conclude that tracking the aging of the dynamic and sensitive components inside the machine is not of big interest during normal operation because the life cycle of these components is much greater than that of the electric machine itself. However, studying and considering this aging, when a fault occurs, is very important because this will largely influence the machine's health operation.

Estimation Strategy of RUL Calculation Using Thermal FEM in the Case of Turn-to-Turn Short Circuit
As explained previously, the aging and performance of critical components in the PMM are highly affected by temperature. The aging equation for the coil insulation is noted. The phases of the magnet function of temperature are noted. In this section, we will take advantage of the detailed knowledge of the machine's thermal aspect and its well-developed thermal FEM, combine it with the aging equations, and elaborate the appropriate RUL for the insulation and magnet phase in the case of turn-to-turn short circuit.
The proposed strategy will solve and answer two questions: what is the remaining useful life of insulation? And, in which slot will the next turn-to-turn short circuit fault occur? In other words, at the end of this analysis we will get the time we still have before insulation, in specific areas, deteriorates and causes a new turn-to-turn short circuit fault.
A block diagram presenting the steps of this strategy is illustrated in Figure 26. An illustrative example clarifying the prognostic approach and the RUL calculation in the case of turn-to-turn short circuit will be presented in Figure 27. The sensor's data will be collected. The prognostic approach (HMM) will investigate this data and elaborate the state of the machine.
If a turn-to-turn short circuit is detected in the electric machine, the thermal FEM will be conducted, where the phase of the magnet and the remaining useful life of the insulation are elaborated. The location of the next turn-to-turn short circuit that will occur in the machine will be identified also.
The thermal FEM is capable of determining temperature in the whole machine. As stated in the previous section, the critical machine elements whose performance is directly related to the operating temperature are the magnet and the stator coil. Hence, when a turn-to-turn short circuit fault occurs, the higher temperature at the magnet and coil level is noted. The RUL of insulation is calculated using insulation aging Equation (11) from the previous section. The new 'Br' of the magnet due to the increase of its temperature is calculated using the aging magnet Equations (12) and (13).

Conclusions
Hybrid electric vehicles are gaining popularity nowadays. The challenge of reliability pushes research to apply prognosis on different elements constituting the electrical propulsion system of the vehicle. This research focuses on the prognosis of the electrical machine in the HEV.
Several axes are treated and presented in this paper. We started with machine modeling where a surface permanent magnet machine used in hybrid electric vehicle application is modeled using finite element modeling. Then, the hidden Markov model for prognostic purposes is developed to detect the presence of short circuit, demagnetization and eccentricity faults. Prognosis aims to detect faults at their early stage or before they occur; hence, the probability of false alarms is high. To avoid this problem and eliminate any possibility of ambiguity in the prognostic decision, we used three vital parameters that are useful for machine monitoring, torque, temperature and vibration, as the inputs of the HMM. Torque, Figure 27. Illustrative example for the RUL calculation in the case of turn to turn short circuit.

Conclusions
Hybrid electric vehicles are gaining popularity nowadays. The challenge of reliability pushes research to apply prognosis on different elements constituting the electrical propulsion system of the vehicle. This research focuses on the prognosis of the electrical machine in the HEV.
Several axes are treated and presented in this paper. We started with machine modeling where a surface permanent magnet machine used in hybrid electric vehicle application is modeled using finite element modeling. Then, the hidden Markov model for prognostic purposes is developed to detect the presence of short circuit, demagnetization and eccentricity faults. Prognosis aims to detect faults at their early stage or before they occur; hence, the probability of false alarms is high. To avoid this problem and eliminate any possibility of ambiguity in the prognostic decision, we used three vital parameters that are useful for machine monitoring, torque, temperature and vibration, as the inputs of the HMM. Torque, temperature and vibration signals were synthesized from electromagnetic, thermal and vibration finite element models respectively. After that, the RUL of the PMM is calculated when a turn-to-turn short circuit in one slot occurs. A suggested RUL calculation strategy that takes advantage of the aging equation of insulation and aging behavior of magnet is presented.
Results show that torque, temperature and vibration are good vital parameters to predict the presence of demagnetization, turn-to-turn short circuit and eccentricity faults. The hidden Markov model is suitable for prognosis as it is easy to implement and its input is directly collected from data sensors. Funding: This work is co-funded by the European Union and Normandy Region. Europe is involved in Normandy through the European Funds for Regional Development.

Conflicts of Interest:
The authors declare no conflicts of interest. initial value of the resistor in ohms ∆R increase in resistance of the resistor operating at temperature T for a time t, in ohms T 0 initial temperature Br residual flux density Hc coercive force