# From Modeling to Failure Prognosis of Permanent Magnet Synchronous Machine
## 3 Hidden Markov Model
### The HMM of Our System  
In general, HMM can be expressed as: \(\lambda_{\text{HMM}}\) = (TM, EM, \(\pi\)). It consists of [29]:  
- A set of states 'S': S = {S\({}_{0}\), \(S_{1}\), \(S_{2}\),..., Sn} where 'S0' is the initial state of the system and S\({}_{i}\), i \(\in\) {1, 2,..., n} is the faulty state (n is the number of treated states). - The observables 'O': O = {O\({}_{0}\), O\({}_{1}\), O\({}_{2}\),..., O\({}_{m}\)}. This is the apparent input of the model. - An initial probability value (\(\pi\)) 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. Figure 18: The prognostic strategy. 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  
\[\text{S}_{\text{1}}=\{\text{S}_{\text{H}},\,\text{S}_{\text{F1-1}},\,\text{S}_{ \text{F1-2}},\,\ldots,\,\text{S}_{\text{F1-13}}\},\]  
where \(\text{S}_{\text{H}}\) refers to the healthy state, \(\text{S}_{\text{F1-1}}\) refers to the faulty state with one turn short circuited, \(\text{S}_{\text{F1-2}}\) refers to the faulty state where two turns are short circuited, \(\text{S}_{\text{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  
\[\text{SO}_{\text{1}}\text{=}\{\text{[SO}_{\text{1-1}}\text{]},\,\text{[SO}_{ \text{1-2}}\text{]},\,\ldots,\,\text{[SO}_{\text{1-13}}\text{]}\},\]  
where \(\{\text{SO}_{\text{1-1}}\}\) is a vector containing torque, temperature and vibration data in the case of one turn short circuited, \(\{\text{SO}_{\text{1-2}}\}\) is a vector containing torque, temperature and vibration data in the case of two turns short circuited, \(\ldots\)  
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.