# Windowed Least Square Algorithm Based PMSM Parameters Estimation

Authors: Song Wang
Journal: Mathematical Problems in Engineering
 (2013)

---

## Abstract

Stator resistance and inductances ind-axis and q-axis of permanent magnet synchronous motors (PMSMs) are important parameters. Acquiring these accurate parameters is usually the fundamental part in driving and controlling system design, to guarantee the performance of driver and controller. In this paper, we adopt a novel windowed least algorithm (WLS) to estimate the parameters with fixed value or the parameter with time varying characteristic. The simulation results indicate that the WLS algorithm has a better performance in fixed parameters estimation and parameters with time varying characteristic identification than the recursive least square (RLS) and extended Kalman filter (EKF). It is suitable for engineering realization in embedded system due to its rapidity, less system resource possession, less computation, and flexibility to adjust the window size according to the practical applications.


---

## Body

## 1. Introduction

The high-field-strength neodymium-iron-boron (NdFeB) magnets have become commercially available with affordable prices, so the permanent magnet synchronous motor (PMSM) is receiving increasing attention due to its high speed, high power density, and high efficiency. It is very suitable for some high-performance requirement applications, for example, robotics, aerospace, electric ship propulsion systems, and wind power generation systems [1–3]. It has been shown that PMSM can provide significant performance improvement in many variable speed applications [4]. The commonly used control method in motor control is vector control. The method has a requirement of obtaining related parameters of the motor. Therefore, acquiring accurate parameters of the motor is usually the fundamental part in driving system design. We cannot measure the motor parameters with normal no-load test and locked rotor test in the work site. Moreover, with the increasing working time of the motor and the surrounding environment changes, some parameters of the motor will be changed. Therefore, servo drivers usually have the function of parameters identification and self-tuning [3].Stator resistance and inductances ind-axis and q-axis are important parameters of motor model, which are considered as constants usually. However, these parameters vary with different operation conditions when motor is running [5]. The study object of this paper was permanent magnet servomotor produced by Huada Company in Wuhan of China. The experiment data showed that stator resistance value ranged from Rs to 1.3Rs and that inductance value ranged from Ld to 1.004Ld when the temperature ranged from 20 degrees to 80 degrees. Thus, the temperature of motor had a great influence on stator resistance and inductance in d-axis and q-axis. When these parameters are treated as constants, the stability and control performance of the system will be affected. Therefore, the realization of parameters (Rs, Ld, and Lq) identification is essential for motion control of PMSM.Model identification and parameter estimation techniques have become mature after years of development. From the least square estimation theory [6–14] and its various improved algorithm [15–23] to Kalman filter algorithm [24–27], neural network [28, 29], genetic algorithm [30–32], and so forth, they can serve as parameter estimation tools. However, these methods have their own characteristics and applicability.The least square estimation is one of the most simple and most mature parameter estimation methods. However the amount of calculation of the traditional least square method will increase with time sequence increase. It is hard to realize in embedded chip due to the large amount of calculation, and there is a problem of data saturation. Kalman filtering algorithm is put forward for system identification by Kalman in 1960, and there is a wide range of use. However, it is sensitive to the initial conditions [26], and its performance is poor for time varying parameter identification [33, 34]. With the development of artificial intelligence technology, neural network [28, 29] and genetic algorithm [30–32] are used to the parameter estimation. These intelligent methods can get the identification results with high accuracy. However, it is hard to apply them in practical parameter estimation due to the large amount of calculation and complexity of the algorithm. Therefore, least square algorithm is also a commonly parameter estimation method. Kinds of improved algorithms are proposed to promote the identification performance of traditional least square algorithm [18–22, 35–41]. For example, the forgetting factor is introduced in the recursive least square estimation, and the past time of data will be forgotten by index rate [42, 43]. However, it still cannot discard the past time of data [16] but just weakens the impact of the past time of data for the current parameter estimation. Another method is to use window method for the time series data [16, 23, 44]. This method can discard the past time of data flexibly and eliminate the impact of the past time of data for future parameter estimation. The window size can be set flexible according to practical application. In this paper, we adopt windowed least square algorithm for stator resistance Rs, Ld, and Lq inductance estimation and make a comparison with recursive least square and extended kalman Filter (EKF). From the simulation result, we can see that windowed least square algorithm has a better performance in convergence speed and identification precision for fixed parameters and parameters with time varying characteristics. From the view of algorithm complexity, the windowed least square algorithm is suitable for engineering realization in embedded chip, such as DSP and ARM.This paper is consisted of the five sections. Section2 describes the principle of least square theory and the recursive least square algorithm. Section 3 illustrates the windowed least square algorithm. Section 4 does some simulations for PMSM parameter estimation. Section 5 analyses the simulation results and shows some conclusions.


## 2. Least Square Estimation and Recursive Least Square Estimation

### 2.1. The Principle of Least Square Estimation

The earliest stimulus for the development of the least square estimation theory was apparently provided by astronomical studies in which planet and comet motions were studied using telescopic measurement data. The principle of the parameter estimation is simple and does not need any statistical characteristics of the variables. It is used in system identification and parameter estimation widely. The least square estimation still can provide an accurate solution when other identification methods lose efficacy.Supposingy(i) and x1(i),x2(i)⋯xn(i) are the observation sequences of y and x at t1,t2⋯tm. The relationship of y and x is expressed
(1)[y(1)y(2)⋮y(m)]=[x1(1)⋯xn(1)x1(2)⋯xn(2)⋮x1(m)⋯xn(m)][θ1θ2⋮θn],
where θ=(θ1,θ2,…θn) is the measured parameter set and n is the number of parameters. We hope to estimate their values by the observation value of y and x at different time sequences. m is the time sequences; to estimate the n parameters θi, m≥n is required, and if m=n, we can get the single solution from (1) as (2):
(2)θ^=X-1y,
where θ^ is the estimation value of θ and inverse matrix X-1 of X is required:
(3)ε=y-Xθ,whereε=(ε1,ε2⋯εm)T is the error vector.The target function is shown in the following:(4)J=∑i=1mεi2=εTε.Obtainingθ^ to make J minimum,
(5)∂J∂θ|θ=θ^=-2XTy+2XTXθ^=0.
The result is
(6)θ^=(XTX)-1XTy,θ
^ is the least square estimate, LS of θ.


### 2.2. Recursive Least Square Estimation

In practical parameter estimation, the data is always constantly to be refreshed. Therefore, we can further deduce (2) to a recursion algorithm. This algorithm does not need to compute the inverse matrix calculation repeatedly and reduces the time-consuming and system resources occupation.The least square estimation usingm groups of data is shown as follows:
(7)θ^(m)=(XmTXm)-1XmTYm.Them+1 moment data is (x(m+1),y(m+1)), and then
(8)Ym+1=Xm+1θ(m+1),
where
(9)Ym+1=[y(1)⋮y(m)…y(m+1)]=[Ym…y(m+1)],Xm+1=[x1(1)…xn(1)⋮…x1(m)…xn(m)………x1(m+1)…xn(m)]=[Xm…xT(m+1)].The new least estimation equation is shown as follows:(10)θ^(m+1)=(Xm+1TXm+1)-1Xm+1TYm+1.In order to get out of inverse matrix calculation ofXm+1T·Xm+1, θ^(m+1) is deduced as follows:
(11)θ^(m+1)=θ^(m)+P(m)x(m+1)×[1+xT(m+1)P(m)x(m+1)]-1·[y(m+1)-xT(m+1)θ(m)].Equation (11) is the recursive least square (RLS) estimation. Recursive least square algorithm is called the generalization Kalman filter algorithm [45, 46]. It is the engineering realization method of the least square estimation theory [17].From the calculation of least square estimation and recursive least square estimation, we can see that the past time of data has a big effect to future parameter estimation, and a large number of data calculations have occupied the system resources seriously. Therefore, it is difficult to be realized in embedded systems.


## 2.1. The Principle of Least Square Estimation

The earliest stimulus for the development of the least square estimation theory was apparently provided by astronomical studies in which planet and comet motions were studied using telescopic measurement data. The principle of the parameter estimation is simple and does not need any statistical characteristics of the variables. It is used in system identification and parameter estimation widely. The least square estimation still can provide an accurate solution when other identification methods lose efficacy.Supposingy(i) and x1(i),x2(i)⋯xn(i) are the observation sequences of y and x at t1,t2⋯tm. The relationship of y and x is expressed
(1)[y(1)y(2)⋮y(m)]=[x1(1)⋯xn(1)x1(2)⋯xn(2)⋮x1(m)⋯xn(m)][θ1θ2⋮θn],
where θ=(θ1,θ2,…θn) is the measured parameter set and n is the number of parameters. We hope to estimate their values by the observation value of y and x at different time sequences. m is the time sequences; to estimate the n parameters θi, m≥n is required, and if m=n, we can get the single solution from (1) as (2):
(2)θ^=X-1y,
where θ^ is the estimation value of θ and inverse matrix X-1 of X is required:
(3)ε=y-Xθ,whereε=(ε1,ε2⋯εm)T is the error vector.The target function is shown in the following:(4)J=∑i=1mεi2=εTε.Obtainingθ^ to make J minimum,
(5)∂J∂θ|θ=θ^=-2XTy+2XTXθ^=0.
The result is
(6)θ^=(XTX)-1XTy,θ
^ is the least square estimate, LS of θ.


## 2.2. Recursive Least Square Estimation

In practical parameter estimation, the data is always constantly to be refreshed. Therefore, we can further deduce (2) to a recursion algorithm. This algorithm does not need to compute the inverse matrix calculation repeatedly and reduces the time-consuming and system resources occupation.The least square estimation usingm groups of data is shown as follows:
(7)θ^(m)=(XmTXm)-1XmTYm.Them+1 moment data is (x(m+1),y(m+1)), and then
(8)Ym+1=Xm+1θ(m+1),
where
(9)Ym+1=[y(1)⋮y(m)…y(m+1)]=[Ym…y(m+1)],Xm+1=[x1(1)…xn(1)⋮…x1(m)…xn(m)………x1(m+1)…xn(m)]=[Xm…xT(m+1)].The new least estimation equation is shown as follows:(10)θ^(m+1)=(Xm+1TXm+1)-1Xm+1TYm+1.In order to get out of inverse matrix calculation ofXm+1T·Xm+1, θ^(m+1) is deduced as follows:
(11)θ^(m+1)=θ^(m)+P(m)x(m+1)×[1+xT(m+1)P(m)x(m+1)]-1·[y(m+1)-xT(m+1)θ(m)].Equation (11) is the recursive least square (RLS) estimation. Recursive least square algorithm is called the generalization Kalman filter algorithm [45, 46]. It is the engineering realization method of the least square estimation theory [17].From the calculation of least square estimation and recursive least square estimation, we can see that the past time of data has a big effect to future parameter estimation, and a large number of data calculations have occupied the system resources seriously. Therefore, it is difficult to be realized in embedded systems.


## 3. Windowed Least Square Estimation

Recursive least square algorithm can be used to real-time parameter estimation. However, the algorithm uses the past time of data, and the past time of data has the same importance as the present data in the algorithm. It weakened the importance of current data, caused a lot of system resources possession, and affected the estimation speed and precision [44]. In order to guarantee the instantaneity of parameter estimation, the paper adopts windowed least squares (WLS) to estimate the parameters of PMSM. The algorithm simulates the window processing function of communication signal. The time series data used for parameter estimation are added window handle, to reduce the calculation of estimation and system resources possession, making the algorithm easy for engineering realization.Suppose thatP(m)=(XmTXm)-1, the parameter estimation by (x(k),y(k)), k=1,2,…,m, is as follows:
(12)θ^(m)=P(m)XmTYm,where(13)Xm=[xT(1)xT(2)⋮xT(m)],Ym=[y(1)y(2)⋮y(m)].Consider increasing a group of data(x(m+1),y(m+1)), and then the parameter estimation is shown as follows [16, 23, 44]:
(14)θ-(m+1)=(Xm+1TXm+1)-1Xm+1TYm+1=θ^(m)+P(m)x(m+1)×[1+xT(m+1)P(m)x(m+1)]-1×[y(m+1)-xT(m+1)θ^(m)],P-(m+1)=(Xm+1TXm+1)-1=P(m)-P(m)x(m+1)×[1+xT(m+1)P(m)x(m+1)]-1×xT(m+1)P(m),where(15)Xm+1=[xT(1)xT(2)⋮xT(m)xT(m+1)],Ym+1=[y(1)y(2)⋮y(m)y(m+1)].Therefore,Xm+1=[xT(1)X].Consider eliminating a group of data(x(1),y(1)), and then the parameter estimation is shown as follows, where
(16)P(m+1)=(XTX)-1,X=[xT(2)⋮xT(m)xT(m+1)],Xm+1TXm+1=XTX+x(1)xT(1),P(m+1)=(Xm+1TXm+1-x(1)xT(1))-1=((P-(m+1))-1+(-x(1))xT(1))-1=P-(m+1)-P-(m+1)(-x(1))×[1+xT(1)P-(m+1)(-x(1))]-1xT(1)P-(m+1)=P-(m+1)+P-(m+1)x(1)×[1-xT(1)P-(m+1)x(1)]-1xT(1)P-(m+1).Therefore, the estimation result is shown as follows:(17)θ^(m+1)=(XTX)-1XTY=P(m+1)XTY,where(18)(x(k),y(k)),k=2,…,m+1,Y=[y(2)⋮y(m)y(m+1)],Xm+1TYm+1=XTY+y(1)x(1),(19)θ^(m+1)=P(m+1)(Xm+1TYm=1-y(1)x(1))=[P-(m+1)+P-(m+1)x(1)×[1-xT(1)P-(m+1)x(1)]-1×xT(1)P-(m+1)]×[Xm+1TYm=1-y(1)x(1)]=P-(m+1)Xm+1TYm=1-y(1)P-(m+1)x(1)×[1-xT(1)P-(m+1)x(1)]-1×xT(1)P-(m+1)x(1)-y(1)P-(m+1)x(1)+P-(m+1)x(1)×[1-xT(1)P-(m+1)x(1)]-1×xT(1)P-(m+1)Xm+1TYm+1=θ-(m+1)-y(1)P-(m+1)x(1)1-xT(1)P-(m+1)x(1)×(xT(1)P-(m+1)x(1)+1-xT(1)P-(m+1)x(1))+P-(m+1)x(1)[1-xT(1)P-(m+1)x(1)]-1×xT(1)θ-(m+1)=θ-(m+1)-y(1)P-(m+1)x(1)1-xT(1)P-(m+1)x(1)+P-(m+1)x(1)xT(1)θ-(m+1)1-xT(1)P-(m+1)x(1)=θ-(m+1)+P-(m+1)x(1)1-xT(1)P-(m+1)x(1)×(xT(1)θ-(m+1)-y(1)).Therefore, for any moment(20)θ^(m+k)=θ-(m+k)+P-(m+k)x(k)1-xT(k)P-(m+k)x(k)×(xT(k)θ-(m+k)-y(k)),wherem is the window size, and
(21)P(m+k)=P-(m+k)Xm+k×[1-Xm+kTP-(m+k)Xm+k]-1Xm+kTP-(m+k).The window size is adjustable according to actual needs, based on the data length of regulation. This can guarantee the speed of calculation and can reduce the system resources possession too. At this time, the parameter estimation is related to the currentm data sample, the past time of data has no effect on parameter estimation, and this can ensure the instantaneity and accuracy of the parameter estimation.


## 4. Simulations

### 4.1. PMSM Model

The voltage equations, flux linkage equations, and electromagnetic torque equations of PMSM ind, q frames are as follows [47, 48]:
(22)uq=Rsiq+Lqpiq+ωrLdid+ωrψf,ud=Rsid+Ldpid-ωrLqiq.In the steady state,(23)uq=Rsiq+ωrLdid+ωrψf,ud=Rsid-ωrLqiq.Flux linkage equations are as follows:(24)ψd=Ldid+ψfψq=Lqiq,whereuq and ud are voltages in q-axis and d-axis, respectively, iq and id are currents in q-axis and d-axis, Rs is phase resistance of stator, Ld and Lq are inductances in d-axis and q-axis, ωr is rotor velocity, ψf is flux linkage established by magnets, and p is the differential operator.The mathematical model of PMSM is discretized to estimate parameters (Rs, Ld, and Lq). The discrete model of PMSM is as follows:
(25)uq(k)=Rsiq(k)+pψq(k)+ωrψd(k)ud(k)=Rsid(k)+pψd(k)+ωrψq(k),
where ψd and ψq are as follows:
(26)ψd(k)=Ldid(k)+ψf,ψq(k)=Lqiq(k).The PMSM simulation model is established by MATLAB/SIMULINK, and the PMSM running data is obtained by the model. The simulation model is shown in Figure1.Figure 1
MATLAB motor simulation model.In MATLAB/SIMULINK, theRs, Ld, and Lq parameters of PMSM are fixed in simulation. We cannot simulate the time varying characteristic of Rs, Ld, and Lq. Therefore, we design a motor simulation model according to the requirement. The Rs, Ld, and Lq can be changed flexibly in the simulation.


### 4.2. PMSM Parameters Estimation of Windowed Least Square Algorithm

WhenRs, Ld, and Lq are fixed value, the PMSM simulation data is obtained by MATLAB. The windowed least square algorithm is used to identify the parameters. The algorithm with different window sizes is used for Rs, Ld, and Lq identification. From the identification result (Figures 2, 3 and 4), we can see that bigger window size has a better identification result. However, the window size does not obviously have an effect on the promotion of parameter identification precision when Rs, Ld, and Lq are fixed.Figure 2
Estimation result ofRs of  WLS with different window sizes when the parameters are fixed.Figure 3
Estimation result ofLd of  WLS with different window sizes when the parameters are fixed.Figure 4
Estimation result ofLq of  WLS with different window sizes when the parameters are fixed.Different window sizes have big effect on the results of parameter estimation when the estimated parameters have time varying characteristic. The motor parametersRs, Ld, and Lq are measured at 23.4°C, 30°C, 40°C, 50°C, 60°C, 70°C, and 80°C. Using piecewise linear method to simulate the time varying of the three parameters, the motor running data is obtained by MATLAB.The windowed least square is used to identify theRs, Ld, and Lq. The identification result is shown in Figures 5, 6, and 7 when the Rs, Ld and Lq are changed at the same time. From the Figures 5–7, we can see that shorter window size has lower effect on the promotion of identification precision. However, the window size is too big to improve the identification precision. The identification result is better when the window size is 300–400. In the motor model, ψf is bigger than Ldid, so the change of Ld has little effect on the model output. Therefore, the identification result of Ld is not very well. However, the algorithm can also identify the parameter correctly.Figure 5
Estimation result ofRs of  WLS with different window sizes when the parameters have time varying characteristic.Figure 6
Estimation result ofLd of  WLS with different window sizes when the parameters have time varying characteristic.Figure 7
Estimation result ofLq of  WLS with different window sizes when the parameters have time varying characteristic.


### 4.3. PMSM Parameters Estimation of Extended Kalman Filter

The Kalman filter is a common parameter identification method. It is proposed in 1960 by Kalman [49]. The theory is applied to practical engineering immediately when it is put forward. The Apollo program and C-5 plane navigation system design are the most successful application examples. Extended Kalman filter (EKF) is an improved model of the Kalman filter which is one of the most widely applied in nonlinear system filter.Discrete system state equation of EKF is(27)X(k)=A(k-1)X(k-1)+B(k-1)U(k-1)+C(k-1)+w(k-1),Z(k)=H(k-1)X(k)+v(k),
where
(4.3)A(k-1)=∂f(X,U)∂XTs|X=X^(k-1),B(k-1)=∂f(X,U)∂UTs|U=U(k-1),C(k-1)=[f(X,U)Ts-∂f(X,U)∂XXTs]|X=X^(k-1),H(k)=∂h(X)∂X|X=X^(k-1),whereX(k) is the system state vector, U(k) is the system input vector, Z(k) is the system observation vector, w(k) is the system random noise vector, v(k) is the system random observation noise vector. w(k) and v(k) are noise sequences with zero mean, and the covariance matrices are Q(k) and R(k).T
s is the sampling period. the discrete linear state space equation (29) of PMSM is established by discretization and linearization of the model (30):(29)ddt={id=udLd-RsLdid+ψqLdωeiq=uqLq-RsLqiq-ψdLqωeψd=0ψq=0Rs=0,(30)[id(k)iq(k)ψd(k)ψd(k)Rs(k)]=[1-R^s(k-1)LdTs00ω^e(k-1)LdTs-i^d(k-1)LdTs01-R^s(k-1)LqTS-ω^e(k-1)LqTs0-i^q(k-1)LqTs001000001000001]×[id(k-1)iq(k-1)ψd(k-1)ψd(k-1)Rs(k-1)]+[TsLd00TsLq000000][ud(k-1)uq(k-1)]+Ts[i^d(k-1)R^s(k-1)Ldi^q(k-1)R^s(k-1)Lq000]+w(k-1),(31)[id(k)iq(k)]=[1000001000][id(k)iq(k)ψd(k)ψd(k)Rs(k)]+v(k).Using the simulation model and getting the motor outputid, iq, ud, uq, ωe; the initial values of P, Q, and R in EKF algorithm are
(32)P=diag([0.10.10.00040.0020.02]),Q=diag([30150.0050.030.03]),R=diag([0.10.02]).WhenRs, Ld, and Lq of motor are fixed, the identification result table of EKF, recursive least square and windowed least square, algorithm is shown in Table 1.Table 1
Estimation result comparison of EKF, RLS, and WLS whenRs, Ld, and Lq are fixed value.
Temperature (°C)
23.4
30
40
50
60
70
80
R
s
Actual data (Ω)
0.9664
1.0008
1.0373
1.0770
1.1245
1.1592
1.1751
EKF
Estimation data
0.9694
1.0036
1.0400
1.0795
1.1266
1.1612
1.1611
RLS
0.9607
1.0077
1.0271
1.0712
1.1216
1.1451
1.1771
WLS
0.9653
0.9997
1.0362
1.0760
1.1235
1.1583
1.1742
L
d
×
10
-
3
Actual data (mH)
4.24
4.26
4.28
4.30
4.31
4.34
4.36
EKF
Estimation data
4.2368
4.2882
4.2475
4.2941
4.3331
4.3755
4.3595
RLS
4.1602
4.3210
4.3506
4.2611
4.2814
4.2021
4.3807
WLS
4.2465
4.2664
4.2861
4.3058
4.3157
4.345
4.4365
L
q
×
10
-
3
Actual data (mH)
6.21
6.26
6.30
6.34
6.40
6.44
6.48
EKF
Estimation data
6.2095
6.2604
6.3001
6.3400
6.4012
6.4395
6.4800
RLS
6.2531
6.2551
6.5172
6.3703
6.4118
6.4658
6.4727
WLS
6.2089
6.2581
6.2982
6.3387
6.3981
6.4384
6.4780From Table1 we can see that identification result of EKF algorithm is as good as the windowed least square algorithm when Rs, Ld, and Lq are fixed. The comparison diagrams of identification result are shown in Figure 8 when the parameters are fixed.Comparison diagram of EKF, RLS, and WLS whenRs,Ld, and Lq are fixed value.
(a)
Estimation result ofRs
(b)
Estimation result ofLd
(c)
Estimation result ofLqEKF and recursive least square algorithms cannot achieve reasonable result when the parameters have time varying characteristic or have a drastic change. However, windowed least square algorithm can achieve good identification result whenRs, Ld, and Lq have time varying characteristic at the same time (Figures 5–7).


## 4.1. PMSM Model

The voltage equations, flux linkage equations, and electromagnetic torque equations of PMSM ind, q frames are as follows [47, 48]:
(22)uq=Rsiq+Lqpiq+ωrLdid+ωrψf,ud=Rsid+Ldpid-ωrLqiq.In the steady state,(23)uq=Rsiq+ωrLdid+ωrψf,ud=Rsid-ωrLqiq.Flux linkage equations are as follows:(24)ψd=Ldid+ψfψq=Lqiq,whereuq and ud are voltages in q-axis and d-axis, respectively, iq and id are currents in q-axis and d-axis, Rs is phase resistance of stator, Ld and Lq are inductances in d-axis and q-axis, ωr is rotor velocity, ψf is flux linkage established by magnets, and p is the differential operator.The mathematical model of PMSM is discretized to estimate parameters (Rs, Ld, and Lq). The discrete model of PMSM is as follows:
(25)uq(k)=Rsiq(k)+pψq(k)+ωrψd(k)ud(k)=Rsid(k)+pψd(k)+ωrψq(k),
where ψd and ψq are as follows:
(26)ψd(k)=Ldid(k)+ψf,ψq(k)=Lqiq(k).The PMSM simulation model is established by MATLAB/SIMULINK, and the PMSM running data is obtained by the model. The simulation model is shown in Figure1.Figure 1
MATLAB motor simulation model.In MATLAB/SIMULINK, theRs, Ld, and Lq parameters of PMSM are fixed in simulation. We cannot simulate the time varying characteristic of Rs, Ld, and Lq. Therefore, we design a motor simulation model according to the requirement. The Rs, Ld, and Lq can be changed flexibly in the simulation.


## 4.2. PMSM Parameters Estimation of Windowed Least Square Algorithm

WhenRs, Ld, and Lq are fixed value, the PMSM simulation data is obtained by MATLAB. The windowed least square algorithm is used to identify the parameters. The algorithm with different window sizes is used for Rs, Ld, and Lq identification. From the identification result (Figures 2, 3 and 4), we can see that bigger window size has a better identification result. However, the window size does not obviously have an effect on the promotion of parameter identification precision when Rs, Ld, and Lq are fixed.Figure 2
Estimation result ofRs of  WLS with different window sizes when the parameters are fixed.Figure 3
Estimation result ofLd of  WLS with different window sizes when the parameters are fixed.Figure 4
Estimation result ofLq of  WLS with different window sizes when the parameters are fixed.Different window sizes have big effect on the results of parameter estimation when the estimated parameters have time varying characteristic. The motor parametersRs, Ld, and Lq are measured at 23.4°C, 30°C, 40°C, 50°C, 60°C, 70°C, and 80°C. Using piecewise linear method to simulate the time varying of the three parameters, the motor running data is obtained by MATLAB.The windowed least square is used to identify theRs, Ld, and Lq. The identification result is shown in Figures 5, 6, and 7 when the Rs, Ld and Lq are changed at the same time. From the Figures 5–7, we can see that shorter window size has lower effect on the promotion of identification precision. However, the window size is too big to improve the identification precision. The identification result is better when the window size is 300–400. In the motor model, ψf is bigger than Ldid, so the change of Ld has little effect on the model output. Therefore, the identification result of Ld is not very well. However, the algorithm can also identify the parameter correctly.Figure 5
Estimation result ofRs of  WLS with different window sizes when the parameters have time varying characteristic.Figure 6
Estimation result ofLd of  WLS with different window sizes when the parameters have time varying characteristic.Figure 7
Estimation result ofLq of  WLS with different window sizes when the parameters have time varying characteristic.


## 4.3. PMSM Parameters Estimation of Extended Kalman Filter

The Kalman filter is a common parameter identification method. It is proposed in 1960 by Kalman [49]. The theory is applied to practical engineering immediately when it is put forward. The Apollo program and C-5 plane navigation system design are the most successful application examples. Extended Kalman filter (EKF) is an improved model of the Kalman filter which is one of the most widely applied in nonlinear system filter.Discrete system state equation of EKF is(27)X(k)=A(k-1)X(k-1)+B(k-1)U(k-1)+C(k-1)+w(k-1),Z(k)=H(k-1)X(k)+v(k),
where
(4.3)A(k-1)=∂f(X,U)∂XTs|X=X^(k-1),B(k-1)=∂f(X,U)∂UTs|U=U(k-1),C(k-1)=[f(X,U)Ts-∂f(X,U)∂XXTs]|X=X^(k-1),H(k)=∂h(X)∂X|X=X^(k-1),whereX(k) is the system state vector, U(k) is the system input vector, Z(k) is the system observation vector, w(k) is the system random noise vector, v(k) is the system random observation noise vector. w(k) and v(k) are noise sequences with zero mean, and the covariance matrices are Q(k) and R(k).T
s is the sampling period. the discrete linear state space equation (29) of PMSM is established by discretization and linearization of the model (30):(29)ddt={id=udLd-RsLdid+ψqLdωeiq=uqLq-RsLqiq-ψdLqωeψd=0ψq=0Rs=0,(30)[id(k)iq(k)ψd(k)ψd(k)Rs(k)]=[1-R^s(k-1)LdTs00ω^e(k-1)LdTs-i^d(k-1)LdTs01-R^s(k-1)LqTS-ω^e(k-1)LqTs0-i^q(k-1)LqTs001000001000001]×[id(k-1)iq(k-1)ψd(k-1)ψd(k-1)Rs(k-1)]+[TsLd00TsLq000000][ud(k-1)uq(k-1)]+Ts[i^d(k-1)R^s(k-1)Ldi^q(k-1)R^s(k-1)Lq000]+w(k-1),(31)[id(k)iq(k)]=[1000001000][id(k)iq(k)ψd(k)ψd(k)Rs(k)]+v(k).Using the simulation model and getting the motor outputid, iq, ud, uq, ωe; the initial values of P, Q, and R in EKF algorithm are
(32)P=diag([0.10.10.00040.0020.02]),Q=diag([30150.0050.030.03]),R=diag([0.10.02]).WhenRs, Ld, and Lq of motor are fixed, the identification result table of EKF, recursive least square and windowed least square, algorithm is shown in Table 1.Table 1
Estimation result comparison of EKF, RLS, and WLS whenRs, Ld, and Lq are fixed value.
Temperature (°C)
23.4
30
40
50
60
70
80
R
s
Actual data (Ω)
0.9664
1.0008
1.0373
1.0770
1.1245
1.1592
1.1751
EKF
Estimation data
0.9694
1.0036
1.0400
1.0795
1.1266
1.1612
1.1611
RLS
0.9607
1.0077
1.0271
1.0712
1.1216
1.1451
1.1771
WLS
0.9653
0.9997
1.0362
1.0760
1.1235
1.1583
1.1742
L
d
×
10
-
3
Actual data (mH)
4.24
4.26
4.28
4.30
4.31
4.34
4.36
EKF
Estimation data
4.2368
4.2882
4.2475
4.2941
4.3331
4.3755
4.3595
RLS
4.1602
4.3210
4.3506
4.2611
4.2814
4.2021
4.3807
WLS
4.2465
4.2664
4.2861
4.3058
4.3157
4.345
4.4365
L
q
×
10
-
3
Actual data (mH)
6.21
6.26
6.30
6.34
6.40
6.44
6.48
EKF
Estimation data
6.2095
6.2604
6.3001
6.3400
6.4012
6.4395
6.4800
RLS
6.2531
6.2551
6.5172
6.3703
6.4118
6.4658
6.4727
WLS
6.2089
6.2581
6.2982
6.3387
6.3981
6.4384
6.4780From Table1 we can see that identification result of EKF algorithm is as good as the windowed least square algorithm when Rs, Ld, and Lq are fixed. The comparison diagrams of identification result are shown in Figure 8 when the parameters are fixed.Comparison diagram of EKF, RLS, and WLS whenRs,Ld, and Lq are fixed value.
(a)
Estimation result ofRs
(b)
Estimation result ofLd
(c)
Estimation result ofLqEKF and recursive least square algorithms cannot achieve reasonable result when the parameters have time varying characteristic or have a drastic change. However, windowed least square algorithm can achieve good identification result whenRs, Ld, and Lq have time varying characteristic at the same time (Figures 5–7).


## 5. Analysis and Conclusion

Through the previous different PMSM parameters identification experiments, we can see the following.(1)
When the parameters of PMSM have no time varying characteristic, three methods can achieve better identification result in precision and accuracy. In the calculation and instantaneity of identification, recursive least square algorithm has a fatal flaw of data saturation, so the precision and accuracy of the algorithm are hard to guarantee. It is difficult to realize in embedded system the real-time parameters identification due to the amount of calculations and system resources possession of EKF [28]. The window size of windowed least square algorithm is flexible, so we can choose the collected data according to the changes of the parameters. It will reduce the influence of the past time of data to the current parameter identification, guarantee the accuracy and instantaneity of identification, and reduce the system resources possession at the same time.(2)
When the parameters of PMSM have strong time varying characteristic, the EKF and recursive least square algorithms cannot guarantee the precision and accuracy of identification. However, windowed least square algorithm can get better identification result. Therefore, EKF and recursive least square algorithms are suitable for fixed parameters estimation or parameters with weak time varying characteristic identification. Windowed least square algorithm can get a good result both for fixed parameters and for time varying parameters identification.Embedded technology is widely used in the motor driver and controller at present. However, the embedded chip (MCU, DSP, ARM, etc.) has certain restriction in computing speed and storage space. Therefore, windowed least square algorithm is a better choice for PMSM parameters identification of motor driver and controller. This paper is the beginning of work. There are a lot of work to do, such as transplant the algorithm to practical controller and control system (in Figures9 and 10) which is designed to control the PMSM in practical application.Figure 9
The PMSM experiment system.Figure 10
The prototype DSP-based PMSM driver.



---

*Source: 131268-2013-09-11.xml*