Next Article in Journal
High-Density Functional Near-Infrared Spectroscopy and Machine Learning for Visual Perception Quantification
Previous Article in Journal
Predicting Office Workers’ Productivity: A Machine Learning Approach Integrating Physiological, Behavioral, and Psychological Indicators
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A Novel Angle Segmentation Method for Magnetic Encoders Based on Filtering Window Adaptive Adjustment Using Improved Particle Swarm Optimization

1
School of Mechanical and Power Engineering, Harbin University of Science and Technology, Harbin 150080, China
2
School of Mechatronics Engineering, Harbin Institute of Technology, Harbin 150001, China
*
Author to whom correspondence should be addressed.
Sensors 2023, 23(21), 8695; https://doi.org/10.3390/s23218695
Submission received: 4 August 2023 / Revised: 23 September 2023 / Accepted: 29 September 2023 / Published: 25 October 2023
(This article belongs to the Section Industrial Sensors)

Abstract

:
In this paper we outline newly-developed control algorithms, designed to achieve high-precision feedback for a motor control system using a magnetic encoder. The magnetic encoder, combing single-pole and multi-pole magnetic steels, was adopted to extend the resolution of the magnetic encoder. First, with a view to settling the issue of the jump points of the multi-pole angle value at the convergence of two adjacent magnetic poles, the angle segmentation method, which uses the window filter discrimination method, is employed to determine the actual angle value. The appropriate filter window width is selected via the improved particle swarm optimization (IPSO) algorithm, and an expanded resolution is achieved. Second, a compensation table is completed via a linear compensation algorithm based on virtual cutting to enhance the accuracy of the combined magnetic encoder. On this basis, a linear difference algorithm is used to achieve deviation correction of the angle. Finally, the jump points can be restrained effectively via the angle segmentation method. The resolution reaches 0.05°, and the accuracy is 0.045°.

1. Introduction

As industrialization moves further towards high-end manufacturing, the applications of permanent magnet synchronous motor (PMSM) drives increase, especially in the field of servo drive [1,2].
Aiming at improving PMSM control precision and response speed, on the one hand, the control strategy with high performance of the motor is examined here. An optimized control based on Proportional-Integral-Derivative (PID) control is proposed, which can address the adverse effects caused by low-cost magnetic encoders, thus improving the control performance and precision of PMSM [3]. A multi-motor synchronization control is emphasized in [4], ensuring the stability and robustness of the control system in the presence of external disturbances. On the other hand, improving the precision and accuracy of encoders, the feedback element of the control system offers another approach to enhancing the control precision of the control system [5]. Among numerous encoders, rotary encoders are widely applied [6,7,8] and photoelectric encoders and magnetic encoders are the most common. Although the photoelectric encoder has high detection accuracy, the volume it requires increases with higher accuracy, and it cannot be used in harsh environments with pollution, vibration, and other factors [9,10]. Despite these shortcomings, magnetic encoders are increasingly needed.
Many types of research have been conducted on the structure and algorithm in terms of the issue of inferior accuracy and poor resolution for the magnetic encoder [10]. Considering its structure, these issues can be alleviated by improving the installation accuracy of the Hall elements, the direction and accuracy of magnetization of the magnetic steel, and the number of poles contained in the magnetic steel. An eccentric rotation structure is employed to obtain high resolution without reducing absolute angle precision in [10,11,12]. However, the method of handling multi-poles is not related to the number of Hall ICs that fail, as pointed out in [10], and long short-term memory (LSTM) has been proposed in [11] to decrease the huge angular position error when the number of sensors is cut down. An absolute multi-pole structure including an index track and sub-division track has been proposed to enhance the resolution of the encoder [13]. The accuracy of a special magnetic medium can be enhanced when it is modified and flattened. Thus, a linear magnetic encoder requires high position precision [14].
Regarding software algorithms, a rotary magnetic encoder that adopts a novel sensing mechanism was proposed in [7]. Time pulses, a measurement basis, are recorded to compute the angular position. Finally, high resolution and stability are obtained. Aiming to increase the precision of a multi-turn absolute magnetic encoder with the feature of being battery-free, a high-resolution, self-referencing lookup table (LUT) algorithm has been presented in which bipolar magnet (BPM) signals are used to introduce the tables for multi-turn angles, eliminating the external disturbance effects of the BPM signals [15]. An efficient error correction algorithm, which is designed for magnetic analog encoders (MAEs), requires very little memory space compared with the LUT. When this is combined with a type-2 phase-locked loop (PLL), a ±0.2° total position error can be obtained [16]. An adaptive linear neuron algorithm has been proposed that is based on a third-order PLL. It compensates sinusoidal and cosine signals for the magnetic encoder and eliminates noise and DC error in the phase as well as frequency steps. The simulation and experimental results demonstrate that the method can enhance the precision of the absolute magnetic encoder [17]. In ref. [18], a digital phase-locked loop (AADPLL) compensating the noisy signals of the magnetic encoder by assisting with a pulse interpolator achieved the maximum operating speed and the highest resolution. Moreover, intelligent algorithms such as a neural network [12,19] and fuzzy algorithm [20] have also been used to enhance the accuracy and resolution of magnetic encoders. In ref. [12], a neural network was combined with eccentric rotation to solve the issue of absolute angle calculation. A radial basis function neural network (RBFNN) has been proposed and added to the PLL to prevent disturbances of quadrature sinusoidal signals, thus improving the accuracy of the magnetic encoder [19]. To achieve high-precision control, a multi-sensor data fusion methodology has been proposed in which fuzzy logic is introduced. Moreover, it introduces a projected electronic circuit to analogically implement the Takagi–Sugeno model, which maintains the signal uninterruptedly and naturally [20]. To enhance the position resolution, position interpolation has been put forward in which the sine and cosine signals of every two incremental encoders are collected [21]. A listing of classical methods and their features is given in Table 1.
Most of the studies above have enhanced the resolution and accuracy of magnetic encoders without considering the changes in the environment. Therefore, the magnetic sensitivity coefficient of the encoder changes as the ambient conditions vary, causing the appearance of jump points in the angle solution when the magnetic encoder is at the convergence of two adjacent magnetic poles. At exactly that moment, the current pole number of the magnetic encoder fails to be distinguished. Thus, improving its accuracy and resolution maintains an unsolved problem. In this paper, a window-filtering algorithm using the front window, present window, and back window is applied to determine the number of poles that the encoder is currently located in. However, jump points occur when a poor window width is chosen.
The search space for the proper window width is viewed as the flight space of birds, in which each bird is abstracted as a particle representing a feasible solution of the window width. Thus, the window size of the optimization problem is equivalent to the food source that the birds are looking for. This algorithm is called particle swarm optimization (PSO). At present, various optimization problems such as multimodal problems [22], the optimal charge pattern of Li-ion batteries [23], thinned planar array design [24], and mobile robot swarms [25] have been solved by PSO. In this article, the IPSO algorithm is employed to find the appropriate window width. On this basis, a window-filtering algorithm is applied to judge the pole number of the magnetic encoder, eliminating jump points under complex conditions.
The main contributions of this paper can be summarized as follows:
(1)
The window width is screened by a window-filtering angle subdivision algorithm with a dynamic inertia coefficient, which is used to judge the number of poles of the magnetic encoder for which local optimal solutions fail to occur. Hence, an accurate optimal solution can be obtained with fewer iterations, which boosts the operation speed, avoiding the appearance of jump points of the magnetic encoder caused by the error estimation of the window width. Meanwhile, the encoder resolution is improved after subdivision.
(2)
The accuracy of the magnetic encoder is enhanced by a linear interpolation compensation tabulation algorithm based on virtual cutting. The error compensation table is stored in the fixed memory area of the MCU, which can be retrieved in time as the servo control system works, and the compensation result remains stable and reliable. Compared with cross-interval tabulation employed in the arctangent method [26], the compensation method based on virtual cutting enables the angle of the magnetic encoder to remain high.

2. Structure and Working Principle

2.1. Structure Design

The magnetic encoder in this paper combines two types of magnetic steel and includes six Hall elements, a signal acquisition board, a magnetic isolation ring, a magnetic conduction ring, and other components, and its structure is shown in Figure 1.
Multi-pole magnetic steel with axial magnetization that is radial serves as single-pole magnetic steel. In order to save space, the plug-in structure of the single-pole Hall element is used and is uniformly distributed on the circumference of the signal acquisition board. Surface-mounted Hall elements are selected as the multi-pole Hall elements. There are three multi-pole Hall elements that are arranged along the large radius with an angle of 120° and three single-pole Hall elements that are distributed along the small radius collecting the Hall signal. The angle between multi-pole Hall elements is
θ m u l = 120 ° p m u l ( 2 k c o f f + 1 )
where p m u l is the pole number, p m u l = 24 , k c o f f is the adjustment coefficient of the hall angle, k c o f f = 3 , θ m u l = 35 ° .

2.2. Working Principle

The angle solution scheme is shown in Figure 2. When the spindle shaft of the motor rotates, two kinds of magnetic steel generate magnetic field signals separately. Meanwhile, the Hall elements that are installed on the signal acquisition board will induce a magnetic field signal, which will be converted into a three-phase sine or cosine voltage signal, and then converted into a two-phase voltage signal with a phase difference of 90°. Finally, the angle values can be obtained from the arctangent of the digital signals, which the two-phase voltage is converted into through the analog-to-digital (AD) conversion module inside the microcontroller.
The appropriate filter window interval can be found via the IPSO algorithm. On the basis of this filtering window range, an angle subdivision method for the window filter is established to solve the jump problem of the magnetic encoder at the zero-crossing point. Then, a compensation algorithm based on virtual cutting is established to compensate for the resolution error. Finally, the angle value is input into the controller through a serial peripheral interface (SPI) to control the rotation of the motor.

3. The Window Filter Angle Value Division Method Based on the IPSO

3.1. The Angle Subdivision Method Based on the Window Filter

The output waveform of the single-pole and multi-pole angle values sampled by the data acquisition card is shown in Figure 3a.
It may be observed from Figure 3a that jump points occur as the magnetic encoder crosses the two adjacent magnetic poles, leaving the pole number and the angle values undetermined. To solve this issue, two filter windows, those of the front and back layers, are built to judge the number of poles in this paper.
First, the zero point of two groups of angle values needs to be calibrated. The angle value of the single-pole angle is set as the reference to sort from small to large, and the multi-pole angle is moved accordingly. Hence, the calibration function is defined as
{ θ s _ x = s o r t ( θ s ) θ m _ y = f a r r y ( θ s _ x , θ m )
where θ s is the single-pole angle value obtained via sampling, θ m is the multi-pole angle value obtained by sampling, θ s _ x is the sorted single-pole angle value, and θ m _ y is the sorted multi-pole angle value. The sorted angle resolution waveform is shown in Figure 3b.
The highest 11 bits of single-pole angle values are extracted, and the ordinal index of the maximum value is recorded successively from the values with the same highest 11 bits. This is given by
{ θ s _ s e l _ x ( j ) = f e n d ( f l o o r ( 2 11 × θ s _ x ( i ) 65,536 ) ) j s _ n o t e = h n o t e ( j )
where f l o o r is the rounding function, f e n d is the filtering function, and h n o t e is the recording function. θ s _ s e l _ x is the set of highest 11-bit single-pole angle values selected, and j s _ n o t e is the rearrangement of the serial number of the maximum value from the serial numbers of the values with the same highest 11 bits.
The serial numbers are divided into three intervals, namely S1 = [0, 4096), S2 = [4096, 61,440), and S3 = [61,440, 65,536). The multi-pole angle values are extracted one by one according to the serial numbers and treated as a basis for the lookup table. The distribution of angle values after interval division is shown in Figure 4.
Equation (4) shows the filter windows of the front, current and back layers, which are set to judge the number of poles.
{ θ M a r r y f r o n t ( j s _ n o t e ) = θ m _ y ( j s _ n o t e ) + x w i n d o w θ M a r r y b a c k ( j s _ n o t e ) = θ m _ y ( j s _ n o t e ) x w i n d o w
where θ M a r r y b a c k is the back boundary of the window area, θ M a r r y f r o n t is the front boundary of the window area, and x w i n d o w is window size satisfying x w i n d o w ( 0 , 65,535 ) .
When the differences between the two adjacent angles of each layer window with the threshold value 30,000 are compared, the pole numbers related to the angle value in each layer window above are determined.
The angle value of each layer window is substituted into Equation (5) as input:
y y = a b s ( d i f f ( x x ) ) > 30,000 ? k : k + 1
The pole number of the front window, current window, and back window, which are expressed by P M f r o n t , P M c u r r , and P M b a c k , can be obtained. The schematic diagram of the pole number distribution is shown in Figure 5.
The pole number and the angle interval in each three-layer window can be checked using the highest 11 bits of the single-pole angle value, assuming that the window width is set appropriately:
Y a c t ( p M _ x ( k ) , θ M _ a c t ( k ) ) = c h e c k ( θ S _ a c t ( k ) )
where check is the table lookup function, θ S _ a c t ( k ) is the single-pole angle value, p M _ x ( k ) is the pole number obtained using the lookup table, and θ M _ a c t ( k ) is the multi-pole angle value obtained using the lookup table.
There exist two cases in which the pole number is misjudged. One case is that the pole number of the front-layer window is greater than that of the current window, but the angle value is located in S1, as shown in Figure 6a. At the same time, Figure 6b illustrates the other case that the pole number of the back-layer window is less than that of the current window, but the angle value stays in S3.
The servo control system is still capable of calculating the pole number of the magnetic encoder by referring to the above method. Then, the multi-pole angle value after segmentation can be expressed as
θ M _ d i v = 65,536 × ( p M _ x 1 ) + θ M _ a c t
where θ M _ d i v is the multi-pole angle value when the segmentation algorithm is employed.

3.2. The Filtering Window Width Prediction Algorithm Based on IPSO

Figure 5 above is just a schematic of the pole number for the three-layer window under ideal conditions without determination of the window width. If the window size is not selected appropriately, new jump points will be introduced. Therefore, in this paper, the IPSO algorithm is adopted in the segmentation algorithm to determine the appropriate filter window interval, making the angle value after the segmentation prevent the existence of jump points. This method remains capable of resolving the issue of jump points in the decoding process of magnetic encoders with different pole numbers, which proves efficient and simple.
The function of the IPSO algorithm is to calculate the window width according to
y j u m p _ p o i n t = G m i n ( θ M _ d i v _ e r r )
where y j u m p _ p o i n t is the number of jump points of the multi-pole angle after segmentation, and θ M _ d i v _ e r r is the difference in multi-pole angle after segmentation.
The inertia weight factor in Equation (9) effectively prevents the occurrence of a local optimal solution of the window width selection:
ω ( i g e r ) = ω m a x ( ω m a x ω i n i t ) ( i g e r T g e r ) 2
where ω is the inertia weight factor, i g e r is the number of iterations, ω i n i t is the initialization weight, ω m a x is the maximum weight value, and T g e r is the maximum number of iterations.
Each particle in the swarm represents a practical strategy, and its position and velocity are continuously updated as iterations increase:
v ( i g e r + 1 ) = w ( i g e r ) v ( i g e r 1 ) I n e r t i a   h o l d i n g   p a r t + c 1 r 1 ( p i d ( i g e r ) x ( i g e r ) ) T h e   i n d i v i d u a l   o p t i m a l   p a r t + c 2 r 2 ( p g d ( i g e r ) x ( i g e r ) ) T h e   g l o b a l   o p t i m a l   p a r t
x i ( i g e r + 1 ) = x i ( i g e r ) + v i ( i g e r + 1 )
where r 1 and r 2 are decimals on the interval [0, 1], p i d is the individual optimal particle position obtained, p g d is the global optimal particle position acquired, c 1 is an individual learning factor, c 2 is a global learning factor, and x is the particle position.
A pole number prediction method, based on the filtering window width obtained via the IPSO algorithm above, is established to solve the issue of multi-pole angle hopping caused by environmental changes and other factors.
The difference in multi-pole angle after subdivision is
θ M _ d i v _ e r r = d i f f ( θ M _ d i v )
Substituting this into Equation (8) gives the objective function as
y j u m p _ p o i n t = f i n d ( a b s ( θ M _ d i v _ e r r > 30,000 ) )
The population is initialized with the number of iterations of the swarm set as 100 and the number of particles in the swarm set as 30. The individual fitness and population fitness are updated as iterations increase, and the speed and position are updated according to Equations (10) and (11). The specific process is shown in Figure 7.
The PSO algorithm with dynamic inertia weight coefficient is adopted according to Equation (9). The values of ω i n i t , ω m a x , and T g e r are set as 0.4, 0.9, and 100, respectively. The distribution of inertia weight is shown in Figure 8.
It can be seen that ω stays large at the start of the iteration, which facilitates global searching. However, the inertia coefficient in the later stage of the iteration remains small, facilitating a local search within a certain range, which favors finding the optimal solution accurately and reducing the search time.
The window width is determined using the IPSO algorithm. The distribution of the initialized particle state is exhibited in Figure 9a, and the distribution of the particle state after optimization is shown in Figure 9b. The calculated window width is 24,454, and the optimal fitness namely the number of jump points after subdivision is 0, indicating that there is no jump point and the selected window value is appropriate.
When the single-increment try out method is used to select the window width and the trial step size is 1, the calculation of data in the process is tremendous and there remains an extraordinarily long runtime. The magnetic encoder has a pole number of 24, resulting in numerous window widths that satisfy the condition. The distribution of window width using a single-increment try-out method is shown in Figure 9a,b. It is evident that the selected window widths, producing the angle value, leads to the presence of jump points at I, II, III, IV, V, and VI, indicating that these window widths are unreasonable. The greater the pole number of the magnetic encoder is, the less the suitable window width. In order to reduce computational load, longer step sizes, such as 1000 and 2000, are adopted in the single-increment try-out method, which may result in the complete absence of all reasonable window widths.
Substituting the window width obtained via the IPSO algorithm into Equations (4) and (5) results in the final tabulation of the multi-pole angle interval and pole number, as shown in Figure 10.
Figure 11 shows the flow chart of the angle segmentation method based on IPSO when the searching process for the window width in Figure 7 is added to the identification process for the pole number. For the two special cases in which the magnetic encoder crosses zero in Figure 6a,b, the pole number in the first case is regarded as the current pole number plus 1, and in the second case, it is considered as the current pole number minus 1. Thus, θ M _ d i v can be determined from the final lookup table shown in Figure 10, according to the single-pole angle value of the highest 11 bits (0–2047) in the servo control system.
The multi-pole angle resolution is obtained by substituting the calculated pole number into Equation (7) and is shown in Figure 12. It can be seen that there is no jump point after subdivision, and the resolution of the angle values is increased from 2 16 LSB to 3 × 2 19 LSB.

4. Linear Interpolation Compensation Tabulation Method Based on Virtual Cutting

The resolution of the novel magnetic encoder is enhanced by the segmentation method proposed in Section 3, but its accuracy remains inferior. Therefore, the photoelectric encoder, which is installed coaxially with the combined encoder, is used to lower the error of the combined magnetic encoder.
The angle deviation between the photoelectric encoder and magnetic encoder can be expressed as
θ M _ G d _ e r r = θ G d θ M _ d i v
where θ G d is the angle value of the photoelectric encoder, and θ M _ G d _ e r r is the angle deviation between the photoelectric encoder and the magnetic encoder.
Then, the angle values of the combined encoder are sorted from small to large and are shrunk by a factor of 2 6 / 5 . Meanwhile, the angle deviation of the two types of encoders changes accordingly. The formula is
{ θ M _ d i v _ x x = s o r t ( θ M _ d i v ) 65,536 × 2 10 × 5 θ M _ G d _ e r r _ y y = f a r r y ( θ M _ d i v _ x x , θ M _ G d _ e r r )
where θ M _ d i v _ x x is the sorted angle value of the magnetic encoder, and θ M _ G d _ e r r _ y y is the sorted angle deviation of the two types of encoders.
The angle deviation compensation table obtained by the cross-interval tabulation method [26] is shown in Figure 13a,b and shows the differential value of each point. What seems self-evident is that there remains a lot of high-frequency noise in Figure 13a, which is represented by the differential value of each point in Figure 13b. This introduces high-frequency oscillation in the angle if the compensation table in Figure 13a is utilized directly. Thus, this issue can be solved by linear interpolation compensation tabulation based on virtual cutting, the core idea of which is oversampling.
According to oversampling theory [27], a 1-bit accuracy improvement is gained through the utilization of an AD converter, with each 4-bit increase in the ratio of oversampling.
A moving average algorithm is employed to realize oversampling interpolation in the microcontroller. The angle value in Equation (15) has been reduced to the interval, [0, 5 × 210). The virtual step Cstair obtains an increase of 1LSB for every 1LSB increase in the angle value. At the same time, C p ( i ) is used to record the coordinates of the sampling point of the angle value for each C s t a i r correspondingly, resulting in the cutting of the angle value of the magnetic encoder, as presented in Figure 14.
Region I in Figure 14 displays the result of the angle cutting. The angle values contained in the last four steps in region I are spliced into the first section, and the initial four steps are stitched to the end. Therefore, the total number of virtual steps is 5128.
The moving average is calculated for the angle values at each of the four steps from position C p ( 1 ) at the time at which the virtual cutting of the sampling points is completed:
θ M _ a v e r ( i ) = i = 2 5125 k = 0 C p ( i ) C p ( i 1 ) 1 θ M _ d i v _ x x ( C p ( i 1 ) + k ) C p ( i + 3 ) C p ( i 1 )
θ e r r _ a v e r ( i ) = i = 2 5125 k = 0 C p ( i ) C p ( i 1 ) 1 θ e r r _ y y ( C p ( i 1 ) + k ) C p ( i + 3 ) C p ( i 1 )
where θ M _ a v e r is the average angle value of the magnetic encoder in every four steps, θ e r r _ a v e r is the average angle error of the two types of encoders installed coaxially in every four steps, and i is the sampling point.
Since the linear fitting calculation is completed, virtual lines are constructed every four sampling points, which is shown in Equation (18). The angle error of the sampling point before the four sampling points is calculated by this line. Then, the error compensation table calculated from Equation (18) is obtained and stored in the internal memory unit of the single-chip microcomputer.
M g d e r r T ( i k ) = θ e r r _ a v e r ( i k + 4 ) θ e r r _ a v e r ( i k ) θ M _ a v e r ( i k + 4 ) θ M _ a v e r ( i k ) slope   term × ( i k 1 ) sampling   point θ e r r _ a v e r ( i k + 4 ) θ e r r _ a v e r ( i k ) θ M _ a v e r ( i k + 4 ) θ M _ a v e r ( i k ) × θ M _ a v e r ( i k ) + θ e r r _ a v e r ( i k ) intercept   term
where M g d e r r T is the fitting error, and i k represents the sampling point.
Therefore, the angle error of the magnetic encoder is corrected by searching for the compensation table saved in the internal memory unit of the microcontroller, when the encoder is working. Assuming that the current sampling point of angle value is θ x , its integer and decimal parts of it are
θ i n t ( τ ) = f l o o r ( θ x ( τ ) 65,536 × 24 × 5120 )
θ f l o a t ( τ ) = θ x ( τ ) θ i n t ( τ )
where θ i n t and θ f l o a t are the integer and decimal parts of the angle value of the current sampling point, respectively, and τ represents the current sampling points.
Therefore, the final angle that is compensated is
M f i n a l = θ + f c h e c k ( θ i n t ( τ ) ) + ( f c h e c k ( θ i n t ( τ ) + 1 ) f c h e c k ( θ i n t ( τ ) ) ) ( θ f l o a t ( τ ) )
Finally, the error table is obtained via the linear interpolation compensation algorithm using virtual cutting, which is shown in Figure 15a,b is the noise distribution for Figure 15a. Comparison with Figure 13 reveals that the high-frequency noise caused by AD sampling is eliminated.

5. Experiment Analysis

The test device of the whole control system is presented in Figure 16. It is mainly composed of a magnetic encoder, a high-precision photoelectric encoder, controller, data acquisition card, motor, and upper computer. An RX24T series R5F524TBAGFP MCU manufactured by Renesas was selected to verify the effectiveness of the algorithm proposed in this paper. This MCU supports 32-bit floating-point numbers and uses an SPI to receive data.
The main characteristic parameters of the PMSM are shown in Table 2. The data acquisition card is connected to the encoder in the motor control system. When the motor operates, the angle values of the encoder are sampled using the data acquisition card.

5.1. The Accuracy Test

The magnetic encoder is coaxial with the high-precision photoelectric encoder, and their angle values are output simultaneously. When the angle value of the photoelectric encoder with a resolution of 2 16 was set as a baseline, the angle error corrections of the magnetic encoder were completed by employing the method presented in this paper and the method in [26]. The angle values of the two types of encoders were obtained, as shown in Figure 17. Meanwhile, Figure 18a,b displays the angle deviation. What remains clear is that the angle accuracy obtained with the method presented in this paper is ± 200 L S B (0–65,536 × 24LSB), which is significantly better than the one achieved by the arctangent cross-interval tabulation method, indicating that the accuracy of the magnetic encoder is improved effectively through linear interpolation compensation tabulation based on virtual cutting.

5.2. The Resolution Test

An angle differential calculation was carried out to obtain the resolution of the magnetic encoder, as shown in Figure 19. The fluctuation intervals of the resolution are [−24, 16] LSB (0.13°), [−318, 114] LSB (0.07°), and [−226, 116] LSB (0.05°).
What remains clear is that the resolution of the magnetic encoder obtained via the proposed angle subdivision method is enhanced in this paper, compared with the fluctuation in resolution of the single-pole magnetic encoder, which is exhibited in Figure 19a,b. At the same time, a comparison is made by introducing an algorithm that performs linear interpolation compensation tabulation based on virtual cutting, which is shown in Figure 19b,c. The results indicate that rather than decreasing, the resolution of the magnetic encoder is enhanced to some extent, and an improvement of its accuracy is achieved.
The low price becomes the merit of the combined magnetic encoder, as the price of photoelectric encoders remain high. Not only does it meet the requirements for accuracy and resolution, but it also exhibits high reliability, enabling its operation in harsh environmental conditions such as oil contamination and vibrations.

6. Conclusions

A combined magnetic encoder is an angle displacement sensor which integrates hardware and software, achieving the solution of the angle value of a magnetic encoder with high resolution and accuracy.
First, a window-filtering angle subdivision algorithm based on IPSO was proposed to correct the misjudgment of the pole number when the combined magnetic encoder is at the convergence of two adjacent magnetic poles, enhancing the resolution of the magnetic encoder.
Then, a compensation table was completed by a linear compensation algorithm based on virtual cutting to increase the accuracy of the combined magnetic encoder. Virtual cutting lines were applied in this method to achieve the division of the multi-pole angle values and the sampling points correspondingly. On this basis, a linear interpolation tabulation algorithm was employed to complete the deviation correction of the angle value.
Finally, an accuracy test and resolution test were carried out on the experimental platform of the control system, and the results were compared with those obtained via the cross-interval tabulation method [26] under the same experimental conditions. The test results indicate that the angle segmentation method proposed in this paper can effectively solve the issue of the appearance of jump points, and a resolution of 0.05° and accuracy of 0.045° can be reached.
The algorithm system developed in this manuscript is suitable for combination magnetic encoders with a limited pole number. The window values can be judged efficiently and rapidly via the intelligent algorithm proposed in this manuscript, ensuring that the jump points are able to be suppressed effectively during the angle value subdivision process. The algorithms proposed in this manuscript prove universal and can be generalized to address individual differences caused by inconsistent magnetization of multi-pole magnetic steel. It remains efficient and straightforward, and the issue of the existence jump points is effectively solved during the decoding process of multi-pole magnetic encoders.

Author Contributions

Conceptualization, L.W. and X.W.; methodology, L.W., X.W. and P.L.; software, L.W., X.W. and P.L.; validation, L.W. and X.W.; formal analysis, X.W.; investigation, L.W. and X.W.; resources, L.W. and X.W.; data curation, L.W., X.W. and P.L.; writing—original draft preparation, X.W.; writing—review and editing, L.W. and X.W.; visualization, L.W., S.H. and X.W.; supervision, L.W., Y.Z. and S.H.; project administration, L.W.; funding acquisition, L.W. All authors have read and agreed to the published version of the manuscript.

Funding

This work was partly supported by the Heilongjiang Key Research and Development Plan (grant number 2022ZX01A19), and partly supported by Heilongjiang Provincial Natural Science Foundation Joint Guidance Project (grant number LH2023E083).

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The data presented in this study are available on request from the corresponding author. The data are not publicly available due to privacy or ethical.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Feng, Y.; Zheng, J.; Yu, X. Hybrid Terminal Sliding-Mode Observer Design Method for a Permanent-Magnet Synchronous Motor Control System. Trans. Ind. Electron. 2009, 56, 3424–3431. [Google Scholar] [CrossRef]
  2. Wang, Y.; Yu, H.; Liu, L.Y. Speed-current single-loop control with overcurrent protection for PMSM based on time-varying nonlinear disturbance observer. Trans. Ind. Electron. 2021, 69, 179–189. [Google Scholar] [CrossRef]
  3. Bitriá, R.; Palacín, J. Optimal PID Control of a Brushed DC Motor with an Embedded Low-Cost Magnetic Quadrature Encoder for Improved Step Overshoot and Undershoot Responses in a Mobile Robot Application. Sensors 2022, 22, 7817. [Google Scholar]
  4. Jung, D.; Kim, S. A Passive Decomposition Based Robust Synchronous Motion Control of Multi-Motors and Experimental Verification. Sensors 2023, 23, 7603. [Google Scholar] [PubMed]
  5. Chen, Y.; Yang, M.; Xu, D.; Blaabjerg, F. A Novel Frequency Characteristic Model and Noise Shaping Method for Encoder-Based Speed Measurement in Motor Drive. In Proceedings of the ICPE 2019—ECCE Asia, Busan, Republic of Korea, 27–30 May 2019; pp. 1–6. [Google Scholar]
  6. Dalboni, M.; Soldati, A. Absolute Two-Tracked Optical Rotary Encoders Based on Vernier Method. IEEE Trans. Instrum. Meas. 2023, 72, 9501412. [Google Scholar] [CrossRef]
  7. Wang, S.; Wu, Z.; Peng, D.; Chen, S.; Zhang, Z.; Liu, S. Sensing Mechanism of a Rotary Magnetic Encoder Based on Time Grating. IEEE Sens. J. 2018, 18, 3677–3683. [Google Scholar]
  8. Chen, Y.C.; Lee, C.H.; Chou, M.J.; Shen, S.C. High-Precision Digital Rotary Encoder Based on Dot-Matrix Gratings. IEEE Photon. J. 2018, 10, 6801712. [Google Scholar]
  9. Hu, Y.; Zhang, S.; Yan, Y.; Wang, L.; Qian, X.; Yang, L. A Smart Electrostatic Sensor for Online Condition Monitoring of Power Transmission Belts. Trans. Ind. Electron. 2017, 64, 7313–7322. [Google Scholar]
  10. Sado, K.; Deguchi, Y.; Nagatsu, Y.; Hashimoto, H. Development of Magnetic Absolute Encoder Using Eccentric Structure: Improvement of Resolution by Multi-Polarization. In Proceedings of the 2020 IEEE/ASME International Conference on Advanced Intelligent Mechatronics (AIM), Boston, MA, USA, 1 July 2020; pp. 1–6. [Google Scholar]
  11. Takeyama, A.; Komatsuzaki, S.; Sado, K.; Nagastu, Y.; Hashimoto, H. Development of a Magnetic Absolute Encoder Using Eccentric Structure and Long Short-Term Memory. In Proceedings of the IECON 2021—47th Annual Conference of the IEEE Industrial Electronics Society, Toronto, ON, Canada, 13–16 October 2021; pp. 1–6. [Google Scholar]
  12. Deguchi, Y.; Isshiki, G.; Sado, K.; Nagatsu, Y.; Ishii, S.; Hashimoto, H. Verification of Ultra-High Resolution Magnetic Absolute Encoder Using Eccentric Structure and Neural Network. In Proceedings of the 2020 IEEE/SICE International Symposium on System Integration (SII), Honolulu, HI, USA, 12–15 January 2020; pp. 848–853. [Google Scholar]
  13. Liu, Y.; Hao, M. Absolute multi-pole encoder with a simple structure based on an improved gray code to enhance the resolution. J. Chongqing Univ. 2023, 3, 181–187. [Google Scholar]
  14. Chen, B.; Chang, J.Y. Effect of Flattening Cracked Medium on Positioning Accuracy of a Linear Magnetic Encoder. IEEE Trans. Magn. 2020, 56, 6701207. [Google Scholar]
  15. Nguyen, H.X.; Tran, N.C.; Park, J.W.; Tran, N.; Jeon, J.W. Improving the Accuracy of Battery-Free Multiturn Absolute Magnetic Encoders by Using a Self-Referencing Lookup Table Algorithm. IEEE Trans. Instrum. Meas. 2019, 69, 5468–5477. [Google Scholar]
  16. Lara, J.; Xu, J.; Chandra, A. A Novel Algorithm Based on Polynomial Approximations for an Efficient Error Compensation of Magnetic Analog Encoders in PMSMs for EVs. IEEE Trans. Ind. Electron. 2016, 63, 3377–3388. [Google Scholar] [CrossRef]
  17. Nguyen, H.X.; Tran, N.C.; Park, J.W.; Jeon, J.W. An Adaptive Linear-Neuron-Based Third-Order PLL to Improve the Accuracy of Absolute Magnetic Encoders. IEEE Trans. Ind. Electron. 2019, 66, 4639–4649. [Google Scholar] [CrossRef]
  18. Hoang, H.V.; Jeon, J.W. An Efficient Approach to Correct the Signals and Generate High-Resolution Quadrature Pulses for Magnetic Encoders. IEEE Trans. Ind. Electron. 2011, 58, 3634–3646. [Google Scholar]
  19. Yu, S.; Liu, W.; Yang, X.; Shu, F. Quadrature Sinusoidal Signals Correction of Magnetic Encoders Via Radial Basis Function Neural Network and Adaptive Loop Shaping. IEEE Trans. Ind. Electron. 2022, 70, 11527–11534. [Google Scholar] [CrossRef]
  20. Montanari, A.N.; Oliveira, E. A Novel Analog Multisensor Design Based on Fuzzy Logic: A Magnetic Encoder Application. IEEE Sens. J. 2017, 17, 7096–7104. [Google Scholar] [CrossRef]
  21. Lin, Y.-J.; Chou, P.-H.; Yang, S.-C. High-Resolution Permanent Magnet Drive Using Separated Observers for Acceleration Estimation and Control. Sensors 2022, 22, 725. [Google Scholar] [CrossRef]
  22. Ren, Z.; Zhang, A.; Wen, C.; Feng, Z. A Scatter Learning Particle Swarm Optimization Algorithm for Multimodal Problems. IEEE Trans. Cybern. 2014, 44, 1127–1140. [Google Scholar]
  23. Wang, S.C.; Liu, Y.H. A PSO-Based Fuzzy-Controlled Searching for the Optimal Charge Pattern of Li-Ion Batteries. IEEE Trans. Ind. Electron. 2015, 62, 2983–2993. [Google Scholar] [CrossRef]
  24. Deligkaris, K.V.; Zaharis, Z.D.; Kampitaki, D.G.; Goudos, S.K.; Rekanos, I.T.; Spasos, M.N. Thinned Planar Array Design Using Boolean PSO With Velocity Mutation. IEEE Trans. Magn. 2009, 45, 1490–1493. [Google Scholar] [CrossRef]
  25. Zhang, J.; Lu, Y.; Che, L.; Zhou, M. Moving-Distance-Minimized PSO for Mobile Robot Swarm. IEEE Trans. Cybern. 2022, 52, 9871–9881. [Google Scholar] [PubMed]
  26. Wang, L.; Li, P.; Qiao, Y.; Hao, S.; Hao, M. Study on high precision magnetic encoder based on the arctangent cross-intervals tabulation method. Austral. J. Electr. Electron. Eng. 2016, 13, 167–173. [Google Scholar]
  27. Wang, L.; Zhang, Y.; Hao, S.; Song, B.; Hao, M.; Tang, Z. Study on high precision magnetic encoder based on PMSM sensorless control. Sens. Rev. 2016, 36, 267–276. [Google Scholar]
Figure 1. Magnetic encoder. (a) Whole structure. (b) Signal acquisition board.
Figure 1. Magnetic encoder. (a) Whole structure. (b) Signal acquisition board.
Sensors 23 08695 g001
Figure 2. Angle value solution scheme.
Figure 2. Angle value solution scheme.
Sensors 23 08695 g002
Figure 3. (a) Angle value of the combined magnetic encoder. (b) Sorted angle value.
Figure 3. (a) Angle value of the combined magnetic encoder. (b) Sorted angle value.
Sensors 23 08695 g003
Figure 4. Interval of multi-pole angle value.
Figure 4. Interval of multi-pole angle value.
Sensors 23 08695 g004
Figure 5. Pole number distribution of the three-layer window.
Figure 5. Pole number distribution of the three-layer window.
Sensors 23 08695 g005
Figure 6. Two special cases. (a) case 1: p a c t F r o > p a c t c u r r , θ a c t c u r r S 1 . (b) case 2: p a c t B a c < p a c t c u r r , θ a c t c u r r S 1 . ( p a c t b a c , p a c t c u r r , p a c t f r o are the practical pole number of back-layer window, current window and front-layer window).
Figure 6. Two special cases. (a) case 1: p a c t F r o > p a c t c u r r , θ a c t c u r r S 1 . (b) case 2: p a c t B a c < p a c t c u r r , θ a c t c u r r S 1 . ( p a c t b a c , p a c t c u r r , p a c t f r o are the practical pole number of back-layer window, current window and front-layer window).
Sensors 23 08695 g006
Figure 7. Search process of window width based on IPSO.
Figure 7. Search process of window width based on IPSO.
Sensors 23 08695 g007
Figure 8. Distribution of inertia weight.
Figure 8. Distribution of inertia weight.
Sensors 23 08695 g008
Figure 9. (a) State of initialized particle. (b) State of optimized particle. (where, I-VI represent unreasonable window widths as the single-increment try out method is used).
Figure 9. (a) State of initialized particle. (b) State of optimized particle. (where, I-VI represent unreasonable window widths as the single-increment try out method is used).
Sensors 23 08695 g009
Figure 10. Final tabulation of the angle value interval and pole number.
Figure 10. Final tabulation of the angle value interval and pole number.
Sensors 23 08695 g010
Figure 11. Flow chart of angle segmentation method based on IPSO.
Figure 11. Flow chart of angle segmentation method based on IPSO.
Sensors 23 08695 g011
Figure 12. Angle resolution.
Figure 12. Angle resolution.
Sensors 23 08695 g012
Figure 13. Cross-interval tabulation method. (a) Table for deviation compensation between the magnetic encoder and photoelectric encoder. (b) Differential values of each point in (a).
Figure 13. Cross-interval tabulation method. (a) Table for deviation compensation between the magnetic encoder and photoelectric encoder. (b) Differential values of each point in (a).
Sensors 23 08695 g013
Figure 14. Principle of virtual cutting.
Figure 14. Principle of virtual cutting.
Sensors 23 08695 g014
Figure 15. Linear interpolation compensation tabulation based on virtual cutting. (a) Deviation compensation table for the magnetic encoder and photoelectric encoder. (b) Differential value of each point in (a).
Figure 15. Linear interpolation compensation tabulation based on virtual cutting. (a) Deviation compensation table for the magnetic encoder and photoelectric encoder. (b) Differential value of each point in (a).
Sensors 23 08695 g015
Figure 16. Experimental platform of the control system.
Figure 16. Experimental platform of the control system.
Sensors 23 08695 g016
Figure 17. Angle values of the two types of encoders. (a) Angle values of the two types of encoders obtained via cross-interval tabulation method and the method presented in this paper, respectively. (b) Enlarged view of (a).
Figure 17. Angle values of the two types of encoders. (a) Angle values of the two types of encoders obtained via cross-interval tabulation method and the method presented in this paper, respectively. (b) Enlarged view of (a).
Sensors 23 08695 g017
Figure 18. Results of accuracy test. (a) Accuracy of the angle value obtained via the proposed method (b) Accuracy of the angle value acquired via cross-interval tabulation method.
Figure 18. Results of accuracy test. (a) Accuracy of the angle value obtained via the proposed method (b) Accuracy of the angle value acquired via cross-interval tabulation method.
Sensors 23 08695 g018
Figure 19. Results of the resolution test. (a) Resolution of the single-pole magnetic encoder (0–65,535). (b) Resolution of the multi-pole magnetic encoder when the algorithm for linear interpolation compensation tabulation based on virtual cutting fails to be utilized (0–65,535 × 24). (c) Resolution of the multi-pole magnetic encoder when the algorithm for linear interpolation compensation tabulation based on virtual cutting never fails to be used (0–65,535 × 24).
Figure 19. Results of the resolution test. (a) Resolution of the single-pole magnetic encoder (0–65,535). (b) Resolution of the multi-pole magnetic encoder when the algorithm for linear interpolation compensation tabulation based on virtual cutting fails to be utilized (0–65,535 × 24). (c) Resolution of the multi-pole magnetic encoder when the algorithm for linear interpolation compensation tabulation based on virtual cutting never fails to be used (0–65,535 × 24).
Sensors 23 08695 g019
Table 1. Several classical technologies to improve the precision and resolution.
Table 1. Several classical technologies to improve the precision and resolution.
ReferenceTechnologiesMerits
[11]Long Short-Term Memory (LSTM)Decreasing angle error via fewer sensors
[15]Self-referencing lookup table (LUT)Eliminating the external disturbance effects
[16]Type-2 phase-locked loop (PLL)Using little memory, with total position error of ±0.2°
[17]Adaptive Linear-Neuron and a third-order phase-locked loop (ALN-PLL)Reducing noise and eliminating dc-error, and rejecting the disturbances
[18]Digital phase-locked loop (AADPLL)Extracting high-order sinusoids
Table 2. The main characteristic parameters of the PMSM.
Table 2. The main characteristic parameters of the PMSM.
Motor ModelRated PowerBus VoltageBus Current
PM-1515 kW80 V400 A
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Wang, L.; Wei, X.; Liang, P.; Zhang, Y.; Hao, S. A Novel Angle Segmentation Method for Magnetic Encoders Based on Filtering Window Adaptive Adjustment Using Improved Particle Swarm Optimization. Sensors 2023, 23, 8695. https://doi.org/10.3390/s23218695

AMA Style

Wang L, Wei X, Liang P, Zhang Y, Hao S. A Novel Angle Segmentation Method for Magnetic Encoders Based on Filtering Window Adaptive Adjustment Using Improved Particle Swarm Optimization. Sensors. 2023; 23(21):8695. https://doi.org/10.3390/s23218695

Chicago/Turabian Style

Wang, Lei, Xin Wei, Pengbo Liang, Yongde Zhang, and Shuanghui Hao. 2023. "A Novel Angle Segmentation Method for Magnetic Encoders Based on Filtering Window Adaptive Adjustment Using Improved Particle Swarm Optimization" Sensors 23, no. 21: 8695. https://doi.org/10.3390/s23218695

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop