PMSM Rotor Position Detection Based on Hybrid Optical Encoder and R-Signal Zero-Setting Scheme

. Rotor position detection is a prerequisite for achieving good control performance of PMSM. For a PMSM control system based on an optical encoder, it is a difficulty to detect rotor position and achieve R-Signal zero-setting. To solve the problem, a hybrid optical encoder is used in the paper by which a scheme for rotor position detection and R-Signal zero-setting is proposed. This encoder can do absolute and incremental rotor position detection simultaneously; here, the former is used for acquiring imprecise rotor position and the latter is for precise rotor position. Firstly, two detection methods of the encoder are analyzed, and a scheme for rotor position detection is proposed: absolute rotor position is used for motor starting before achieving R-Signal zero-setting; once achieving R-Signal zero-setting, incremental rotor position detection that has high precision is adopted. Then a novel scheme for R-Signal zero-setting is emphatically proposed. Finally, the simulation is conducted. Results show that rotor position detection and R-Signal zero-setting can be achieved by the proposed scheme.


Introduction
With the development of permanent magnetic materials and microelectronic technology, PMSMs have been widely used in servo systems due to their superior performance [1][2][3] in recent years.It is a must to acquire accurate rotor position of PMSM in order to achieve great control performance of servo systems [4].
Methods used in detecting rotor position of PMSM are divided into two types: detection with or without position sensor [5].Detection without position sensor, whose algorithm is complex, relies on motor parameters strongly and is not reliable to get rotor position [6][7][8][9] when a motor is in low-speed operation.As for detection with position sensor, rotary transformer, incremental and absolute optical encoder are commonly used.Rotary transformer has advantages of antipollution, antielectromagnetic interference, and antivibration, which are reliable to work in harsh environment.However, the output of rotary transformer is analog signals which are hard to be detected precisely [10].Rotor position can be directly detected via absolute optical encoder, but the price of absolute optical encoder is more expensive; incremental optical encoder holds a leading position due to its high performance-cost ratio and high control flexibility.
The difficulty of using incremental optical encoder is reference signal (named R-Signal) zero-setting and how to detect rotor position, before a control system is powered on and rotor position is unknown.Reference [11][12][13] proposed a scheme based on stator current vector that can detect rotor position accurately before a control system is powered on.However, the rotor will turn during the process and the motor must not be loaded.Reference [14] used high frequency impulses to avoid the rotor turning, but the motor must not be loaded either.Reference [15] proposed a method of R-Signal zero-setting but the process is complex.
In this paper, a hybrid optical encoder [16,17] is used and detection methods of PMSM rotor position based on the encoder are analyzed; then a scheme is proposed for rotor position detection and R-Signal zero-setting based on the encoder.The scheme for rotor position detection is that absolute rotor position detection is done to acquire an imprecise rotor position used for motor starting before achieving R-Signal zero-setting; once achieving R-Signal zero-setting, incremental rotor position detection is adopted which has high precision and is used for motor normal operation.Based on the characteristics of hybrid optical encoder, a novel scheme for R-Signal zero-setting is emphatically proposed.Finally, the simulation is conducted.Results show that the rotor position detection and R-Signal zero-setting can be achieved by the proposed scheme.

Rotor Position Detection Based on Hybrid Optical Encoder
Hybrid optical encoder has dual advantages of absolute and incremental encoder and can do absolute and incremental rotor position detection simultaneously.The hybrid optical encoder used in the paper is HEIDENHAIN ERN1387 which is cited as an example to analyze absolute and incremental rotor position detection.
Accordingly, based on the absolute rotor position detection, the calculating formula for  is The electrical angle is the product of the mechanical angle and number of pole pairs of rotor.The relationship is shown in where   denotes the electrical angle and  denotes the number of pole pairs.Equation ( 4) is based on the situation where electrical angle of the rotor is 0 when R-Signal is detected, which indicates that R-Signal zero-setting is accomplished.In systems having R-Signal zero-setting done, (4) can be used for the calculation of   ; but for systems not accomplishing R-Signal zero-setting, it is wrong to calculate   via (4).If (4) were still used to calculate   , it would cause serious problems such as overcurrent and overheat.Therefore R-Signal zero-setting is the premise of incremental rotor position detection.
R represents the mechanical angle between the position where the electrical angle is 0 and the position where R-Signal is detected.Assume that the number of pulses corresponding to  R is  R and the relationship between  R and  R is Assume that the value of pulse counter is  1 when R-Signal is detected; then the calculating formula for the electrical angle   is

Combination Scheme.
According to absolute rotor position detection, rotor position can be calculated via (2).However, C-Signal and D-Signal are analog voltage signals with small amplitude that are susceptible to interference and hard to be detected precisely.Therefore, the result of absolute rotor position detection has some errors, which do not affect motor starting but are not conducive to motors' running for a long time.
Compared with absolute rotor position detection, incremental rotor position detection generally has high accuracy and the signals used for incremental rotor position detection are all digital signals that are not susceptible to interference, which contributes to achieving good control performance of PMSM.However, incremental rotor position detection cannot work without accomplishing R-Signal zero-setting.
Based on the above analysis, the combination scheme of rotor position detection is as follows: absolute rotor position detection is in use before accomplishing R-Signal zero-setting; once accomplished, incremental rotor position detection is applied immediately.
Accurate rotor position can be got via incremental rotor position detection contributing to the high performance of servo systems.However R-Signal zero-setting is the premise of the detection method.The accuracy of R-Signal zerosetting affects the control performance directly.Nowadays schemes for R-Signal zero-setting are complex and inefficient, so it is an urgent need to accomplish R-Signal zero-setting quickly and easily.

R-Signal Zero-Setting Scheme
According to ( 5) and ( 6), it can be got that the essence of Rsignal zero-setting is to find  R corresponding to  R .If pulse counter is cleared when electrical angle reaches 0, the value of pulse counter will be  R when R-Signal is detected.However electrical angle cannot be detected directly.To solve this, an R-Signal zero-setting scheme is proposed.
As is known, electrical angle is the product of mechanical angle and the number of pole pairs.Therefore when mechanical angle is 0, electrical angle is 0 accordingly.So if pulse counter is cleared at the position where mechanical angle is 0, the value of pulse counter is  R when R-Signal is detected, thus accomplishing R-Signal zero-setting.
As is shown in Figure 1, when mechanical angle is 0, the voltage of C-Signal and D-Signal is shown in (7).Therefore it is reasonable to do R-Signal zero-setting when  C and  D meet  C = 0, In practical, C-Signal and D-Signal are analog voltage signals with small amplitude that are susceptible to interference and hard to be detected precisely, which brings some errors between the measured value and actual value.Therefore, the situation does not exist where voltages of C-Signal and D-Signal meet (7); that is to say, the position cannot be got where the mechanical angle is 0 through the absolute rotor position detection.
Consider that, as mechanical angle approaches 0, the voltage of C-Signal is close to 0 and the voltage of D-Signal is negative.Therefore, an interval can be specified that is close to the position where mechanical angle is 0 based on the characteristics of the voltage of C-Signal and D-Signal.Define the position where mechanical angle is 0 as "Absolute Zero Point" and the interval close to "Absolute Zero Point" as "Crude Zero Point."Equation ( 8) represents an interval that is close to "Absolute Zero Point," so this interval is a "Crude Zero Point": Figure 2 denotes the relationship between "Absolute Zero Point" and the "Crude Zero Point" specified by (8).
The "Crude Zero Point" specified by (8) where V C = 0.05 V In Figure 2, the arc represents motion orbit of rotor; the brown arc represents the part of motion orbit corresponding to the "Crude Zero Point" specified by ( 8) and point C is the right edge of the interval.
Based on the above analysis, R-Signal zero-setting scheme is as follows: firstly, set a "Crude Zero Point" like (8) before PMSM is powered on; secondly, start the motor based on the mechanical angle calculated by the absolute rotor position detection; thirdly, clear pulse counter when the voltage of C-Signal and D-Signal meets the relationship shown by the "Crude Zero Point" set before; finally, once detecting R-Signal, record the value of pulse counter which is  R and calculate  R via (5) thus accomplishing R-Signal zero-setting.The flow chart of R-Signal zero-setting scheme is shown in Figure 3.The "Crude Zero Point" specified by (8) where V C = 0.05 V

Discussion
The rotor position calculated by the absolute rotor position detection is imprecise which can be used for motor starting but not suitable for motor operation.Incremental rotor position detection has high accuracy, which is conducive to the operation of motor, but R-Signal zero-setting must be accomplished.
According to R-Signal zero-setting scheme, the position where pulse counter is cleared is at "Crude Zero Point" instead of "Absolute Zero Point" during the process of R-Signal zero-setting.A "Crude Zero Point" specifies an interval that is close to "Absolute Zero Point."When rotor position approaches "Absolute Zero Point," mechanical angle of rotor will enter the interval specified by a "Crude Zero Point" more than one time.Therefore pulse counter starts counting since it is cleared last time, which results in losses of pulse counting.
Citing the "Crude Zero Point" shown in (8) as an example, the influence of the error between the "Crude Zero Point" and "Absolute Zero Point" on R-Signal zero-setting is analyzed.Error analysis is shown in Figure 4.
In Figure 4, the circle represents motion orbit of rotor; the brown arc represents the part of motion orbit of rotor corresponding to a "Crude Zero Point"; point C is the right edge of the interval specified by a "Crude Zero Point"; and mechanical angle of rotor is increased in a clockwise direction.
As is shown in Figure 1, the voltage of C-Signal changes as sine wave with mechanical angle of rotor increasing.Therefore when motor turns in a clockwise direction, the voltage of C-Signal increases monotonically in the interval specified by a "Crude Zero Point."Then, mechanical angle of rotor will be close to the right edge of the interval specified by the "Crude Zero Point," when  C and  D meet (8) for the last time.Similarly, if motor is turning in an anticlockwise direction, mechanical angle of rotor will be close to the left edge of the interval when  C and  D meet (8) for the last time.
Set the two positions where  C and  D meet (8) for the last time as point D (in a clockwise direction) and point E (in an anticlockwise direction) shown in Figure 4.
According to Figure 4, pulse counter is cleared at point D when rotor turns in a clockwise direction.When rotor reaches point R, record the value of pulse counter and calculate  R via (5).The result corresponds to the arc  DR, while the actual value corresponds to  OR.Obviously,  OR >  DR, so the calculated result of  R is smaller than the actual one.
Similarly, motor turning in an anticlockwise direction, the calculated result corresponds to the arc  ER that is also smaller than  OR, so the calculated result of  R is also smaller than the actual one.
To summarize, the error between the "Crude Zero Point" and "Absolute Zero Point" leads to a smaller  R .

Simulation and Analysis
According to the rotor position detection scheme, PMSM drive and control system is constructed.Figure 5 shows the diagram of the system.As is shown in Figure 5, vector control strategy is adopted in the PMSM drive and control system.The encoder used in the simulation diagram is ERN1387, which is a hybrid optical encoder.Based on the hybrid optical encoder, the speed and electrical angle of PMSM rotor can be acquired by decoding output signals of ERN1387.
Parameters of the motor in the simulation model are as follows: the stator resistance is 2 Ω; the stator inductance is 8.35 × 10 −4 H; the rotor inertia is 1 × 10 −3 kg⋅m 2 ; the number of pole pairs is 4; the rated speed is 1000 r/min; the load torque is 5 N⋅m; the initial position of rotor is /6 (this value can be any one within 0∼2).Parameters of the hybrid optical encoder are as follows: the number of lines of the grating is 2048; frequency quadruple,  R , is /3 (this value can be any one within 0∼2), and the actual value of  R is 1365.
Figure 6 is the simulation waveform of mechanical angle of PMSM rotor.In Figure 6, dotted frame A is the waveform of mechanical angle under the absolute rotor position detection; and dotted frame B corresponds to the incremental rotor position detection.To reflect differences between the two rotor position detection methods, waveforms in dotted frame A and B are both amplified.As shown in dotted frame A, mechanical angle changes from /6, and the waveform is not smooth.In dotted frame B, mechanical angle varies smoothly.It can be got from Figure 6 that PMSM rotor initial position can be acquired by the absolute rotor position detection.Besides, compared with the incremental rotor position detection, the absolute rotor position detection does not affect PMSM starting but is not conducive to PMSM normal operation.What is more, the continuous variation of mechanical angle in Figure 6 denotes that the combination scheme of the absolute and incremental rotor position detection is feasible.
Figure 7 is the simulation waveform of  R .In Figure 7, the value is 1359 when R-Signal is detected and is close to the value (1365) set before, which shows that R-Signal zerosetting can be accomplished via the proposed scheme.
Figure 8 is simulation waveforms of three-phase stator currents based on the absolute and incremental rotor position detection.Similar to Figure 6, dotted frames A and B, which are both amplified, correspond, respectively, to waveforms of three-phase stator currents under conditions of the absolute  and incremental rotor position detection.In dotted frame A, there are many glitches in waveforms of currents.However, in dotted frame B, three-phase stator currents vary smoothly.It can be drawn from Figure 8 that, compared with the absolute rotor position detection, the incremental rotor position detection is suitable for PMSM normal operation.Besides, the stable variation of stator currents shows that the result of R-Signal zero-setting is correct.Figure 9 is the simulation waveform of torque.In Figure 9, the torque changes from a large number to a stable state where the value changes around the load torque.Figure 10 is the simulation waveform of speed.In Figure 10, motor runs at the rated speed.Figures 9 and 10 show that when the proposed scheme is going on, the motor is in a normal operation.

Conclusion
In this paper, a scheme for rotor position detection and R-Signal zero-setting is proposed, based on a hybrid optical encoder.The scheme combines the absolute rotor position  detection with incremental rotor position detection: the absolute rotor position is used for motor starting before achieving R-Signal zero-setting; once achieving R-Signal zero-setting, incremental rotor position detection is adopted and used for motor normal operation.To accomplish R-Signal zero-setting quickly and easily, a novel scheme for R-Signal zero-setting is emphatically proposed.Simulation results show that the proposed scheme is feasible and that rotor position detection and R-Signal zero-setting can be achieved.

1 Figure 1 :
Figure 1: The relationship between the voltage of C-Signal and D-Signal and mechanical angle of rotor.

2. 1 . 1 . In Figure 1 ,
Absolute Rotor Position Detection.As the rotor of PMSM rotates once, the encoder can produce absolute position detection signals: C-Signal and D-Signal that are both analog voltage signals.The characteristics of C-Signal and D-Signal are as follows: the amplitude of each one is 1 V and the phase angle of C-Signal is leading 90 degrees compared with that of D-Signal.The relationship between the voltage of C-Signal and D-Signal and mechanical angle of rotor is shown in Figure  C and  D , respectively, represent the voltage of C-Signal and D-Signal.The relationship between  C and  D and mechanical angle of rotor represented by  is

Figure 4 :
Figure 4: Error analysis for R-Signal zero-setting.

Figure 5 :Figure 6 :
Figure 5: The diagram of PMSM drive and control system.