Modeling and Detection of Dynamic Position Sensor Offset Error in PMSM Drives

Rotor position information obtained through a position sensor is crucial for proper field-oriented control (FOC) of permanent magnet synchronous machine-based high dynamic energy conversion applications. In applications such as transportation and industrial, PMSM energy conversion systems are subjected to harsh environmental conditions such as vibration, shock, and thermal shock causing mechanical interfaces holding position sensors to fail, introducing errors to the position measurement. A dynamic position sensor offset error (DPSOE), being such a failure mode has the potential to degrade system torque output or more adversely, reverse machine torque output that may cause catastrophic outcomes. This paper evaluates different DPSOE scenarios, presents an approach to model the failure mode for analysis and proposes two novel, and robust DPSOE detection methods for PMSM drive systems. The proposed detection methods are analytically proven and supported by simulation and experimental results under multiple operating conditions proving robustness.


I. INTRODUCTION
Electromechanical energy conversion now and again has proven to be superior in numerous aspects when compared with conventional non-electromechanical energy conversion systems such as hydraulic systems and internal combustion engines. Improved efficiency, higher torque/power density, reduced maintenance requirements, and ease of interfacing with software-based controls are some of the key factors contributing to electrification of actuation systems across a broad set of applications. More recently, the aviation industry has shown a strong interest in electrification considering the extravagant benefits [1], [2], [3].
Energy efficiency being a key metric across numerous industries (transportation, industrial, and residential), permanent magnet synchronous machines (PMSMs), surpass other machine types in terms of efficiency. Other factors such as The associate editor coordinating the review of this manuscript and approving it for publication was Shaopeng Wu . compact design, ease of optimal torque generation through field orientation, ease of thermal management, and reliability have led to PMSMs being the preferred electromechanical energy conversion device, despite the cost associated with permanent magnets. Growing sectors such as autonomous driving, powertrain electrification, and aviation electrification are leaning towards PMSM-based energy conversion attributed to their superior performance compared to other electric machines [4], [5].
In applications, PMSMs are used as torque controllers, speed controllers, or position controllers. Despite the final control variable, a PMSM requires rotor position information for proper field-oriented control (FOC), and this is achieved either with a position sensor, or with an algorithm that estimates rotor position (i.e., sensorless position sensing). Though a sensor-based PMSM FOC control strategy is costly, it is far superior to sensorless control strategies for applications involving high load/torque dynamics [6], [7], [8].
Rotor position sensing in PMSMs is commonly achieved through optical encoders, resolvers, or linear hall sensors. Despite the type of sensor technology, some form of mechanical interfacing between the sensor and the motor is required. Each sensor includes a rotor-mounted element and a statormounted element. The relative motion between these two elements is used to determine the rotor position with respect to the stator. Once assembled onto the motor, these sensors require two sets of calibrations [9], [10], [11], [12]. Of them, the first is the position sensor offset calibration or the back emf offset calibration that allows the proper alignment between position sensor zero and rotor zero position as shown in figures 1 and 2 below.
Since the position sensors are mechanically mounted on the stator and rotor of a machine, these mechanical assemblies have the potential to fail due to aging, rapid acceleration/deceleration, manufacturing defects, thermal cycling, thermal shock, and/or vibration. The dynamic position sensor offset error (DPSOE) fault, presented in this paper is the failure of the mechanical interface holding the sensor, introducing a time varying position sensor offset that is unpredictable.
The effect of such failure poses harmful system response such as stall conditions, torque reversal, or reduced torque output [13]. The effect of inaccurate position sensor offset calibration from a static offset point of view has been discussed in detail in [13]. However, a mechanical failure in a rotating system is dynamic in nature and not only a Static PSOE (SPSOE). Despite position sensors being a crucial element in the reliable operation of a PMSM system, position sensor failure modes are often overlooked [14]. Existing literature that may relate to position sensor faults is discussed herewith illustrating DPSOE is not addressed in the existing literature. Resolver single-phase fault-tolerant approach is proposed in [15], where the faulted signal is reconstructed based on healthy signals. Authors of [16] propose a position and speed estimation approach that combines highfrequency injection with discrete hall sensor inputs. However, this approach is not appropriate for torque control applications due to the inaccuracy of position signal information at stall conditions nor addresses DPSOE. A DC bus current sensor-based position sensor fault detection is presented in [17]. The proposed approach computes three-phase currents based on DC bus current measurements and voltage vector applied. However, a DPSOE will adversely influence the current estimation strategy as the currents are referred to from an incorrect frame of reference, making the proposed approach impractical for DPSOE fault. A multi-fault diagnosis is proposed in [18] where IGBT, current sensor, and speed sensor fault diagnosis is performed. However, this approach also assumes that accurate rotor position information is available for fault diagnosis. The hall effect sensor fault detection proposed in [19] is only applicable to discrete hall sensors in trapezoidal controlled drives. Therefore, the approach is not practical for linear position sensors used in FOC drives.
Noting the gap in the literature on DPSOE fault detection, this paper presents the following. 1). How a DPSOE may behave in an FOC system 2). An approach to model failure mode characteristics 3). Robust DPSOE detection strategies The organization of the rest of the paper is as follows. Section II outlines the challenges associate with DPSOE. Variations of DPSOE fault are discussed in section III, followed by a model to replicate these different variations in simulation. Section IV proposes a detection strategy to detect a DPSOE condition followed by simulation and experimental results in section V. Section VI outlines an alternate method with reduced computations for DPSOE detection followed by the conclusion of the paper.
The main contributions of this paper include the presentation of DPSOE fault model and two fault diagnosis methods. The first method proposed in section IV allows for an accurate quantification method which requires more computational power. The alternate method discussed in section IV is a simpler method that only allows fault detection without the ability to quantify the fault severity. As discussed in the literature review, modeling, detection nor severity assessment of DPSOE fault diagnosis is not available in present body of knowledge and this paper makes a significant contribution.

II. PROBLEM STATEMENT AND KEY CHALLENGES
The primary difference that makes DPOSE a challenging problem is that during a DPSOE fault, the motor speed and position signals measured by the actuator experiencing the fault are sporadic and unpredictable. In contrast, the speed measured during an SPSOE fault is accurate, attributing to the constant offset in the rotor positions measurement. The measured rotor position θ m (t), true rotor position θ r (t), and PSOE θ(t) are related as shown in (1). Since the speed is obtained by differentiating position, the measured speed ω m (t), actual rotor speed ω r (t), and the influence of PSOE on speed measurement may be derived as (2).
A DPSOE fault poses a severe risk to users, property, and the system itself due to the unintended and unpredictable nature of the torque response. The following discussion emphasizes the criticality of DPSOE fault from an FOC PMSM system utilized in torque control applications to explain to the reader the need for fault detection. In fieldoriented control of PMSMs, the rotor flux vector alignment/position is measured or estimated to optimally place the stator flux vector. The stator flux vectors rotate at a speed different to that of the rotor flux vector speed when DPSOE is present.
In figure 3.a, a non-faulty position sensor offset is shown where the relative angular alignment between the rotor flux vector and the stator flux vector is known and constant. Therefore, enables the optimal placement of the stator flux vector with respect to the rotor flux vector. Figure 3.b is a faulty sensor where there is an uncalibrated offset error which is varying under rotor movement due to a loosened position sensor. These fluctuations in the position offset cause the rotor flux vector to be placed mostly non-optimally resulting in reduced torque, zero torque, or torque reversal. Simulation, and experimental results presented earlier corroborate this conclusion. Apart from the loss of torque and torque reversal, the masking of the fault by the closed-loop control system makes this fault one of the more severe faults in PMSM FOC drives that require attention. In current regulated PMSM FOC drives, the current regulation continues to regulate the current in the incorrect frame of reference during PSOE as the current references are unable to distinguish between a correct and an incorrect position signal [13]. As demonstrated with experimental results, FOC controlled PMSM continues to operate with DPSOE without drive overcurrent fault or any other hardware faults. Hence rapid detection of this fault is of utmost importance.   The three primary behaviors of DPSOE stem from the level of coupling between the motor rotor/shaft, and the rotating portion of the position sensor. When the position sensor is rigidly coupled to the motor rotor, the speed of the motor rotor (ω r ) is equal to the speed of the sensor (ω m ), while maintaining the difference between the absolute position zero  locations of the sensor and the rotor constant. In other words, the position sensor is following the motor rotor at a known, constant/static PSOE. A continuous slip behavior is when ω r is not equal to ω m and ω m is non-zero. The stick-slip behavior is when ω m is equal to ω r , for some period and the speeds are not equal at other times. The completely stuck sensor behavior is when ω m is zero where as ω r is non-zero. Experimental results for each of these three fault scenarios are depicted in figures 6 and 7. Each figure illustrates the behavior of rotor position (θ r ), measured position with the faulty/loosened sensor (θ m ), the difference between the two position signals (DPSOE) and FOC PMSM torque output. The sporadic nature of the torque output of the PMSM under DPSOE is apparent demonstrating the severity of the fault. Considering experimental results, the following relationship may be obtained for DPSOE.

III. BEHAVIOUR AND MODEL OF DYNAMIC POSITION SENSOR OFFSET ERROR
The reasoning for the DPSOE model approach is presented in the following discussion. As discussed earlier, any type of position sensor consists of a rotor-mounted element and a stator-mounted element. The relative motion between the two elements enables rotor position measurement. For example, in a hall effect sensor, the magnet is mounted on the rotor and the sensor is mounted on the stator, or in an optical encoder, the disk is mounted on the rotor whereas the light source and the sensor are mounted on the stator. The rotormounted element is held mechanically through friction. A failure in the mechanical interface may result in a permanent shift in the mounting location, intermittent shift in the mounting location, partial breakage, or complete breakage, leading to the following scenarios. A permanent shift in the mounting location is a static PSOE, which has been discussed in previous literature. An intermittent shift (also known as stick-slip behavior) in the mounting location is caused by a lack of 'sensor holding friction torque' (T SHFT ) under rapid accelerations and decelerations to hold the sensor in place (figure 6). However, in this scenario the T SHFT is sufficient to hold the sensor in place under low acceleration/deceleration movements. The second intermittent shift scenario for the sensor mount location is caused by the T SHFT being significantly low causing slow rates of acceleration to introduce motion to the rotor-mounted element (figure 7). A complete breakage causes the T SHFT to be zero allowing the sensor to move sporadically based on the 'jerk' transferred from the motor rotor ( figure 6). The temperature of the overall system, and the sensor module elements may also influence T SHFT , (level of material expansion resulting in a loosened sensor), but not discussed in this paper.

B. MODELING OF DPSOE BEHAVIOR
In summary, the sensor element on the rotor requires sufficient holding torque from the mounting interface. Due to various degrees of mechanical failure, at times the sensor is completely coupled to the motor rotor, and there may be occasions where the coupling is partially, or fully decoupled.
Depending on the level of coupling, the amount of torque transferred (full, partial, or no torque transferred) from the motor shaft to the sensor element on the rotor vary. Further, depending on the level of coupling of the sensor element to the motor shaft, the inertia influencing the motion of the loosened sensor also varies. In summary, the dynamics of the sensor are governed by the combined inertia of the motor rotor and the sensor inertia or solely by the inertia of the sensor element only. The collective effect of the amount of torque transferred and the effective inertia, influence the DPSOE behavior. Considering these factors, the DPSOE model shown in figure 8 was developed.
FOC-based torque controlled PMSM and drive system in a speed-regulated dynamometer (DC machine) is depicted in figure 8 above, elaborating sensor coupling failure. The coupling between the PMSM and the DC machine is assumed to be rigid. The model for mechanical dynamics with and without DPSOE is shown in the dashed box within figure 8.a. This model allows the evaluation of true rotor position along with measured position from the faulty sensor. Equation (6) holds under a no-fault scenario and once the sensor if properly offset calibrated, θ r (s) = θ m (s). J mech , J snsr are mechanical system inertia excluding the sensor inertia and sensor inertia (inertia of the sensor element on the rotor), respectively. B mech , B snsr are viscous friction/damping coefficients of the mechanical system, excluding the sensor and sensor itself. T em , T L are electromagnetic torque from the PMSM and dynamometer load respectively, assuming friction torque is negligible.
The measured and true rotor position under DPSOE is shown below in equations 7 and 8.

C. MODEL VALIDATION THROUGH SIMULATION RESULTS
The DPSOE model proposed earlier is validated through simulation results to compare with the experimental results shown earlier. Stick-slip behavior, completely stuck, and continuous slip behavior in simulation are presented in figures 9 and 10. The modeled faulty sensor behavior and the motor control system with the faulty sensor closely follow the results obtained experimentally.

IV. DERIVATION OF DPSOE DETECTION AND QUANTIFICATION IN PMSM FOC DRIVES
In order to devise a DPSOE detection strategy, the current regulation-based field-oriented controlled PMSM shown in figure 8 is represented in a block diagram form as a multiinput multi-output system in figure 11.
Here, I r qs_ref and I r ds_ref are current commands applied to the closed loop system. C(s) is the matrix containing proportional and integral regulators (PI regulators) for quadrature and direct axis as shown in (9). K P and K I are proportional and integral gains of the controller. 's' represents the Laplace variable. θ r is the true motor rotor position while θ m is the rotor position measured by the erroneous sensor under DPSOE fault. K s (θ) and K ′ s (θ ) are forward and inverse rotor reference frame transformations respectively. P(s) is the inverse motor model where, L q , and L d , are inductances along each axis while r s and ω r represent resistance and rotor speed, respectively. V r qs and V r ds are rotor reference frame voltages applied by the FOC controller but observed from the motor reference frame. L q ≈ L d is appropriate as a non-salient machine is considered.
By applying superposition theorem to the above closed loop system, the following result is obtained for the voltages applied by the controller under dynamic state. where, The following result is obtained by simplifying the results in (13) under steady state conditions where, Existing literature utilizes the above result along with a motor model to extract the induced emf contributions along quadrature and direct axis under a static PSOE (SPSOE) [13]. However, the approach used for SPSOE diagnosis is not applicable under a DPSOE as the motor speed calculated based on the faulty position sensor is inaccurate. Hence the following approach is proposed. The result in (15) is rewritten as (16) and (17) , allows for the inductive voltage drop to be assumed negligible. In non-salient PMSMs, the reader may use the larger of the two inductance values, L q and L d . Hence, (16) and (17) maybe re-written as (18) and (19).
Considering the inequality discussed previously, (18) and (19) is reduced to (20) and (21), respectively. The approximation results in a speed-independent DPSOE diagnosis strategy and the authors will show that the approximation has minimal impact on detecting a DPSOE, in the following sections. V r qs_error and V r ds_error are quantities computer within a microprocessor to assist in the calculation of θ (t), as shown in (22). VOLUME 11, 2023 Authorized licensed use limited to the terms of the applicable license agreement with IEEE. Restrictions apply. The above result now can be used for the approximate quantification of DPSOE without the need for accurate motor rotor speed as shown in (22), followed by the detection strategy.
The following method is proposed for the detection of a DPSOE fault, considering (20), (21), and (22). The approach relies on an inverse tangent calculation to closely approximate the amount of position sensor offset under a DPSOE fault.
A Simulink-based implementation of the proposed method is shown in figure 12. The quantified DPSOE is observed at the output obtained by implementing (22). This value under healthy operation is zero at steady-state. As the sensor moves (i.e., DPSOE fault), the quantified DPSOE oscillates between zero and 2π (or -π to π) as shown in figures 9 and 10. The first threshold-based counter compares the absolute value of the quantified DPSOE signal against a preset threshold to evaluate if a DPSOE is present. The same counter converts the quantified DPSOE to a digital signal indicating if a fault is detected or not. The discretization allows the evaluation of how long the fault persists avoiding false positives under transient states (during no fault or healthy state). The second counter assists in tracking the faulty position sensor oscillation cycles about the rotor and compares them with a set count value to indicate a DPSOE fault. Details associated with threshold selection and counter-level selection is discussed below.
The selection of fault detection threshold and counter value are important to allow for proper detection of DPSOE and to avoid false positives under transient conditions. First, the threshold selection for the 'Threshold based flag' block from figure 12 is discussed. During healthy operation, θ= 0. Therefore, equations (16) and (17)   The above relationship further reduces to (26).
A surface plot is generated considering the range of current references and machine parameters to visualize the detection signal variation range for the chosen experimental setup ( figure 13). The figure shows that under healthy conditions, and steady-state, the quantified DPSOE will not exceed ±0.08 Radians. Therefore, the designer may choose the threshold to be larger than 0.08 in this application/system. The second component in the algorithm is the counter value to avoid fault positives during transient conditions. The factors considered for transient bypass are closed-loop system bandwidth (ω BW ) and the closed-loop system time constant (τ ) and the closed-loop system time constant T s is the sampling rate of the system and the FOC algorithm is expected to execute at every sampling instance. Based on (26), the threshold derived for experimental validation was 100 counts and the selection has proven to be practical.
The reader should note that the proposed approach is for a dynamically varying PSOE rather than a stuck sensor with an incorrect PSOE (i.e., SPSOE). The detection of a static PSOE (SPSOE) is discussed in [13]. Simulation and experimental results pertaining to the proposed DPSOE detection strategy is presented next.

V. SIMULATION AND EXPERIMENTAL RESULTS ON DPSOE DETECTION A. SIMULATION RESULTS ON DPSOE FAULT DIAGNOSIS
This section presents simulation results on how the proposed fault diagnosis signals behave during a DPSOE fault event and the effectiveness of the proposed strategy under various operating conditions. The simulations were conducted with MATLAB Simulink with machine parameters matching that of the experimental setup used.      robustness preventing false positives during transient conditions at healthy states.

B. EXPERIMENTAL RESULTS ON DPSOE FAULT DIAGNOSIS
The following section presents experimental results on DPSOE detection. The experimental setup is shown in figure 4 along with PMSM parameters given in Table 1 below. The dual inverter drive board is controlled by the dSPACE DS1104 R&D system. A torque sensor placed between the two machines measures shaft torque. There are two optical encoders with one permanently mounted for true position and speed measurement while the other is used for DPSOE fault injection. Position and speed measurements from both sensors are observed simultaneously. The FOC PMSM operates with the healthy position signal during the healthy state and the system switches to the faulty position sensor when a DPSOE fault needs to be injected. The severity of the DPSOE (slowly varying vs rapidly varying nature) is adjusted by changing the setscrew mounting the faulty sensor to the coupling ( figure 4).  Figures 18 and 19 show DPSOE fault detection experimental results. In the experimental setup, the FOC controller is switched from the non-faulty (healthy) sensor to the faulty sensor signal as a means of fault injection. In figure 19, the switch from non-faulty to faulty sensor occurs slightly after t = 30 seconds. The first subfigure of each figure depicts the motor-dyno system speed based on the healthy and faulty sensors. In figure 18 the faulty sensor speed signal is seen dropping to zero intermittently due to complete detachment from the motor rotor and in figure 19, only slight variations of speed are seen due to small movements of the faulty sensor.
The second subfigure shows the regulation of the quadrature axis current under the fault condition. This clearly shows that an FOC system with feedback does not fault out or stall under a DPSOE, but rather continues to regulate currents in the erroneous reference frame resulting in unintended torque output from the machine. The actual torque output of the machine is shown in the third subfigure, where I r qs_Ref = 2A and I r ds_Ref = 0A. Despite the constant current reference, torque can be seen fluctuating as the controller reference frame is constantly changing, resulting in rapid movement of the stator flux vector with respect to the rotor flux vector. Also, the reader should note the fluctuations seen in the measured currents in figures 18 and 19. These fluctuations in rotor reference frame current are caused by the closed-loop dynamics of the control system, adapting under continuously changing reference frame caused by DPSOE. The closedloop current regulators are designed with a certain bandwidth in mind. However, step changes in the position sensor, cause step changes in measured rotor reference frame currents, injecting high-frequency content into the closed loop system. As the current measurements change, the closed-loop system attempts to correct for the current. However, the P.I. regulators are unable to respond to the high-frequency content outside its designed bandwidth. Hence those high-frequency content reflects on the current measurement. This is evident when comparing the measured current signals in figures 18 and 19. In figure 19, the DPSOE is slowly varying allowing the current regulators to compensate. However, in figure 18, the rapidly changing DPSOE injects frequency content well beyond the current regulator bandwidth and hence the FOC system is unable to compensate.
Fourth subfigure illustrates quadrature and direct axis voltage errors utilized for DPSOE calculation followed by the quantified DPSOE in the fifth subfigure. The actual and the quantified DPSOE value tend to follow with reasonable accuracy and the accuracy can be seen improving at higher speeds as a result of higher induced EMF. The counter value used for DPSOE detection is shown in subfigure six and the fault flag status in subfigure seven. The fault flag can be seen rising (from zero to one) immediately after the DPSOE fault has been introduced to the system.
Additional experimental results are provided in figures 20 through 22. Figure 20 demonstrates DPSOE detection in the counterclockwise direction and at 800RPM motor speed. Figures 21 and 22 are for varying speed conditions with the current reference maintained constant. As mentioned earlier, The DPSOE quantification can be seen to follow the faulty offset error immediately triggering the fault flag, even under transient speed conditions. Both slow-varying and rapidly varying DPSOE cases are evaluated with sufficient accuracy. It is also noteworthy that the DPSOE algorithm does not indicate false positives under transient speeds when DPSOE is not present in the system, confirming the robustness of the proposed algorithm.

VI. ALTERNATE DPSOE DETECTION METHOD WITHOUT INVERSE TANGENT CALCULATION
Certain PMSM FOC drives are resource constrained especially in low-cost applications. An accurate inverse tangent calculation is either CPU resource heavy, storage heavy (for look-up table), or both. For example, on a Texas Instruments C2000 microprocessor, a single inverse tangent calculation takes approximately 90 floating point unit (FPU) cycles, whereas a multiplication of a floating-point number with a constant only consumes approximately 4 FPU cycles. Hence the authors propose the following method which does not require an inverse tangent calculation.
A Simulink implementation of the proposed DPSOE detection method is shown in figure 23. During a DPSOE fault, quadrature and direct axis voltages error in (20) and (21) oscillate from positive to negative. Therefore, comparing the  signal with respect to zero results in a binary signal for each axis. The binary signal is fed to a counter block that counts the total number of zero crossings for each of the signals resulting in the total number of zero crossings. This serves as a method to detect DPSOE with little to no computational requirements. The total count value for detection mayvbe set to avoid false positives under transient conditions.

VII. CONCLUSION
Field-oriented controlled permanent magnet synchronous machines and drives are proliferating across many different energy conversion applications due to the numerous advantages of PMSMs. The use of sensed/sensored FOC is common in torque-controlled PMSM applications such as propulsion, traction, and steering applications due to high bandwidth requirements. However, a position sensor consists of mechanical interfaces that may incur faults due to vibration, shock, aging, or environmental conditions that occur in aforementioned applications introducing a dynamic position sensor offset error (DPSOE). This paper presents a comprehensive study of DPSOE, a modeling scheme to simulate various DPSOE conditions, and robust DPSOE detection methods. Two novel methods are presented with one with different levels of computational complexity. The proposed theoretical DPSOE detection scheme is supported by simulation and experimental results elaborating the practicality of the proposed approach. The fault model discussed is also a new contribution to the body of knowledge.