Quadrature Demodulation Method for Resolver Signal Processing Under Different Sampling Rate

Resolvers are widely used as position sensors to obtain angle information. The resolver requires the excitation signal and its amplitude is modulated by the rotor position. The envelope of the modulated signal can be detected precisely only when the samplings are synchronized with the excitation signal. A large error can occur if the synchronization fails. In this paper, the resolver signals are sampled in synchronization with the pulsewidth modulation (PWM) carrier, not the excitation signal. When the resolver excitation signal frequency and the PWM carrier frequency are different, the envelope cannot be detected, so additional signal processing is required to obtain the angle information. For signal processing, multiple auxiliary signals are synthesized based on the sampled signals and quadrature demodulation is performed. A detailed error analysis according to the PWM frequency and motor speed is also performed. The effectiveness is demonstrated through simulation and experimental evidence.


I. INTRODUCTION
The accuracy of rotor position and speed measurements plays the most important role in determining motor control performance [1]- [3]. The methods of obtaining angle information are largely divided into two groups; using angle sensors and sensorless algorithms [4]- [5]. Since the sensorless method does not use angle sensors, it is cost effective, but the angle sensors are still used in many fields for reasons of reliability, utility, and robustness. Among many angle sensors, resolvers are widely used due to their robustness and simple structure. When an excitation signal is applied to the resolver, amplitude-modulated sine and cosine signals are output. The phase-locked loop (PLL) [6]- [8] is used to obtain angle information via demodulation. The whole process of obtaining angle information from resolver signals is called resolver-todigital conversion (RDC).
To detect envelope of the resolver signals, the signals are sampled at the peak of the excitation signal [9]- [11]. It is relatively simple to implement and has no delay associated with low pass filter. Because the sampling is synchronized with the excitation signal, it is called a synchronous sampling method or a peak sampling method. It is also called the under sampling method because the sampling frequency does not satisfy the Nyquist frequency. However, there is no flexibility to change the sampling frequency because it must sample at the peak of the excitation signal. A square wave excitation signal was used to give a more freedom in sampling timing [12]- [13]. It allowed sampling at various points on the flat top of the square wave. However, it may suffer significant signal distortion caused by cable impedance mismatch and harmonic loss. Wang and Wu [14] utilized multiple sampling and a correction method to increase the RDC accuracy and to reduce quantization error.
There are also various studies to improve angle accuracy [15]- [17]. A look-up table (LUT) is usually used for trigonometric functions, but the LUT methods have some inconveniences such as data interpolation and memory space. Wang et al. [15] generated auxiliary sinusoidal signals by adding and subtracting the demodulated signals to increase the linearity. By utilizing the linearized signal, they could increase the position accuracy without a LUT. Similarly, Ye et al. [16] made multiple linear sections of the sinusoidal signal near the null points and used an array of phase-shifted signals to increase the linearity at the zero crossings. A thirdorder rational polynomial can be used in place of arc tangent function. Wang et al. [17] obtained pseudo-linear signals using the third-order rational polynomial and compensated the angle error through a polynomial fitting. However, since these methods are based on demodulated signals, there is no other mention of the demodulation method.
In motor control, angle information is required at the time of PWM interrupt. Usually, the resolver signals are sampled and processed in the PWM interrupt service routine (ISR). However, in this case, if the PWM frequency is different from that of the resolver excitation frequency, it will fail to sample at the peak of the excitation signal, causing problems in envelope detection. Therefore, an angle error occurs in the demodulation process due to synchronization mismatch. For this reason, in order to use the conventional RDC method based on synchronization, the PWM frequency must be matched to the resolver carrier frequency. Recently, variable frequency control [18] or changing the switching frequency for each specific torque/speed region is used to increase the efficiency, so there is a limitation to apply the existing RDC method.
In this study, a new RDC method for PWM frequency selection independent of the excitation signal frequency is proposed. The proposed method asynchronously samples the resolver signal according to the PWM frequency. Since the envelope is not detected properly, an extra signal processing is required. For this purpose, the resolver signals are sampled twice from one PWM period as double sampling [19]. Two sets of signals sampled at adjacent interrupt points are used to synthesize multiple auxiliary signals to obtain angular information.
This paper is organized as follows. In Section II, the peak sampling method is described and several problems are discussed when the sampling frequency and the excitation signal frequency are different. In Section III, the proposed    demodulation method is illustrated with definitions of new variables. Section IV shows simulation and experiment results.

II. RESOLVER SIGNAL SAMPLING BASED ON PWM
A resolver is a kind of transducer that requires an excitation signal V ex as input. The two output signals are modulated with a sine wave V s and a cosine wave V c depending on the rotor angle [20]: where U m and V m are the amplitudes of excitation and output signals, ω ex = 2πf ex and ω r are the angular speeds of the excitation signal and motor, and θ r = ω r t is the rotor position. Generally, ω ex is much larger than ω r , so the last terms in (2) and (3) are ignored. The peak sampling method is simple and robust because it is an under-sampling method [9]- [11]. Figs. 1 (a) and (b) show the excitation signal V ex and a modulated output signal V c . With peak sampling, V c is sampled at the peak of the excitation signal, yielding the envelope of cosine signal. Fig. 1 (c) shows an example of irregular sampling when the excitation frequency is higher than the sampling frequency,   f ex /f s = 1.4. Fig. 1 (d) shows the other example when the sampling frequency is higher than the excitation frequency, f ex /f s = 0.8. In both cases, the sampled signals are far from the sine and cosine shapes. Fig. 2 (a) shows the Lissajous curve when V s and V c are sampled at the peak. Note that the sampled points lie regularly on the red circle with the peak sampling. Figs. 2 (b) and (c) show the corresponding Lissajous curves when the sampling is not taken at the peak, in which the sampled points are randomly displaced from the circle. As shown in the above, if the sampling frequency is not an integer ratio of the carrier frequency, i.e. fs fex ̸ = 1 n , where n is an integer, a large angle error may occur. Fig. 3 shows the timing diagram when RDC and PWM interrupt are used separately. The first row shows the timing of the peak sampling. The second and third rows show the RDC and PWM interrupts and calculation times, respectively. If the PWM interrupt has the highest priority, the RDC ISR to obtain the angle information is always delayed until the PWM ISR completes. At t i+1 , delayed sampled That is, the angle used at the (i + 1)th PWM interrupt is the last calculated angle from the RDC interrupt. Since the calculation time used for PWM and RDC interrupt is not always constant, δt i is not constant. Such varying delays cause the following moving average error : where K is the size of moving window. If the calculation time of the PWM interrupt is longer, the error increases because the RDC interrupt is not properly executed.

A. PROPOSED RDC PROCESSING
The overall algorithm proposed in this paper is well shown in Fig. 4. The resolver outputs V s and V c are sampled in synchronization with the PWM carrier, and V sin and V cos are output by correcting the error caused by non-peak sampling in the demodulator. They are also applied as inputs to the quadrature PLL to determine the angle. Since V sin and V cos have double angle frequencies, it is necessary to check the initial quadrant. In this paper, it is assumed that the resolver output signals are sampled twice per PWM period as double sampling [19]. Fig. 5 shows two resolver output signals and the PWM carrier. The PWM period is denoted by T s , and (V s1 , V c1 ) and (V s2 , V c2 ) are sampled at t 1 and t 2 respectively. Since they are sampled at regular intervals, the time interval between t 1 and t 2 is T s /2, i.e., t 2 − t 1 = T s /2. The two sampled data sets are where θ ex1 = θ ex (t 1 ), θ r1 = θ r (t 1 ), θ ex2 = θ ex (t 2 ) = θ ex (t 1 + T s /2), and θ r2 = θ r (t 1 + T s /2). Assuming ω r is constant within short PWM periods, θ r2 = θ r (t 1 ) + ω r T s /2. in the excitation and resolver signals be defined by

B. QUADRATURE DEMODULATION
Equations (7) and (8) can be expressed equivalently as [21] Let x 2p = cos (θ ex2 + θ r2 ), x 2n = cos (θ ex2 − θ r2 ), y 2p = sin (θ ex2 + θ r2 ) and y 2n = sin (θ ex2 − θ r2 ). Suppose that these four components are known individually then utilizing trigonometric formula, it follows that The process shown in (11) and (12) is a kind of demodulation method because the excitation signal is deleted and only the sine and cosine functions of 2θ r2 remain. The angle information is obtained by the quadrature PLL or using the inverse tangent function such that As shown in (13), four components composing V s2 and V c2 should be found. To find the four components, two separate expressions are needed. These two additional expressions are obtained by interpolating (V s1 , V c1 ) at t 1 to t 2 .
In estimating 2θ r , the quadrature PLL shown in Fig. 4 [8] is used by applying V cos2 and V sin2 to the inputs. The input of PI regulator is expressed as follows : 2θ r is detected which makes e = 0 by the PI regulator.

C. POLARITY DETECTION
In order to obtain the desired angle θ r from 2θ r , it is important to determine the initial quadrant [22]- [23]. The angle should be chosen with the aid of sin θ r and cos θ r , and these signals are contained in V s2 and V c2 . In (7) and (8), if the excitation component sin θ ex2 is positive, the desired signs of sin θ r and cos θ r are the same as V s2 and V c2 , respectively. Based on this concept, it is proposed to detect the initial quadrant of θ r by starting the first PWM interrupt at the V ex > 0 as shown in Fig. 6. Fig. 7 illustrates the initial quadrant detection process. One of four quadrants is found using the sensed signs of V s2 and V c2 at first interrupt. If this value does not match the quadrant of the output angle from the PLL, π is added, and if it does match, 0 is added. The first interrupt only needs to start at any point where the excitation signal is positive. This means more degrees of freedom compared to the peak sampling method.

III. ERROR ANALYSIS
In the previous section, ω r /ω ex and tan 2 ∆θ r have been ignored for simplicity's sake. However, this section analyzes their effect on angle errors. First, it is worth observing how the motor speed affects the resolver signals when not sampling at the peak of the excitation signal. Fig. 8 shows the modulated signals (2) and (3) with and without terms including ω r /ω ex . As indicated by red marks the sampled data are not affected by ω r /ω ex when the sampling is made at the peaks of sin θ ex . It is because cos θ ex = 0 whenever | sin θ ex | = 1. However, ω r /ω ex will have an effect if the sampling is not made at the peak. It will cause an angle error and its effect grows in proportion to ω r .
In addition, although the demodulation signals (22)-(25) contain tan 2 ∆θ r , it was neglected by assuming tan 2 ∆θ r ≈ 0 over a half PWM period T s /2. But as the motor speed increases, its magnitude gradually increases.
Similarly to (26) and (27), we havē The perturbations in (31)    where k 0 = tan 2 ∆θ r (1 + 0.5 tan 2 ∆θ r ). These are applied to the PLL as shown in Fig. 9. Then the input of the PI regulator,ē is obtained from (31)-(34) such that where ε = k 1 /k 2 , k 1 = 2ω r /ω ex k 0 sin 2θ ex2 and k 2 = 1 − ω 2 r /ω 2 ex k 0 + 1 + 1 + ω 2 r /ω 2 ex k 0 cos 2θ ex2 . Note that ε is the perturbing error that is caused by ω r /ω ex and tan 2 ∆θ r . So its upper bound is obtained by differentiating it  with respect to 2θ ex such as Fig. 10 shows the plot of ε max over the plain of ω r and f s , when f ex = 10kHz. As expected from (36), the error ε max increases along with the motor speed ω r , and decreases as the switching frequency f s increases. The maximum error occurs at a switching frequency of 5 kHz and a speed corresponding to 20000 rpm based on a 4-pole motor. According to this analysis, the angle error is less than 0.7 • in the entire range. The maximum angle error ε max according to f s and motor speed ω r is examined. But actually in (31)   0 when T s /T ex = m for an integer m, so V cos2 and V sin2 will also become 0. Therefore, the proposed demodulation method has a disadvantage in that it cannot use a sampling frequency that is a multiple of the excitation signal frequency, but has the advantage of more flexibility in frequency selection compared to the peak sampling method.

IV. SIMULATION AND EXPERIMENTAL RESULTS
The motor parameters used in the experiments and simulations are listed in Table.1. Simulation was conducted through MATLAB/SIMULINK. Fig. 13 shows the PMSM and inverter used in this experiment. The TI TMS320F28377D was used for DSP. The circuit [24] for the resolver excitation signal was used and the bandwidth of the PLL was set at 700 Hz. For comparison, an encoder was used which outputs 6000 pulses per revolution. The effectiveness of the proposed method was verified by the angle error θ err between the actual angle and the angle obtained by the proposed method. In the actual experiment, θ err was calculated as the difference between the angle obtained by the encoder and the proposed angle.
Figs. 11 and 12 show the speed control simulation results when f s is 7 kHz and 13 kHz using the proposed method. Figs. 11 (a) and (b) show the PLL outputθ r and the PLL inputs V cos , V sin , and the angle error θ err when f s = 7 kHz and the motor speed is 1000 and 7000 rpm, respectively. Similar results are shown in Figs. 12 (a) and (b) show the similar simulation result when f s = 13 kHz. Note that θ err is limited to ±0.001 • at 1000 rpm and ±0.05 • at 7000 rpm, which are a small value despite sampling asynchronous to the resolver excitation signal. As was predicted in (36), the error becomes small as the motor speed decreases and the PWM frequency increases. Figs. 14 and 15 show the experimental results of the proposed method when f s = 7 kHz and 13 kHz, respectively. A separate interrupt for the peak sampling method was used and compared with the proposed method. The θ err (blue) of the proposed method at 1000 rpm is not significantly different from θ err (green) of the peak sampling method. However, the difference is much larger at 7000 rpm. This is because, as shown in Fig 3, the changing angle during the time difference δt between RDC for peak sampling and PWM interrupt increases with speed. The same experimental results is shown in Fig.15 when f s =13 kHz. It can be seen that the proposed method shows a smaller error when f s is higher, which is in good agreement with the error analysis result mentioned above. Even the same calculation time, it occupies a relatively large portion as the PWM period becomes shorter. So the case of 13 kHz has larger error than the case of 7 kHz when the peak sampling method was applied. In Figs.14 and 15, there are angular errors corresponding to the fundamental and double frequencies. This may occur for various reasons such as the scaling, quadrature, and offset errors of the resolver signals [25], or offset and scaling error of the sensed current [26], but the methods of eliminating errors due to these factors are beyond the scope of this paper. Fig. 16 (a) shows the motor speed ω r , input/output (IO) signal V IO indicating the start of ISR, and the PLL outputθ r when the f s changes from 7 kHz to 15 kHz. Note that the motor speed increases from 1000 rpm to 5000 rpm. At 3000rpm, the PWM frequency changes from 7 kHz to 13 kHz. Also, at 5000rpm, the PWM frequency changes from 13 kHz to 15 kHz. Figs. 16 (b) and (c) are expanded waveforms, in which the differences in PWM periods are clearly seen. This shows that the motor speed control performs well when the PWM frequency is changed. In the peak sampling method, it is impossible to change the frequency because it must be synchronized with the peak of the excitation signal, but it can be seen that the PWM frequency can be changed in the proposed RDC method.

V. CONCLUSION
A demodulation method based on resolver signals sampled in synchronization with a PWM interrupt is proposed. This method is called 'quadrature demodulation' because it additionally generates a pair of signals modulated with a cosine excitation signal. Quadrature demodulation is performed using the sine and cosine excitation signals and the results are applied to the input of quadrature PLL. This method is very suitable for motor current control because it samples the resolver signals in synchronization with the PWM interrupt. Although a frequency corresponding to a multiple of the excitation signal cannot be used, the frequency selection is more free compared to the existing method. In addition, the maximum value of the angle error that can occur when the motor speed is high was calculated. The effectiveness is verified through simulation and experimental results.