Mover Position Detection for PMTLM Based on Linear Hall Sensors through EKF Processing

Accurate mover position is vital for a permanent magnet tubular linear motor (PMTLM) control system. In this paper, two linear Hall sensors are utilized to detect the mover position. However, Hall sensor signals contain third-order harmonics, creating errors in mover position detection. To filter out the third-order harmonics, a signal processing method based on the extended Kalman filter (EKF) is presented. The limitation of conventional processing method is first analyzed, and then EKF is adopted to detect the mover position. In the EKF model, the amplitude of the fundamental component and the percentage of the harmonic component are taken as state variables, and they can be estimated based solely on the measured sensor signals. Then, the harmonic component can be calculated and eliminated. The proposed method has the advantages of faster convergence, better stability and higher accuracy. Finally, experimental results validate the effectiveness and superiority of the proposed method.


Introduction
Permanent magnet tubular linear motors (PMTLM) have been the focus of significant research for the last few decades due to their high power density, small end effect and excellent dynamic performance [1,2]. PMTLMs have been increasingly applied in electromagnetic launches, healthcare and other applications with strict volume restriction [2].
Mover position detection is one of the key techniques for servo control of PMTLM, and is vital for thrust control and positioning accuracy. In most applications, a grating scale is the most commonly used position sensor [3,4]. A grating scale has the advantages of high precision, high resolution and fast response, but also suffers from shortcomings like high cost and large volume. Furthermore, an auxiliary guide is needed for a grating scale, which restricts its application. Some researchers have also adopted sensorless methods [5][6][7][8][9][10], utilizing the voltage and current information to estimate mover position based on the electrical PMTLM model. Sensorless methods can be divided into two categories: back-EMF-based methods and high frequency injection methods. The former is highly dependent on electrical parameter accuracy and shows bad performance in low-speed region, while the latter introduces thrust ripple and extra loss. Generally, sensorless methods are unfit for applications where high precision is demanded.
As an alternative, linear Hall sensors are more and more widely used nowadays to detect mover position [11][12][13][14][15][16][17]. They have merits like low cost and high robustness, and the installation is easy to implement. Two linear Hall sensors electrically separated 90 degrees are widely adopted for both rotor angular detection and mover position detection. Linear Hall sensors can measure varying magnetic field strength and continuously output the corresponding sine and cosine wave signals. However,

Position Detection Based on Linear Hall Sensors
Linear Hall sensors are based on the Hall Effect, and the sensor output is linear to the magnetic field strength. As the mover transports inside the stator, the air-gap magnetic field is approximately distributed in a sine wave. The diagram and physical map of PMTLM used for experiments are shown in Figures 1 and 2. The pole pitch of PMTLM is 10 mm, and the two Hall sensors are separated by 5 mm axially so that the two sensor signals are electrically 90 • apart. The Hall sensors continuously output position-dependent sine/cosine signals, and then the mover position can be obtained by using an arctangent function, as shown in Equations (1) and (2). u ak = u mk sin θ k , u bk = u mk cos θ k (1) arctan(u ak /u bk ), i f u ak > 0, u bk ≥ 0 arctan(u ak /u bk ) + π, i f u bk < 0 arctan(u ak /u bk ) + 2π, i f u ak ≤ 0, u bk ≥ 0 x k = (τ · θ k )/π (2) where x k is mover position, τ is pole pitch, u ak , u bk are signals detected by Hall sensors, u mk is the amplitude of the fundamental component and θ k is the corresponding electrical angle of the mover.   Figure 3a is a 2-D finite-element-method simulation result by Ansoft Maxwell, demonstrating the distribution of a magnetic line in air-gap. The distribution curves of magnetic field strength at different radial distances can be seen more specifically in Figure 3b. Obviously, the distribution curve is not a pure sine wave, and is even approximate to a triangular wave when 7 mm away from PMs, indicating that the magnetic field contains large odd-order harmonics. As the radial distance becomes farther, the magnetic line becomes closer to a sine wave while its amplitude decreases. Limited by the size of the motor, the two Hall sensors are installed 9 mm away from PMs in practice, producing third-order harmonic components in Hall sensor signals, as shown in Equation (3) where r k is the percent of the third-order harmonic component.
Therefore, the raw electrical angle ˆk calculated by Equation (2) contains a large error, as described in Equations (4) and (5).
Apparently, the third-order harmonics in sensor signals would introduce a fourth-order error in position detection result. The amplitude of error is related to the percentage of the harmonic component, which could be large in some applications. Thus, it is necessary to filter out third-order harmonics from the original sensor signals.   Figure 3a is a 2-D finite-element-method simulation result by Ansoft Maxwell, demonstrating the distribution of a magnetic line in air-gap. The distribution curves of magnetic field strength at different radial distances can be seen more specifically in Figure 3b. Obviously, the distribution curve is not a pure sine wave, and is even approximate to a triangular wave when 7 mm away from PMs, indicating that the magnetic field contains large odd-order harmonics. As the radial distance becomes farther, the magnetic line becomes closer to a sine wave while its amplitude decreases. Limited by the size of the motor, the two Hall sensors are installed 9 mm away from PMs in practice, producing third-order harmonic components in Hall sensor signals, as shown in Equation (3) where r k is the percent of the third-order harmonic component.
Therefore, the raw electrical angle ˆk calculated by Equation (2) contains a large error, as described in Equations (4) and (5).
Apparently, the third-order harmonics in sensor signals would introduce a fourth-order error in position detection result. The amplitude of error is related to the percentage of the harmonic component, which could be large in some applications. Thus, it is necessary to filter out third-order harmonics from the original sensor signals.   Figure 3b. Obviously, the distribution curve is not a pure sine wave, and is even approximate to a triangular wave when 7 mm away from PMs, indicating that the magnetic field contains large odd-order harmonics. As the radial distance becomes farther, the magnetic line becomes closer to a sine wave while its amplitude decreases. Limited by the size of the motor, the two Hall sensors are installed 9 mm away from PMs in practice, producing third-order harmonic components in Hall sensor signals, as shown in Equation (3). Therefore, the raw electrical angleθ k calculated by Equation (2) contains a large error, as described in Equations (4) and (5).
Apparently, the third-order harmonics in sensor signals would introduce a fourth-order error in position detection result. The amplitude of error is related to the percentage of the harmonic component, which could be large in some applications. Thus, it is necessary to filter out third-order harmonics from the original sensor signals. u ak = u mk (sin θ k − r k sin 3θ k ) u bk = u mk (sin(θ k + π/2) − r k sin 3(θ k + π/2)) = u mk (cos θ k + r k cos 3θ k ) where r k is the percent of the third-order harmonic component.

Analysis of ANF-Based Signal Processing
In order to eliminate harmonics in Hall sensor signals, [15] proposed a signal processing procedure based on ANF, and an improved ANF is presented in [16]. To the best of the author's knowledge, ANF remains one of the most effective signal processing methods to filter out harmonics. ANF is a notch filter that is constructed by a closed loop, and can operate well even in a low-speed region. In this section, its performance will be discussed.
The simplified diagram of ANF processing is shown in Figure 4. Two ANFs are used to process two channel sensor signals. Take one ANF for example; the transfer function from u a to ˆa u is  Equation (6) has the same form as a conventional second-order notch filter. Its gain equals zero at s = jω h , so the harmonic component at the frequency of ω h is filtered out. The parameter σ determines the sharpness of the notch filter. As σ becomes larger, the bandwidth of ANF becomes larger, thus the convergence rate is faster, and yet the filtering performance gets worse. Hence, there is always a dilemma between faster convergence rate and better filtering performance for ANF.
Moreover, the ANF-based signal processing method is not stable at zero speed. In steady state, the inputs of the two integrators in Figure 4 should be fluctuating around zero. Particularly, all variables in Figure 4 are constant when mover speed is zero, and then the inputs of the two integrators are supposed to be equal to zero, i.e.,

Analysis of ANF-Based Signal Processing
In order to eliminate harmonics in Hall sensor signals, [15] proposed a signal processing procedure based on ANF, and an improved ANF is presented in [16]. To the best of the author's knowledge, ANF remains one of the most effective signal processing methods to filter out harmonics. ANF is a notch filter that is constructed by a closed loop, and can operate well even in a low-speed region. In this section, its performance will be discussed.
The simplified diagram of ANF processing is shown in Figure 4. Two ANFs are used to process two channel sensor signals. Take one ANF for example; the transfer function from u a toû a is

Analysis of ANF-Based Signal Processing
In order to eliminate harmonics in Hall sensor signals, [15] proposed a signal processing procedure based on ANF, and an improved ANF is presented in [16]. To the best of the author's knowledge, ANF remains one of the most effective signal processing methods to filter out harmonics. ANF is a notch filter that is constructed by a closed loop, and can operate well even in a low-speed region. In this section, its performance will be discussed.
The simplified diagram of ANF processing is shown in Figure 4. Two ANFs are used to process two channel sensor signals. Take one ANF for example; the transfer function from u a to ˆa u is  Equation (6) has the same form as a conventional second-order notch filter. Its gain equals zero at s = jω h , so the harmonic component at the frequency of ω h is filtered out. The parameter σ determines the sharpness of the notch filter. As σ becomes larger, the bandwidth of ANF becomes larger, thus the convergence rate is faster, and yet the filtering performance gets worse. Hence, there is always a dilemma between faster convergence rate and better filtering performance for ANF.
Moreover, the ANF-based signal processing method is not stable at zero speed. In steady state, the inputs of the two integrators in Figure 4 should be fluctuating around zero. Particularly, all variables in Figure 4 are constant when mover speed is zero, and then the inputs of the two integrators are supposed to be equal to zero, i.e.,  Equation (6) has the same form as a conventional second-order notch filter. Its gain equals zero at s = jω h , so the harmonic component at the frequency of ω h is filtered out. The parameter σ determines the sharpness of the notch filter. As σ becomes larger, the bandwidth of ANF becomes larger, thus the convergence rate is faster, and yet the filtering performance gets worse. Hence, there is always a dilemma between faster convergence rate and better filtering performance for ANF.
Moreover, the ANF-based signal processing method is not stable at zero speed. In steady state, the inputs of the two integrators in Figure 4 should be fluctuating around zero. Particularly, all variables in Figure 4 are constant when mover speed is zero, and then the inputs of the two integrators are supposed to be equal to zero, i.e., Sensors 2017, 17, 782

of 12
Taking atan2(û a ,û b ) asθ k , we then have, It can be easily proven that Equation (8) has no solution, suggesting that the method described in Figure 4 cannot achieve a steady state when motor is at a standstill. Therefore, ANF is obviously not suitable for applications where motors operate in a stationary state. Moreover, the slow convergence rate of ANF could be a severe problem for a short-stroke linear motor, in that the motor might have already completed the whole stroke before the ANF algorithm converges to a steady state.
Apart from ANF, the signal processing method based on SFE also has the abovementioned problems, which will not be discussed in detail in this section. In order to obtain signals without harmonics promptly, precisely and stably, EKF-based signal processing is proposed in this paper.

Signal Processing Using EKF
The EKF is a linearized extension of the Kalman filter. The Kalman filter has proven to be the optimal filter in a linear system, so the EKF also has merits such as fast convergence rate and high robustness. The EKF is a well-proven and commonly used recursive algorithm for signal estimation. Here, we use the EKF to estimate the third-order harmonic component based solely on the raw data measured by linear Hall sensors.
To employ the EKF, the state model and the observation model are first constructed. Taking the amplitude of the fundamental component and the percentage of the harmonic component as state variables, the two original signals detected by Hall sensors as outputs, and the raw electrical angle calculated by Equation (4) as input, variables used in the EKF model are represented as follows: r k is only related to the mechanical structure of the PMTLM, and u mk barely changes if the running condition of the PMTLM is unchanged. Hence, we can consider that x k+1 = x k , and then the EKF model can be described as in Equation (10).
where w k is the state equation noise, v k is the observation equation noise, and their covariance matrices are represented as Q k and E k respectively. Employing Equation (5), we have h(x k , u k ) ≈ u mk sin θ k + r k sin 4θ k − u mk r k sin 3 θ k + r k sin 4θ k u mk cos θ k + r k sin 4θ k + u mk r k cos 3 θ k + r k sin 4θ k = u mk sin(u k + r k sin 4u k ) − u mk r k sin 3(u k + r k sin 4u k ) u mk cos(u k + r k sin 4u k ) + u mk r k cos 3(u k + r k sin 4u k ) The recursive EKF algorithm is divided into time prediction and measurement update [21,22]. Equations for them are as follows.
Time prediction: Measurement update: where F k is the identity matrix in our case, and H k is the linear approximation of h (x k , u k ), i.e., Based on Equations (12)- (17), u mk and r k are estimated online. Then, the third-order harmonics can be calculated and removed. We have the following: where u ak , u bk are the estimated fundamental components and θ k is the estimated electrical angle.
In this way, the signals after EKF processing no longer contain large third-order harmonics. Small errors may still exist due to the approximation error in Equation (5), but most of the harmonics are eliminated, contributing to a more precise mover position detection result.
The diagram of EKF processing is shown in Figure 5. The estimated electrical angle θ is not feedback to the signal processing procedure. Instead, the raw electrical angleθ is used for EKF processing: θ k + r k sin 4θ k rather than θ k + r k sin 4θ k is used as the input of EKF, and sin 3θ k rather than sin 3θ k is used to produce the reference of third-order harmonic component. There are two reasons for doing so. First, the difference is small betweenθ k and θ k , and it becomes even smaller between sin nθ k and sin nθ k , thus the adverse impact of this approximation is limited. In addition, as long as u mk and r k stay around the true values, θ will stick to the true value. When the motor operates at zero speed, the input and output data of EKF remain unchanged, and then they can be considered useless data. The useless data have no effect on the update of state variables, so the convergence process of EKF is not undermined. Therefore, useless data will not cause the divergence of u mk and r k , and then the stability of EKF processing at zero speed is guaranteed.

Experimental Results
In this section, extensive experimental results are provided to confirm the validity of the proposed method. The experimental platform is shown in Figure 6. A grating scale is installed to provide the true value of the mover position, and its resolution is 1 μm. The motor driver adopts a

Experimental Results
In this section, extensive experimental results are provided to confirm the validity of the proposed method. The experimental platform is shown in Figure 6. A grating scale is installed to provide the true value of the mover position, and its resolution is 1 µm. The motor driver adopts a voltage source inverter, and the switching frequency is 10 kHz. A float-point digital signal processor (DSP) TMS320F28335 is used to run the position detection and servo control algorithm. In order to deal with the high nonlinearity of the model described in Equation (10), suboptimal multiple fading factors are employed in Equation (13) of EKF processing in actual experiments, and this can significantly enhance the robustness against system nonlinearity and model uncertainty [23,24].

Experimental Results
In this section, extensive experimental results are provided to confirm the validity of the proposed method. The experimental platform is shown in Figure 6. A grating scale is installed to provide the true value of the mover position, and its resolution is 1 μm. The motor driver adopts a voltage source inverter, and the switching frequency is 10 kHz. A float-point digital signal processor (DSP) TMS320F28335 is used to run the position detection and servo control algorithm. In order to deal with the high nonlinearity of the model described in Equation (10), suboptimal multiple fading factors are employed in Equation (13) of EKF processing in actual experiments, and this can significantly enhance the robustness against system nonlinearity and model uncertainty [23,24].   Figure 7b, which indicates that third-order harmonics exist in the original sensor signals. ThenANF-based signal processing method is first utilized to remove thirdorder harmonics, and the corresponding FFT result shows that the harmonic content is reduced. However, the ANF shows instability at zero speed, meaning that the ANF processed signals diverge from the original signals. Conversely, EKF processed signals remain stable when the mover is at a standstill, as depicted in Figure 7e. Moreover, Figure 7f shows that the harmonic content is further reduced when sensor signals are processed by the EKF, meaning that the EKF has a better filtering performance than the ANF. Figure 8 shows experimental results at the speed of 600 mm/s, and the waveforms and FFT results are consistent with Figure 7. Therefore, we can come to the conclusion that EKF processing is able to minimize the third-order harmonics at different speeds, including zero speed.   Figure 7b, which indicates that third-order harmonics exist in the original sensor signals. ThenANF-based signal processing method is first utilized to remove third-order harmonics, and the corresponding FFT result shows that the harmonic content is reduced. However, the ANF shows instability at zero speed, meaning that the ANF processed signals diverge from the original signals. Conversely, EKF processed signals remain stable when the mover is at a standstill, as depicted in Figure 7e. Moreover, Figure 7f shows that the harmonic content is further reduced when sensor signals are processed by the EKF, meaning that the EKF has a better filtering performance than the ANF. Figure 8 shows experimental results at the speed of 600 mm/s, and the waveforms and FFT results are consistent with Figure 7. Therefore, we can come to the conclusion that EKF processing is able to minimize the third-order harmonics at different speeds, including zero speed. When the processed signals are used for position calculation, the performance of different processing methods can be more specifically observed from Figure 9. Figure 9c,d demonstrate the original error of position detection when using raw sensor data. It can be seen that the maximum error is about 200 μm, and the original error fluctuates four times during an electrical period, which When the processed signals are used for position calculation, the performance of different processing methods can be more specifically observed from Figure 9. Figure 9c,d demonstrate the original error of position detection when using raw sensor data. It can be seen that the maximum error is about 200 μm, and the original error fluctuates four times during an electrical period, which When the processed signals are used for position calculation, the performance of different processing methods can be more specifically observed from Figure 9. Figure 9c,d demonstrate the original error of position detection when using raw sensor data. It can be seen that the maximum error is about 200 µm, and the original error fluctuates four times during an electrical period, which agrees with Equation (5). In order to reduce this fourth-order error in position detection results, the third-order harmonics in Hall sensor signals are supposed to be filtered out. When ANF is applied, its position detection error is described in Figure 9e,f. The error begins to diminish at the second electrical period, and yet diverges when the mover speed drops to zero. Compared with ANF, EKF can converge within several signal sampling periods, thus EKF processing can minimize the error more rapidly and more effectively. When EKF processing is employed, the maximum error is reduced to 60 µm at 20 mm/s and 100 µm at 600 mm/s (see Figure 9g,h). Furthermore, the error sticks to zero when PMTLM operates at zero speed, which is consistent with discussions in Section 4. Apparently, EKF processing shows better performance than ANF processing for PMTLM mover position detection.
Sensors 2017, 17, 782 9 of 12 agrees with Equation (5). In order to reduce this fourth-order error in position detection results, the third-order harmonics in Hall sensor signals are supposed to be filtered out. When ANF is applied, its position detection error is described in Figure 9e,f. The error begins to diminish at the second electrical period, and yet diverges when the mover speed drops to zero. Compared with ANF, EKF can converge within several signal sampling periods, thus EKF processing can minimize the error more rapidly and more effectively. When EKF processing is employed, the maximum error is reduced to 60 μm at 20 mm/s and 100 μm at 600 mm/s (see Figure 9g,h). Furthermore, the error sticks to zero when PMTLM operates at zero speed, which is consistent with discussions in Section 4. Apparently, EKF processing shows better performance than ANF processing for PMTLM mover position detection. Finally, the mover position detected by the proposed method is used for closed-loop control of the PMTLM, and the driver system operates well, as shown in Figure 10. The mover gradually marches to 90 mm at a top speed of 1 m/s, halts for 50 ms, and then moves backward to the origin.
The convergence process of EKF is depicted in Figure 10c,d. Both u mk and r k stay stable in all speed regions and remain invariant at zero speed. Obviously, sensor signals measured at zero speed would not update the state variables of EKF, and this explains why r k starts to converge at 0.05 s.
Also, the value of u mk fluctuates slightly along with the mover position, and this suggests that the (e,f) Error when using ANF processed signals. (g,h) Error when using EKF processed signals. The left column is measured at 20 mm/s, and the right column is measured at 600 mm/s. Finally, the mover position detected by the proposed method is used for closed-loop control of the PMTLM, and the driver system operates well, as shown in Figure 10. The mover gradually marches to 90 mm at a top speed of 1 m/s, halts for 50 ms, and then moves backward to the origin. within 100 μm, which is much smaller than the position estimation error using the original Hall sensor signals (see Figure 10f). On the other hand, it is also noteworthy that the error at zero speed is significantly reduced from 200 μm to 36 μm. Therefore, the presented method can achieve both higher dynamic accuracy and higher positioning accuracy. Even though there are still errors due to things like sensor error or mechanical error, the proposed EKF processing method seems to be feasible and superior.

Conclusions
Linear Hall sensors are utilized for mover position detection of PMTLM, and the third-order harmonics in Hall sensor signals seriously impact the accuracy. In this paper, an EKF-based signal processing method is introduced to filter out harmonics. The proposed method is compared with the conventional method and validated by substantial experiments. In the end, a PMTLM control loop based on EKF processing is constructed to manifest its performance in whole speed region. Unlike the conventional method, EKF processing can converge within several sampling periods, and the processed signals remain stable at a standstill, so both the convergence rate and the stability are enhanced. Furthermore, the proposed method also has higher position detection accuracy, whether the mover is dynamic or static. The proposed method has the advantages of low cost, small volume and high accuracy, and can be easily extended to rotary machines and signals containing higher order harmonics. The EKF processing algorithm can also be used for sensorless control methods to eliminate harmonics in the observed back-EMF. The convergence process of EKF is depicted in Figure 10c,d. Both u mk and r k stay stable in all speed regions and remain invariant at zero speed. Obviously, sensor signals measured at zero speed would not update the state variables of EKF, and this explains why r k starts to converge at 0.05 s. Also, the value of u mk fluctuates slightly along with the mover position, and this suggests that the magnetic field strengths of different PMs are distinctive, which could be caused by manufacturing differences.
It can be seen in Figure 10e that the dynamic error of the proposed position detection method is within 100 µm, which is much smaller than the position estimation error using the original Hall sensor signals (see Figure 10f). On the other hand, it is also noteworthy that the error at zero speed is significantly reduced from 200 µm to 36 µm. Therefore, the presented method can achieve both higher dynamic accuracy and higher positioning accuracy. Even though there are still errors due to things like sensor error or mechanical error, the proposed EKF processing method seems to be feasible and superior.

Conclusions
Linear Hall sensors are utilized for mover position detection of PMTLM, and the third-order harmonics in Hall sensor signals seriously impact the accuracy. In this paper, an EKF-based signal processing method is introduced to filter out harmonics. The proposed method is compared with the conventional method and validated by substantial experiments. In the end, a PMTLM control loop based on EKF processing is constructed to manifest its performance in whole speed region. Unlike the conventional method, EKF processing can converge within several sampling periods, and the processed signals remain stable at a standstill, so both the convergence rate and the stability are enhanced. Furthermore, the proposed method also has higher position detection accuracy, whether the mover is dynamic or static. The proposed method has the advantages of low cost, small volume and high accuracy, and can be easily extended to rotary machines and signals containing higher order