1.. Introduction
================

Permanent magnet synchronous motors (PMSMs) are widely used as motors in electric vehicles, electrical traction systems, industrial applications, wind generation and defense, due to their high energy efficiency, high torque-to-weight ratio, high power factor, fast response, rugged construction and reliable operation \[[@b1-sensors-14-23119]--[@b3-sensors-14-23119]\].  However, permanent magnet (PM) demagnetization faults often occur in the practical application of PMSMs by flux-weakening control and, in severe cases, even cause irreversible demagnetization \[[@b4-sensors-14-23119]\].  Therefore, it is important to improve the reliability for the PMSM by online monitoring of PM flux-linkage and analysis of PM demagnetization. 

To prevent PM demagnetization, many solutions \[[@b5-sensors-14-23119]--[@b7-sensors-14-23119]\] have been proposed for optimizing the magnetic circuit and, thus, reducing the risk of PM demagnetization from the motor-design standpoint; this may lead to increasing manufacturing cost, but can reduce maintenance costs.  This approach is referred to as the static prevention method.  On the other hand, a dynamic monitoring method can provide accurate PM flux-linkage information by online monitoring of the PMSM control system, which can effectively prevent the occurrence of more serious demagnetization and decrease the extent of irreversible demagnetization. 

Xiao *et al.*  \[[@b8-sensors-14-23119]\] have proposed a dynamic method to estimate PM flux-linkage for a surface-mounted permanent magnet synchronous motor (SPMSM) based on an extended Kalman filter (EKF), which provides a reference for online monitoring of the PM flux-linkage in the PMSM closed-loop control system.  Shi *et al.*  \[[@b9-sensors-14-23119]\] have achieved PM flux-linkage identification for an IPMSM using an EKF. 

Sliding-mode variable structure control \[[@b10-sensors-14-23119]--[@b12-sensors-14-23119]\] has good robustness against system parameter perturbations, external disturbances and inaccurate mathematical models, but the chattering phenomenon of traditional sliding-mode control limits its application.  Terminal-sliding-mode \[[@b13-sensors-14-23119]\] (TSM) is a new sliding-mode control method that can design a nonlinear sliding manifold to converge in finite time, but it has singularity problems.  Feng *et al.*  \[[@b14-sensors-14-23119],[@b15-sensors-14-23119]\] proposed a nonsingular terminal-sliding-mode (NTSM) control approach, which solves the singularity problem of the traditional TSM and offers high tracking accuracy in the steady state.  However, it converges slowly far away from the equilibrium point and has chattering problems when designing a control law combined with global reach conditions, which also limit its practical application.  Levant \[[@b16-sensors-14-23119]\] proposed a high-order sliding-mode (HOSM) control, which applies discontinuous control on a higher time derivative of the sliding-mode manifold to eliminate chattering while retaining the good properties of the traditional sliding-mode. 

1.1.. Contribution
------------------

The main contribution of this study is to propose a robust nonsingular fast terminal-sliding-mode observer (NFTSMO) to detect PM flux-linkage demagnetization faults for interior permanent magnet synchronous motors (IPMSMs) by flux-weakening control.  PM demagnetization faults are reconstructed by the NFTSMO, which is combined with the chattering elimination characteristics of high-order sliding-mode and the fast convergence of nonsingular fast terminal-sliding-mode.  It is robust to speed fluctuations, torque ripples and stator resistance uncertainties.  The fault-decision criteria and the fault-processing method are also presented. 

1.2.. Structure of This Article
-------------------------------

In Section 2, a mathematical model of rotor PM flux-linkage demagnetization for IPMSMs in the *d*-*q* synchronous reference frame is introduced.  In Section 3, an NFTSMO is designed to reconstruct the PM flux-linkage for an IPMSM, and the stability of the observer is proven.  The fault-decision criteria and fault-processing method for IPMSM by flux-weakening control are also presented.  The simulation and experimental results are shown in Section 4.  Finally, conclusions are given. 

2.. IPMSM Mathematical Model of PM Flux-Linkage in Normal and Demagnetization
=============================================================================

2.1.. IPMSM Mathematical Model
------------------------------

The stator voltage Equations for a PMSM in the *d*-*q*-axis reference frame are as follow: $$\left\{ \begin{matrix}
u_{d} & {= R_{s}i_{d} + \frac{d\psi_{d}}{dt} - \omega_{e}\psi_{q}} \\
u_{d} & {= R_{s}i_{q} + \frac{d\psi_{q}}{dt} + \omega_{e}\psi_{d}} \\
\end{matrix} \right.$$where *u~d~*, *u~q~* are the *d-q*-axis voltages, *i~d~*, *i~q~* are the *d-q*-axis stator currents, *ψ~d~*, *ψ~q~* are the stator flux-linkage, *R~s~* is stator resistance, *ω~e~* is electrical angular velocity, respectively. 

The stator flux-linkage equations for an IPMSM in the *d-q*-axis reference frame are: $$\begin{cases}
\psi_{d} & {= L_{d}i_{d} + \psi_{r}} \\
\psi_{q} & {= L_{q}i_{q}} \\
\end{cases}$$where *ψ~r~* is the rotor PM flux-linkage and *L~d~*, *L~q~* are the *d-q*-axis inductances. 

Substituting [Equation (2)](#FD2){ref-type="disp-formula"} into [Equation (1)](#FD1){ref-type="disp-formula"}, the equations for IPMSM in the *d-q*-axis reference frame can be expressed as follows: $$\begin{cases}
\frac{di_{d}}{dt} & {= \frac{u_{d}}{L_{d}} - \frac{R_{s}}{L_{d}}i_{d} + \omega_{e}\frac{L_{q}}{L_{d}}i_{q}} \\
\frac{di_{q}}{dt} & {= \frac{u_{q}}{L_{q}} - \frac{R_{s}}{L_{q}}i_{q} - \omega_{e}\frac{L_{d}}{L_{q}}i_{d} - \omega_{e}\frac{\psi_{r}}{L_{q}}} \\
\end{cases}$$

2.2.. IPMSM Mathematical Model of PM Demagnetization
----------------------------------------------------

In the PMSM operation, the PM flux magnitude and direction can vary in a very wide range due to the position feedback signal error or the impact of external effects, such as temperature rise and poor working conditions.  This influences the system control performance and may even lead to PM demagnetization.  In this case, there is a deviation angle *γ* between the directions of rotor flux and the *d*-axis of the *d-q* reference frame.  The PM flux-linkage *ψ~r~* will produce the new component *ψ~rd~* and *ψ~rq~* in the *d-q*-axes \[[@b8-sensors-14-23119]\], respectively.  It is illustrated in [Figure 1](#f1-sensors-14-23119){ref-type="fig"}. 

Then, the stator flux-linkage [Equations (2)](#FD2){ref-type="disp-formula"} for IPMSM are formed as follows: $$\begin{cases}
\psi_{d} & {= L_{d}i_{d} + \psi_{rd}} \\
\psi_{q} & {= L_{q}i_{q} + \psi_{rq}} \\
\end{cases}$$where *ψ*~*rq*~ =*ψ*~*r*~ sin *γ*,*ψ*~*rd*~ =*ψ*~*r*~ cos *γ*. 

Substituting [Equation (4)](#FD4){ref-type="disp-formula"} into [Equation (1)](#FD1){ref-type="disp-formula"} and considering that the time constant of the mechanical system is much larger than that of the electrical system in the PMSM, that is *dψ~r~*/*dt* ≈ 0, *dψ~rd~*/*dt* ≈ 0, *dψ~rq~*/*dt* ≈ 0.  The equations for IPMSM in the *d*-*q*-axis reference frame can be rearranged as follows: $$\begin{cases}
\frac{di_{d}}{dt} & {= - \frac{R_{s}}{L_{d}}i_{d} + \omega_{e}\frac{L_{q}}{L_{d}}i_{q} + \frac{u_{d}}{L_{d}} + \omega_{e}\frac{\psi_{rq}}{L_{d}}} \\
\frac{di_{q}}{dt} & {= - \frac{R_{s}}{L_{q}}i_{q} - \omega_{e}\frac{L_{d}}{L_{q}}i_{d} + \frac{u_{q}}{L_{q}} - \omega_{e}\frac{\psi_{rd}}{L_{q}}} \\
\end{cases}$$

3.. PM Demagnetization Fault Detection by NFTSMO
================================================

In order to achieve good performances, such as fast convergence and better tracking precision, to solve the problem of the NTSM converges slowly far away from the equilibrium point, a nonsingular fast terminal-sliding-mode observer (NFTSMO) is proposed to detect a PM demagnetization fault. 

3.1.. Design and Analysis Stability of the NFTSMO
-------------------------------------------------

According to [Equation (5)](#FD5){ref-type="disp-formula"}, the mathematical model of the IPMSM can be designed as follows: $$\overset{˙}{\textit{\textbf{x}}} = \textit{\textbf{Ax}} + \textit{\textbf{Bu}} + \textit{\textbf{Dd}}$$where: ***x*** = \[*i~d~ i~q~*\]*^T^* are state vectors, ***u*** = \[*u~d~ u~q~*\]*^T^* are input vectors, ***d*** = \[*ψ~rd~ ψ~rq~*\]*^T^* are the reconfigurable vectors of the PM demagnetization fault, and: $$A = \begin{bmatrix}
{- \frac{R_{s}}{L_{d}}} & {\omega_{e}\frac{L_{q}}{L_{d}}} \\
{- \omega_{e}\frac{L_{d}}{L_{q}}} & {- \frac{R_{s}}{L_{q}}} \\
\end{bmatrix},B = \begin{bmatrix}
\frac{1}{L_{d}} & 0 \\
0 & \frac{1}{L_{q}} \\
\end{bmatrix},D = \begin{bmatrix}
0 & \frac{\omega_{e}}{L_{d}} \\
{- \frac{\omega_{e}}{L_{q}}} & 0 \\
\end{bmatrix}$$

According to [Equation (6)](#FD6){ref-type="disp-formula"}, the observer can be designed as follows: $$\overset{˙}{\overset{\mathbf{\hat{}}}{\textit{\textbf{x}}}} = \textit{\textbf{A}}\widehat{\mathbf{x}} + \textit{\textbf{Bu}} + \mathbf{\upsilon}$$where: ***x̂*** = \[*i̇̂~d~ i̇̂~q~*\]*^T^*, "ˆ" denotes the estimated values, ***υ*** = \[*υ~d~ υ~q~*\]*^T^* is the control input vector of the observer. 

Then, the stator current error equation can be obtained by subtracting [Equation (6)](#FD6){ref-type="disp-formula"} from [Equation (7)](#FD7){ref-type="disp-formula"}: $$\mathbf{ė} = \textit{\textbf{Ae}} + \textit{\textbf{Dd}} - \mathbf{\upsilon}$$where: ***e*** = ***x*** − ***x̂*** \[*x*~1~ − *x̂*~2~ *x*~2~ − *x̂*~2~\]*^T^* = \[*e*~1~ *e*~2~\]*^T^* are stator current errors in the *d*-*q*-axis reference frame. 

According to the high-order sliding-mode control and the definition of system relative degree \[[@b16-sensors-14-23119]\], the relative degree of system [(8)](#FD8){ref-type="disp-formula"} is one; the system can eliminate the chattering by second-order or more than a two order sliding-mode control. 

The traditional second-order nonsingular terminal-sliding-mode (NTSM) manifold is designed as follows \[[@b14-sensors-14-23119]\]: $$\textit{\textbf{l}} = \textit{\textbf{s}} + \mathbf{\beta}\mathbf{ṡ}^{p/q}$$where: ***l*** = \[*l*~1~ *l*~2~\]*^T^*, ***s*** = \[*s*~1~ *s*~2~\]*^T^* = ***e*** = \[*e*~1~ *e*~2~\]*^T^*, ***β***= *diag*(*β*~1~, *β*~2~), *β*~1~ \> 0, *β*~2~ \> 0, 1 \< *p*/*q* \< 2, *p* \> 0, *q* \> 0, *p* and *q* are odd. 

This paper proposes the following second-order nonsingular fast terminal-sliding-mode (NFTSM) manifold inspired by \[[@b17-sensors-14-23119]\]: $$\textit{\textbf{l}} = a\textit{\textbf{s}} + \textit{\textbf{b}}\mathbf{ṡ} + \mathbf{\beta}\mathbf{ṡ}^{p/q}$$where: ***l*** ∈ ***R***^2^, ***l*** = \[*l*~1~ *l*~2~\]*^T^*, ***s*** = \[*s*~1~ *s*~2~\]*^T^* = ***e*** = \[*e*~1~ *e*~2~\]*^T^*, ***β*** = *diag*(*β*~1~, *β*~2~), *β*~1~ \> 0, *β*~2~ \> 0, *a* \> 0, *b* \> 0, 1 \< *p*/*q* \< 2, *p* \> 0, *q* \> 0, *p* and *q* are all odd. 

### Remark 1

*According to NFTSM manifold [(10)](#FD10){ref-type="disp-formula"}, it determines the convergence phase by judging the size of* ‖***s***‖. *The values of a, b are as follows*: $$\begin{cases}
{a = m_{1},b = n_{1}} & {\left\| \textit{\textbf{s}} \right\| \geq \sigma} \\
{a = m_{2},b = n_{2}} & {\left\| \textit{\textbf{s}} \right\| < \sigma} \\
\end{cases}$$when ‖***s***‖ \> *σ*, the linear sliding-mode plays a main role, and it can accelerate moving to the sliding-mode manifold; when ‖***s***‖ \< *σ*, the nonsingular sliding-mode plays a main role: it converges to zero in finite time.  Therefore, it has the advantages both of the linear sliding-mode and nonsingular terminal-sliding-mode. 

### Remark 2

*It can regulate the convergence speed of **l** by choosing a, b in the linear sliding-mode phase and regulate the convergence speed of **l** by choosing **β**, **p** and **q** in the nonsingular terminal-sliding-mode phase*. 

Then, the robust HOSM control law is designed to ensure that the system states always move towards the NFTSM manifold and the system is robust to parameter uncertainties and external disturbances.  The HOSM control law of the observer is designed according to the following theorem. 

#### Theorem 1

*The stator current error [Equation (8)](#FD8){ref-type="disp-formula"} can converge to zero in finite time, if the NFTSM manifold is chosen as [Equation (10)](#FD10){ref-type="disp-formula"} and the control law [(12)](#FD12){ref-type="disp-formula"} is designed as follows*: $$\mathbf{\upsilon} = \mathbf{\upsilon}_{eq} + \mathbf{\upsilon}_{n}$$*where*: $$\mathbf{\upsilon}_{eq} = \textit{\textbf{Ae}}$$ $$\mathbf{\upsilon}_{n} = {\int_{0}^{t}{\lbrack{\frac{a\mathbf{ṡ}}{(p/q)\mathbf{\beta}\mathbf{ṡ}^{p/q - 1} + b} + (k + \eta)\operatorname{sgn}(\textit{\textbf{l}}{) +}\mu\textit{\textbf{l}}}\rbrack}}d\tau$$where *k* \> max (***D*** ‖***ḋ***‖), *k* \> 0, *η* \> 0, *μ* \> 0 are the designed parameters. 

##### Proof

The following Lyapunov function is selected to be: $$V(t) = \frac{1}{2}\textit{\textbf{l}}^{T}\textit{\textbf{l}}$$

Differentiating *V* with respect to time, one obtains: $$\begin{array}{ll}
{\overset{˙}{V}(t)} & {= \textit{\textbf{l}}^{\mathbf{T}}\textit{\textbf{i}} = \textit{\textbf{l}}^{\mathbf{T}}(a\overset{˙}{\textit{\textbf{s}}} + \textit{b}\overset{¨}{\mathbf{s}} + (\textit{p}/\textit{q})\mathbf{\beta}{\overset{˙}{\textit{\textbf{s}}}}^{p/q - 1}\overset{¨}{\mathbf{s}})} \\
 & {= \textit{\textbf{l}}^{\mathbf{T}}\left\lbrack {(p/q)\mathbf{\beta}{\overset{˙}{\textit{\textbf{s}}}}^{p/q - 1} + b} \right\rbrack\left\lbrack {\overset{¨}{\textit{\textbf{s}}} + \frac{a\overset{˙}{\textit{\textbf{s}}}}{(p/q)\mathbf{\beta}{\overset{˙}{\textit{\textbf{s}}}}^{p/q - 1} + b}} \right\rbrack} \\
\end{array}$$

From the stator current error [Equation (8)](#FD8){ref-type="disp-formula"} and the [Equations (12)](#FD12){ref-type="disp-formula"}--[(13)](#FD13){ref-type="disp-formula"}, we get: $$\mathbf{ė} = \textit{\textbf{Ae}} + \textit{\textbf{Dd}} - \mathbf{\upsilon} = \textit{\textbf{Dd}} - \mathbf{\upsilon}_{n}$$

From [Equation (17)](#FD17){ref-type="disp-formula"}, [Equation (16)](#FD16){ref-type="disp-formula"} can be rearranged as follows: $$\overset{˙}{V}(t) = \textit{\textbf{l}}^{\mathbf{T}}\lbrack(\textit{p}/\textit{q})\mathbf{\beta}\mathbf{ṡ}^{p/q - 1} + \textit{b})\rbrack\lbrack\textit{\textbf{D}}\overset{\mathbf{˙}}{\mathbf{d}} - (k + \eta)\operatorname{sgn}(\textit{\textbf{l}}) - \mu\textit{\textbf{l}}\rbrack$$

Since the parameter *k* satisfies *k* \> max (***D***‖***ḋ***‖), then *V̇*(*t*) can be expressed as: $$\begin{array}{ll}
{\overset{˙}{V}(t)} & {\leq - \textit{\textbf{l}}^{\mathbf{T}}\left\lbrack {(p/q)\mathbf{\beta}\mathbf{ṡ}^{p/q - 1} + b} \right\rbrack\lbrack\eta\operatorname{sgn}(\textit{\textbf{l}}{) +}\mu\textit{\textbf{l}}\rbrack} \\
 & {= - \left\lbrack {(p/q)\begin{array}{l}
\min \\
{i = 1,2} \\
\end{array}(\beta_{i}\mathit{ṡ}_{i}^{p/q - 1}) + b} \right\rbrack\ \left\lbrack {\left.  \eta \right\|\left.  \textit{\textbf{l}} \right\| + \mu\left\| \textit{\textbf{l}} \right\|^{2}} \right\rbrack} \\
\end{array}$$

Taking *p* and *q* as all odd and 1 \< *p*/*q* \< 2, e.g., *q* = 2*m* + 1, *p* = 2*m* + 3, *m* ∈ *N*, this gives: $$\mathit{ṡ}_{i}^{p/q - 1} = \mathit{ṡ}_{i}^{(p - q)/q} = \left( \mathit{ṡ}_{i}^{2} \right)^{(p - q)/(2q)} = \left( \mathit{ṡ}_{i}^{2} \right)^{1/(2m + 1)} \geq 0$$

We get: $$(p/q)\begin{matrix}
\min \\
{i = 1,2} \\
\end{matrix}(\beta_{i}\mathit{ṡ}_{i}^{p/q - 1}) + b > 0$$

Substituting [Equation (21)](#FD21){ref-type="disp-formula"} into [Equation (19)](#FD19){ref-type="disp-formula"}, one of the following two conditions exists: ***V̇*** \< 0, for ‖***l***‖ ≠ 0.  The condition for Lyapunov stability is satisfied.  The system states can reach the sliding mode ***l*** = 0 within finite time.***V̇*** = 0, for ‖***l***‖ = 0.  This shows that the system states have reached the sliding-mode manifold ***l*** = 0. 

Therefore, the system states can reach the NFTSM manifold ***l*** within finite time.  After ***l*** reaches zero in finite time, both ***s*** and ***ṡ*** will also reach zero in finite time; the system will stay on the second-order sliding mode ***s*** = ***ṡ*** = 0 \[[@b14-sensors-14-23119],[@b15-sensors-14-23119]\].  Then, the stator current error [Equation (8)](#FD8){ref-type="disp-formula"} will converge to zero in finite time.  This completes the proof. 

### Remark 3

*Considering the assumption of the demagnetization model [(5)](#FD5){ref-type="disp-formula"}, that is:* ***ḋ*** = \[*ψ̇~rd~ ψ̇~rq~*\] ≈ 0, so ***D*** ‖***ḋ***‖ ≈ 0. * We can find that positive constants ksatisfy k* \> 0, *such that the state estimation errors converge to zero infinite time*. 

### Remark 4

*Because of using the second-order sliding-mode technique, it can be seen from [Equations (12)](#FD12){ref-type="disp-formula"}-[(14)](#FD14){ref-type="disp-formula"} that the control* ***υ*** *is continuous and smooth, which can be used to estimate the PM demagnetization fault directly*. 

3.2.. Reconfiguration of PM Demagnetization Fault
-------------------------------------------------

When the stator current error [Equation (8)](#FD8){ref-type="disp-formula"} stays on the second-order sliding-mode manifold, it satisfies ***e***= ***ė*** = 0, according to the sliding-mode equivalent control method \[[@b18-sensors-14-23119]\].  Substituting this into [Equation (8)](#FD8){ref-type="disp-formula"}, the following equivalent PM flux-linkage can be obtained: $$\textit{\textbf{Dd}} = \mathbf{\upsilon}$$

That is, $$\begin{cases}
{\hat{\psi}}_{rd} & {= - \frac{1}{\omega_{e}}L_{q}\upsilon_{q}} \\
{\hat{\psi}}_{rq} & {= \frac{1}{\omega_{e}}L_{d}\upsilon_{d}} \\
\end{cases}$$

Therefore, the amplitude of rotor PM flux-linkage *ψ̂~r~* can then be estimated: $${\hat{\psi}}_{r} = \sqrt{{\hat{\psi}}_{rd}^{2} + {\hat{\psi}}_{rq}^{2}}$$

The principle diagram of the proposed NFTSMO for the reconfiguration of the PM demagnetization fault is described in [Figure 2](#f2-sensors-14-23119){ref-type="fig"}. 

3.3.. PM Demagnetization Fault Detection and Fault Processing
-------------------------------------------------------------

To estimate the severity of the PM demagnetization fault, it is necessary to define a severity factor (diagnosis index) λ.  The severity factor λ is defined by: $$\lambda = \frac{\psi_{r} - {\hat{\psi}}_{r}}{\psi_{r}}$$where *ψ̂~r~* is the estimated value of PM flux-linkage *ψ~r~* in a control period using [Equation (24)](#FD24){ref-type="disp-formula"}.  The low diagnosis index λ means that the estimation error is small, and the PMSM is in the normal condition.  If the severity factor λ is greater than the threshold value Δλ, then the PMSM is under a demagnetization fault. 

[Figure 3](#f3-sensors-14-23119){ref-type="fig"} shows the flowchart of the proposed fault diagnosis and fault treatment.  For the first step, the PM flux-linkage *ψ̂~r~* is calculated using [Equation (24)](#FD24){ref-type="disp-formula"}.  In the second step, the severity factor λ is calculated using [Equation (25)](#FD25){ref-type="disp-formula"}.  The third step is the demagnetization fault decision using the diagnosis index λ.  The final step is fault processing.  If severity factor λ is greater than the upper bound of threshold value Δλ, then the current limiter is activated. 

In order to avoid the drop of the operating point below the kneepoint and at the same time using the flux-weakening control, it is necessary to properly limit the $i_{d}^{*}$. The current limiter is designed to prevent the dropping of the operating point below the knee point and achieving the minimum torque ripple. [ Figure 4](#f4-sensors-14-23119){ref-type="fig"} is the schematic diagram of the proposed current limiter \[[@b19-sensors-14-23119]\].  In [Figure 4](#f4-sensors-14-23119){ref-type="fig"}, *I~smax~* is the maximum phase current, and *I~dmax~* is the maximum allowed current of the *d*-axis.  The compensation current *i~dr~* is a positive direct current, and it is obtained by inputting the weakening current *i~d~*~0~, with a compensation function given by: $$\left.  \textit{i}_{dr} = \rho\lambda \middle| \textit{i}_{d0} \middle| = K_{p}(\psi_{r} - {\hat{\psi}}_{r}) \middle| i_{d0} \right|$$where *ρ* is the compensation coefficient, *K~p~* = *ρ*/*ψ~r~*.  The *i~dr~* is the input of a current limiter that is bound to the references $i_{d}^{*}$ and $i_{q}^{*}$. The appropriate coefficient *K~p~* can reduce the *d*-axis current *i~d~* and increase the *q*-axis current *i~q~*; thus, it can reduce the PM demagnetization risk and reduce the torque ripple significantly. 

4.. Simulations and Experiments
===============================

The proposed PM demagnetization fault-detection scheme has been simulated using MATLAB/Simulink and implemented on the RT-LABplatform.  A schematic diagram of the online PM demagnetization fault-detection system for IPMSM is shown in [Figure 5](#f5-sensors-14-23119){ref-type="fig"}.  The flux-weakening control strategy is carried out on the IPMSM \[[@b20-sensors-14-23119]\].  The IPMSM parameters are listed in [Table 1](#t1-sensors-14-23119){ref-type="table"}.  This section evaluates the dynamic performance of the proposed NFTSMO, which is compared with the sliding-mode observer (SMO) and the nonsingular terminal-sliding-mode observer (NTSMO). 

4.1.. Simulations
-----------------

The proposed NFTSMO is designed according to Theorem 1.  The observer parameters are chosen as follows: *p* = 7, *q* = 5, *β*~1~ = *β*~2~ = 0.1, *k* + *η* = 3000, *μ* = 2000.  The initial values of *i̇̂~d~*, *i̇̂~q~* are set to 1.5 A, 1.5 A. The parameters *a*, *b* and *σ* of NFTSM manifold are chosen as: $$\left\{ \begin{array}{lll}
{a = 60,} & {b = 1} & {\left\| \textit{\textbf{s}} \right\| \geq 0.1} \\
{a = 1,} & {b = 0.0001} & {\left\| \textit{\textbf{s}} \right\| < 0.1} \\
\end{array} \right.$$

To observe the dynamic performance of the proposed scheme, the initial rotor speed is set to 500 rpm and subsequently increases to 1000 rpm at 1 s; the initial value of the load torque is set to 0 Nm and subsequently increases to 2 Nm at 2 s; and the initial value of the stator resistance is set to 2.875 Ω and subsequently increases to 5.75 Ω at 3 s.

Because the actual dynamic process of PM demagnetization in an IPMSM is very difficult to simulate, the approach of setting initial values of the PM flux-linkage amplitude and the rotor deviation angle \[[@b8-sensors-14-23119]\] are utilized.  These can be used to verify the validity of the observer. 

The initial value of the PM flux-linkage amplitude is set to 0.175 Wb and subsequently decreases to 0.10 Wb at 4 s. The initial value of the deviation angle γ is set to 0° and subsequently increases to 30° at 5 s. The upper bound Δλ of the severity factor λ is set to 0.25. 

The reference, actual rotor speed, the reference, actual torque and the actual *d*-*q*-axis stator currents are shown in [Figure 6](#f6-sensors-14-23119){ref-type="fig"}. * n*\* is the reference speed, *n* is the actual speed, *T~m~* is the reference load torque and *T~e~* is the actual IPMSM output torque. 

[Figures 7](#f7-sensors-14-23119){ref-type="fig"}, [8](#f8-sensors-14-23119){ref-type="fig"} and [9](#f9-sensors-14-23119){ref-type="fig"} demonstrate the simulation results of demagnetization fault detection by the SMO, NTSMO, and NFTSMO.  They indicate the estimated *d*-*q*-axis PM flux-linkage, PM flux amplitude and *d*-*q*-axis stator currents. 

The following conclusions can be drawn from these simulation results: [Figure 7](#f7-sensors-14-23119){ref-type="fig"} demonstrates that the SMO has the chattering phenomenon when moving to the sliding-mode manifold. [ Figure 8](#f8-sensors-14-23119){ref-type="fig"} demonstrates that the NTSMO converges slowly far away from the equilibrium point.  It can be seen from [Figure 9](#f9-sensors-14-23119){ref-type="fig"} that the NFTSMO converges quickly, which has the advantages of both SMO and NTSMO.When the PM flux-linkage amplitude is decreased to 0.10 Wb at 4 s, the severity factor is λ = (*ψ~r~* ‒ *ψ̂~r~*)/*ψ~r~* = (0.175 − 0.10)/0.175 = 0.4286.  This is greater than the upper bound Δλ, and therefore, the current limiter is activated.  The absolute value of *d*-axis current *i~d~* (*i~d~* \< 0 by flux-weakening control) is decreased, that is the *d*-axis current *i~d~* increases, while the *q*-axis current *i~q~* increases; and then, this can reduce PM demagnetization risk and torque ripple significantly. When the deviation angle γ is increases to 30 ° at 5 s, the estimated *d*-axis flux *ψ̂~rd~* is 0.0865 Wb; the estimated *q*-axis flux *ψ̂~rq~* is 0.0500 Wb; and the estimated flux amplitude *ψ̂~r~* is 0.0999 Wb; whereas, the actual *d*-axis flux is *ψ~rd~* = 0.10 × *cos*30° = 0.0866 Wb, and the actual *q*-axis flux is *ψ~rq~* = 0.10 × *sin*30° = 0.0500 Wb.  It can be seen from simulation results that the estimated PM flux-linkages are very close to the actual values. 

4.2.. Experimental Results
--------------------------

RT-LAB is a powerful, modular, distributed, real-time platform from OPAL-RT Technologies, Inc. It supports model-based design using rapid control prototyping (RCP) and hardware-in-the-loop simulation (HILS) of complex dynamic systems.  HILS differs from pure real-time simulation and RCP by the use of the real controller in the loop; this controller is connected to the rest of the system simulated by RT-LAB.  Therefore, in HILS, the plant is simulated, but the controller is real \[[@b21-sensors-14-23119]\]. 

To implement the proposed approach, experiments have been carried out on an OP5600 RT-Lab platform using HILS.  The RT-Labplatform is shown in [Figure 10](#f10-sensors-14-23119){ref-type="fig"}, and the configuration is shown in [Figure 11](#f11-sensors-14-23119){ref-type="fig"}. 

The controller is a TMS320F2812 digital signal processor, which implements high-performance control and computation.  The IGBT inverter model uses blocks from the RT-Events toolbox to achieve precise modeling of the switching signals, which are done through the interpolation scheme embedded in RT-Events.  The PWM (Pulse Width Modulation) switching frequency is chosen as 5 kHz.  The sampling period is chosen as 50 *μ*s, which are the same as the SMO, NTSMO, NFTSMO and IPMSM. 

[Figure 12](#f12-sensors-14-23119){ref-type="fig"} shows the reference rotor speed (*n\**), the actual rotor speed (*n*), the reference torque (*T~m~*) and the actual torque (*T~e~*).  As shown in [Figure 12](#f12-sensors-14-23119){ref-type="fig"}, the actual speed (*n*) can track the reference speed (*n\**) precisely in the steady state, whereas the actual torque (*T~e~*) fluctuates when the speed increases from 500 rpm to 1000 rpm, but it converges to the reference torque (*T~m~*) quickly. 

The experimental results of the demagnetization fault-detection using SMO, NTSMO and NFTSMO are shown in [Figures 13](#f13-sensors-14-23119){ref-type="fig"}, [14](#f14-sensors-14-23119){ref-type="fig"}, [15](#f15-sensors-14-23119){ref-type="fig"} and [16](#f16-sensors-14-23119){ref-type="fig"}.  These figures indicate the estimated values of the *d-q*-axis PM flux-linkages and *d-q*-axis stator currents. 

The following conclusions can be drawn from these experimental results: When the PM flux-linkage amplitude is decreased to 0.10 Wb, the severity factor λ becomes greater than the upper bound Δλ, and therefore, the current limiter is activated.  The *d*-axis current *i~d~* is increased, which can reduce PM demagnetization risk.  The *q*-axis current *i~q~* is also increased, which can reduce torque ripple significantly. When the deviation angle γ of PM flux-linkage is increased to 30 °, the estimated value of *d*-axis flux *ψ̂~rd~* is decreased to 0.0864 Wb, whereas that of *q*-axis flux *ψ̂~rq~* is increased to 0.0500 Wb, and the estimated PM flux-linkage amplitude *ψ̂~r~* is 0.0998 Wb.  The estimated PM flux-linkages are very close to the actual value.[Figure 14](#f14-sensors-14-23119){ref-type="fig"} is a larger version of [Figure 13](#f13-sensors-14-23119){ref-type="fig"}, which demonstrates that the SMO has the chattering phenomenon. [ Figure 15](#f15-sensors-14-23119){ref-type="fig"} demonstrates that the NTSMO converges slowly far away from the equilibrium point. [ Figure 16](#f16-sensors-14-23119){ref-type="fig"} demonstrates that the proposed NTSMO has good tracking performance and strong robustness against parameter fluctuations. 

Simulation and experimental results have demonstrated that the proposed nonsingular fast terminal-sliding-mode observer converges quickly and has low sensitivity to parameter variations. 

5.. Conclusions
===============

An IPMSM mathematical model of demagnetization has been introduced.  A robust nonsingular fast terminal-sliding-mode observer (NFTSMO) has been constructed to simulate permanent magnet (PM) demagnetization faults for IPMSMs.  The fault decision criteria and the fault-processing method have been presented.  The overall scheme has been simulated using MATLAB/Simulink and implemented on the RT-LAB platform.  A number of robustness tests have been carried out.  The results verify the efficiency and stability of the proposed scheme.  This method can accurately estimate PM flux-linkage. 

The scheme shows good performance in spite of speed fluctuations, torque ripples and the uncertainties of stator resistance.  The online fault detection scheme of PM demagnetization for IPMSMs by flux-weakening control can prevent the deterioration of demagnetization and reduce the extent of irreversible demagnetization. 

The authors are grateful for the support provided by the Natural Science Foundation of China (Nos.  61273157, 61273158, 61104024 and 61473117), the Hunan Provincial Natural Science Foundation of China (Nos.  13JJ8020 and 14JJ5024). 

Kai-Hui Zhao, Te-Fang Chen and Chang-Fan Zhang designed the overall algorithms and the simulations.  Jing He, Te-Fang Chen and Gang Huang designed the experiments and performed the simulations and experiments.  Kai-Hui Zhao and Chang-Fan Zhang wrote the manuscript. 

The authors declare no conflict of interest

![ Variation of interior permanent magnet synchronous motor (IPMSMs) PM flux-linkage.](sensors-14-23119f1){#f1-sensors-14-23119}

![ Principle diagram of the nonsingular fast terminal-sliding-mode observer (NFTSMO) for the reconfiguration of the PM flux-linkage.](sensors-14-23119f2){#f2-sensors-14-23119}

![ Flowchart of demagnetization fault diagnosis and fault treatment.](sensors-14-23119f3){#f3-sensors-14-23119}

![ Control block diagram of the current limiter.](sensors-14-23119f4){#f4-sensors-14-23119}

![ Schematic diagram of online PM demagnetization fault-detection system for IPMSM.](sensors-14-23119f5){#f5-sensors-14-23119}

![ Simulation results: the reference, actual speed and torque; the actual *d*-*q*-axis currents.](sensors-14-23119f6){#f6-sensors-14-23119}

![ Simulation results: demagnetization fault detection by sliding-mode observer (SMO).](sensors-14-23119f7){#f7-sensors-14-23119}

![ Simulation results: demagnetization fault detection by nonsingular terminal-sliding-mode observer (NTSMO).](sensors-14-23119f8){#f8-sensors-14-23119}

![ Simulation results: demagnetization fault detection by NFTSMO.](sensors-14-23119f9){#f9-sensors-14-23119}

![ RT-Labplatform.](sensors-14-23119f10){#f10-sensors-14-23119}

![ Configuration of the RT-Lab hardware-in-the-loop simulation (HILS) system.](sensors-14-23119f11){#f11-sensors-14-23119}

![ Experimental results: the reference, actual rotor speed and torque.](sensors-14-23119f12){#f12-sensors-14-23119}

![ Experimental results: demagnetization fault detection by SMO.](sensors-14-23119f13){#f13-sensors-14-23119}

![ Enlargement of [Figure 13](#f13-sensors-14-23119){ref-type="fig"}.](sensors-14-23119f14){#f14-sensors-14-23119}

![ Experimental results: demagnetization fault detection by NTSMO.](sensors-14-23119f15){#f15-sensors-14-23119}

![ Experimental results: demagnetization fault detection by NFTSMO.](sensors-14-23119f16){#f16-sensors-14-23119}

###### 

Parameters of IPMSM. 

  **Parameters**                  **Unit**      **Values**
  ------------------------------- ------------- ------------
  Rated power (*P~N~*)            *KW*          2
  Rated voltage (*U~N~*)          *V*           380
  Rated current (*I~N~*)          *A*           4
  Rated speed (*n~N~*)            *r/min*       1000
  Stator resistance (*R~s~*)      Ω             2.875
  *q*-axis inductance (*L~q~*)    *H*           0.0075
  *d*-axis inductance (*L~d~*)    *H*           0.0025
  Rotational Inertia (*J*)        *kg · m*^2^   0.0008
  Rotor PM flux (*ψ~r~*)          *Wb*          0.175
  Number of pole pairs (*n~p~*)   pairs         4

[^1]: External Editor: Vittorio M.N. Passaro
