Model-Based Detection and Estimation of DC Offset of Phase Current Sensors for Field Oriented PMSM Drives

Failure of a phase current sensor in permanent magnet synchronous machine (PMSM) drive can highly impact the performance of the drive. Especially, offset faults can cause torque oscillations, which can lead to an unacceptable deterioration of the drive's performance and mechanical damages. The diagnosis of this fault condition is of fundamental importance in many applications and it is often solved by means of highly computational state estimation techniques. This article presents a new model-based approach to systematically and accurately detect and estimate phase current sensor offsets in PMSM drives. The steady-state analytical solution of the PMSM drive model, including the control loop of the field oriented control and the sensor offset disturbance, has been found, allowing for estimating the effect of the fault on the electric drive performance. Then, a simple and effective diagnostic algorithm has been developed to detect, isolate, and accurately estimate the location and the magnitude of the fault eliminating any need for state estimation or observers. Numerical and experimental results have been reported to validate the proposed model and diagnostic algorithm even in case of motor parameters variation.

rotor cooling requirements, and wide field-weakening capability [1]- [4]. As every electric drive system, PMSM drives are prone to faults due to manufacturing defects, environmental conditions, poor thermal management, electromagnetic interference (EMI), and control issues. Many faults have been studied and analyzed for PMSM drives including electrical (winding or switch short-and open-circuit), mechanical (eccentricity, bearing fault), magnetic (demagnetization of the permanent magnets), and sensing (current, voltage, position) faults [1], [5]- [7].
The detection, isolation, and estimation of phase current sensor faults in PMSM drives is of great importance since a faulty sensor can usually cause an unacceptable deterioration of the drive performance. The failure of a phase current sensor can be caused by aging, overload, EMI, vibrations, shock, temperature, and humidity [8], [9]. A faulty current sensor will deviate from the true value by an offset and/or a gain, as well as complete loss of the signal is possible. A PMSM rotating at a speed ω r will be affected by torque oscillations at the pω r or 2pω r , with p pole pairs number, in case of dc offset or gain fault of the phase-current sensor, respectively [6], [10]. This can cause failures or degradation of the mechanical components, such as bearings, shafts, and transmissions, and reduction of the motor efficiency. Due to the lack of redundancy in current measurement, it is usually difficult to detect and isolate the faulty sensor. Academia and industry have been developing fault detection and isolation (FDI) methodologies for the online detection of the current sensor faults of PMSM drives using model-based, signal-based, and data-driven approaches [10]- [19].
Model-based methodologies for sensor FDI are widely used in industrial applications and have shown effectiveness and great applicability. Residuals are generated by the error calculation between the measured and the estimated signal and are then fed into a decision-making algorithm for the assessment of the fault condition. However, many of the model-based techniques available in the literature rely on observers and/or observation of the fault signature without attempting to mathematically model the fault itself. While observers represent a very robust methodology for fault diagnosis, they are often limited in the capability of isolating the specific fault (e.g., the phase affected by sensor fault) since the mathematical model of the faults is missing. A higher order sliding-mode control based on the Luenberger observers is implemented in [13], to generate several This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see http://creativecommons.org/licenses/by/4.0/ residuals and provide the detection of all sensor faults (voltages, speed, and currents). In [17], a robust sliding-mode observer is developed to detect permanent and intermittent current faults including system disturbances. In [16], the method of structural analysis is used to systematically generate the residuals for different faults of an electric drive, and then used for electric vehicle onboard diagnostic.
In a similar manner, signal-based or data-driven methodologies are phenomenological methodologies, which develop FDI strategies from some knowledge of the fault outcome, and are limited by the capability of distinguishing a specific fault signature from other faults and degradation mechanisms. In [15], the normalized average of the measured currents is used as fault indicator for the detection of the current sensor fault in PMSM drive. However, this method is unable to isolate the faulty phase or estimate the amplitude of the fault. In [12], a diagnostic algorithm is developed for current sensor fault and switches' open-circuit fault using two empirical fault indicators: the average normalized value of the product of two phase currents and the polarity of the normalized average current. A Bayesian network data-driven fault diagnostic method for FDI of three-phase inverters, including sensor faults, has been proposed in [18], with the aim of decoupling noise and uncertainty from the fault signature in the collected data by using the FFT of line-to-line voltage output of the inverter. An online method is proposed in [19] based on the FFT analysis of the phase current of a pulsewidth modulation inverter. The frequency-domain analysis is able to correlate signal features with the fault condition.
The control loop response to the fault disturbance will impact the capability of observers and signal-based methods in detecting and isolating the fault, since the impact of the fault on the measured size is mitigated by the control loop itself. Of course, faults like current sensor offsets can be detected and compensated by reading the A/D converter output when no current is flowing in the stator terminals and the motor is at rest. However, when the motor is running the dc offset of the measured phase currents is not directly correlated to the actual fault condition, due to the response of the control loop. Isolation and estimation algorithms are required to properly define the faulty phase current sensor/s and the related fault amplitude. In [20], the integrator output signal of the d-axis PI current controller is used to estimate the phase current offset fault. After some initial signal manipulation, empirical correlations are found between the integrator output and the offset of two phases. The solution proposed in [21] is designed for current-controlled PMSM drives, which use two current sensors, and estimates the offset and gain error of the phase current measurement by observing the voltage error output of the PI current controllers. Thus, the effect of the control loop gains is ignored. In [22], a new signal-based method is proposed using only the information of three-phase currents and the rotor position. The algorithm calculates several metrics and is capable of detecting a complete loss of signal from the phase current sensor. However, an iterative approach is proposed to estimate the offset of the phase currents.
In this article, the authors effort is in defining a model-based diagnostic algorithm for dc offset fault of the phase current sensors in surface-mounted PMSM (SPMSM) electric drive with FOC. The proposed method is based on the steady-state analytical solution of the SPMSM dq model, including the effect of the control loop. This allows not only to detect and isolate the dc offset fault of the phase currents, but also to estimate the fault magnitude starting from the measured phase currents and motor mechanical speed. More properly, the proposed algorithm can be defined as an algorithm for fault detection, isolation and estimation (FDIE) of the offset current sensors in SPMSM drive with FOC. The proposed methodology does not include any complex observer algorithm and can be implemented in state of the art DSP. This algorithm has shown low error in estimating the faulty condition and low impact of the model parameters' variation thanks to the inclusion of the control loop in the modeling approach. The proposed diagnostic algorithm can be applied to the case of two or three current sensors. To the best knowledge of the authors, there are no comprehensive and systematic modeling approaches for SPMSM investigating the detection, isolation, and estimation of the phase current sensor offset fault taking into account the effect of the control loops.
The rest of this article is organized as follows. Section II describes the proposed modeling approach of the SPMSM drive when current offset faults occur; Section III reports the FDIE algorithm proposed in this work; Section IV includes the numerical validation of the proposed model, sensitivity analysis to the model parameters' variation, and shows experimental results of diagnostic algorithm. Finally, Section V concludes this article.

II. MODEL OF CURRENT SENSOR OFFSET FOR SPMSM DRIVE
The considered drive is composed by an ac SPMSM, fed by a three-phase two-level voltage source inverter (VSI). A FOC and space vector modulation (SVM) are used to implement the control algorithm (see Fig. 1), including three phase current sensors and a rotor position sensor. The mathematical model of the PMSM can be expressed by the following set of equations using the dq axes reference frame [23], [24] ⎧ where v and i are the motor voltage and current, R and L are the motor resistance and inductance, p is the pole pair number, ω r is the motor speed, and φ denotes the magnet flux. The electromagnetic torque T is The FOC is composed of two PI controllers which generate the dq axes voltage references, v * d and v * q , starting from the errors between the reference currents i * d , i * q , and the measured currents i md , i mq . A decoupling module is required to take into account of the cross-coupling terms in (1), defined as Thus, the reference space vector of the supply voltage in the stator reference frame v * * is given by where θ is the rotor mechanical angle, and j is the unit imaginary number. Then, v * * is provided as input to the SVM algorithm for the definition of the inverter switching pattern. When a fault of the phase current sensors occurs, one or more of the measured currents i m1 , i m2 , i m3 are different from the actual ones i 1 , i 2 , i 3 . In case of offset fault, the space vector of the measured stator current i m can be expressed as where i is the space vector of the actual stator current and ε represents the space vector of the current offsets, with where Δi 1 , Δi 2 , and Δi 3 are the offset errors on the stator phase currents i 1 , i 2 and i 3 , respectively, as shown in Fig. 1, and where: Therefore, it is possible to write the following equations: Equation (8) shows that the offsets of the phase current sensors give rise to oscillations on the dq axes current components, corresponding to torque oscillations as well, according to (2). The oscillations have an instantaneous angular frequency given by the temporal derivative of pθ(t), that is pω r (t), where ω r is the rotor speed. Combining (6) and (8) yields From the control scheme of Fig. 1 and (3), it is possible to determine the dq components of the motor supply voltage by means of the following set of equations: where k P d , k Id , k P q , and k Iq represent the proportional and integral gains of the dq axes PI controllers, respectively. If constant speed is assumed, that is taking into account that v * * d and v * * q must also satisfy (1), substituting (9) into (10), and making the derivative, the following equations can be achieved: Assuming that the inverter modulation is ideal, the solution of (12) allows for analytically determining the current i d and i q for any offset present in the measurement of the stator currents, i 1 , i 2 , and i 3 , taking into account all the parameters of the control loop. Note that even if the decoupling block has been applied to the reference voltages according to (3), the two equations (12) representing the dynamic of i d and i q are still decoupled. The method of undetermined coefficients, [25], [26], can be used to find the analytical solution of the differential equations (12). Since in (12), the forcing functions are equal to a linear combination of terms proportional to sin(pω r t − ϕ) and cos(pω r t − ϕ), then the steady-state solution will be and where The proposed modeling approach demonstrates that at steadystate i d and i q are equal to the corresponding reference values i * d and i * q plus a sine-wave term having amplitude C d and C q , respectively, and angular frequency pω r , due to the offset fault of the current sensor. Combining (14) and (15), it is immediate to obtain that the amplitudes C d and C q of the sine-wave terms are as follows: 1) directly proportional to the amplitude A of the offset space vector ε; 2) depending on the motor parameters, the controller gains, and the rotor speed; 3) not depending on the current references i * d and i * q . The space vector of the actual stator currents can be obtained as following: which gives Combining (13), (14), and (17) yields Therefore, the actual stator currents are given by with .
(21) Ultimately, at steady state, due to the offsets of the current sensors, the actual stator currents, in addition to the traditional term having angular frequency pω r , have a component having angular frequency 2pω r and amplitude W , and dc components H 1 , H 2 , H 3 , whose amplitudes obviously depend on the amplitudes of the offsets, which affect the current sensors. However, as matter of fact these dc components are not equal to the sensor offset values due to the response of the FOC loop. The detection of these additional components of the stator currents can be used for the estimation of the current sensor offsets, as shown in the following section.

III. DIAGNOSTIC ALGORITHM
The model proposed in Section II is utilized to develop a diagnostic algorithm with the aim of detecting, isolating and estimating the dc offset fault of phase current sensors in an SPMSM. The goal is to find which motor phase sensors are affected by offset fault and accurately and systematically estimate the magnitude of each offset fault. The block diagram in Fig. 2 shows the proposed FDIE algorithm. It detects the presence of a dc offset fault by performing an FFT analysis on the measured q-axis current (i mq ). If the harmonic at pω r is present, a dc offset fault is detected, as described in Section II. Then, two faults indicators are defined as follows: 1) A, which represents the amplitude of the current offset space vector ε; 2) ϕ, which represents the argument of the current offset space vector ε. When no fault is present, these two indicators are null. In case of offset fault they can be calculated by combining (9) and (13) as following: The faults indicators A and ϕ are calculated starting from the reference currents i * d , i * q , the measured currents i m1 , i m2 , i m3 , the motor speed ω r , the electric drive parameters, and the FOC controller parameters. Then, the phase current offsets Δi 1 , Δi 2 , Δi 3 can be estimated taking into account (6) and the homopolar component i m0 It yields ⎧ ⎪ ⎨ ⎪ ⎩ Eventually, in order to filter the current ripples due to the modulation of the inverter, the average values Δi mean 1 , Δi mean 2 , Δi mean 3 , over the oscillation period of 2π/(pω r ) are evaluated to determine the dc components of Δi 1 , Δi 2 , Δi 3 , which represent the real offset of the phase current sensors. The proposed algorithm is able to isolate the fault by providing information of the specific sensor/s affected by dc offset. This function is achieved by verifying which of the Δi mean is not zero. Then, the estimation action is achieved as well and can be used to estimate the torque ripple by means of (2). The electric drive control will consider to compensate the fault or turn OFF the electric drive in case of hazard condition. Note that the proposed methodology is designed to work with nonzero rotor speed.
The proposed algorithm works even if the drive is equipped with two phase current sensors. In this case, since the third current is calculated as the opposite of the sum of the two measured currents (i m3 = −i m1 − i m2 ), it is sufficient to set i m0 = 0 in (25) to estimate the phase current offsets. In this way, it is Δi 3 = −Δi 1 − Δi 2 , that is i m3 can be regarded as affected by opposite of the sum of the errors of the other two phases, even if there is no current sensor on phase 3. The proposed FDIE algorithm is able to detect, isolate and estimate the phase current offset faults by solving simple and effective algebraic equations. However, it is important to point out that the proposed algorithm is meant to be used when the speed and torque are nonzero. As matter of fact, when no load is present and the electric machine is not spinning, the phase current offset can be detected by measuring the actual output of the sensors. In this case Δi 1 , Δi 2 , Δi 3 can be directly determined. This algorithm has been developed for FDIE functions, but it can be utilized for compensating the effects due to the fault conditions or for self-commissioning algorithms. It can be online implemented, but it can be used offline as well. In general, the required computing power is minimal. However, if computation time needs to be further minimized, the proposed algorithm can be converted in a look-up-table format as well, which tabulates A and ϕ values as function of i * d , i * q , ω r , and of the motor parameters.

IV. PERFORMANCE EVALUATION AND DISCUSSION
This section reports the numerical validation of the proposed model and the experimental results demonstrating the effectiveness of the proposed FDIE algorithm. The same SPMSM drive parameters have been used both for the numerical and for the experimental analyzes.

A. Set-Up Description
The analyzes reported in this section is based on a 1.23 kW three-phase SPMSM by Control Techniques UNIMOTOR (Model: 95UMB300CACAA). The motor is  driven by a two-level three-phase VSI converter based on Mitsubishi PM100DSA120 IPMs. The load is composed of a MAGTROL Hysteresis Dynamometer (Model: HD-715-8NA) and a flywheel to emulate the load inertia of the electric drive load. The SPMSM closed-loop torque control is based on an FOC implemented by means of DS1006 processor board of a dSPACE modular system. Altera CPLD EPM7160SLC8410 is used to implement a symmetrical SVM. The modulation unit generates the synchronization signal, with a period of 100 μs, which is used to run the dSPACE processor interrupt control task. Within each modulation period, T s , the control unit works out the inverter modulation pattern (S j with j=1,. . .,6) to be imposed in the next T s by the DS4003 digital I/O board, with 4 μs of dead time. The motor speed is acquired using an incremental encoder (4096 ppr, corresponding to a 1.92 rad/s speed measurement quantization error) and DS3002 encoder board of dSPACE. The three-phase currents are acquired using the LEM Current Transducer LA 25-NP with a measurement resistor equal to 301 Ω and a DS2004 A/D Board. DC-link voltage is also acquired by LEM Voltage Transducer CV3-1500 and DS2004 A/D Board. A picture of the experimental set-up is shown in Fig. 3, while the structure of the control set-up is reported in Fig. 4, including the proposed diagnostic strategy. For the purposes of the following analyzes, the phase current offset fault is emulated by adding the offsets after the measurement chain in the DS1006 control code, as shown in Fig. 4. This allowed for easy estimating the performance of the proposed model and FDIE algorithm for different operating conditions.
The system parameters are given in Table I. The load torque imposed by the Magtrol Brake is T L and it is calculated as where ω * r is the desired mechanical speed.

B. Numerical Model Validation and Sensitivity Analysis
The following simulation analysis has the scope of verifying the performance of the mathematical model presented in Section II. The numerical model is implemented in MATLAB Simulink and includes the dq axes model of the SPMSM, the FOC control loop, the two-level VSI, the phase currents measurement with offset fault, and the load. The following two models of the VSI have been implemented: 1) ideal modulation of the voltage reference generated by the FOC; 2) real SVM, a realistic model of the SVM inverter considering symmetric modulation, time delay due to the acquisition, and quantization error due to the 8-bit discretization of the modulation unit. The following analyzes have been performed: 1) model performance assessment using VSI with ideal modulation; 2) model parameter sensitivity analysis using VSI with ideal modulation; 3) model performance assessment using VSI with SVM. The following settings have been considered for the following Sections:

1) Model Performance Assessment Using VSI With Ideal
Modulation: Fig. 5 shows the performance of the model proposed in Section II when the phase current offsets have been injected. The simulation has been carried out by using a maximum step size equal to 100 μs. Equation (13) is used to estimate motor phase currents in the dq reference frame i e d , i e q , and compared with the actual dq currents in the SPMSM i d , i q . The proposed model accurately and systematically estimates the motor currents with a zero error. Then, in the same manner, using (22) and (25), the offsets can be accurately predicted without any error.

2) Model Parameter Sensitivity Analysis Using VSI With
Ideal Modulation: Sensitivity analysis against parameters' uncertainty is a fundamental point of all model-based algorithms, even if not always adequately addressed in the technical literature. Of course, R and L can be estimated by means of accurate short-circuit and open-circuit tests, but they will vary with operating temperature, speed, and aging of the motor. From the theoretical point of view, a correct approach that does not depend on the motor under test and that allows us to assess the robustness of the proposed algorithm against the variations of R and L, consists in expressing C d , C q , δ d , δ q as functions of R, L and performing the sensitivity analysis of these functions as the resistance and the inductance rated values of the motor vary. For example, denoting withR,L the motor resistance and inductance rated values, respectively, the variation of C x resulting from a variation of the resistance R is given by which can be evaluated according to first-order Taylor expansion L) can be easily derived from (14) and (15) and is not reported here due lack of space. It allows us to evaluate the  C q (R,L) at 1000 r/min are plotted. From their inspection, it is immediate to deduce that the sensitivity of both C d and C q against R variations is always rather small, while the effect of inductanceL variations is limited. Similar results are obtained by evaluating the sensitivity of C d and C q against L variations, and for different speed. The same applies to δ d and δ q . From a physical point of view, the small sensitivity of C d , C d , C q , δ d , δ q , against R and L variations is due to the presence of PI controllers and to their inclusion in the drive model.

3) Model Performance Assessment Using VSI With SVM:
This case scenario includes a realistic model of the VSI. Fig. 8 shows the motor currents i d , i q , and their estimation i e d , i e q , achieved by the proposed model in the operating conditions defined by (27). It is possible to observe that, while the average of the estimated value is accurate, there is an instantaneous error due to the current ripple generated by the SVM technique, because the proposed model is developed considering ideal behavior of the VSI. Nevertheless, at steady-state the model is correctly estimating (i e d ) mean = i * d = 0 A and (i e q ) mean = i * q = 3.11 A and the oscillations due to the offset fault as shown in the  zoom in Fig. 8. The maximum values of the errors between the dq axes estimated and actual currents are lower than 50 mA and shown in Fig. 9. Therefore, the proposed model is able to predict the behavior of the motor currents for diagnostic purposes even when the nonlinear behavior of a real VSI is considered.

C. FDIE Algorithm Validation by Experimental Analysis
The FDIE algorithm was experimentally tested on the 1.23 kW SPMSM drive that has been numerically modeled in the previous sections. The results of the experimental tests reporting the measured dq axes currents and the estimated offsets (see Figs. 10 and 11) have been compared with the numerical simulation (see Figs. 12 and 13) in the same operating conditions as defined in (27). It is possible to notice the very good agreement between simulation and experimental results.
Figs. 10 and 12 show the measured dq axes currents and the related average, in simulation and experiment, respectively. Obviously, because of the current sensors offset fault, the measured dq axes currents are different from the real machine currents depicted in Figs. 5 and 8. However, at steady-state conditions, it is i mean md = i * d = 0 A and i mean mq = i * q = 3.11 A, as expected, and the observed oscillations are due to the offset fault. The FDIE algorithm proposed in Section III is used to detect the current sensor offsets at each time step and the steady-state results are shown in Figs. 11 and 13. The diagnostic algorithm is able to accurately estimate the current offsets using as input the motor parameters, the dq axes current references, the measured rotor speed, and the measured currents. The current ripple caused by the SVM influences the computation of the current sensor offsets Δi 1 , Δi 2 , and Δi 3 and an average calculation is required  respectively. This corresponds to errors of −2.5%, −2.0%, and 3.3% (simulation) and −2.5%, 2.0%, and 3.3% (experimental), showing a good performance of the proposed FDIE algorithm as well as a good agreement between the experimental set-up and simulation environment. Fig. 14 shows the motor electromagnetic torque, the rotor speed and related mean values during the experimental test. The torque is estimated using (2), where i q is the q-axis component of the real motor current before the fault injection. The torque is affected by the oscillations due to the phase current offsets. For this specific scenario, the torque ripple is 1.06 N · m peak to peak. Due to the load inertia and the resolution of the encoder, no oscillation can be acquired on the rotor speed. Higher torque ripple are measured in case of higher phase current sensor offset that can cause mechanical damage of the set up.  Table II (cases 5 and 6).
The FDIE algorithm has been tested in many other operating conditions and with different values of the offset fault, reference      speed, and torque reference, as shown by Tables II, III, and Fig. 16, confirming the validity of the proposed methodology. No impact has been identified in the estimation error when the offset values, the motor speed or the torque reference change.
The estimation error in the experimental results is due to the unknown disturbances in the measurement circuits (such as gain error), nonlinearity of the VSI, and dead time [27]. Note that case In this case, the electric drive is not affected by the phase current offset fault, there are no oscillations on the dq axes currents. Indeed, ε = 0 in (6) and this yields C d = C q = 0 in (14). However, the proposed FDIE algorithm can properly estimate the phase current offsets thanks to the measurement of the homopolar component in (25). Fig. 16 reports the estimation errors of the (Δi 1 , Δi 2 , Δi 3 ) calculated from experimental tests performed at different speed and torque. In all the operating conditions, the error is smaller than 7%.

V. CONCLUSION
A novel modeling approach for SPMSM drive has been presented in this article. It allows for the analytical estimation of the real phase currents flowing in the drive, when current sensor offset faults are present. The developed model includes the response of the FOC control loop and allows for the high performance of the estimation even when disturbance due to the modulation technique, or parameter variations are considered, as shown by the numerical results. Starting from the proposed model, an FDIE algorithm has been developed, which is capable of assessing if an offset fault is present, on which phase/s, and which is the entity of the fault. Experimental results have confirmed the validity of the proposed FDIE scheme. The proposed algorithm can be used for both online and offline assessment of the faulty condition, thanks to the simplicity of the proposed approach. Moreover it can be utilized for self-commissioning and compensation of the offset errors.