Windowed Least Square Algorithm Based PMSM Parameters Estimation SongWang

Stator resistance and inductances in d-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.


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][2][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 in -axis and -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   to 1.3  and that inductance value ranged from   to 1.004  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 -axis and -axis.When these parameters are treated as constants, the stability and control performance of the system will be affected.Therefore, the realization of parameters (  ,   , and   ) identification is essential for motion control of PMSM.

Mathematical Problems in Engineering
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][31][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][19][20][21][22][35][36][37][38][39][40][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   ,   , and   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.Section 2 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.

Least Square Estimation and Recursive Least
Square Estimation . . .
where  = ( where θ is the estimation value of  and inverse matrix  −1 of  is required: where  = ( 1 ,  2 ⋅ ⋅ ⋅   )  is the error vector.The target function is shown in the following: Obtaining θ to make  minimum, The result is θ is the least square estimate, LS of .

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 using  groups of data is shown as follows: The  + 1 moment data is (( + 1), ( + 1)), and then where The new least estimation equation is shown as follows: In order to get out of inverse matrix calculation of   +1 ⋅  +1 , θ( + 1) is deduced as follows: 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.

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.
where  is the window size, and 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 current  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.

Simulations
In the steady state, Flux linkage equations are as follows: where   and   are voltages in -axis and -axis, respectively,   and   are currents in -axis and -axis,   is phase resistance of stator,   and   are inductances in -axis and -axis,   is rotor velocity,   is flux linkage established by magnets, and  is the differential operator.The mathematical model of PMSM is discretized to estimate parameters (  ,   , and   ).The discrete model of PMSM is as follows: where   and   are as follows: The PMSM simulation model is established by MAT-LAB/SIMULINK, and the PMSM running data is obtained by the model.The simulation model is shown in Figure 1.
In MATLAB/SIMULINK, the   ,   , and   parameters of PMSM are fixed in simulation.We cannot simulate the time varying characteristic of   ,   , and   .Therefore, we design a motor simulation model according to the requirement.The   ,   , and   can be changed flexibly in the simulation.

PMSM Parameters Estimation of Windowed Least Square
Algorithm.When   ,   , and   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   ,   , and   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   ,   , and   are fixed.
Different window sizes have big effect on the results of parameter estimation when the estimated parameters have time varying characteristic.The motor parameters   ,   , and   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 the   ,   , and   .The identification result is shown in Figures 5, 6, and 7 when the   ,   and   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,   is bigger than     , so the change of   has little effect on the model output.Therefore, the identification result of   is not very well.However, the algorithm can also identify the parameter correctly.

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.
Mathematical Problems in Engineering 7 Discrete system state equation of EKF is + C ( − 1) + w ( − 1) , where where X() is the system state vector, U() is the system input vector, Z() is the system observation vector, w() is the system random noise vector, k() is the system random observation noise vector.w() and k() are noise sequences with zero mean, and the covariance matrices are Q() and R().  is the sampling period.the discrete linear state space equation ( 29) of PMSM is established by discretization and linearization of the model (30): î ( − 1) R ( − 1) When   ,   , and   of motor are fixed, the identification result table of EKF, recursive least square and windowed least square, algorithm is shown in Table 1.
From Table 1 we can see that identification result of EKF algorithm is as good as the windowed least square algorithm when   ,   , and   are fixed.The comparison diagrams of identification result are shown in Figure 8 when the parameters are fixed.
EKF 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 when   ,   , and   have time varying characteristic at the same time (Figures 5-7).

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 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Time (s)  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 Figures 9 and 10) which is designed to control the PMSM in practical application.

Figure 2 :Figure 3 :
Figure 2: Estimation result of   of WLS with different window sizes when the parameters are fixed.

Figure 4 :Figure 5 :
Figure 4: Estimation result of   of WLS with different window sizes when the parameters are fixed.

Figure 6 :
Figure 6: Estimation result of   of WLS with different window sizes when the parameters have time varying characteristic.

Figure 7 :
Figure 7: Estimation result of   of WLS with different window sizes when the parameters have time varying characteristic.

Figure 8 :
Figure 8: Comparison diagram of EKF, RLS, and WLS when   ,   , and   are fixed value.
) and  1 (),  2 () ⋅ ⋅ ⋅   () are the observation sequences of  and  at  1 ,  2 ⋅ ⋅ ⋅   .The relationship of  and  is expressed 1 ,  2 , . . .  ) is the measured parameter set and  is the number of parameters.We hope to estimate their values by the observation value of  and  at different time sequences. is the time sequences; to estimate the  parameters   ,  ≥  is required, and if  = , we can get the single solution from (1) as (2):

Table 1 :
Estimation result comparison of EKF, RLS, and WLS when   ,   , and   are fixed value.
(c) Estimation result of